The idea and everything else is based on the forum phpBB-3.0 developed by the phpBB Group under the GPL
How It Works?
It only works only when the poster clicks the "Post a Reply" Button, in the topic preview section.
Not in the quick Reply Option.
The Poster needs to click on the "Quote" button wich is next to the "username" (post owner name) located on the
Preview Topic Section (the iframe below the atachments area), then the "clicked message" is added to the "message" textarea.
You can select a few words/phrases/area (mouse selection) from a especific post, and ONLY
the selected text will be quoted.
This MOD was tested on Dragon Fly 9.2.1 CVS with firefox 2.11 & IE 6.0
This MOD can be improved, If you do, please share it! =)
Files to edit:
at the end of the file ADD:
* Add quote text to message
function addquote(post_id, username)
// Find the object for the frame
var message_name = 'message_' + post_id;
var theSelection = '';
var divarea = false;
divarea = theframe.document.all[message_name];
divarea = theframe.document.getElementById(message_name);
// Get text selection - not only the post content :(
theSelection = theframe.window.getSelection().toString();
else if (theframe.document.getSelection)
theSelection = theframe.document.getSelection();
else if (theframe.document.selection)
theSelection = theframe.document.selection.createRange().text;
if (theSelection == '' || typeof theSelection == 'undefined' || theSelection == null)
theSelection = divarea.innerHTML.replace(/<br>/ig, '\n');
theSelection = theSelection.replace(/<br\/>/ig, '\n');
theSelection = theSelection.replace(/<\;/ig, '<');
theSelection = theSelection.replace(/>\;/ig, '>');
theSelection = theSelection.replace(/&\;/ig, '&');
else if (document.all)
theSelection = divarea.innerText;
else if (divarea.textContent)
theSelection = divarea.textContent;
else if (divarea.firstChild.nodeValue)
theSelection = divarea.firstChild.nodeValue;
BBCwrite('post', 'message','','\n\n[quote="'+ username +'"]' + theSelection + '[/quote]', true);
I somehow missed this the 1st time around. Tried it now, but although the concept is sound, having to go through the Preview is perhaps too non-intuitive for anyone but power users?
Great as a hack, but if bookmarking for later inclusion, might I suggest a possible alternative implementation?
Multiple quotes is best done today by manual copy-and-paste then applying the Quote button, and repeat. But the tedious part is the insertion of the correct =username.
Simplest solution to Quick Reply issue is possibly to enable full reply in place of Quick Reply. (My users prefer it that way anyway.) Then no need to use any PHP code in Quote, and it avoids having to change greenday2k's code to work with Quick Reply (which wouldn't be possible without at least including nbbcode.php anyway).
Still don't know how to mod the BBCode Quote button for subsequent (ie multi-) quotes though ... But even without that it would provide selected text quoting.
No, sorry, what I meant was if you converted Quick Reply into a normal message reply. It was a long time ago, and I was using DF9.2.1CVS plus ForumsPlus, along with reDesign3, but I expect this will give you the general idea.
In viewtopic.php add to the quickreply.html template variables: 'L_BBCODE' => bbcode_table('message', 'post', 1), // lb add bbcodes
'L_SMILIES' => smilies_table('inline', 'message', 'post'),
Yep, a quick reply box appearing (or not) is set by Members and Forums settings.
I was thinking of replacing the existing (goes to full reply) Quote button with the one that greenday2k defined. Which I think should work fine with the Quick Reply box (with BBCode buttons). I'd swap it out by just changing the viewtopic.html template (hopefully).
This would (again hopefully) allow user to select text and then hit Quote button as well. (Current behaviour is that Quote button adds whole post which you then have to delete unwanted parts from.)
Should be able to add a 2nd "Multi-Quote" button same way, but I'm not convinced as to the need. Because each replaced Quote button should now work as greenday2k spec'd.
Haven't had chance to try this yet - am in middle of code to allow remote images in coppermine