Post by elmia on Jul 25, 2018 3:39:30 GMT -8
Dear coding geniuses,
I'm new to the world of JS. I'm using the PBMetaDescription plugin to add thread descriptions to my forum as the original thread descriptions plugin doesn't function properly due to high customization. However, this plugin does not place the thread description on the thread itself, only the thread list, as was originally requested. I, on the other hand, would like to have the thread descriptions placed on the thread page as well as the thread list, preferably to any spot I want to (so it should be a div that I can place into the layout template).
Could somebody kindly at least steer me into the right direction regarding what I should be doing? I've been trying to figure this one out myself, but so far I have been successful in breaking the code only... Any help would be greatly appreciated and if some kind soul provides me with a code that I can just paste to the plugin, I'll be forever grateful!
I believe this is the part that I should be tinkering with? Just to be clear, I sort of don't have a clue about what I'm doing.
/**
* showDescriptions
* @return {void}
* ------------------------------------------------------------------
**/
showDescriptions : function(){
var threads = $('[id^=thread-');
$.each(threads, function(thread){
var id = $(this).attr('id').split('-')[1];
var description = $('<p/>', {
class: 'description',
text : pb.plugin.key('PBMetaDescription').get(id)
});
var selector = $('#thread-'+id).find(module.plugin.selector);
if(selector.length > 0){
$('#thread-'+id).find(selector).append(description);
}else{
$('#thread-'+id).find('.main .link').append(description);
}
});
}