-
-
Save badboy/892420 to your computer and use it in GitHub Desktop.
dotjs for adding the title text of XKCD comics on the page [no-jquery version, far more verbose, but it works]
This file contains hidden or 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
| var comic = document.querySelector("div.s img[title]"); | |
| var titleP = document.createElement("p"); | |
| titleP.style.fontVariant = "normal"; | |
| titleP.style.border = "1px solid yellow"; | |
| titleP.style.padding = "1em"; | |
| titleP.style.backgroundColor = "#FFFFCC"; | |
| titleP.innerText = comic.title; | |
| comic.insertAdjacentElement("afterEnd", titleP); |
This file contains hidden or 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
| // ==UserScript== | |
| // @name XKCD title-text addition | |
| // @author Jan-Erik | |
| // @namespace http://github.com/badboy | |
| // @version 1.0 | |
| // @description Add the image title as a textbox underneath the XKCD comic. | |
| // @extra No more tooltip for me. | |
| // @include http://xkcd.com/* | |
| // ==/UserScript== | |
| var comic = document.querySelector("div.s img[title]"); | |
| var titleP = document.createElement("p"); | |
| titleP.style.fontVariant = "normal"; | |
| titleP.style.border = "1px solid yellow"; | |
| titleP.style.padding = "1em"; | |
| titleP.style.backgroundColor = "#FFFFCC"; | |
| titleP.innerText = comic.title; | |
| comic.insertAdjacentElement("afterEnd", titleP); |
This file contains hidden or 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
| javascript:(function(){var d=document,c=d.querySelector("div.s img[title]"),t=d.createElement("p");s=t.style;s.fontVariant="normal";s.border="1px solid yellow";s.padding="1em";s.backgroundColor="#FFFFCC";t.innerText=c.title;c.insertAdjacentElement("afterEnd",t);})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment