diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..610e4049 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +CloudToButt.pem diff --git a/CloudToButt.crx b/CloudToButt.crx index fb81d2fd..207bed22 100644 Binary files a/CloudToButt.crx and b/CloudToButt.crx differ diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..2c88e3e7 --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +all: + DISPLAY=:0 sudo google-chrome --pack-extension=Source --pack-extension-key=CloudToButt.pem --user-data-dir=/tmp/foooo + sudo chown hank:hank Source.crx + mv Source.crx CloudToButt.crx diff --git a/README.md b/README.md index 115ef3ef..828cf007 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,26 @@ -cloud-to-butt +Cloud To Butt Plus ============= -Chrome extension that replaces occurrences of 'the cloud' with 'my butt' +Chrome extension that replaces occurrences of 'the cloud' with 'my butt', and other amusing cloud-related substitutions. -[Direct download of crx file](https://github.com/panicsteve/cloud-to-butt/blob/master/CloudToButt.crx?raw=true) +[Direct download of crx file](https://github.com/hank/cloud-to-butt/blob/master/CloudToButt.crx?raw=true) + +Screenshot Gallery +------------------ + +http://www.flickr.com/groups/cloud-to-butt/ Installation ------------ In Chrome, choose Window > Extensions. Drag CloudToButt.crx into the page that appears. + +Safari Version +-------------- + +Can be found here: https://github.com/logancollins/cloud-to-butt-safari + +Firefox Version +--------------- + +Can be found here: https://github.com/DaveRandom/cloud-to-butt-mozilla diff --git a/Source/content_script.js b/Source/content_script.js index fef888ac..68a4a8ae 100644 --- a/Source/content_script.js +++ b/Source/content_script.js @@ -27,9 +27,36 @@ function walk(node) } } -function handleText(textNode) -{ - textNode.nodeValue = textNode.nodeValue.replace(/\bthe cloud\b/gi, "my butt"); +function handleText(textNode) { + var v = textNode.nodeValue; + + // Deal with the easy case and french people + v = v.replace(/\b(Th|th|L|l)e (C|c)loud/g, function(match, p1, p2, offset, string) { + // t - 7 = m + // c - 1 = b + m = String.fromCharCode(p1.charCodeAt(0) - 7); + b = String.fromCharCode(p2.charCodeAt(0) - 1); + return m + "y " + b + "utt"; + }); + + // Deal with private clouds + v = v.replace(/\b(P|p)rivate (C|c)loud/g, function(match, p1, p2, offset, string) { + // c - 1 = b + b = String.fromCharCode(p2.charCodeAt(0) - 1); + return b + "utt"; + }); + // Get the corner cases + if(v.match(/cloud/i)) { + // If we're not talking about weather + if(v.match(/PaaS|SaaS|IaaS|computing|data|storage|cluster|distributed|server|hosting|provider|grid|enterprise|provision|apps|hardware|software|/i)) { + v = v.replace(/(C|c)loud/gi, function(match, p1, offset, string) { + // c - 1 = b + b = String.fromCharCode(p1.charCodeAt(0) - 1); + return b + "utt"; + }); + } + } + textNode.nodeValue = v; } diff --git a/Source/manifest.json b/Source/manifest.json index 205e2c4f..8a3f57dd 100644 --- a/Source/manifest.json +++ b/Source/manifest.json @@ -1,8 +1,8 @@ { "manifest_version": 2, - "name": "Cloud To Butt", - "version": "1.0", - "description": "Replaces the text 'the cloud' with 'my butt'.", + "name": "Cloud To Butt Plus", + "version": "1.1", + "description": "Replaces the text 'the cloud' with 'my butt', as well as 'cloud' with 'butt' in certain contexts.", "content_scripts": [ {