Latest topics
» Forumactif Edge - Releases
by Ange Tuteur Tue 03 Sep 2019, 11:49
» GIFActif - Giphy Button for the Editor
by Ange Tuteur Wed 08 May 2019, 17:21
» Forum Closure
by Ange Tuteur Mon 01 Jan 2018, 01:28
» Chit Chat Thread
by Valoish Sun 31 Dec 2017, 19:15
» Font/Text background color.
by Valoish Sun 31 Dec 2017, 19:11
» Forumactif Messenger - Instant Message Application for Forumotion
by Wolfuryo Sun 31 Dec 2017, 18:24
» [GAME] Count to One Million!
by brandon_g Fri 29 Dec 2017, 18:58
» Post Cards
by manikbiradar Wed 20 Dec 2017, 07:50
» [GAME] Countdown from 200,000
by Valoish Wed 13 Dec 2017, 23:22
» GeekPolice Tech Support Forums - GeekPolice.net
by Dr Jay Mon 11 Dec 2017, 19:12
» Asking about some plugin for Forumotion
by Dr Jay Mon 11 Dec 2017, 19:10
» [GAME] What are you thinking right now?
by Van-Helsing Sat 09 Dec 2017, 14:51
» Widget : Similar topics
by ranbac Wed 06 Dec 2017, 18:11
» Change the Background of the Forum and put an image and how to make prefixs?
by Clement Wed 06 Dec 2017, 15:19
» Hello from Western Australia
by SarkZKalie Wed 06 Dec 2017, 05:34
by Ange Tuteur Tue 03 Sep 2019, 11:49
» GIFActif - Giphy Button for the Editor
by Ange Tuteur Wed 08 May 2019, 17:21
» Forum Closure
by Ange Tuteur Mon 01 Jan 2018, 01:28
» Chit Chat Thread
by Valoish Sun 31 Dec 2017, 19:15
» Font/Text background color.
by Valoish Sun 31 Dec 2017, 19:11
» Forumactif Messenger - Instant Message Application for Forumotion
by Wolfuryo Sun 31 Dec 2017, 18:24
» [GAME] Count to One Million!
by brandon_g Fri 29 Dec 2017, 18:58
» Post Cards
by manikbiradar Wed 20 Dec 2017, 07:50
» [GAME] Countdown from 200,000
by Valoish Wed 13 Dec 2017, 23:22
» GeekPolice Tech Support Forums - GeekPolice.net
by Dr Jay Mon 11 Dec 2017, 19:12
» Asking about some plugin for Forumotion
by Dr Jay Mon 11 Dec 2017, 19:10
» [GAME] What are you thinking right now?
by Van-Helsing Sat 09 Dec 2017, 14:51
» Widget : Similar topics
by ranbac Wed 06 Dec 2017, 18:11
» Change the Background of the Forum and put an image and how to make prefixs?
by Clement Wed 06 Dec 2017, 15:19
» Hello from Western Australia
by SarkZKalie Wed 06 Dec 2017, 05:34
Recent Tutorials
Top posting users this month
Top Achievers
Who is online?
In total there are 61 users online :: 0 Registered, 0 Hidden and 61 Guests :: 2 Bots
None
Most users ever online was 515 on Tue 14 Sep 2021, 15:24
None
Most users ever online was 515 on Tue 14 Sep 2021, 15:24
Recent Topic with Avatar problem
Page 1 of 1 • Share
- snowsMember
- Gender :
Posts : 14
Points : 2709
Reputation : 0
Language : English
Browser : Forum Version :
Hey Fmdesign, i got this code from Forumotion support forum it is a code for recent topic with the poster avatar on it...... when ever i change my profile avatar it takes 26 hours or more before the recent topic avatar change to the current profile avatar... HERE IS THE CODE, Please help me check the code and if there is any correction to make please let me know
here is my URL www.9jatechs.com
here is my URL www.9jatechs.com
- Code:
$(function(){
var style = document.createElement('STYLE'), css = '.mini_ava2>img{height:50px;margin-right:5px;width:50px;}';
style.type = 'text/css';
if (style.styleSheet) style.styleSheet.cssText = css;
else style.appendChild(document.createTextNode(css));
document.getElementsByTagName('HEAD')[0].appendChild(style);
if(!window.localStorage) return;
// Default avatar
var default_avatar= 'http://2img.net/i/fa/invision/pp-blank-thumb.png';
// Time of cache 24h*60m*60s*1000ms - one day
var caching_time= 24*60*60*1000;
// Time of cache in case of error 60s*1000ms - one minute
var caching_error= 60*1000;
var set_avatar= function(id) {
$('.mini_ava2.member'+id).html('<img src="'+get_avatar(id)+'" />');
};
var get_avatar= function(id) {
if(localStorage.getItem('t_ava'+id) < +new Date - caching_time || (localStorage.getItem('d_ava'+id)==default_avatar && localStorage.getItem('t_ava'+id) < +new Date - caching_error))
{
localStorage.setItem('d_ava'+id, default_avatar);
$.get('/u'+id, function (d){
localStorage.setItem('t_ava'+id,+new Date);
localStorage.setItem('d_ava'+id, $('#profile-advanced-right .module:first div img:first,.forumline td.row1.gensmall:first > img, .frm-set.profile-view.left dd img,dl.left-box.details:first dd img, .row1 b .gen:first img, .real_avatar img',d).first().attr('src')||default_avatar);
set_avatar(id);
});
}
return localStorage.getItem('d_ava'+id);
};
var to_replace= {};
$('#recentTopics a[href^="/u"]').each(function(){
to_replace[$(this).attr('href').substr(2)]= 1;
$(this).before('<span class="mini_ava2 member'+$(this).attr('href').substr(2)+'"></span>');
});
for(i in to_replace)
{
set_avatar(i);
};
});
- Wolfuryo
- Gender :
Posts : 256
Points : 3807
Reputation : 81
Language : Romanian and English
Browser : Forum Version :
You have to modify this part:
24*60*60*1000 is the number of milliseconds a day has. If you want to disable this, replace it with 0.
|
- snowsMember
- Gender :
Posts : 14
Points : 2709
Reputation : 0
Language : English
Browser : Forum Version :
Hey @Wolfuryo please make the modification for me, i did it and it my self and it makes no effect
- Wolfuryo
- Gender :
Posts : 256
Points : 3807
Reputation : 81
Language : Romanian and English
Browser : Forum Version :
- Code:
$(function(){
var style = document.createElement('STYLE'), css = '.mini_ava2>img{height:50px;margin-right:5px;width:50px;}';
style.type = 'text/css';
if (style.styleSheet) style.styleSheet.cssText = css;
else style.appendChild(document.createTextNode(css));
document.getElementsByTagName('HEAD')[0].appendChild(style);
if(!window.localStorage) return;
// Default avatar
var default_avatar= 'http://2img.net/i/fa/invision/pp-blank-thumb.png';
// Time of cache 24h*60m*60s*1000ms - one day
var caching_time= 0;
// Time of cache in case of error 60s*1000ms - one minute
var caching_error= 60*1000;
var set_avatar= function(id) {
$('.mini_ava2.member'+id).html('<img src="'+get_avatar(id)+'" />');
};
var get_avatar= function(id) {
if(localStorage.getItem('t_ava'+id) < +new Date - caching_time || (localStorage.getItem('d_ava'+id)==default_avatar && localStorage.getItem('t_ava'+id) < +new Date - caching_error))
{
localStorage.setItem('d_ava'+id, default_avatar);
$.get('/u'+id, function (d){
localStorage.setItem('t_ava'+id,+new Date);
localStorage.setItem('d_ava'+id, $('#profile-advanced-right .module:first div img:first,.forumline td.row1.gensmall:first > img, .frm-set.profile-view.left dd img,dl.left-box.details:first dd img, .row1 b .gen:first img, .real_avatar img',d).first().attr('src')||default_avatar);
set_avatar(id);
});
}
return localStorage.getItem('d_ava'+id);
};
var to_replace= {};
$('#recentTopics a[href^="/u"]').each(function(){
to_replace[$(this).attr('href').substr(2)]= 1;
$(this).before('<span class="mini_ava2 member'+$(this).attr('href').substr(2)+'"></span>');
});
for(i in to_replace)
{
set_avatar(i);
};
});
- snowsMember
- Gender :
Posts : 14
Points : 2709
Reputation : 0
Language : English
Browser : Forum Version :
not okay still
- Wolfuryo
- Gender :
Posts : 256
Points : 3807
Reputation : 81
Language : Romanian and English
Browser : Forum Version :
- Code:
$(function(){
/*By Justice. No reproduction without written consent from the author*/
if(!_userdata.session_logged_in) return;
var n=$(".js-marquee a:nth-child(2n)"), len=n.length;
var index=0;
function get_ava(i){
$.get(n.eq(i).attr("href"), function(data){
var ava=$("[alt='avatar']", data).eq(0).attr("src");
n.eq(i).after("<img style='width:50px;height:50px' src='"+ava+"'/>");
i++;
if(i==len) return;
get_ava(i);
})
}
get_ava(index);
})
- snowsMember
- Gender :
Posts : 14
Points : 2709
Reputation : 0
Language : English
Browser : Forum Version :
hey, this code worked fine, but it disable other code in my forumWolfuryo wrote:
- Code:
$(function(){
/*By Justice. No reproduction without written consent from the author*/
if(!_userdata.session_logged_in) return;
var n=$(".js-marquee a:nth-child(2n)"), len=n.length;
var index=0;
function get_ava(i){
$.get(n.eq(i).attr("href"), function(data){
var ava=$("[alt='avatar']", data).eq(0).attr("src");
n.eq(i).after("<img style='width:50px;height:50px' src='"+ava+"'/>");
i++;
if(i==len) return;
get_ava(i);
})
}
get_ava(index);
})
- Wolfuryo
- Gender :
Posts : 256
Points : 3807
Reputation : 81
Language : Romanian and English
Browser : Forum Version :
You have to remove the first code for this to run without problems.
- snowsMember
- Gender :
Posts : 14
Points : 2709
Reputation : 0
Language : English
Browser : Forum Version :
i removed the first Code, it works fine but disable some Javascript code , Like PostCard By @Ange Tuteur and much more
- Wolfuryo
- Gender :
Posts : 256
Points : 3807
Reputation : 81
Language : Romanian and English
Browser : Forum Version :
See if replacing the code with this solves the problem:
- Code:
$(function(){
/*By Justice. No reproduction without written consent from the author*/
if(!_userdata.session_logged_in) return;
var n=$(".js-marquee a:nth-child(2n)"), len=n.length;
if(len==0) return;
var index=0;
function get_ava(i){
$.get(n.eq(i).attr("href"), function(data){
var ava=$("[alt='avatar']", data).eq(0).attr("src");
n.eq(i).after("<img style='width:50px;height:50px' src='"+ava+"'/>");
i++;
if(i==len) return;
get_ava(i);
})
}
get_ava(index);
})
- snowsMember
- Gender :
Posts : 14
Points : 2709
Reputation : 0
Language : English
Browser : Forum Version :
Hey @Wolfuryo understand me ''this code work fine but it disable other functioning code in my forumWolfuryo wrote:See if replacing the code with this solves the problem:
- Code:
$(function(){
/*By Justice. No reproduction without written consent from the author*/
if(!_userdata.session_logged_in) return;
var n=$(".js-marquee a:nth-child(2n)"), len=n.length;
if(len==0) return;
var index=0;
function get_ava(i){
$.get(n.eq(i).attr("href"), function(data){
var ava=$("[alt='avatar']", data).eq(0).attr("src");
n.eq(i).after("<img style='width:50px;height:50px' src='"+ava+"'/>");
i++;
if(i==len) return;
get_ava(i);
})
}
get_ava(index);
})
- Sponsored content
Similar topics
Create an account or log in to leave a reply
You need to be a member in order to leave a reply.
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum