diff --git a/POV Cam/injection.js b/POV Cam/injection.js index 1806e51..dbebcc5 100644 --- a/POV Cam/injection.js +++ b/POV Cam/injection.js @@ -31,11 +31,11 @@ function modifyPage() { // Auto-open pesterlog if (items.autoopenpesterlog == "yes") { - // First button is "Show Pesterlog", second "Hide Pesterlog" - // In Act 6 Act 5 Act 1 x2 combo, can have another pair of buttons var buttons = outerContainer.getElementsByTagName("button"); - for (var i = 0; i < buttons.length; i += 2) { - buttons[i].click(); + for (var i = 0; i < buttons.length; i++) { + if (buttons[i].innerText.toLowerCase().indexOf("show") != -1) { + buttons[i].click(); + } } } diff --git a/POV Cam/manifest.json b/POV Cam/manifest.json index 740d362..47e51ec 100644 --- a/POV Cam/manifest.json +++ b/POV Cam/manifest.json @@ -27,6 +27,8 @@ "content_scripts": [ { "matches": [ + "https://*.homestuck.com/story/*", + "http://*.mspaintadventures.com/*s=6&p=*", "http://*.mspaintadventures.com/DOTA/", "http://*.mspaintadventures.com/007395/", diff --git a/POV Cam/mspaintadventures-page-elements.js b/POV Cam/mspaintadventures-page-elements.js index 596eb36..2a32ad6 100644 --- a/POV Cam/mspaintadventures-page-elements.js +++ b/POV Cam/mspaintadventures-page-elements.js @@ -1,3 +1,5 @@ +isHomestuckDomain = document.location.hostname.indexOf("homestuck") != -1; + function getPageNo() { var pageNo; @@ -16,7 +18,11 @@ function getPageNo() { } else if (document.location.pathname == "/ACT7.html") { pageNo = 10027; } else { - pageNo = parseInt(document.location.search.slice(7)); + if (isHomestuckDomain) { + pageNo = parseInt(document.location.pathname.slice(7) || "1") + 1900; + } else { + pageNo = parseInt(document.location.search.slice(7)); + } } if ((pageNo > 7688) && (pageNo < 7826)) { @@ -38,7 +44,7 @@ function getOuterContainer(elem) { function getStandardNextPageLink() { // Try to find where to put the links - var linkContainer = document.querySelector("font > a[href*='?s=6&p=']").parentElement; + var linkContainer = document.querySelector("font > a[href*='?s=6&p='], a[href*='/story']").parentElement; if (linkContainer) { return linkContainer; @@ -71,7 +77,7 @@ function getStandardNextPageLink() { } function getStartOverLinkContainer() { - var SOLink = document.querySelector("a[href$='?s=6']"); + var SOLink = document.querySelector("a[href$='?s=6'], #o_start-over"); if (SOLink) { SOLink = SOLink.parentElement.parentElement; diff --git a/POV Cam/next-page-links.js b/POV Cam/next-page-links.js index 5ac61a5..e6a36c0 100644 --- a/POV Cam/next-page-links.js +++ b/POV Cam/next-page-links.js @@ -51,7 +51,7 @@ class DestinationLink { createLinkElement(caption) { var link = document.createElement("a"); - link.href = "/?s=6&p=" + zeroPad(this.pageNo); + link.href = isHomestuckDomain ? "/story/" + (this.pageNo - 1900) : "/?s=6&p=" + zeroPad(this.pageNo); link.hash = this.nextLinkIndex; link.title = caption; @@ -74,12 +74,14 @@ function createLink(linkData) { var link = destinationLink.createLinkElement(nextPageCaption); - if ((document.location.pathname == "/trickster.php") && (destinationLink.pageCaption.indexOf("==>") != -1)) { + var originalSucker = document.querySelector("img[src*='sucker']"); + + if (originalSucker && (destinationLink.pageCaption.indexOf("==>") != -1)) { // In trickster section, replace "==>" in page name with sucker image link.innerHTML = destinationLink.pageCaption.replace("==>", ""); var sucker = document.createElement("img"); - sucker.src = "http://mspaintadventures.com/images/trickster_sitegraphics/sucker.gif"; + sucker.src = originalSucker.src; sucker.style.backgroundColor = linkData.colour; sucker.style.boxShadow = "0px 0px 2px 2px " + linkData.colour;