another quick resource to display the topic icon from last topic within a forum. Topic icons must be used and must be selected to be displayed!
Sadly the resource is available for all version - but PhpBB2.
Javascript & jQuery
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: Add topic icon on forum list
Author: Niko
Version: 1.1
Release Date: 04.01.2023 (dd.mm.year)
Contact: https://www.fmcodes.net/u2
Original content: https://www.fmcodes.net/t2016-
*/
const FORUM_VERSION = _userdata["tpl_used"];
var versions = {
'prosilver': 'h2.topic-title', //phpbb3
'punbb': '.pun .posthead h2', //punBB
'invision':'.postbody-head h3', //invision
'modernbb': 'h2.topic-title', //modernBB
'awesomebb': '.post-header h2' //awesomeBB
};
var selector = versions[FORUM_VERSION];
$("dd.lastpost a.lastpost-link[href^='/t'], td.tcr span a[href^='/t']:first-child, table.ipbtable.index-box td.row1 a[href^='/t']:first-child, span.lastpost-infos a[href^='/t']:first-child, .forum-lastpost a.topic-title[href^='/t']").each(function() {
var element = $(this);
var href = $(this).attr('href');
$.ajax({
url:href,
type:'GET',
success: function(data){
var icon = $(data).find(selector).html();
$(element).html(icon);
}
});
});
});
Last edited by Niko on February 4th 2023, 12:22; edited 1 time in total