News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Partial quoting and "to" button

Started by Slonarch, December 10, 2004, 03:16:59 PM

Previous topic - Next topic

[Unknown]

Add them in this area of the Display template:

<td align="right" valign="bottom" height="20" nowrap="nowrap" style="font-size: smaller;">';

-[Unknown]

suren

#21
my implementation of the above code  ;)


Incrementing sellective quotation with member name.

in script.js go to the end , add:

// Incrementing sellective quotation with member name.
var index = 1;
var total = 0;

function quote_selection(char_name, post_date)
{
total += index;
selection = document.getSelection ? document.getSelection() : document.selection.createRange().text;
document.postmodify.message.value += '\n[quote author=' + char_name + ' ' + 'date=' + post_date + ']' + '[b][color=red]' + total + ' ' + '[/color][/b]: ' + selection + '[/quote]\n';
}

in Display.template.php , Find:

// Can they reply?  Have they turned on quick reply?
if ($context['can_reply'] && !empty($options['display_quick_reply']))
echo '
<a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';num_replies=', $context['num_replies'], ';sesc=', $context['session_id'], '" onclick="if (!currentSwap) doQuote(', $message['id'], '); else window.location.href = this.href; return false;">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/quote.gif" alt="' . $txt[145] . '" border="0" />' : $txt[145]), '</a>';
// So... quick reply is off, but they *can* reply?
elseif ($context['can_reply'])
echo '
<a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';num_replies=', $context['num_replies'], ';sesc=', $context['session_id'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/quote.gif" alt="' . $txt[145] . '" border="0" />' : $txt[145]), '</a>';

add after:

// Incrementing sellective quotation with member name.
echo '
<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/quote.gif" alt="Sellective quotation" onclick="quote_selection(\'', $message['member']['name'], '\', \'', , '\')" style="cursor: ', $context['browser']['is_ie'] ? 'hand' : 'pointer', '" />';



as you can see there is one small unfinished part ( the second parameter to the function "posted date" is not there does any one know how i can get the post date in the correct format ???)

hfhs72

Quote from: Slonarch on December 19, 2004, 01:32:52 PM

To Slonarch,

I've been trying to follow what you and [unknown] have done however, it's very confusing with so many messages. Can you post exactly what code has to go where and in what files so, us newbies can do this without messing up our boards.

Thanks,
Don

Slonarch

hfhs72,

Sorry, havn't been here for a while. Hope it will still be helpful.

echo '
<table><tr><td align="center" border="0">
<img src="', $settings['images_url'], '/author.gif" alt="Author" onclick="to_name(\'', $message['member']['name'], '\')" border="0" style="cursor: ', $context['browser']['is_ie'] ? 'hand' : 'pointer', '" />
</td>
<td align="center" border="0">
<img src="', $settings['images_url'], '/quote1.gif" alt="Quote" onclick="quote_selection()" style="cursor: ', $context['browser']['is_ie'] ? 'hand' : 'pointer', '" />
</td></tr></table> ';

goes to Display.template.php under the line saying
                     <a href="mailto:', $message['member']['email'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/email_sm.gif" alt="' . $txt[69] . '" title="' . $txt[69] . '" border="0" />' : $txt[69]), '</a>';

and


function quote_selection()
{
selection = document.getSelection ? document.getSelection() : document.selection.createRange().text;
document.postmodify.message.value += '\n[quote]' + selection + '[/quote]\n';
}

function to_name(char_name)
{
document.postmodify.message.value += '[b][u]2 [color=red]' + char_name + '[/color][/u][/b]: ';
}


goes to the bottom of script.js

You probably should try suren's code though.

kober

How to make it working with firefox 1.5? now it is not working :(

iv_nik

#25
Quote from: Slonarch on December 12, 2004, 07:34:59 AMAn example of a discussion with the use of patial quoting (quotes are the grey text):
http://forums.ag.ru/?board=brehno&action=display&s=0&num=1094747302&start=25
In this example partial quoting DOES work with OPERA, when using code from this topic it doesn't work.
How to make Opera quote selected text?

iv_nik

Thanks to bANAn, now we have working version of partial quoting in Opera:
In display.template.php search
<a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['label'], '">', $settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/im_' . ($message['member']['online']['is_online'] ? 'on' : 'off') . '.gif" alt="' . $message['member']['online']['label'] . '" border="0" />' : $message['member']['online']['label'], '</a>';
Add after it the following code:
        //Quote Selection
          echo '

<table><tr>
<td align="left" border="0">
<img src="', $settings['images_url'], '/quote_selection.gif" "' . $txt['quote_sel'] . '" title="' . $txt['quote_sel'] . '" onmouseover="copySelection()" style="cursor: ', $context['browser']['is_ie'] ? 'hand' : 'pointer', '" />
</td></tr></table>';


In script.js add: function copySelection()
{
  var text = null;
        w = window;
        if (w.document.getSelection) {
                text = (w.document.getSelection());
  } else if (w.getSelection) {
                text = (w.getSelection() /*.getRangeAt(0)*/);
        } else if (w.document.selection) {
                var selection = w.document.selection;
                text = selection.createRange().text;
        } else {
                return false;
        }
document.postmodify.message.value += '\n[quote]' + text + '[/quote]\n';
}


The only thing to mention: it's working on mouseover due particular selected text processing in Opera.

Tested on v.1.1RC2

Vinspire

Ermmm ... can i know what is this trick suppose to do ?

Kinda confused in the threads ....

Screenshot of what this trick did would be great  ;D ;D ;D

lodyr

#28
How to make text references? How correctly to write?
<a href="javscript:void(0);" onclick="to_name(\'', $message['member']['name'], '\'); return false;" title="Author">Author</a>
correctly?                               
<a href="javscript:void(0);" onclick="quote_selection(); return false;" title="Quote">Quote</a>
or
<a href="javascript:quote_selection();" style="cursor: ', $context['browser']['is_ie'] ? 'pointer' : 'hand', '" title="Quote">Quote</a>

MothMan

Has anyone gotten this to work with the latest forum release (1.1.1) ?

I've tried every code changes suggested in the thread, and none of them are working for me...  they simply don't seem to make any change.  The new function is not present, the buttons do not appear, etc.

4LP3RUZ1

Quote from: MothMan on December 19, 2006, 02:31:33 PM
Has anyone gotten this to work with the latest forum release (1.1.1) ?

I've tried every code changes suggested in the thread, and none of them are working for me...  they simply don't seem to make any change.  The new function is not present, the buttons do not appear, etc.

I wrote a 1.1 implementation that only works with quick-reply in here
Frozen frogs are back :(

BBC

This tweak generates lot of errors with validation:

style="cursor: pointer" />

The attribute given above is required for an element that you've used, but you have omitted it. For instance, in most HTML and XHTML document types the "type" attribute is required on the "script" element and the "alt" attribute is required for the "img" element.

Typical values for type are type="text/css" for <style> and type="text/javascript" for <script>.

BBC

: 'pointer', '" />

So it is in Display.template.php

BBC

Well, stupid me. I put back alt="Quote" and alt="Author" and it is OK now.
Tooltip didn´t worked wit alt attribute and i deleted it and write title=.

Advertisement: