Cross-Referencing Quoted post
Posted December 6th 2011, 5:33am
It was my dream that such a solution comes to FM & that makes Forum usage much beneficial to others as well. Thnx to this forum & its teacher that I have cloned a vBulletin feature in FM

VBulletin demo: http://www.defence.pk/forums/wmd-missil ... ost2345982
see when you quote posts the original link too appears its essential if you have a very long debate in a thread.

FM demo: http://engineering.forumotion.info/t20p ... -tester#68
same looks isn't it

I use the LGforum code so do involve his copyrights, plus have added feature that when you press quote window auto-scrolls to editor.
http://jsfiddle.net/defencedog/qHev7/

 var CopyrightNotice = 'Quick  Quote in Quick Reply for forumotion  boards. Copyright © by LGforum.  All Rights Reserved. Use, modification,  and/or distribution of this  script is not allowed without this entire  copyright notice in the  original, copied, or modified script';
$(function() {
$('.i_icon_quote').click(function() {
var y = $(this).closest('div').get(); //get the respective .postbody
var z = $(y).find('h2 a').attr('href'); //get href of each post
var x = this.parentNode.href;
$.get(x, function(response) {
var findmsg = response.indexOf('<textarea id="text_editor_textarea');
var start = response.indexOf('>', findmsg) + 1;
var end = response.indexOf('</textarea>');
var message = response.substring(start, end);
document.post.message.value += '' + message + ' [right][url=http://engineering.forumotion.info' + z + ']Original post[/url][/right] ';
$('textarea#text_editor_textarea').focus(); //scrolling feature
});

return false;
});
});



you can quote twice thrice original posts always are correctly linked to its source post.
I will be happy, if Dion care to explain how could (if any) optimisation is needed to this code or any alternative way
φ
Posts: 163
Joined: August 5th 2011, 11:00pm
Location: Pakistan
Likes Given: 34
Likes Received: 3
Cross-Referencing Quoted post
Posted December 6th 2011, 10:56am
Nice work ;) Do you have any new ideas about the new features for fouromtion. If you do, please send me an pm :|
φ
Posts: 209
Joined: September 10th 2011, 11:00pm
Location: SC, USA
Likes Given: 8
Likes Received: 8
Cross-Referencing Quoted post
Posted December 6th 2011, 11:08am
I have temporarily hidden the code until you get approval to post it. I personally would object to having my modified code posted in this way.

Please note that your code will only work with phpBB3 boards.

Since you are dealing with an onclick() event that includes an AJAX call, there is no need to worry about optimization.

I have one comment about the code. The "z" variable is outside the $.get() function, and that can lead to problems. Since it seems to work in this case, no worries...but if you use this technique in the future, remember that it's best to define your variables internal to the function.
φ
Posts: 1599
Joined: March 12th 2009, 11:00pm
Location: Uncertain due to momentum
Likes Given: 26
Likes Received: 357
Cross-Referencing Quoted post
Posted December 6th 2011, 3:23pm
Dion said:
I personally would object to having my modified code posted in this way.

But Dion I meant no harm, nor did I changed the copyrights. Plz do tell us why we can't edit your codes after having included your copyright :(

I included z because the function $.get(x, function(response) { is nested inside $('.i_icon_quote').click(function() { & I thought thats legal syntax. Plus would you like to tell me what is this response function?...& which selector is selected by ths parentNode :
var x = this.parentNode.href;
φ
Posts: 163
Joined: August 5th 2011, 11:00pm
Location: Pakistan
Likes Given: 34
Likes Received: 3
Cross-Referencing Quoted post
Posted December 6th 2011, 6:20pm
That code was copyrighted by LGforum, not me. He now has his own board where that tutorial resides, and he asked me to remove all of his tutorials that were originally posted here. I realize that as written, his copyright allows you to post your modified code here. However, because of the above, I would appreciate your getting his approval before I unhide your modified code. I would expect the same courtesy if the situation were reversed.

I know why you used the "z" variable, but event-triggered functions are strange things. If you click another quote button before the first AJAX call is complete, both quotes will use the "z" variable from the second click! That's why you need to pass the value of the "z" variable to the AJAX response function.

In that code, you are clicking on an image. The parent node of that image is an tag, and it is grabbing the "href" attribute from that tag.
φ
Posts: 1599
Joined: March 12th 2009, 11:00pm
Location: Uncertain due to momentum
Likes Given: 26
Likes Received: 357
Cross-Referencing Quoted post
Posted December 16th 2011, 5:51am
You have permission to post it, since the code has now been updated on my board. Thanks for the polite courtesy though Dion.
φ
Posts: 509
Joined: July 9th 2011, 11:00pm
Location: England
Likes Given: 15
Likes Received: 26
Cross-Referencing Quoted post
Posted January 1st 2012, 12:07pm
so where is the code ?
φ
Posts: 42
Joined: October 11th 2011, 11:00pm
Likes Given: 13
Likes Received: 1
Cross-Referencing Quoted post
Posted February 11th 2012, 2:07pm
:-( It doesn't work on my forum.
φ
Posts: 280
Joined: October 2nd 2011, 11:00pm
Likes Given: 27
Likes Received: 4
Cross-Referencing Quoted post
Posted February 11th 2012, 2:20pm
The code in the first post could do with being updated. Ion-cube if you wish to update it using my updated version of the code this is based off, that's fine.
φ
Posts: 509
Joined: July 9th 2011, 11:00pm
Location: England
Likes Given: 15
Likes Received: 26
Cross-Referencing Quoted post
Posted February 11th 2012, 2:27pm
LGforum said:
The code in the first post could do with being updated. Ion-cube if you wish to update it using my updated version of the code this is based off, that's fine.
I did not actually take the time to see if it works with new quotes. I based whether it works or not on current quotes, and did not actually experiment with it.
φ
Posts: 280
Joined: October 2nd 2011, 11:00pm
Likes Given: 27
Likes Received: 4
Cross-Referencing Quoted post
Posted February 11th 2012, 4:24pm
It will only work with quotes after installing the script. By clicking on the 'Quote' button.

Note: you must have the quick reply activated. And if I remember correctly, you don't.
φ
Posts: 509
Joined: July 9th 2011, 11:00pm
Location: England
Likes Given: 15
Likes Received: 26
Cross-Referencing Quoted post
Posted February 11th 2012, 5:41pm
LGforum said:
Note: you must have the quick reply activated. And if I remember correctly, you don't.
That is correct, I don't.
φ
Posts: 280
Joined: October 2nd 2011, 11:00pm
Likes Given: 27
Likes Received: 4
Post a reply
12 posts

Who is online

Users browsing this forum: No registered users and 1 guest