[WorldWideTorrents.eu] Shoutbox User Info

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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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();
	});
})();