| 907 | |
| 908 | // 更新规则 |
| 909 | ruleUpdate(key) { |
| 910 | let newInfo = document.querySelector(`textarea[info_key=${key}]`).value |
| 911 | let newWords = (document.querySelector(`textarea[words_key=${key}]`).value.split(' ')) |
| 912 | let newLimit = (document.querySelector(`textarea[limit_key=${key}]`).value.split(' ')) |
| 913 | |
| 914 | // 去除空格 |
| 915 | newWords = Array.from(new Set(newWords)) |
| 916 | .filter(word => { return word != ' ' & word.length > 0 }) |
| 917 | newLimit = Array.from(new Set(newLimit)) |
| 918 | .filter(word => { return word != ' ' & word.length > 0 }) |
| 919 | // console.log(newInfo,newWords); |
| 920 | this.rule[key].info = newInfo |
| 921 | this.rule[key].words = newWords |
| 922 | this.rule[key].limit = newLimit |
| 923 | |
| 924 | this.editOff(key) |
| 925 | |
| 926 | // 保存到油猴中 |
| 927 | GM_setValue('key', this.rule) |
| 928 | }, |
| 929 | |
| 930 | // 添加新规则 |
| 931 | add_key() { |