(href)
| 9525 | var inUpdate = false; |
| 9526 | var importHandler, configCon; |
| 9527 | function initConfig(href) { |
| 9528 | if (location.hostname === "github.com") { |
| 9529 | if (location.href.indexOf("https://github.com/hoothin/UserScripts/issues/new?labels=Pagetual&template=custom-rule-request.md&title=Request%20Pagetual%20support%20for%20") === 0) { |
| 9530 | let issue_body = document.getElementById("issue_body"); |
| 9531 | if (!issue_body) return true; |
| 9532 | issue_body.value = issue_body.value.replace("\n", "\n" + location.hash.slice(1) + "\n"); |
| 9533 | let starButton = document.createElement("a"); |
| 9534 | starButton.href = "https://github.com/hoothin/UserScripts#star"; |
| 9535 | starButton.className = "js-toggler-target rounded-left-2 btn-with-aria-count btn-sm btn"; |
| 9536 | setHTML(starButton, '<svg height="16" viewBox="0 0 16 16" version="1.1" width="16" class="octicon octicon-star d-inline-block mr-2"><path d="M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Zm0 2.445L6.615 5.5a.75.75 0 0 1-.564.41l-3.097.45 2.24 2.184a.75.75 0 0 1 .216.664l-.528 3.084 2.769-1.456a.75.75 0 0 1 .698 0l2.77 1.456-.53-3.084a.75.75 0 0 1 .216-.664l2.24-2.183-3.096-.45a.75.75 0 0 1-.564-.41L8 2.694Z"></path></svg><span class="d-inline">Star</span>'); |
| 9537 | starButton.style.float = "right"; |
| 9538 | document.querySelector(".Layout-main>h2").appendChild(starButton); |
| 9539 | return true; |
| 9540 | } else if (location.href === "https://github.com/hoothin/UserScripts#star") { |
| 9541 | let starButton = document.querySelector(".starring-container:not(.on)>.unstarred>form>button"); |
| 9542 | if (starButton) emuClick(starButton); |
| 9543 | return true; |
| 9544 | } |
| 9545 | } |
| 9546 | let isGuidePage = checkGuidePage(href); |
| 9547 | |
| 9548 | var click2import, importUrlPres; |
| 9549 | |
| 9550 | let inConfig = isGuidePage; |
| 9551 | if (!inConfig) { |
| 9552 | for (let i = 0; i < configPage.length; i++) { |
| 9553 | if (configPage[i] == location.href) { |
| 9554 | inConfig = true; |
| 9555 | break; |
| 9556 | } |
| 9557 | } |
| 9558 | } |
| 9559 | if (!isGuidePage) { |
| 9560 | if (location.hostname === "hoothin.github.io" || location.hostname === "pagetual.hoothin.com") isGuidePage = true; |
| 9561 | } |
| 9562 | configCon = document.getElementById("configCon"); |
| 9563 | if (configCon) { |
| 9564 | configCon.parentNode.removeChild(configCon); |
| 9565 | } |
| 9566 | if (ruleImportUrlReg.test(href) || inConfig) { |
| 9567 | let importing = false; |
| 9568 | if (!inUpdate && rulesData.uninited) { |
| 9569 | let showTimes = 0; |
| 9570 | let showFirstAlert = () => { |
| 9571 | if (inUpdate || importing || ++showTimes > 5) return; |
| 9572 | showTips(i18n("firstAlert"), configPage[0], 2000); |
| 9573 | setTimeout(() => { |
| 9574 | showFirstAlert(); |
| 9575 | }, 3000); |
| 9576 | }; |
| 9577 | showFirstAlert(); |
| 9578 | } |
| 9579 | let defaultOption = document.querySelector('#discussion_rating_4'); |
| 9580 | if (defaultOption) defaultOption.checked = true; |
| 9581 | let createImportBtn = (pre) => { |
| 9582 | let importBtn = document.createElement("button"); |
| 9583 | importBtn.id = "pagetualImport"; |
| 9584 | importBtn.innerText = i18n("import"); |
no test coverage detected