您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
uid转用户名
当前为
- // ==UserScript==
- // @name NGA_parse_uid
- // @version 0.17
- // @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 https://greasyfork.org/users/163468
- // @description uid转用户名
- // ==/UserScript==
- let pattern = 'nuke.php?func=ucp&uid=';
- $('a[href*="' + pattern + '"]').each((i, v) => {
- let uid = v.href.split(pattern)[1];
- $.post('/nuke.php?uid=' + uid + '&__output=12&__act=get&__lib=ucp', res => {
- //uid to username
- let username = res.result.username;
- v.innerText = username;
- //add avatar
- let avatarDiv = $(v).parent().next();
- let avatar = res.result.avatar;
- if (avatar && (avatarDiv[0].className === 'stat')) {
- if (avatar.indexOf("{") < 0) {
- if (avatar.indexOf("http") < 0 || avatar.indexOf("bbs") >= 0) {
- let file = avatar.match(/[0-9].*/);
- let hex = parseInt(avatar.match(/[0-9]+/)[0]).toString(16);
- avatar = "http://img.ngacn.cc/avatars/2002/";
- while (hex.length < 9) {
- hex = '0' + hex;
- }
- hex = hex.match(/.{1,3}/g);
- for (let i = hex.length - 1; i >= 0; i--) {
- avatar = avatar + hex[i] + '/';
- }
- avatar += file;
- }
- } else {
- avatar = JSON.parse(avatar);
- avatar = avatar[parseInt(Math.random() * avatar.l) + ""];
- }
- avatarDiv.before('<img style="max-width: 280px; margin: 5px auto; border-radius: 50%;" src="' + avatar + '">');
- }
- });
- });
- $('a[href="被禁止的链接"]').each((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);
- }
- });
- //以下代码禁用了相关论坛代码,用于消除启用Tampermonkey脚本时发生的错误(大概不会有什么影响(不是我的锅,在nga上启用任何Tampermonkey脚本都会报错
- commonui.quoteTo.hideWindow = function(){};
- commonui.quoteTo.onmouseup = function(){};