(type)
| 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 |
no test coverage detected