Avatar in: Lattest Topics, Most Viewed Topics and Most Active Topics Widget!
2 posters
Page 1 of 1
Avatar in: Lattest Topics, Most Viewed Topics and Most Active Topics Widget!
* Application: Avatar in: Lattest Topics, Most Viewed Topics and Most Active Topics Widget!
* Description: This application displays the members avatar in all widget of topic.
* Version: 1.03172014-jq1.9.1 - Narmer (Menés, Meni) - 2015/03/17
In your ACP: Modules -> HTML&JAVASCRIPT -> JavaScript codes management -> [Create a new JavaScript]
Title *: <- Whatever you want
Placement : <- In all the pages
Javascript Code * : <- Select, copy and paste the code below in this field:
- Code:
/****
* Application: Avatar in: Lattest Topics, Most Viewed Topics and Most Active Topics Widget!
* Description: This application displays the members avatar in all widget of topic.
* Version: 1.03172014-jq1.9.1 - Narmer (Menés, Meni)
* Made and Optimizations by JScript - 2015/03/17
* Copyright (c) 2014 JScript <jscriptbrasil at live dot com>
* This work is free. You can redistribute it and/or modify it
* under the terms of the WTFPL, Version 2
**/
jQuery(function() {
var oConfig = {
sInfo: '<!--' +
'* Application: Avatar in: Lattest Topics, Most Viewed Topics and Most Active Topics Widget!' +
'* Description: This application displays the members avatar in all widget of topic.' +
'* Version: 1.03172014-jq1.9.1 - Narmer (Menés, Meni)' +
'* Made and Optimizations by JScript - 2015/03/17' +
'-->',
sDefaultAvatar: 'http://i78.servimg.com/u/f78/18/17/62/92/defaul10.png',
sCSS: '<style>' +
'.jsUserPhoto.widget {' +
'float: left;' +
'margin-top: 3px;' +
'margin-right: 10px;' +
'}' +
'.jsUserPhoto {' +
'background: none repeat scroll 0 0 #FFFFFF;' +
'border: 1px solid #D5D5D5 !important;' +
'box-shadow: 0 2px 2px rgba(0, 0, 0, 0.1);' +
'padding: 1px;' +
'}' +
'.jsUserPhoto_mini {' +
'height: 30px !important;' +
'width: 30px !important;' +
'}' +
'</style>'
};
// Add CSS
jQuery(oConfig.sCSS).insertBefore('body');
// Show member avatar in Recent Topics Widget!
var oTarget = $('#right, #left').find('.forumline tr td.row1, .module .inner, .module.main .main-content, .module.borderwrap .box-content').find('a[href^="/t"]'),
iLen = oTarget.length,
index = 0;
oTarget.prepend('<a class="jsUserPhoto widget" href="#" title="No avatar!"><img class="jsUserPhoto_mini" src="' + oConfig.sDefaultAvatar + '" alt="" /></a>');
oTarget.each(function() {
var oThis = $(this),
findUser = oThis.nextAll('a[href^="/u"]').first(),
container = oThis.find('.jsUserPhoto_mini'),
storIMG = '',
userUrl = '',
topicUrl = '';
if (findUser.length) {
userUrl = findUser.attr('href');
oThis.find('a.jsUserPhoto.widget').attr('href', userUrl).attr('title', findUser.text());
storIMG = sessionStorage.getItem(userUrl); // Read object from sessionStorage, more fast!
if (storIMG) {
container.attr('src', storIMG);
} else {
// if not, then only request per session!!!
jQuery.get(userUrl, function(data) {
storIMG = jQuery('#emptyidcc .row1.gensmall img:eq(0), #profile-advanced-right .module:first .inner img:eq(0), #profile-advanced-right .main-content img:first, #profile-advanced-right .box-content.profile.center img:first', data).attr('src');
if (storIMG !== undefined) {
container.attr('src', storIMG);
// Saving object in sessionStorage
sessionStorage.setItem(userUrl, storIMG);
}
});
}
} else {
topicUrl = oThis.attr('href');
var oData = sessionStorage.getItem(topicUrl); // Read object from sessionStorage, more fast!
if (oData) {
oData = JSON.parse(oData);
container.attr('src', oData.storIMG);
oThis.find('a.jsUserPhoto.widget').attr('href', oData.userUrl).attr('title', oData.userName);
oThis.append('<br>' + oData.userPname);
} else {
jQuery.get(topicUrl, function(data) {
storIMG = $('.postdetails.poster-profile:first, .postprofile:first dt, .user-basic-info:first, .postprofile-details.postdetails:first dt', data).find('> a[href^="/u"] img').attr('src');
if (storIMG !== undefined) {
container.attr('src', storIMG);
}
var oUrl = $('span.name, p.author, h4.username', data).first(),
userUrl = oUrl.find('a:last').attr('href'),
userName = oUrl.find('a').text(),
userPname = oUrl.html();
oThis.find('a.jsUserPhoto.widget').attr('href', userUrl).attr('title', userName);
oThis.append('<br>' + userPname);
var oData = {
storIMG: storIMG,
userUrl: userUrl,
userName: userName,
userPname: userPname
};
// Saving object in sessionStorage
sessionStorage.setItem(topicUrl, JSON.stringify(oData));
});
}
}
});
});
Result:
JS
Re: Avatar in: Lattest Topics, Most Viewed Topics and Most Active Topics Widget!
This will no longer be supported by JScript: https://help.forumotion.com/t151137-in-memory-of-jscript-joao-carlos.
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Similar topics
» Avatar in: Top posters, all Top posting and Most active topic starters Widget
» How can I add avatar in Recent Topics Widget?
» Avatar in recent topics widget phpbb3
» New topics and old Topics not showing as viewed
» Active topics of the day
» How can I add avatar in Recent Topics Widget?
» Avatar in recent topics widget phpbb3
» New topics and old Topics not showing as viewed
» Active topics of the day
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum