Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

I was just thinking of making something like this myself #2

Open
wants to merge 2 commits into from

1 participant

shoeman22
shoeman22

But yours was a perfect place to start so I forked it!

I wanted to make it as lightweight as possible, so I removed the jQuery dependency and minified, so now you just need to include the one blaccupy-min.js file and you're good to go ie:

...html
script src="//raw.github.com/shoeman22/Blaccupy/master/blaccupy-min.js" type="text/javascript"></script
...

I also added an override method, so if someone wants to put up a different message, they just need to define;

...javascript
var blackout = function() {
//do whatever
}
...
Before the blaccupy-min.js script tag.

Anyway, thanks for starting this. SOPA needs to die!
Andy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 12, 2012
  1. shoeman22

    Removed jQuery dependency, added minimized version, and added ability…

    shoeman22 authored
    … to override default behavior (see index.html).
  2. shoeman22

    Removed jQuery dependency, added minimized version, and added ability…

    shoeman22 authored
    … to override default behavior (see index.html).
This page is out of date. Refresh to see the latest.
Showing with 67 additions and 21 deletions.
  1. +6 −0 blaccupy-min.js
  2. +39 −13 blaccupy.js
  3. +22 −8 index.html
6 blaccupy-min.js
View
@@ -0,0 +1,6 @@
+function defaultBlackout(){var a=document.getElementsByTagName("body")[0];a.style.backgroundColor="#000000";a.style.color="#3A3A3A";a.style.fontFamily="Helvetica";a.style.fontSize="2.2em";a.style.verticalAlign="middle";a.style.textAlign="center";a.innerHTML='<div style="width:960px;margin:0 auto;">'+document.location.hostname+' is...<br /><br /><div style="text-decoration:underline;">BLACKED OUT!</div><br />...in protest of <a href="http://en.wikipedia.org/wiki/Stop_Online_Piracy_Act" style="color:#FF0000">pending legislation</a> which threatens the freedoms of websites like this one and the freedoms of the people who use them.<br /><br />Please <a href="http://americancensorship.org" style="color:#FF0000">help protect our free speech</a> against the corporate and political interests which seek to take them away!<br /><br />(And don\'t worry, we\'ll be back in business tomorrow!)</div>'}function init(){if(arguments.callee.done){return}arguments.callee.done=true;if(_timer){clearInterval(_timer)}if(typeof blackout==="undefined"){return defaultBlackout()}blackout()}if(document.addEventListener){document.addEventListener("DOMContentLoaded",init,false);
+/*@cc_on @*/
+/*@if (@_win32)
+document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");document.getElementById("__ie_onload").onreadystatechange=function(){if(this.readyState=="complete"){init();}};
+/*@end @*/
+}if(/WebKit/i.test(navigator.userAgent)){var _timer=setInterval(function(){if(/loaded|complete/.test(document.readyState)){init()}},10)}window.onload=init;
52 blaccupy.js
View
@@ -1,13 +1,39 @@
-// Rich Jones of Gun.io, public domain. Fork me, please! http://github.com/Miserlou/
-$(document).ready(function() {
- $('body').css('background', '#000000');
- $('body').css('text-align', 'center');
- $('body').css('color', '#111111');
- $('body').css('font-family','Helvetica');
- $('body').css('font-size','2.2em');
- $('body').css('vertical-align','middle');
- $('a').css('color','#222222');
- $('a').css('text-decoration','underline');;
- $('a:visited').css('color','#222222');
- $('body').html('<div style="width: 960px; margin: 0 auto;"><br /><br />This README is..<br /> <br /><div style="color: #222222">BLACKED OUT!</div><br />..in protest of <a href="http://en.wikipedia.org/wiki/Stop_Online_Piracy_Act" target="_blank" style="color: #220022">pending legislation</a> which threatens the freedoms of websites like this one and the freedoms of the people who use them.<br /><br />Please <a href="http://americancensorship.org/" target="_blank" style="color: #220022">help protect our free speech</a> against the corporate and political interests which seek to take them away!<br /><br />(And don\'t worry, we\'ll be back in business tomorrow!)</div>');
- });
+function defaultBlackout() {
+ var body = document.getElementsByTagName('body')[0];
+ body.style.backgroundColor = '#000000';
+ body.style.color = '#3A3A3A';
+ body.style.fontFamily = 'Helvetica';
+ body.style.fontSize = '2.2em';
+ body.style.verticalAlign = 'middle';
+ body.style.textAlign = 'center';
+ body.innerHTML = '<div style="width:960px;margin:0 auto;">' + document.location.hostname + ' is...<br /><br /><div style="text-decoration:underline;">BLACKED OUT!</div><br />...in protest of <a href="http://en.wikipedia.org/wiki/Stop_Online_Piracy_Act" style="color:#FF0000">pending legislation</a> which threatens the freedoms of websites like this one and the freedoms of the people who use them.<br /><br />Please <a href="http://americancensorship.org" style="color:#FF0000">help protect our free speech</a> against the corporate and political interests which seek to take them away!<br /><br />(And don\'t worry, we\'ll be back in business tomorrow!)</div>';
+}
+function init() {
+ if (arguments.callee.done) return;
+ arguments.callee.done = true;
+ if (_timer) clearInterval(_timer);
+
+ if(typeof blackout === 'undefined') return defaultBlackout();
+ blackout();
+};
+if (document.addEventListener) {
+ document.addEventListener("DOMContentLoaded", init, false);
+}
+/*@cc_on @*/
+/*@if (@_win32)
+ document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
+ var script = document.getElementById("__ie_onload");
+ script.onreadystatechange = function() {
+ if (this.readyState == "complete") {
+ init(); // call the onload handler
+ }
+ };
+/*@end @*/
+if (/WebKit/i.test(navigator.userAgent)) { // sniff
+ var _timer = setInterval(function() {
+ if (/loaded|complete/.test(document.readyState)) {
+ init(); // call the onload handler
+ }
+ }, 10);
+}
+window.onload = init;
30 index.html
View
@@ -1,10 +1,24 @@
+<doctype HTML>
<html>
- <head>
- <script type="text/javascript"
- src="http://code.jquery.com/jquery-1.5.2.js"></script>
- <script type="text/javascript"
- src="blaccupy.js"></script>
- </head>
- <body>
- </body>
+ <head>
+ <title>Blaccupy Example</title>
+ <script type="text/javascript">
+ //If you want to do something other than the default blackout function, define blackout function instead:
+ //For reference, here is what the default function looks like:
+ /*
+ var blackout = function() {
+ var body = document.getElementsByTagName('body')[0];
+ body.style.backgroundColor = '#000000';
+ body.style.color = '#3A3A3A';
+ body.style.fontFamily = 'Helvetica';
+ body.style.fontSize = '2.2em';
+ body.style.verticalAlign = 'middle';
+ body.style.textAlign = 'center';
+ body.innerHTML = '<div style="width:960px;margin:0 auto;">' + document.location.hostname + ' is...<br /><br /><div style="text-decoration:underline;">BLACKED OUT!</div><br />...in protest of <a href="http://en.wikipedia.org/wiki/Stop_Online_Piracy_Act" style="color:#FF0000">pending legislation</a> which threatens the freedoms of websites like this one and the freedoms of the people who use them.<br /><br />Please <a href="http://americancensorship.org" style="color:#FF0000">help protect our free speech</a> against the corporate and political interests which seek to take them away!<br /><br />(And don\'t worry, we\'ll be back in business tomorrow!)</div>';
+ };
+ */
+ </script>
+ <script type="text/javascript" src="blaccupy-min.js"></script>
+ </head>
+ <body></body>
</html>
Something went wrong with that request. Please try again.