Last active
March 2, 2018 00:35
-
-
Save michimani/421c5c55329c50d8c7a1dbfdcbf034c2 to your computer and use it in GitHub Desktop.
Add a specific element before heading in Hatena blog article.
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
if (location.href.match(/michinoeki-mania\.com\/entry/)) { // Replace this with your blog domain | |
var j=new Date(); | |
var f=j.getTime(); | |
var g=""; | |
switch (f%5) { | |
case 0: | |
g="Something 1"; | |
break; | |
case 1: | |
g="Something 2"; | |
break; | |
case 2: | |
g="Something 3"; | |
break; | |
case 3: | |
g="Something 4"; | |
break; | |
case 4: | |
g="Something 5"; | |
break; | |
} | |
var h="<div style='text-align:center;'>"+g+"</div>"; | |
var a=document.getElementsByTagName("h1"); | |
if (typeof(a[3]) != "undefined") { | |
a[3].insertAdjacentHTML("beforebegin",h); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment