Posted Sun Jun 15, 2014 7:55 am
SocialAcademy • Forum » Support Section » Ask Question 's & Problems » Solved & Trash Files → [solved] Avatar Problem
- Please log in to Reply
#2
J0k3R^
#3
Zeus
Posted Sun Jun 15, 2014 9:51 am
JavaScript:
CSS:
- Code:
$(document).on('ready', function() {
$('.statused .tcr').prepend('<div class="avatar-index"><div>');
$('.statused .tcr .avatar-index').each(function () {
var profileUserURL = $(this).parent().children('span').children('strong').children('a').attr('href');
$(this).html('<a href="' + profileUserURL + '" class="avatar-index-enlace"><img src="http://2img.net/i/fa/invision/pp-blank-thumb.png" alt="No Avatar" /></a>');
$(this).children('a').load(profileUserURL + ' .module:eq(0) img:eq(0)')
});
});
CSS:
- Code:
.avatar-index { float: left; }
.avatar-index img { width: 40px; height: 40px; padding: 1px; border: 1px solid #DDD; margin: 0 5px; }
#4
J0k3R^
Posted Sun Jun 15, 2014 9:58 am
im not sure about that but try this:
go to overall_header and add the following to the end of it:
or:
go to overall_header and add the following to the end of it:
- Code:
<!-- BEGIN switch_user_logged_out -->
<script>
$(document).on('ready', function() {
$('.statused .tcr').prepend('<div class="avatar-index"><div>');
$('.statused .tcr .avatar-index').each(function () {
var profileUserURL = $(this).parent().children('span').children('strong').children('a').attr('href');
$(this).html('<a href="' + profileUserURL + '" class="avatar-index-enlace"><img src="http://2img.net/i/fa/invision/pp-blank-thumb.png" alt="No Avatar" /></a>');
$(this).children('a').load(profileUserURL + ' .module:eq(0) img:eq(0)')
});
});
</script>
<!-- END switch_user_logged_out -->
or:
- Code:
<!-- BEGIN switch_user_logged_out -->
<script type="text/javascript">
$(document).on('ready', function() {
$('.statused .tcr').prepend('<div class="avatar-index"><div>');
$('.statused .tcr .avatar-index').each(function () {
var profileUserURL = $(this).parent().children('span').children('strong').children('a').attr('href');
$(this).html('<a href="' + profileUserURL + '" class="avatar-index-enlace"><img src="http://2img.net/i/fa/invision/pp-blank-thumb.png" alt="No Avatar" /></a>');
$(this).children('a').load(profileUserURL + ' .module:eq(0) img:eq(0)')
});
});
</script>
<!-- END switch_user_logged_out -->
#5
Zeus
#6
J0k3R^
Posted Sun Jun 15, 2014 11:56 am
POPULAR
okey, delete the javascript and these codes from overall_header..
i will provide u new:
1st. javascript (homepage + sub-forums):
2nd. javascript (homepage + sub-forums):
3rd. css:
i will provide u new:
1st. javascript (homepage + sub-forums):
- Code:
$(function(){
var text = '<span class="mini_ava"><img src="http://i58.tinypic.com/2enrbyd.png" /></span> <br/> <span class="nopostcont">No posts</span>';
var noPost = $('.table td.tcr');
$(noPost).each(function() {
if($(this).text() == '') {
$(this).html(text);
}
else { }
});
});
2nd. javascript (homepage + sub-forums):
- Code:
$(function(){
if(!window.localStorage) return;
// Avatar by default
var default_avatar= 'http://2img.net/i/fa/invision/pp-blank-thumb.png';
// Time of cache, here : 24hrs * 60m * 60s * 1000ms so one day
var caching_time= 24*60*60*1000;
// Time of cache in case of error, here : 60s * 1000ms so one minute
var caching_error= 60*1000;
var set_avatar= function(id) {
$('.mini_ava.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= {};
$('dd.lastpost strong a.gensmall, .ipbtable tr td:last-child span strong a.gensmall, .table td.tcr strong a.gensmall, .forumline .row3.over strong a.gensmall').each(function(){
to_replace[$(this).attr('href').substr(2)]= 1;
$(this).closest('td,dd').prepend('<div class="mini_ava member'+$(this).attr('href').substr(2)+'"></div>');
});
for(i in to_replace)
{
set_avatar(i);
};
});
3rd. css:
- Code:
.mini_ava{
float:left;
}
.mini_ava img{
width:30px;
height:30px;
margin: 7px 7px;
padding: 1px;
border: 1px solid #B1B1B1;
border-radius:2px;
}
#7
Zeus
#8
Dustin
Posted Sun Jun 15, 2014 8:49 pm
Topic solved & archived. |
Message (Page 1 of 1)
Share Topics Url
Url | |
BBcode | |
HTML |
Permissions in this forum:
You cannot reply to topics in this forum