Make quoted author name clickable in quotes
5 posters
Page 1 of 1
Make quoted author name clickable in quotes
Coucou,
another quick resource that may be useful for someone
From regular non-clickable quoted author
to clickable author name
Hope you will enjoy
another quick resource that may be useful for someone
Introduction and Demo
The resource allows you to make the quoted author username clickable inside quotes. When you cite a previous post, the name of the author will become clickable!From regular non-clickable quoted author
to clickable author name
Disclaimer
In the past, Pinguino (French Administrator) pointed out that the option was not included in the Forumotion update because of technical reasons. Please note that if you have too many quotes in the page, the loading may be slow - but otherwise don't worry about using this script!Pinguino wrote:Hello,
From memory, this integration caused a technical problem which motivated its withdrawal. The tech team just told me that this makes the pages load considerably longer.
Installation: Javascript
You need to go towards Administration Control Panel (ACP) Modules HTML & Javascript Javascript codes management and create a new code - upon verifying that Javascript codes management is enabled.- Title: free choice - does not influence the code effect
- Where: All pages
- Code:
- Code:
$(function() {
/*
Title: Make quoted author name clickable in quotes
Author: Niko
Version: 1.0
Release Date: 03.06.2023 (dd.mm.year)
Contact: https://www.fmcodes.net/u2
Original content: https://www.fmcodes.net/t2037-
*/
const FORUM_VERSION = _userdata["tpl_used"];
var breadcrumb_quoteAuthor = {
'subsilver': 'dl.codebox dt span.genmed b', //phpbb2
'prosilver': 'blockquote div cite', //phpbb3
'punbb': 'blockquote div cite', //punBB
'invision': 'blockquote div cite', //invision
'modernbb': 'blockquote div cite', //modernBB
'awesomebb': 'blockquote cite' //awesomeBB
};
var wrote_keyword = $(breadcrumb_quoteAuthor[FORUM_VERSION]).text().split(' ').pop().split(':')[0];
$(breadcrumb_quoteAuthor[FORUM_VERSION]).each(function(){
var username = $(this).text().split(' '+wrote_keyword+':')[0];
var textNode = $(this);
$.ajax({
url: '/memberlist?username='+username,
type: 'GET',
success: function(data){
if(FORUM_VERSION == 'invision') {
var href = $(data).find(".membername span strong:contains('"+username+"')").parents('.member-header.clearfix').find('.popupmenu.clearfix ul li a[href*="/u"]').attr('href');
console.log(href);
} else {
var href = $(data).find("a span strong:contains('"+username+"'), a span:contains('"+username+"')").parents('a').attr('href');
}
var user_id = href.split('/u').pop()[0];
textNode.html(textNode.html().replace(username,'<a href="/u'+user_id+'" class="quote_mention_username">'+username+'</a>'));
}
});
});
})
CSS
There is no required CSS to be included, but the clickable quoted username can be customized with this class
|
Hope you will enjoy
YoshiGM, SarkZKalie, TonnyKamper and Razor12345 like this post
Niko likes this post
TonnyKamper likes this post
Re: Make quoted author name clickable in quotes
Hello,
Really ? One AJAX request per quote tag ?
Yes, there isn't, I think, any other way to achieve that. But imagine you display 50 posts per page, and each post on the page contains 2 quotes. Result : 100 AJAX requests
Having this link can be very handy, of course, and we had it automatically on server side at a time, but it has been removed due to a too important server charge which was slowing down page loading. And this problem was on sever side, with PHP code and certainly only one single SQL request / loop to recover usernames links...
Your script do the same, but with separated individual AJAX request on server side, moreover AJAX requests that load a full HTML page and not only a single line of JSON data (because no choice, again)...
Thinking about time, client ressources and data needed to add these links, I'm not sure that this code have a very good cost/effect balance...
I think it may consistently slow down topics pages...
Have a good day.
Really ? One AJAX request per quote tag ?
Yes, there isn't, I think, any other way to achieve that. But imagine you display 50 posts per page, and each post on the page contains 2 quotes. Result : 100 AJAX requests
Having this link can be very handy, of course, and we had it automatically on server side at a time, but it has been removed due to a too important server charge which was slowing down page loading. And this problem was on sever side, with PHP code and certainly only one single SQL request / loop to recover usernames links...
Your script do the same, but with separated individual AJAX request on server side, moreover AJAX requests that load a full HTML page and not only a single line of JSON data (because no choice, again)...
Thinking about time, client ressources and data needed to add these links, I'm not sure that this code have a very good cost/effect balance...
I think it may consistently slow down topics pages...
Have a good day.
Niko and TonnyKamper like this post
Re: Make quoted author name clickable in quotes
Coucou @chattigre
yeah, sadly I know
I placed a disclaimer because of this, but I agree with you that it is not the best solution - so it needs to be used carefully
A possible "middle-way" could be to cache the username-userID retrieve, so that the "disaster" happens only once
I agree with you also on the cost/effect balance - but it's upon the user's choice and decision
Of course, this resource will stay in the Community Coding and Analysis Zone, and will never turn into an official tutorial
but hey, here is the idea - maybe another user will get a better way to do it based on this idea
yeah, sadly I know
I placed a disclaimer because of this, but I agree with you that it is not the best solution - so it needs to be used carefully
Niko wrote:Disclaimer
In the past, Pinguino (French Administrator) pointed out that the option was not included in the Forumotion update because of technical reasons. Please note that if you have too many quotes in the page, the loading may be slow - but otherwise don't worry about using this script!Pinguino wrote:Hello,
From memory, this integration caused a technical problem which motivated its withdrawal. The tech team just told me that this makes the pages load considerably longer.
A possible "middle-way" could be to cache the username-userID retrieve, so that the "disaster" happens only once
I agree with you also on the cost/effect balance - but it's upon the user's choice and decision
Of course, this resource will stay in the Community Coding and Analysis Zone, and will never turn into an official tutorial
but hey, here is the idea - maybe another user will get a better way to do it based on this idea
TonnyKamper likes this post
Similar topics
» Single quote button keeps quoting all quotes already quoted when quoting a members comments.
» How to make signature clickable?
» How to make a link clickable
» How to make a Clickable picture rotation
» How To Make Accordion Slides Clickable?
» How to make signature clickable?
» How to make a link clickable
» How to make a Clickable picture rotation
» How To Make Accordion Slides Clickable?
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum