[Tutorial] Avatar em todos os widgets "top" e em "membros mais ativos"

Ver o tópico anterior Ver o tópico seguinte Ir para baixo

Admin
Admin
Administrador
Tempo Online : 250d 6h 21m 59s
Mensagens : 693
Reputação : 4
https://bestweb.forumeiro.com

MensagemAdmin Qui Set 29, 2016 5:15 pm

Informações:

Autor: JScript
Versões: Todas as versões
Introdução: Avatar em todos os widgets "top" e em "membros mais ativos"

Instalação:

Acesse:
Painel de controle ->> Modulos ->> HTML & Javascripts ->> Gestão dos códigos Javascripts
Então crie um novo javascript com investimento em todas as paginas com esse código:
Código:

/****
 * 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);
               }
            });
         }
      }
   });
});

Resultado:
[Tutorial]  Avatar em todos os widgets "top" e em "membros mais ativos" Captur18

Ver o tópico anterior Ver o tópico seguinte Ir para o topo

Cria uma conta ou logue para postar uma mensagem.

Você precisa ser um membro, para poder postar uma resposta.

Criar conta

Participe de nossa comunidade, basta se registrar. É Fácil!


Criar uma conta

Logar

Já tem uma conta? Sem problemas, Logue agora.


Logar-se

 
Permissões neste sub-fórum
Não podes responder a tópicos