Skip to content

Commit

Permalink
Merge branch 'homestuck-domain'
Browse files Browse the repository at this point in the history
  • Loading branch information
madman-bob committed Apr 14, 2018
2 parents 3ce10a7 + 31c90e0 commit cb471f1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
8 changes: 4 additions & 4 deletions POV Cam/injection.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions POV Cam/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/",
Expand Down
12 changes: 9 additions & 3 deletions POV Cam/mspaintadventures-page-elements.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
isHomestuckDomain = document.location.hostname.indexOf("homestuck") != -1;

function getPageNo() {
var pageNo;

Expand All @@ -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)) {
Expand All @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
8 changes: 5 additions & 3 deletions POV Cam/next-page-links.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;

Expand Down

0 comments on commit cb471f1

Please sign in to comment.