inherit
205756
0
Feb 27, 2014 8:11:19 GMT -8
grodhisatva
3
February 2014
grodhisatva
|
Post by grodhisatva on Feb 21, 2014 11:08:35 GMT -8
First I just want to say I did search the forum first for a similar thread. Forum: peeteegold.freeforums.net/I am just beginning to get into development, and one of the things I would like to do to my forum is have the quote button simply paste the quote bbcode into the quickreply box rather than send the users to another page. The reason I am posting this here is because I do not necessarily want it done FOR me, just a little advice on how this could be accomplished if at all. Here is an example of what I want to do; notice how the quote button just inserts the quote code into the reply box.
|
|
inherit
205756
0
Feb 27, 2014 8:11:19 GMT -8
grodhisatva
3
February 2014
grodhisatva
|
Post by grodhisatva on Feb 21, 2014 11:08:51 GMT -8
|
|
inherit
Official Code Helper
65613
0
1
Oct 22, 2024 1:56:19 GMT -8
Chris
"'Oops' is the sound we make when we improve"
9,018
December 2005
horace
RedBassett's Mini-Profile
|
Post by Chris on Feb 21, 2014 14:46:53 GMT -8
A quick and dirty code would be to cycle through each quote button on the page and add a click handler to each that will insert the message content that follows it into the quick reply possibly with a key modifier such as CTRL so one could click normally and be taken to full reply unless holding the key. The handler would preventDefault to suppress the default action of the quote button when activated. The complexity of such a code would depend on whether you want plain simple text as in your image example or fully formatted HTML/BBCOde. For example, if the post contains an image do you want it quoted as well, or if there were words bolded or colored would that be copied to the quote as well? If the answer is yes then you would need to grab the HTML rather than the text and convert it to BBCode. For the most part you could do this with regular expressions since the V5 bbcode format now closely shadows the HTML syntax and just replace "<" with "[" and ">" with "]", there would of course be exceptions to such a blind mass replacement (e.g such a character appearing in a code box would first need to be preprocessed perhaps converting to its HTML entity counterpart to avoid regex recognition).
In the handler something along the lines of $('.form_post_quick_reply textarea[name="message"]').replaceSelection( '[quote]' + $(this).closest('.content').find('.message').html().replace(/\<(\/?\w+)([\s>])/g,"[$1$2").replace(/\>/g,"]")+'[/quote]' )
would for the most part produce an anonymous quote and place it in the quick reply. To get a quote with a name and time attached you would need to do a bit more work and gather that info then add the appropriate attributes (author, timestamp, source) before sending it to quick reply
|
|
inherit
205756
0
Feb 27, 2014 8:11:19 GMT -8
grodhisatva
3
February 2014
grodhisatva
|
Post by grodhisatva on Feb 22, 2014 10:52:53 GMT -8
you're the man.
i don't know 100% what you're talking about but researching all of it will surely be a great learning tool!
thanks!
|
|