[WorldWideTorrents.eu] Shoutbox User Info

Adds a hover-based info popup for users in the Shoutbox

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         [WorldWideTorrents.eu] Shoutbox User Info
// @namespace    pxgamer
// @version      0.1.1
// @description  Adds a hover-based info popup for users in the Shoutbox
// @author       pxgamer
// @include      *worldwidetorrents.eu/index.php
// @include      *worldwidetorrents.eu/
// @include      *worldwidetorrents.eu/shoutbox.php*
// @require      https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @grant        none
// ==/UserScript==
/*jshint multistr: true */

(function() {
	'use strict';
	let userId = '';
	let info = null;
	$('body').append('<div class="info_popup" style="display: none; position: fixed; border-radius: 5px 0px 0px 0px; bottom: 0px; right: 0px; width: 200px; height: 100px; background: black; color: white; padding: 5px;"><div><b class="username" style="color: aqua;"></b></div><div><ul><li class="reputation"></li><li class="forumposts"></li><li class="comments"><li class="joindate"></li><li class="class"></li></ul></div></div>');
	$('a[data-userid]').hover(function() {
		userId = $(this).data('userid');
		$.ajax({
			type: "GET",
			url: "/api/user/?id="+userId,
			async: false,
			success: function (data) {
				info = data;
			},
			returnData: "json"
		});
		$('.info_popup div .username').text(info.username);
		$('.info_popup div .username').text(info.username);
		$('.info_popup div .reputation').text('Rep: ' + info.reputation);
		$('.info_popup div .joindate').text('Joined: ' + info.added);
		$('.info_popup div .forumposts').text('Forum Posts: ' + info.forum_posts);
		$('.info_popup div .comments').text('Comments: ' + info.comments);
		$('.info_popup div .class').text('Class: ' + info.class);
		$('.info_popup').show();
	}, function() {
		$('.info_popup').hide();
	});
})();