News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

dQuoteSelection

Started by digger, August 22, 2009, 08:49:34 AM

Previous topic - Next topic

KidCactus

It seems like this mod for some reason adds one hour to the time stamp of the quote after change to Daylight Saving Time. I have +1 now on my server, and if someone quote using this mod, the quote time stamp will show the wrong time. Quoting the normal way shows the correct time.

Anyone else experiencing this?

poolhall


steve51184


KidCactus

#43
And you both have set the server clock to +1 hour?

This is what I get, by selecting and quoting:

Quote from: KidCactus on March 31, 2010, 02:21:27 PMtest

And this is what I get quoting the normal way:

Quote from: KidCactus on March 31, 2010, 01:21:27 PMtest

poolhall

I apologize. Yep, you're right, I am experiencing a similar issue which I never noticed before. I have a zero overall time offset in the admin panel but -8 in my profile and when I quote a selection, 8 hours add to the quote stamp, e.g. quoting a message from 03/31/2010, 06:16:46 and get 03/30/2010, 22:16:46 in the quote stamp.

KidCactus

Ah, ok, good to know it's not just me then. Now onto trying to figure out how to fix it...

KidCactus

Not a bug fix, but at least a workaround in the meantime — in ./Themes/default/xml_topic.js:

Find this:

document.postmodify.message.value += '[quote author=' + author + ' link=' + link + ' date=' + date + ']' + selected.replace(/(^\s+)|(\s+$)/g, "") + '[/quote]\n';

Replace with (if you have +1 hour in your settings):

document.postmodify.message.value += '[quote author=' + author + ' link=' + link + ' date=' + (date-3600) + ']' + selected.replace(/(^\s+)|(\s+$)/g, "") + '[/quote]\n';

That 3600 number is the time offset in seconds, so you'd need to change that to whatever you have in your settings.

matiaz

¿Is possible quote with BBcode format?

MothMan

I noticed a while back someone commented that an RC3 update was incoming... any word on that?

Mandoleran

Quote from: MothMan on May 25, 2010, 08:16:10 PM
I noticed a while back someone commented that an RC3 update was incoming... any word on that?

+1
any progres in that direction?

woodscooter

Two points to make about this mod.  I'll put them in two separate posts so as not to confuse myself.

Some people were asking why it couldn't be applied to the "normal" reply box, why the quote has to go into Quick Reply. 

Well, if you click Preview in Quick Reply, you get switched to the "normal" reply box.  I wonder whether an extra line of Javascript could simulate a click on the Preview button, straight after rendering the Quick Reply with the quoted text in it?

woodscooter

It is a great mod, and it works for me.  Version is  1.1.11.

There is an oddity in my installation, though.  After selecting text and clicking on Quote (selected), the Page Up and Page Down keys, and the line up/line down (arrow) keys often stop working.

I haven't yet found what causes them to come back again, but it may be that I have to close the browser.

This behaviour was first reported to me from a Forum Member using Firefox on Ubuntu, but subsequently I've seen it happen on a Chrome browser and on Internet Explorer, both on a Windows system.  I've also confirmed it with Firefox on Ubuntu.

If anyone can suggest what mechanism may be affecting the browser's behaviour, I would be pleased to hear about it.  If I know where to look, I can experiment to get to the cause.

Thanks.

atfosan

Quote from: woodscooter on June 29, 2010, 05:54:40 PM
Two points to make about this mod.  I'll put them in two separate posts so as not to confuse myself.

Some people were asking why it couldn't be applied to the "normal" reply box, why the quote has to go into Quick Reply. 

Well, if you click Preview in Quick Reply, you get switched to the "normal" reply box.  I wonder whether an extra line of Javascript could simulate a click on the Preview button, straight after rendering the Quick Reply with the quoted text in it?

Quote (selected) in normal reply box would be great! :)
my SMF project - school site: forum with PortaMx and SimpleSEF mods

miro-ppb

Any chance of this being updated to work on RC4?

digger



miro-ppb


smldmr

#57
search in display.template for

<li class="quote_button"><a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';last_msg=', $context['topic_last_message'], '" onclick="return oQuickReply.quote(', $message['id'], ');">', $txt['quote'], '</a></li>';

replace it with:

<li class="quote_button"><a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';last_msg=', $context['topic_last_message'], '" onmouseover="selected=get_text_selection();" onclick="return oQuickReply.quote_selection(', $message['id'], ', \'', $context['session_id'], '\', \'', $context['session_var'], '\', true, selected, \'' , $message['member']['name'] , '\', ' , $message['timestamp'] , ');">', $txt['quote'], '</a></li>';

all the other codes are compatible with RC4. And if you use another template as default, then copy the topix.js from default/scripts/ in your custom tamplates scripts directors. If you have there one topic.js, then add the code


// * Mod dQuoteSelection
// Get selected text
function get_text_selection() {
var txt = '';
    if (txt = window.getSelection)
      txt = window.getSelection().toString();
    else
      txt = document.selection.createRange().text;
    return txt;
}

// When a user select text and presses quote, put it in the quick reply box (if expanded).
QuickReply.prototype.quote_selection = function (iMessageId, sSessionId, sSessionVar, bTemplateUpgraded, TextSelection, cAuthor, cDate)
{

// Add backwards compatibility with old themes.
if (sSessionVar == true)
{
bTemplateUpgraded = true;
sSessionVar = 'sesc';
}

if (this.bCollapsed)
{
// This is for compatibility.
if (bTemplateUpgraded)
return true;
else
{
window.location.href = smf_prepareScriptUrl(this.opt.sScriptUrl) + 'action=post;quote=' + iMessageId + ';topic=' + this.opt.iTopicId + '.' + this.opt.iStart + ';' + sSessionVar + '=' + sSessionId;
return false;
}
}
else
{
    // If some text selected, insert into quick reply box
    if (TextSelection)
    {
      var quote_link = 'topic=' + this.opt.iTopicId + '.msg' + iMessageId + '#msg' + iMessageId;
      document.postmodify.message.value += '[quote author=' + cAuthor + ' link=' + quote_link + ' date=' + cDate + ']' + TextSelection.replace(/(^\s+)|(\s+$)/g, "") + '[/quote]\n';

    }
// Doing it the XMLhttp way?
else if (window.XMLHttpRequest)
{
ajax_indicator(true);
getXMLDocument(smf_prepareScriptUrl(this.opt.sScriptUrl) + 'action=quotefast;quote=' + iMessageId + ';' + sSessionVar + '=' + sSessionId + ';xml', this.onQuoteReceived);
}
// Or with a smart popup!
else
reqWin(smf_prepareScriptUrl(this.opt.sScriptUrl) + 'action=quotefast;quote=' + iMessageId + ';' + sSessionVar + '=' + sSessionId, 240, 90);

// Move the view to the quick reply box.
if (navigator.appName == 'Microsoft Internet Explorer')
window.location.hash = this.opt.sJumpAnchor;
else
window.location.hash = '#' + this.opt.sJumpAnchor;

return false;
}


on the end of your custom topic.js.

Offcourse you must add all other changes too :)

ChaosEnergy

any update for 2.0 final?
Chaos Empire ®

digger


Advertisement: