forked from madman-bob/Homestuck-POV-Cam
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor pre-retcon image viewing code into separate directory
- Loading branch information
1 parent
a83f562
commit d1dadd3
Showing
4 changed files
with
47 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
div.retcon-container { | ||
display: inline-block; | ||
position: relative; | ||
} | ||
|
||
img.pre-retcon { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
transition: opacity 0.3s; | ||
} | ||
|
||
img.pre-retcon:hover { | ||
opacity: 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
Some pages have been retro-actively modified by the author | ||
This utility allows you to switch back and forth between the pre and post retcon images | ||
*/ | ||
|
||
function createPreRetconImage(postRetconImage) { | ||
var preRetconImage = document.createElement("img"); | ||
|
||
preRetconImage.src = postRetconImage.src.replace("_retcon", "").replace("retcon", ""); | ||
preRetconImage.className = "pre-retcon"; | ||
|
||
return preRetconImage; | ||
} | ||
|
||
function overlayPreRetconImage(postRetconImage) { | ||
var doubleImageContainer = document.createElement("div"); | ||
doubleImageContainer.className = "retcon-container"; | ||
|
||
postRetconImage.parentElement.insertBefore(doubleImageContainer, postRetconImage); | ||
|
||
doubleImageContainer.appendChild(postRetconImage); | ||
doubleImageContainer.appendChild(createPreRetconImage(postRetconImage)); | ||
} |