The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Avatar in: Top posters, all Top posting and Most active topic starters Widget

2 posters

Go down

Avatar in: Top posters, all Top posting and Most active topic starters Widget Empty Avatar in: Top posters, all Top posting and Most active topic starters Widget

Post by JScript July 2nd 2015, 7:33 pm

/****
* Application: Avatar in: Top posters, Top posting users this week, Top posting users this month and Most active topic starters Widget!
* Description: This application displays the members avatar in all widget of topic.
* Version: 1.07022015-jq1.9.1 - Meni
* Made and Optimizations by JScript - 2015/07/02
**/

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: Top posters, Top posting users this week, Top posting users this month and Most active topic starters Widget!
 * Description: This application displays the members avatar in all widget of topic.
 * Version: 1.07022015-jq1.9.1 - Meni
 * Made and Optimizations by JScript - 2015/07/02
 * Copyright (c) 2015 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: Top posters, Top posting users this week, Top posting users this month and Most active topic starters Widget!' +
         '* Description: This application displays the members avatar in all widget of topic.' +
         '* Version: 1.07022015-jq1.9.1 - Meni' +
         '* Made and Optimizations by JScript - 2015/07/02' +
         '* Copyright (c) 2015 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' +
         '-->',
      sDefaultAvatar: 'http://i78.servimg.com/u/f78/18/17/62/92/defaul10.png',
      sCSS: '<style>' +
         '.jsUserPhoto.topWidget {' +
         'float: left;' +
         'margin-top: 3px;' +
         'margin-right: 3px;' +
         '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;' +
         '}' +
         '.topWidget .jsUserPhoto_mini {' +
         'height: 16px !important;' +
         'width: 16px !important;' +
         '}' +
         '</style>'
   };

   // Add CSS
   jQuery(oConfig.sCSS).insertBefore('body');

   // Show member avatar in Recent Topics Widget!
  var oTarget = $('#right, #left').find('td.genmed, div.module td, div.module.main .main-content td').find('a[href^="/u"]'),
      iLen = oTarget.length,
      index = 0,
      td = oTarget.parent();

   td.css('width', td.width() + 24);

   oTarget.prepend('<a class="jsUserPhoto topWidget" href="#" title="No avatar!"><img class="jsUserPhoto_mini" src="' + oConfig.sDefaultAvatar + '" alt="" /></a>');

   oTarget.each(function () {
      var oThis = $(this),
         container = oThis.find('.jsUserPhoto_mini'),
         storIMG = '',
         userUrl = '';

      if (oThis.length) {
         userUrl = oThis.attr('href');
         oThis.find('a.jsUserPhoto.topWidget').attr('href', userUrl).attr('title', oThis.text());

         storIMG = sessionStorage.getItem('_top_' + 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('_top_' + userUrl, storIMG);
               }
            });
         }
      }
   });
});

Result:
Avatar in: Top posters, all Top posting and Most active topic starters Widget Captur16

Here in the forum:
Avatar in: Top posters, all Top posting and Most active topic starters Widget Captur17

Any suggestions for improvement?

JS
JScript
JScript
Forumember

Male Posts : 741
Reputation : 175
Language : PT-BR, EN
Location : Brazil

http://jscript.forumeiros.com/

Back to top Go down

Avatar in: Top posters, all Top posting and Most active topic starters Widget Empty Re: Avatar in: Top posters, all Top posting and Most active topic starters Widget

Post by SLGray February 23rd 2017, 8:06 am

This will no longer be supported by JScript: https://help.forumotion.com/t151137-in-memory-of-jscript-joao-carlos.


Avatar in: Top posters, all Top posting and Most active topic starters Widget Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51501
Reputation : 3519
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Back to top

- Similar topics

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