// ==UserScript== // @name NGA优化摸鱼体验 // @namespace http://tampermonkey.net/ // @version 1.0 // @require https://cdn.staticfile.org/jquery/3.4.0/jquery.min.js // @description NGA论坛隐藏切换显示头像,表情,图片等,防止突然蹦出一对??而导致的突然性的社会死亡 // @author HLD // @match *bbs.nga.cn/* // @match *ngabbs.com/* // @downloadURL none // ==/UserScript== (function() { 'use strict'; /////////////////////////////////////////////////////// /* 显示设置 ON: 显示 OFF: 隐藏 [ ]内的为切换按键 */ //头像[Q] const AVATAR = 'OFF' //表情[W] const SMILE = 'OFF' //图片[E] const IMAGE = 'ON' /////////////////////////////////////////////////////// /////////////////////////////////////////////////////// /////////////////////////////////////////////////////// //注册按键 $('body').keyup(function(event){ if (/textarea|select|input/i.test(event.target.nodeName) || /text|password|number|email|url|range|date|month/i.test(event.target.type)) { return; } //切换显示头像 if(event.keyCode == 81){ $('.avatar').toggle() } //切换显示表情 if(event.keyCode == 87){ $('img').each(function(){ const classs = $(this).attr('class'); if(classs && classs.indexOf('smile') > -1) $(this).toggle() }) $('.smile_alt_text').toggle() } //切换显示图片 if(event.keyCode == 69){ $('.postcontent img').each(function(){ const classs = $(this).attr('class'); if(!classs && $(this).width() > 24) { if($(this).is(":hidden")) { $(this).show() $('.switch-img').hide() }else { $('.switch-img').css('display', 'inline') $(this).hide() } } }) } }) //动态监听 setInterval(()=>{ $('.forumbox.postbox[hld-render!=ok]').length > 0 && runDom() }, 100) const resizeImg = (url) => { if($('#img_full').length > 0) return let $imgBox = $('
') $imgBox.click(function(){ $(this).remove() }) $imgBox.css({ 'position': 'fixed', 'top': '0', 'left': '0', 'right': '0', 'bottom': '0', 'background': 'rgba(0, 0, 0, 0.6)', 'z-index': '99999', 'display': 'flex', 'align-items': 'center', 'justify-content': 'center' }) let $img = $('