| 28627 | } |
| 28628 | |
| 28629 | function openPrefs() { |
| 28630 | if (window.top != window.self) return; |
| 28631 | let fieldsSearchData = GM_config.fields["gallery.searchData"]; |
| 28632 | if (fieldsSearchData && fieldsSearchData.value) { |
| 28633 | fieldsSearchData.value = fieldsSearchData.value.replace(/&/g, "&").replace(/>/g, ">").replace(/</g, "<").replace(/&/g, "&").replace(/>/g, ">").replace(/</g, "<"); |
| 28634 | } |
| 28635 | let fieldsCustomRules = GM_config.fields.customRules; |
| 28636 | if (fieldsCustomRules && fieldsCustomRules.value) { |
| 28637 | fieldsCustomRules.value = fieldsCustomRules.value.replace(/&/g, "&").replace(/>/g, ">").replace(/</g, "<").replace(/&/g, "&").replace(/>/g, ">").replace(/</g, "<"); |
| 28638 | } |
| 28639 | document.head.appendChild(configStyle); |
| 28640 | GM_config.open(); |
| 28641 | document.documentElement.appendChild(GM_config.frame); |
| 28642 | |
| 28643 | setTimeout(()=>{ |
| 28644 | if (GM_config.frame && GM_config.frame.contentDocument.body.innerHTML === "") { |
| 28645 | _GM_openInTab("https://pv.hoothin.com/open-settings", {active:true}); |
| 28646 | return; |
| 28647 | } |
| 28648 | if (GM_config.frame && GM_config.frame.style && GM_config.frame.style.display == "none") { |
| 28649 | GM_config.frame.src=""; |
| 28650 | } |
| 28651 | initKeyInputs(); |
| 28652 | }, 1000); |
| 28653 | } |
| 28654 | |
| 28655 | function loadPrefs() { |
| 28656 | // 根据 GM_config 的 key 载入设置到 prefs |