MCPcopy Index your code
hub / github.com/XIU2/UserScript / menu_disable

Function menu_disable

Autopage.user.js:2589–2620  ·  view source on GitHub ↗
(type)

Source from the content-addressed store, hash-verified

2587 }
2588 // 启用/禁用 (当前网站)
2589 function menu_disable(type) {
2590 switch(type) {
2591 case 'check':
2592 return check(); break;
2593 case 'add':
2594 add(); break;
2595 case 'del':
2596 del(); break;
2597 }
2598
2599 function check() { // 存在返回真,不存在返回假
2600 if (GM_getValue('menu_disable').indexOf(location.hostname) == -1) return false // 不存在返回假
2601 return true
2602 }
2603
2604 function add() {
2605 if (check()) return
2606 let list = GM_getValue('menu_disable'); // 读取网站列表
2607 list.push(location.hostname); // 追加网站域名
2608 GM_setValue('menu_disable', list); // 写入配置
2609 location.reload(); // 刷新网页
2610 }
2611
2612 function del() {
2613 if (!check()) return
2614 let list = GM_getValue('menu_disable'), // 读取网站列表
2615 index = list.indexOf(location.hostname);
2616 list.splice(index, 1); // 删除网站域名
2617 GM_setValue('menu_disable', list); // 写入配置
2618 location.reload(); // 刷新网页
2619 }
2620 }
2621 // 左键双击网页空白处暂停翻页
2622 function pausePageEvent() {
2623 if (!GM_getValue('menu_pause_page')) return

Callers 1

registerMenuCommandFunction · 0.70

Calls 3

checkFunction · 0.70
addFunction · 0.70
delFunction · 0.70

Tested by

no test coverage detected