(url)
| 12062 | |
| 12063 | const pageNumReg=/[&\/\?](p=|page[=\/_-]?)\d+|[_-]\d+\./; |
| 12064 | function createPageBar(url) { |
| 12065 | curPage++; |
| 12066 | sideController.setup(); |
| 12067 | let posEle = null; |
| 12068 | let scrollH = Math.max(document.documentElement.scrollHeight, getBody(document).scrollHeight); |
| 12069 | let insert = ruleParser.getInsert(); |
| 12070 | if (!insert || !insert.parentNode) return; |
| 12071 | if (forceState == 2) { |
| 12072 | posEle = getBody(document); |
| 12073 | posEle = posEle.children[posEle.children.length - 1]; |
| 12074 | } else { |
| 12075 | posEle = insert; |
| 12076 | } |
| 12077 | while (posEle && !posEle.offsetParent) { |
| 12078 | posEle = posEle.previousElementSibling || posEle.parentNode; |
| 12079 | } |
| 12080 | if (posEle) { |
| 12081 | let actualBottom = getElementBottom(posEle); |
| 12082 | bottomGap = scrollH - actualBottom + (window.innerHeight || document.documentElement.clientHeight) * rate; |
| 12083 | if (bottomGap < 100) bottomGap = 100; |
| 12084 | } else { |
| 12085 | bottomGap = 1000; |
| 12086 | } |
| 12087 | if (hidePageBar) return null; |
| 12088 | url = url.replace(/#p{.*/, ""); |
| 12089 | let example = (ruleParser.curSiteRule.insertPos == 2 || ruleParser.curSiteRule.insertPos == "in") ? insert.children[0] : (insert.parentNode.children[0] || insert); |
| 12090 | while (example && (compareNodeName(example, ["script", "style"]) || example.classList.contains("pagetual_pageBar"))) { |
| 12091 | example = example.nextElementSibling; |
| 12092 | } |
| 12093 | if (!example || !example.parentNode) example = insert; |
| 12094 | if (example.nodeType != 1) { |
| 12095 | example = example.previousElementSibling || example.parentNode; |
| 12096 | if (!example || example.nodeType != 1) return; |
| 12097 | } |
| 12098 | let exampleStyle = _unsafeWindow.getComputedStyle(example); |
| 12099 | let inTable, inLi; |
| 12100 | if (forceState == 2) { |
| 12101 | inTable = inLi = false; |
| 12102 | } else { |
| 12103 | inTable = compareNodeName(example.parentNode, ["table", "tbody"]) || |
| 12104 | compareNodeName(example, ["tr", "tbody"]) || |
| 12105 | exampleStyle.display == "table-row" || |
| 12106 | (example.nextElementSibling && compareNodeName(example.nextElementSibling, ["tr", "tbody"])); |
| 12107 | inLi = compareNodeName(example, ["li"]) || (example.nextElementSibling && compareNodeName(example.nextElementSibling, ["li"])); |
| 12108 | } |
| 12109 | let pageBar = document.createElement(inTable ? "tr" : (inLi ? "li" : "div")); |
| 12110 | let upSpan = document.createElement("a"); |
| 12111 | let downSpan = document.createElement("a"); |
| 12112 | let pageText = document.createElement("a"); |
| 12113 | let pageNum; |
| 12114 | pageBar.className = isHideBar ? "pagetual_pageBar autopagerize_page_info hide" : "pagetual_pageBar autopagerize_page_info"; |
| 12115 | pageBar.setAttribute("translate", "no"); |
| 12116 | if (isPause) { |
| 12117 | pageBar.classList.add("stop"); |
| 12118 | } |
| 12119 | pageBar.style.cssText = pageBarStyle; |
| 12120 | if (exampleStyle.order) { |
| 12121 | pageBar.style.order = exampleStyle.order; |
no test coverage detected