-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Matt Curry
committed
Apr 1, 2011
0 parents
commit a964de2
Showing
36 changed files
with
889 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Mr Cutty | ||
**Mr Cutty** is a HTML5/JavaScript bookmarklet that gives you various weapons that can be used to destroy a web page. | ||
|
||
## Compatibility | ||
* Chrome 10 works great | ||
* Firefox 4 works, but can be slow | ||
* Safari 5 works great, can be slightly slow at times | ||
* IE9 works, but carnage only flows left and right, not down. I don't care enough to look into it. | ||
* All others untested | ||
|
||
## Sound | ||
Sound effects are off by default. Look for an icon in the upper left to enable. I spent a lot of time and my own money producing these so please check them out. | ||
|
||
## Install | ||
Add a bookmark for | ||
javascript:var s = document.createElement('script');s.type='text/javascript';document.body.appendChild(s);s.src='http://cdn.pseudocoder.com/mrcutty/mrcutty.js';void(0); | ||
|
||
## Build | ||
Check out build.sh. Uses [YUI Compressor](http://developer.yahoo.com/yui/compressor/) | ||
|
||
## License | ||
[MIT license](http://www.opensource.org/licenses/mit-license.php) | ||
|
||
## Copyright | ||
2011 Matt Curry (http://pseudocoder.com) | ||
|
||
## Credits | ||
* Lightsaber sounds [theforce.net](http://theforce.net/fanfilms/postproduction/soundfx/saberfx_fergo.asp) | ||
* Mute/Unmute images [FamFamFam Silk](http://www.famfamfam.com/lab/icons/silk/) | ||
* Site logos taken from their respective sites. | ||
* Other images stolen indiscrimitely from Google image search. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
cat opener.js \ | ||
util.js \ | ||
blood.js \ | ||
carnage.js \ | ||
weapons/google.js \ | ||
weapons/lightsaber.js \ | ||
weapons/bing.js \ | ||
weapons/yahoo.js \ | ||
weapons/chainsaw.js \ | ||
weapons/jcal.js \ | ||
mrcutty.js \ | ||
closer.js \ | ||
> tmp.js | ||
|
||
java -jar yuicompressor-2.4.2.jar tmp.js > mrcutty.js | ||
rm tmp.js |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Mr Cutty</title> | ||
|
||
<script type="application/x-javascript"> | ||
var rootPath = ""; | ||
</script> | ||
<script type="application/x-javascript" src="src/util.js"></script> | ||
<script type="application/x-javascript" src="src/blood.js"></script> | ||
<script type="application/x-javascript" src="src/carnage.js"></script> | ||
<script type="application/x-javascript" src="src/weapons/chainsaw.js"></script> | ||
<script type="application/x-javascript" src="src/weapons/lightsaber.js"></script> | ||
<script type="application/x-javascript" src="src/weapons/google.js"></script> | ||
<script type="application/x-javascript" src="src/weapons/bing.js"></script> | ||
<script type="application/x-javascript" src="src/weapons/yahoo.js"></script> | ||
<script type="application/x-javascript" src="src/weapons/jcal.js"></script> | ||
<script type="application/x-javascript" src="src/mrcutty.js"></script> | ||
</head> | ||
|
||
<body> | ||
|
||
<a title="Mr Cutty" href="javascript:new MrCutty();void(0);">Mr Cutty</a> | ||
|
||
<h1>Mr Cutty</h1> | ||
|
||
<p>Mr Cutty is a HTML5/JavaScript bookmarklet that gives you various weapons that can be used to destroy a web page.</p> | ||
|
||
<h2>Compatibility</h2> | ||
|
||
<ul> | ||
<li>Chrome 10 works great</li> | ||
<li>Firefox 4 works, but can be slow</li> | ||
<li>Safari 5 works great, can be slightly slow at times</li> | ||
<li>IE9 works, but carnage only flows left and right, not down. I don't care enough to look into it.</li> | ||
<li>All others untested</li> | ||
</ul> | ||
|
||
<h2>Sound</h2> | ||
|
||
<p>Sound effects are off by default. Look for an icon in the upper left to enable. I spent a lot of time and my own money producing these so please check them out.</p> | ||
|
||
<h2>Install</h2> | ||
|
||
<p>Add a bookmark for | ||
javascript:var s = document.createElement('script');s.type='text/javascript';document.body.appendChild(s);s.src='http://cdn.pseudocoder.com/mrcutty/mrcutty.js';void(0);</p> | ||
|
||
<h2>Build</h2> | ||
|
||
<p>Check out build.sh. Uses <a href="http://developer.yahoo.com/yui/compressor/">YUI Compressor</a></p> | ||
|
||
<h2>License</h2> | ||
|
||
<p><a href="http://www.opensource.org/licenses/mit-license.php">MIT license</a></p> | ||
|
||
<h2>Copyright</h2> | ||
|
||
<p>2011 Matt Curry (http://pseudocoder.com)</p> | ||
|
||
<h2>Credits</h2> | ||
|
||
<ul> | ||
<li>Lightsaber sounds <a href="http://theforce.net/fanfilms/postproduction/soundfx/saberfx_fergo.asp">theforce.net</a></li> | ||
<li>Mute/Unmute images <a href="http://www.famfamfam.com/lab/icons/silk/">FamFamFam Silk</a></li> | ||
<li>Site logos taken from their respective sites.</li> | ||
<li>Other images stolen indiscrimitely from Google image search.</li> | ||
</ul> | ||
|
||
|
||
|
||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/** | ||
* Class for drawing dripping blood | ||
* @class Blood | ||
* @param {object} ctx the canvas context for drawing | ||
* @param {object} x,y coordinates for the start of the blood path | ||
* @param {object} x,y coordinates for the end of the blood path | ||
*/ | ||
function Blood(ctx, start, end) { | ||
var startY = start.y + ((end.y - start.y) / 2); | ||
var points = []; | ||
var prev = start; | ||
|
||
for (i = 0; i < 5; i++) { | ||
temp = { | ||
start: prev, | ||
h: 0, | ||
rate: Util.rand(1, 3) | ||
}; | ||
|
||
if (i == 9) { | ||
temp.end = end; | ||
} else { | ||
w = Util.rand(10, 50); | ||
temp.end = {}; | ||
temp.end.x = temp.start.x + w; | ||
|
||
diffY = end.y - start.y; | ||
diffX = end.x - start.x; | ||
|
||
temp.end.y = temp.start.y + ((w / diffX) * diffY); | ||
|
||
if (temp.end.x >= end.x) { | ||
temp.end.x = end.x; | ||
temp.end.y = end.y; | ||
i = 10; | ||
} | ||
} | ||
|
||
temp.startY = temp.start.y + ((temp.end.y - temp.start.y) / 2); | ||
|
||
prev = temp.end; | ||
points.push(temp); | ||
} | ||
var t = 0; | ||
|
||
var iv = setInterval(function() { | ||
ctx.save(); | ||
ctx.beginPath(); | ||
ctx.moveTo(points[0].start.x, points[0].start.y); | ||
|
||
for (i = 0; i < points.length; i++) { | ||
draw(points[i]); | ||
points[i].h += points[i].rate; | ||
|
||
//if (i < points.length - 1) { | ||
points[i].start.y += Util.rand(0, 10) / 10; | ||
points[i].end.y += Util.rand(0, 10) / 10; | ||
//} | ||
} | ||
|
||
ctx.closePath(); | ||
ctx.fillStyle = "red"; | ||
ctx.fill(); | ||
ctx.restore(); | ||
|
||
t++; | ||
if (t > 100) { | ||
clearInterval(iv); | ||
} | ||
}, 100); | ||
|
||
function draw(obj) { | ||
cp1x = obj.start.x + ((obj.end.x - obj.start.x) / 2); | ||
cp1y = obj.startY + obj.h; | ||
|
||
ctx.quadraticCurveTo(cp1x, cp1y, obj.end.x, obj.end.y); | ||
} | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
/** | ||
* Class for destorying a web page | ||
* @class Carnage | ||
*/ | ||
var Carnage = { | ||
elmTypes: ["img", "h1", "h2", "h3", "h4", "h5", "h4", "li", "p", "object", "embed", "a", "span"], | ||
|
||
/** | ||
* Initialize the page for the pending carnage | ||
* @method init | ||
*/ | ||
init: function() { | ||
for(var i = 0; i < Carnage.elmTypes.length; i ++) { | ||
Carnage.tagElements(Carnage.elmTypes[i]); | ||
} | ||
}, | ||
|
||
/** | ||
* Loop through the elements and flag those that can be carnaged | ||
* @method init | ||
* @param {string} type the type of elements to check | ||
*/ | ||
tagElements: function(type) { | ||
elms = document.getElementsByTagName(type); | ||
|
||
for (var i = elms.length - 1; i >= 0; i --) { | ||
if(elms[i].tagName == "SPAN" && elms[i].parentNode.className.indexOf("mrcutty-") != -1) { | ||
continue; | ||
} | ||
|
||
if(elms[i].tagName != "P") { | ||
if(elms[i].className != "") { | ||
elms[i].className += " "; | ||
} | ||
elms[i].className += "mrcutty-to-be-carnaged"; | ||
} else { | ||
//this messes up the text for some reason | ||
//newElm = Util.createElement(type); | ||
newText = ""; | ||
|
||
for (j = 0; j < elms[i].childNodes.length; j ++) { | ||
if(elms[i].childNodes[j].nodeType == Node.TEXT_NODE) { | ||
pieces = elms[i].childNodes[j].textContent.split(" "); | ||
|
||
for(k = 0; k < pieces.length; k ++) { | ||
//tempElm = Util.createElement("span", {}, {"class": "mrcutty-to-be-carnaged"}); | ||
//tempElm.innerHTML = pieces[k]; | ||
//newElm.appendChild(tempElm); | ||
newText += "<span class='mrcutty-to-be-carnaged'>" + pieces[k] + "</span> "; | ||
} | ||
} else { | ||
//newElm.appendChild(elms[i].childNodes[j]); | ||
newText += "<" + elms[i].childNodes[j].tagName + " "; | ||
attr = elms[i].childNodes[j].attributes; | ||
for(k = 0; k < attr.length; k ++) { | ||
if(attr[k].value != "") { | ||
newText += attr[k].name + "='" + attr[k].value + "' "; | ||
} else { | ||
newText += attr[k].name + " "; | ||
} | ||
} | ||
|
||
newText += ">"; | ||
newText += elms[i].childNodes[j].innerHTML; | ||
newText += "</" + elms[i].childNodes[j].tagName + ">"; | ||
} | ||
} | ||
|
||
//elms[i].parentNode.replaceChild(newElm, elms[i]); | ||
elms[i].innerHTML = newText; | ||
} | ||
} | ||
}, | ||
|
||
/** | ||
* Trigger the carnage | ||
* @method trigger | ||
* @param {object} elm the element to be carnaged if possible | ||
*/ | ||
trigger: function(elm) { | ||
if(elm.className.indexOf("mrcutty-to-be-carnaged") == -1) { | ||
return; | ||
} | ||
elm.className = elm.className.replace("mrcutty-to-be-carnaged", "mrcutty-carnaged"); | ||
|
||
var d = {elm: elm}; | ||
var pos = Util.findPos(d.elm); | ||
|
||
d.elm.style.position = "fixed"; | ||
d.elm.style.left = pos["left"] + "px" | ||
d.elm.style.top = pos["top"] + "px" | ||
|
||
d.x = pos["left"]; | ||
|
||
range = [-3,-2,-1,1,2,3]; | ||
d.c = range[Util.rand(0,5)]; | ||
|
||
d.offset = Util.rand (5, 70); | ||
d.offset = d.c * d.offset; | ||
|
||
d.x0 = d.x; | ||
d.y = pos["top"]; | ||
d.a = .01; | ||
|
||
d.elm.style.left = d.x + "px"; | ||
d.elm.style.top = d.y + "px"; | ||
var intT = setInterval(function() { | ||
d.x += d.c; | ||
var y = (d.a * (d.x0 - d.x + d.offset) * (d.x0 - d.x)) + d.y; | ||
|
||
d.elm.style.left = d.x + "px"; | ||
d.elm.style.top = y + "px"; | ||
|
||
if ((d.x + d.elm.offsetWidth) < 0 || d.x > window.innerWidth || y > window.innerHeight) { | ||
d.elm.parentNode.removeChild(d.elm); | ||
clearInterval(intT); | ||
} | ||
}, 25); | ||
} | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
new MrCutty(); | ||
|
||
})(); |
Oops, something went wrong.