Đăng nhập hoặcđăng kýđể tham gia thảo luận trên diễn đàn




    You are not connected. Please login or register


    Bài viết : inyo mata


    Bài viết thứ :1
    Đăng vào:Sun Apr 16, 2017 7:19 pm

    Admin

    Admin

    Admin
    Code:
    $(function(){
                   
                      if(!window.localStorage) return;
                   
                      // Avatar by default
                        var default_avatar= 'http://baste.forumotion.asia/users/3716/83/50/54/avatars/1-79.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);
                        };
                   
                  });

    View previous topic View next topic Back to top  Message [Page 1 of 1]

    Permissions in this forum:
    You cannot reply to topics in this forum

     
    • Free forum | ©phpBB | Free forum support | Report an abuse | Forumotion.com