Gossamer Forum
Home : Products : Gossamer Forum : Discussion :

Selected Text Quoting

Quote Reply
Selected Text Quoting
I badly need a "selected text" quoting/reply function for my family's GForum board we are finishing. I have searched onsite here without finding anything definitive. Taking liberty of posting some code segments from mods to another package we tested -- these functionally worked perfectly on that board. One highlights text in a message, chooses "Quote with Link" and ONLY the selected text appears as a quote in the reply. There is also a nice author-date-time addition to the quote function.
I am not a programmer; I hope someone who is might find a way to get this working in GForum 1.2.3. It is really a beneficial code change.

Code:
####
First, code that was inserted into the "message display" segment
####

<#if $head->{param} =~ match(Add)#>
<img src="$skin_icon_url/quote.gif" title="Copy highlighted text to new message" alt="Copy highlighted text to new message" border="0" height="16" onMouseDown="copy_selection('$message->{author}','<#date $message->{time} format "$L{LONGDATE}"#>','#POST$message->{number}')" onMouseOver="javascript:if (style) style.cursor = 'pointer';">
<#endif#>

####
Then, code that was inserted into a javascript functions segment
####

function copy_selection(message_author,post_date,link_post,author_profile) {
if (document.getSelection) {
//for Netscape
var str = document.getSelection();
document.userpass.message.value+="\\quote_with_link{"+message_author+","+post_date+","+link_post+","+str+"}";
document.userpass.message.focus();
} else if (document.selection) {
//for Internet Explorer
var str = document.selection.createRange().text;
document.userpass.message.value+="\\quote_with_link{"+message_author+","+post_date+","+link_post+","+str+"}";
document.userpass.message.focus();
var rng = document.userpass.message.createTextRange();
rng.collapse(false);
rng.select();
} else {
//display message if browser does not support above methods.
window.alert("Your browser does not support this feature");
return;
}
}

####
Finally, a "webtags" description of the "quote with link" tag
####

"quote_with_link"

<blockquote><hr size=0><!-quote-!><font size=1 font color=b22222><b><u>|1|</font><font size=1><font color=000080></u> wrote on |2| - |3|, |4|:</b><p><font size=1><a href="|5|">|6|</font></a><!-/quote-!><hr size=0><font size=2><font color=000000></blockquote>
Subject Author Views Date
Thread Selected Text Quoting cajun100 2693 Mar 9, 2005, 10:07 AM
Thread Re: [cajun100] Selected Text Quoting
cajun100 2608 Mar 11, 2005, 8:07 AM
Thread Re: [cajun100] Selected Text Quoting
Jagerman 2633 Mar 11, 2005, 7:14 PM
Post Re: [Jagerman] Selected Text Quoting
cajun100 2581 Mar 12, 2005, 8:28 AM