Skip to content

Instantly share code, notes, and snippets.

@estelle
Created January 14, 2012 08:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save estelle/1610686 to your computer and use it in GitHub Desktop.
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
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