Plugin dos "Últimos visitantes"

3 participantes

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

Tópico resolvido Plugin dos "Últimos visitantes"

Mensagem por empireofwars 06.04.20 19:19

Detalhes da questão


Endereço do fórum: https://empireofwars.forumotion.com/
Versão do fórum: PunBB

Descrição


Alguém me consegue ajudar e passar o código deste sistema abaixo?

https://ajuda.forumeiros.com/t98384-plugin-ultimos-visitantes-no-perfil
empireofwars

empireofwars
***

Membro desde : 16/03/2020
Mensagens : 115
Pontos : 161

https://empireofwars.forumotion.com/

Ir para o topo Ir para baixo

Admineiro

Tópico resolvido Re: Plugin dos "Últimos visitantes"

Mensagem por tikky 06.04.20 23:35

Olá @empireofwars,

Após seguir as etapas apresentadas do tópico citado por si, use o seguinte código:
Código:
/***
 * Application: LatestVisitors.js
 * Description: Shows the last 10 visitors to your profile!
 * Version: 0.02282015-jq1.9.1
 *        RC1 (Release candidate 1!) - Tot (Imhotep-hwcp)
 * Author: JScript - 2015/02/28
 * 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
 */
var lastVisit = {
  autor: "JScript",
  version: "1.02282015-jq1.9.1",
  codename: "Tot (Imhotep-hwcp)",
 
  observe: 100,
  startMsg: "Starting, wait...",
  noVisitors: "There are no visitors, your visit will appear in the next update!",
 
  initialize: function() {
      if (location.pathname.indexOf("/u") == -1) {
        return false;
      }
      var wrapper = setInterval(function() {
        if (typeof(_userdata) !== "undefined") {
            clearInterval(wrapper);
            if (_userdata.user_level == 0) {
              $('a[href*="wall"]:first').parent().hide();
            }
            if ((location.pathname.indexOf('wall') !== -1) && (_userdata.user_level !== 1)) {
              return location.pathname = location.pathname.split('wall')[0];
            }
            jQuery(function() {
              lastVisit.view();
            });
        }
      }, lastVisit.observe);
  },
 
  dataRead: function() {
      $.ajax({
        url: location.pathname + 'wall',
        cache: false,
        type: "get",
        dataType: "text",
        success: function(response, status, xhr) {
            if (xhr.status == 200) {
              var oTarget = $('#profile-advanced-details ol > li', response),
                  content = '<ol style="margin-top: 0px; margin-bottom: 0px;">',
                  oThis = null,
                  oID = null,
                  iFound = 0;
 
              if (oTarget.length) {
                  for (i = 0, len = oTarget.length; i < len; i++) {
                    oThis = $(oTarget[i]);
                    content += '<li class="clearfix">' + oThis.html() + '</i>'; //.prop('outerHTML');
                    oID = oThis.find('.message-header a');
                    if (oID.attr('href') == ("/u" + _userdata.user_id)) {
                        iFound = 1;
                       
                    }
                  }
                  $("#lastvisit").html(content + '</ol>');
                  if (_userdata.user_level > 0) {
                    $('#lastvisit .message-footer').show();
                  }
                  $('#lastvisit .message-text').remove();
              } else {
                  $("#lastvisit").html('<br>' + lastVisit.noVisitors);
              }
 
              var user_id = Number(location.pathname.split('u')[1]);
 
              if ((user_id !== _userdata.user_id) && (!iFound)) {
                  $.get('/privmsg?mode=post_profile&u=' + user_id, function(data) {
                    $.post("/privmsg", {
                        mode: "post_profile",
                        folder: "profile",
                        username: $('input[name="username"]', data).val(),
                        subject: "last_visit",
                        message: "last_visit",
                        lt: "",
                        post: 1,
                    }, function(e) {
                        // OK!
                    });
                  });
              }
            }
        }
      });
  },
 
  view: function() {
      var style = document.createElement("style");
 
      style.type = "text/css";
      style.innerHTML =
        '#lastvisit ol {\n' +
        '  padding-left: 0;\n' +
        '}\n' +
        '#lastvisit li {\n' +
        '  border-bottom: 1px solid #d5dde5;\n' +
        '  margin-bottom: 4px;\n' +
        '  list-style: none;\n' +
        '}\n' +
        '#lastvisit .avatar {\n' +
        '  max-width: 30px;\n' +
        '  max-height: 30px;\n' +
        '  float: left;\n' +
        '  margin-right: 6px;\n' +
        '}\n' +
        '#lastvisit .avatar img {\n' +
        '  height: 30px !important;\n' +
        '  width: 30px !important;\n' +
        '}\n' +
        '#lastvisit .message-block {\n' +
        '  margin-bottom: 4px;\n' +
        '}\n' +
        '#lastvisit .message-date {\n' +
        '  float: right;\n' +
        '}\n' +
        '#lastvisit .message-text {\n' +
        '  display: none;\n' +
        '}\n' +
        '#lastvisit .message-header > img, #lastvisit .message-header > em  {\n' +
        '  display: none;\n' +
        '}\n' +
        '#lastvisit .message-header {\n' +
        '  color: transparent;\n' +
        '  padding: 2px;\n' +
        '}\n' +
        '#lastvisit .message-header > a {\n' +
        '  float: left;\n' +
        '}\n' +
        '#lastvisit .message-footer {\n' +
        '  display: none;\n' +
        '  float: right;\n' +
        '}\n' +
        '#lastvisit .message-text {\n' +
        '  display: none;\n' +
        '}\n' +
        '#lastvisit .message-date {\n' +
        '  color: #333333;\n' +
        '  float: right;\n' +
        '}\n' +
        '#lastvisit .message-footer li:not(.last) {\n' +
        '  display: none;\n' +
        '}\n' +
        '#lastvisit .message-footer a {\n' +
        '  color: #cdcdcd;\n' +
        '  text-decoration: none;\n' +
        '}\n' +
        '#lastvisit li.last {\n' +
        '  border-bottom: none;\n' +
        '}\n' +
        '#lastvisit {\n' +
        '  left: 0;\n' +
        '  right: 0;\n' +
        '}\n' +
        '#lastvisit div.clearfix {\n' +
        '  display: none;\n' +
        '}\n';
      document.getElementsByTagName("head")[0].appendChild(style);
 
      var forumline = "forumline";
      if ($('#phpbb').length) {
        forumline = "phpbb3"
      }
      $('table[cellpadding="1"] > tbody > tr:last > td:last > .forumline:first, #profile-advanced-right .module:first').after(
        '<!-- All-in-one: phpbb2, phpbb3, punbb & invision! -->\n' +
        '<div style="margin-bottom:4px;" class="module main borderwrap">\n' +
        '  <table width="100%" cellspacing="1" cellpadding="0" border="0" class="' + forumline + '">\n' +
        '      <tbody>\n' +
        '        <tr>\n' +
        '            <td class="catLeft">\n' +
        '              <div class="inner main-head maintitle genmed module-title">\n' +
        '                  <div class="h3">\n' +
        '                    <h3 style="border-bottom: 0px none; padding-bottom: 0px; margin-bottom: 0px; margin-top: 0px;">\n' +
        '                        <strong>Latest Visitors</strong>\n' +
        '                    </h3>\n' +
        '                  </div>\n' +
        '              </div>\n' +
        '            </td>\n' +
        '        </tr>\n' +
        '        <tr>\n' +
        '            <td align="center" class="row1 gensmall">\n' +
        '              <div class="inner main-head main-content clearfix box-content profile center" style="min-height: 50px;">\n' +
        '                  <span class="corners-top"><span></span></span>\n' +
        '                  <div id="lastvisit">' + lastVisit.startMsg + '</div>\n' +
        '                  <span class="corners-bottom"><span></span></span>\n' +
        '              </div>\n' +
        '            </td>\n' +
        '        </tr>\n' +
        '      </tbody>\n' +
        '  </table>\n' +
        '</div>\n'
      );
 
      lastVisit.dataRead();
  }
};
 
lastVisit.initialize();


Atenciosamente,
pedxz.
tikky

tikky
Admineiro
Admineiro

Membro desde : 13/01/2017
Mensagens : 7816
Pontos : 9062

Ir para o topo Ir para baixo

Tópico resolvido Re: Plugin dos "Últimos visitantes"

Mensagem por empireofwars 08.04.20 1:09

obrigado, funcionou
empireofwars

empireofwars
***

Membro desde : 16/03/2020
Mensagens : 115
Pontos : 161

https://empireofwars.forumotion.com/

Ir para o topo Ir para baixo

Ajudeiro

Tópico resolvido Re: Plugin dos "Últimos visitantes"

Mensagem por Sleep 10.04.20 3:33

Tópico resolvido


Movido para "Questões resolvidas".
Sleep

Sleep
Ajudeiro
Ajudeiro

Membro desde : 10/08/2012
Mensagens : 1104
Pontos : 1338

https://ajuda.forumeiros.com/

Ir para o topo Ir para baixo

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


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