News:

Wondering if this will always be free?  See why free is better.

Main Menu

Quote Highlighted Text

Started by Truth31u, December 27, 2006, 03:07:11 PM

Previous topic - Next topic

Truth31u

A while back I was a member of a message board that used the PHPBB software and it had a feature where you could highlight the text you wanted from a post and when you clicked "quote" it would only quote the highlighted text. 

I did a search and could not find a mod for this, or a request so if this has been asked and answered please forgive me.  But I was wondering if anyone could make a mod so a user could highlight the text they want to quote and when they click the quote button only the highlighted text will be quoted?

Thanks

4LP3RUZ1

#1
theres an old topic I found here: http://www.simplemachines.org/community/index.php?topic=21285.15

it is said that it doesn't work on the latest SMF releases, I'll see what I can do

edit: here it is, will only work with quick reply open Themes\default\xml_topic.js

and change

function doQuote(messageid, cur_session_id)
{
if (quickReplyCollapsed)
window.location.href = smf_scripturl + "?action=post;quote=" + messageid + ";topic=" + smf_topic + "." + smf_start + ";sesc=" + cur_session_id;
else
{
if (window.XMLHttpRequest)
{
if (typeof window.ajax_indicator == "function")
ajax_indicator(true);
getXMLDocument(smf_scripturl + "?action=quotefast;quote=" + messageid + ";sesc=" + cur_session_id + ";xml", onDocReceived);
}
else
reqWin(smf_scripturl + "?action=quotefast;quote=" + messageid + ";sesc=" + cur_session_id, 240, 90);

if (navigator.appName == "Microsoft Internet Explorer")
window.location.hash = "quickreply";
else
window.location.hash = "#quickreply";
}
}


with

// Gets the selected text
function getSelect()
{
if (window.getSelection)
{
return window.getSelection();
}
else if (document.getSelection)
{
return document.getSelection();
}
else if (document.selection)
{
return document.selection.createRange().text;
}
return false; //no selection
}

function doQuote(messageid, cur_session_id)
{
if (quickReplyCollapsed)
window.location.href = smf_scripturl + "?action=post;quote=" + messageid + ";topic=" + smf_topic + "." + smf_start + ";sesc=" + cur_session_id;
else
{
if(getSelect() == false) //nothing selected
{
if (window.XMLHttpRequest)
{
if (typeof window.ajax_indicator == "function")
ajax_indicator(true);
getXMLDocument(smf_scripturl + "?action=quotefast;quote=" + messageid + ";sesc=" + cur_session_id + ";xml", onDocReceived);
}
else
reqWin(smf_scripturl + "?action=quotefast;quote=" + messageid + ";sesc=" + cur_session_id, 240, 90);

if (navigator.appName == "Microsoft Internet Explorer")
window.location.hash = "quickreply";
else
window.location.hash = "#quickreply";
}
else
{
document.postmodify.message.value += '[quote]' + getSelect() + '[/quote]';
}
}
}
Frozen frogs are back :(

Daniel15

Wow, what a coincidence, I was going to work on something similar (I use this feature a lot at Whirlpool.net.au) :D
The problem I saw was that no BBCode would be quoted, only the actual text. Unfortunately, I can't think of any ways around this...
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

4LP3RUZ1

I suppose a better way would be to pass the start position and the length of the selection to the actual quoting functions, but that would be more complicated than the above code :D
Frozen frogs are back :(

Truth31u

alperuzi,

Thanks, I will try this.  Will this work with 1.1 RC3?


4LP3RUZ1

yeah, it'll work with any version that has the xml_topic.js file, which I believe is RC3 and newer
Frozen frogs are back :(

MothMan

#6
Thanks for this.  Works perfectly on 1.1.1.

Not to sound ungrateful, I assume this isn't easy... but I guess there isn't a way to get this to work even for people without Quick Reply enabled?

kober


4LP3RUZ1

well, i don't know why it wouldn't...

but the easiest way would be to upgrade to FF 2.0 ;)
Frozen frogs are back :(

Advertisement: