Greasy Fork is available in English.
uid转用户名
当前为
// ==UserScript==
// @name NGA_parse_uid
// @version 0.16
// @author Inazuma
// @match https://nga.178.com/*
// @match https://bbs.ngacn.cc/*
// @match https://bbs.nga.cn/*
// @match http://nga.178.com/*
// @match http://bbs.nga.cn/*
// @match http://bbs.ngacn.cc/*
// @require http://ajax.aspnetcdn.com/ajax/jquery/jquery-2.1.3.min.js
// @grant none
// @namespace http://greasyfork.icu/users/163468
// @description uid转用户名
// ==/UserScript==
let pattern = 'nuke.php?func=ucp&uid=';
$('a[href*="' + pattern + '"]').each(
function(i, v){
let uid = v.href.split(pattern)[1];
$.post('/nuke.php?uid=' + uid + '&__output=12&__act=get&__lib=ucp', function(res) {
v.innerText = res.result.username;
});
}
);
$('a[href="被禁止的链接"]').each(
function(i, v){
let link;
if (v.parentNode.className !== 'nobr') {
link = v.previousElementSibling.firstChild.innerText.replace(/<[^>]+>/g, '');
v.setAttribute('href', link);
v.innerText = v.innerText.replace(/被禁止的链接/g, link);
} else {
link = v.parentNode.parentNode.firstChild.innerText.replace(/<[^>]+>/g, '');
v.setAttribute('href', link);
}
}
);