// ==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
// @downloadURL none
// ==/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=$('').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('√');
else $(this_toc).find(':last-child').remove();
});
console.log($(`#`+taskTitle));
$(`#${taskTitle}`).before(checkTask);
let label=$('