Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /***
- * 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: "<p class=\"ipsPad desc\">Starting, wait...</p>",
- noVisitors: "<p class=\"ipsPad desc\">No latest visitors to show</p>",
- 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 = '<ul class="ipsList_withminiphoto ipsPad" style="padding: 0;">',
- 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"><div class="list_content">' + oThis.html() + '</div></li>';
- oID = oThis.find('.message-header a');
- if (oID.attr('href') == ("/u" + _userdata.user_id)) {
- iFound = 1;
- }
- }
- $("#lastvisit").html(content + '</ul>');
- if (_userdata.user_level > 0) {
- $('#lastvisit .message-footer').show();
- }
- $('#lastvisit .message-text').remove();
- $('.ipsPad li.clearfix .list_content').each(function() {
- var i = this;
- var user_id = $('.avatar a', i).attr('href').match(/\d+/g)[0];
- var user_avatar = $('.avatar a img', i).attr('src');
- var visit_date = $('.message-date', i).text();
- var user_guest = $('.message-header a', i).text();
- $(i).before('<a href="http://www.bitcoding.tk/u'+ user_id +'" title="View Profile" class="ipsUserPhotoLink left"><img src="'+ user_avatar +'" alt="Photo" class="ipsUserPhoto ipsUserPhoto_mini" /></a>');
- $(i).html('<a hovercard-ref="member" hovercard-id="'+ user_id +'" data-ipb="noparse" class="url fn name ___hover___member _hoversetup" href="http://www.bitcoding.tk/u'+ user_id +'" title="" id="anonymous_element_1"><span itemprop="name">'+ user_guest +'</span></a><br /><span class="desc lighter">'+ visit_date +'</span>');
- });
- } else {
- $("#lastvisit").html(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 forumline = "forumline";
- if ($('#phpbb').length) {
- forumline = "phpbb3"
- }
- $('table[cellpadding="1"] > tbody > tr:last > td:last > .forumline:first, #profile-advanced-right .module:first').after(
- '<div class="general_box clearfix">'+
- '<h3>Latest Visitors</h3>'+
- '<div id="lastvisit">'+ lastVisit.startMsg +'</div>' +
- '</div>'
- );
- lastVisit.dataRead();
- }
- };
- lastVisit.initialize();
- $(function() {
- window.onload = function() {
- if($('div#profile_content').length > 0 && $('div#profile-advanced-right .general_box.clearfix').length > 0) {
- if($('#user_status_cell').length > 0 && ($('span.status_length').text() === "No status" || $('span.status_length').text() === " -")) {
- $('#user_status_cell').remove();
- }
- $('div#profile_content .ipsLayout_right .general_box.clearfix:eq(2)').replaceWith($('div#profile-advanced-right .general_box.clearfix'));
- var x = $('div#profile_content .ipsLayout_right .general_box.clearfix:eq(2)');
- $('.ipsPad li.clearfix .list_content', x).each(function() {
- var i = this;
- var user_id = $('.avatar a', i).attr('href').match(/\d+/g)[0];
- var user_avatar = $('.avatar a img', i).attr('src');
- var visit_date = $('.message-date', i).text();
- var user_guest = $('.message-header a', i).text();
- $(i).before('<a href="/u'+ user_id +'" title="View Profile" class="ipsUserPhotoLink left"><img src="'+ user_avatar +'" alt="Photo" class="ipsUserPhoto ipsUserPhoto_mini" /></a>');
- $(i).html('<a hovercard-ref="member" hovercard-id="'+ user_id +'" data-ipb="noparse" class="url fn name ___hover___member _hoversetup" href="/u'+ user_id +'" title="" id="anonymous_element_1"><span itemprop="name">'+ user_guest +'</span></a><br /><span class="desc lighter">'+ visit_date +'</span>');
- });
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement