The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Mini avatars in boarding index

View previous topic View next topic Go down

Mini avatars in boarding index

Post by Luffy on February 26th 2014, 6:24 am

Take a look at my problem.

I want to add a mini avatar to my board index. To add this, i was given a code which i had to add in javascript and an other one which i had to put in css.

The javascript code is this:
Javascript:

Code:
$(function(){
        if(!window.localStorage) return;
        var default_avatar= 'http://illiweb.com/fa/invision/pp-blank-thumb.png';
        var caching_time= 24*60*60*1000;
        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);
        };
        });

My problem is not this. My problem is that i have changed the normal 4 columns to 1. So now i only have the .tc1

The template index_box is this:
index_box:

Code:
{JAVASCRIPT}

<div class="pun-crumbs">
   <p class="crumbs"><a href="{U_INDEX}">{L_INDEX}</a><strong>{NAV_CAT_DESC}</strong></p>
  
</div>
<div class="main">
<!-- BEGIN catrow -->
   <!-- BEGIN tablehead -->
      <div class="main-head">
         <div class="page-title">{catrow.tablehead.L_FORUM}</div>
      </div>
      <div class="main-content">
         <table cellspacing="0" class="table">
            <thead>
               
                  <th class="tcl"></th>
                                  
                                        
            </thead>
            <tbody class="statused">
   <!-- END tablehead -->

   <!-- BEGIN forumrow -->
               <tr>
                  <td class="tcl" style="padding-right: {catrow.forumrow.INC_LEVEL_RIGHT}; padding-left: {catrow.forumrow.INC_LEVEL_LEFT};" >
                     <div class="forumkouti"><span class="status" style="margin-right: -{catrow.forumrow.INC_WIDTH_ICON}; margin-left: -{catrow.forumrow.INC_WIDTH_ICON};">
                        <img title="{catrow.forumrow.L_FORUM_FOLDER_ALT}" src="{catrow.forumrow.FORUM_FOLDER_IMG}" alt="{catrow.forumrow.L_FORUM_FOLDER_ALT}" />
                     </span>
                     <h{catrow.forumrow.LEVEL} class="hierarchy"><a href="{catrow.forumrow.U_VIEWFORUM}" class="forumtitle">{catrow.forumrow.FORUM_NAME}</a></h{catrow.forumrow.LEVEL}>
                     <br />
                     <div class="descript"><span class="genmed">{catrow.forumrow.FORUM_DESC}</span></div>
                                                  </div>
        <div class="subforums" ><span class="gensmall">
            <!-- BEGIN switch_moderators_links -->
            {catrow.forumrow.switch_moderators_links.L_MODERATOR}{catrow.forumrow.switch_moderators_links.MODERATORS}
            <!-- END switch_moderators_links -->
            {catrow.forumrow.L_LINKS}{catrow.forumrow.LINKS}
        </span></div>
                                                  
                     <!-- BEGIN switch_topic_title -->
                     <center><div class="themataforum"><a href="{catrow.forumrow.U_LATEST_TOPIC}" title="{catrow.forumrow.LATEST_TOPIC_TITLE}">{catrow.forumrow.LATEST_TOPIC_NAME}</a>
                                                          <br /><div class="toksakia">{catrow.forumrow.USER_LAST_POST}</div></div></center>
                     <!-- END switch_topic_title -->
                                                  
                                                      
                                                  <div class="thematakouti"><center><b>{catrow.forumrow.TOPICS}<br />Θέματα </b> </center></div><div class="apantiseiskouti"><center><b>{catrow.forumrow.POSTS}<br />Απαντήσεις </b> </center></div>
                                                
                                                  <strong>{forumrow.L_SUBFORUM_STR}</strong> {forumrow.SUBFORUMS}
                                                  </td>

                  
                                  </tr>               
                  
               
   <!-- END forumrow -->

   <!-- BEGIN tablefoot -->
            </tbody>
         </table>
      </div>
   <!-- END tablefoot -->
<!-- END catrow -->
</div>

<!-- BEGIN switch_on_index -->
<div class="main-box clearfix">
   
 

   
</div>
<!-- END switch_on_index -->



So i want to add this javascript but perhaps the commands are different and i am confused to which ones i must change.

Can someone help me please?



Forum Version: PunBB
Forum Address: Information Forum GR
avatar
Luffy
Manager
Manager

Male Posts : 4672
Reputation : 471
Language : Greek, English
Location : Greece

http://helpgr.forumgreek.com/forum

Back to top Go down

Re: Mini avatars in boarding index

Post by Pizza Boi on February 26th 2014, 8:39 am

Hi Very Happy

Did you try saving the Javascript and then using the link in it as the script src?

Like:

Code:
<script src="LINK FROM THE JAVASCRIPT MANAGEMENT"></script>

Regards,
Pizza Boi
avatar
Pizza Boi
Hyperactive

Male Posts : 2016
Reputation : 160
Language : French
Location : Pizza Hut!

http://redlustempire.forumtl.com/

Back to top Go down

Re: Mini avatars in boarding index

Post by Luffy on February 26th 2014, 1:50 pm

The problem is not the script.

The problem is that i changed the entire column plan from the default and now i am confused to what i am supposed to change in the javascript..





avatar
Luffy
Manager
Manager

Male Posts : 4672
Reputation : 471
Language : Greek, English
Location : Greece

http://helpgr.forumgreek.com/forum

Back to top Go down

Re: Mini avatars in boarding index

Post by Pizza Boi on February 26th 2014, 2:57 pm

Hi Very Happy

I'm not an expert in Javascript but when I read the code, I noticed that most lines composed of topic parts.

Try using the available ID's instead and if it doesn't work, I can't help you further due to my lack of experience :/. Sorry.

Regards,
Pizza Boi
avatar
Pizza Boi
Hyperactive

Male Posts : 2016
Reputation : 160
Language : French
Location : Pizza Hut!

http://redlustempire.forumtl.com/

Back to top Go down

Re: Mini avatars in boarding index

Post by Luffy on February 26th 2014, 5:17 pm

SOLVED!!
avatar
Luffy
Manager
Manager

Male Posts : 4672
Reputation : 471
Language : Greek, English
Location : Greece

http://helpgr.forumgreek.com/forum

Back to top Go down

View previous topic View next topic Back to top


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