Created
January 14, 2012 08:01
-
-
Save estelle/1610686 to your computer and use it in GitHub Desktop.
Turn off Your Website on January 18, 2012 to show your opposition to SOPA and PIPA
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
var stopsopa = { | |
pagehtml: document.getElementsByTagName("html")[0], | |
pagebody: document.getElementsByTagName("body")[0], | |
sopaText: "Stop SOPA", | |
// change to whatever you want | |
date: new Date(), | |
blackout: function () { | |
var pageAry = [stopsopa.pagehtml, stopsopa.pagebody], | |
div = document.createElement("div"), | |
text = document.createTextNode(stopsopa.sopaText), | |
footer = document.createElement("a"), | |
footerText = document.createTextNode("Why is this page missing?"); | |
for (var i in pageAry) { | |
pageAry[i].setAttribute("style", "background:white;height:100%;font-family:Arial, sans-serif;"); | |
} | |
//stopsopa.pagebody.setAttribute("style", "background:white;height:100%;"); | |
div.setAttribute("style", "width:100%;text-align:center;font-size:130px;color:red;text-transform:uppercase;white-space:nowrap;font-family:arial, san-serif;font-weight:bold;background:black;padding:50px 20px;line-height:1.2em;position:absolute;top:50%;margin-top:-100px;"); | |
stopsopa.pagebody.innerHTML = ""; | |
footer.setAttribute("style", "background:black;color:yellow;font-size:15px;position:absolute;bottom:0;width:100%;text-align:center;display:block;padding:10px;"); | |
footer.setAttribute("href", "http://www.mozilla.org/sopa/"); | |
footer.setAttribute("target", "_blank"); | |
footer.appendChild(footerText); | |
stopsopa.pagebody.appendChild(footer); | |
div.appendChild(text); | |
stopsopa.pagebody.appendChild(div); | |
}, | |
actionDate: function () { | |
if (stopsopa.date.getMonth() === 0 && stopsopa.date.getDate() === 18 && stopsopa.date.getYear() === 112) { | |
stopsopa.blackout(); | |
} | |
} | |
}; | |
stopsopa.actionDate(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment