您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
自用
当前为
// ==UserScript== // @name B站游戏wiki —— 烟雨江湖【支线任务标记】 // @namespace https://greasyfork.org/users/3128 // @version 0.1 // @description 自用 // @author You // @match https://wiki.biligame.com/yanyu/* // @require https://cdn.staticfile.org/jquery/2.1.4/jquery.min.js // @grant GM_setValue // @grant GM_getValue // @grant GM_addStyle // @grant GM_setClipboard // @grant GM_xmlhttpRequest // @grant unsafeWindow // @grant GM_notification // @grant GM_registerMenuCommand // @license MIT // ==/UserScript== (function() { 'use strict'; let u=unsafeWindow, webHost=location.host.toLowerCase(), webPath=location.pathname.toLowerCase(); let web={ } switch(webHost) { case 'wiki.biligame.com': if(webPath.search('%E7%AD%94%E9%A2%98%E8%BE%85%E5%8A%A9'.toLowerCase())>0){ let t=setInterval(function(e){ if($('.form-control.searcher-text').length>0) { $('.form-control.searcher-text').focus(function(){ console.log($(this).select()); $(this).select(); }); clearInterval(t); } }, 1000); } let wgPageName=u.RLCONF.wgPageName||u.mw.config.get('wgPageName'); if(!wgPageName) alert(`加载基础数据失败,请刷新页面。`); let GM_Config_Task=GM_getValue(wgPageName);//数据储存容器 if(!GM_Config_Task) if(localStorage[wgPageName]) { GM_Config_Task=JSON.parse(localStorage[wgPageName]); GM_setValue(wgPageName, GM_Config_Task); delete localStorage[wgPageName]; } else GM_Config_Task={}; GM_addStyle(`input[title="任务完成标记"]{width:80px;height80px}`); //$('h2>#Ø_支线任务').nextAll(); $('.toclevel-2').each(function(){ let this_toc=this; console.log(this); let taskTitle=$(this).find('.toctext').text(); let checkTask=$('<input type="checkbox" title="任务完成标记">').attr({id:`checkTask_${taskTitle}`}).click(function(e, aa){ GM_Config_Task[taskTitle]=this.checked; GM_setValue(wgPageName, GM_Config_Task); if(this.checked) $(this_toc).append('<span>√</span>'); else $(this_toc).find(':last-child').remove(); }); console.log($(`#`+taskTitle)); $(`#${taskTitle}`).before(checkTask); let label=$('<label>').attr({for:`checkTask_${taskTitle}`}).text(taskTitle); $(`#${taskTitle}`).parent().find('.mw-headline').html(label); if(GM_Config_Task[taskTitle]) { checkTask.prop('checked', GM_Config_Task[taskTitle]||false); $(this).append('√'); } }); break; default : GM_xmlhttpRequest({ url:'', method: 'get', onload: function(e){ console.log(e); }, onerror: function(e){ console.error('error', e); } }); } // Your code here... function getUrlParam(name, url, option, newVal) {//筛选参数,url 参数为数字时 var search = url ? url.replace(/^.+\?/,'') : location.search; //网址传递的参数提取,如果传入了url参数则使用传入的参数,否则使用当前页面的网址参数 var reg = new RegExp("(?:^|&)(" + name + ")=([^&]*)(?:&|$)", "i"); //正则筛选参数 var str = search.replace(/^\?/,'').match(reg); if (str !== null) { switch(option) { case 0: return unescape(str[0]); //所筛选的完整参数串 case 1: return unescape(str[1]); //所筛选的参数名 case 2: return unescape(str[2]); //所筛选的参数值 case 'new': return url.replace(str[1]+'='+str[2], str[1]+'='+newVal); default: return unescape(str[2]); //默认返回参数值 } } else { return null; } } })();