├── LICENSE ├── README.md └── monkeyshine.js /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Rob Dawson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # monkeyshine 2 | 3 | Here is a collection of JavaScript bookmarklets which you can use to vanquish your enemies (or at least mildly amuse them). 4 | 5 | You can try them all out on the [project home-page](http://codebox.org.uk/pages/monkeyshine-javascript-practical-jokes). 6 | 7 | Some are also available as User Scripts, which are supported natively in Google Chrome, and can also be used in other browsers with the help of a browser extension (e.g. Greasemonkey for Firefox). The User Script versions have better prank potential, because once installed they will run automatically on every page that the victim visits, whereas the bookmarklets must be manually clicked in order to run. 8 | 9 | I have tested these scripts in Google Chrome, Firefox and Safari, they should also work fine in Opera and maybe in Internet Explorer 9 and above. 10 | 11 | ### Flip Page by 180° 12 | 13 | This script immediately turns a web page upside down, not too subtle but guaranteed to have an impact. 14 | 15 | [User Script](https://codebox.net/js/userscripts/Flip180.user.js) 16 | 17 | * * * 18 | 19 | ### Flip all Images 20 | 21 | This script turns every image on the page upside-down. 22 | 23 | [User Script](https://codebox.net/js/userscripts/FlipImages.user.js) 24 | 25 | * * * 26 | 27 | ### Random Orientations 28 | 29 | This script makes small adjustments to the orientation of various elements on the page, giving it a nice 'broken' look. 30 | 31 | [User Script](https://codebox.net/js/userscripts/RandomOrientations.user.js) 32 | 33 | * * * 34 | 35 | ### The Bieberfier 36 | 37 | Replaces all images on the page with a picture of teen heartthrob Justin Bieber 38 | 39 | [User Script](https://codebox.net/js/userscripts/Bieberfier.user.js) 40 | 41 | * * * 42 | 43 | ### Rotate Page Booby Trap 44 | 45 | This script does nothing until someone presses a key on keyboard or moves the mouse, then it rotates the page 180°. After you run the script there is a 5 second pause before the trap is activated. 46 | 47 | * * * 48 | 49 | ### I Like Frogs 50 | 51 | This script replaces any text that the victim enters with the words 'I like frogs' 52 | 53 | [User Script](https://codebox.net/js/userscripts/ILikeFrogs.user.js) 54 | 55 | * * * 56 | -------------------------------------------------------------------------------- /monkeyshine.js: -------------------------------------------------------------------------------- 1 | // Rotate page 180 2 | ['', '-ms-', '-webkit-', '-o-', '-moz-'].map(function(prefix){ 3 | document.body.style[prefix + 'transform'] = 'rotate(180deg)'; 4 | }); 5 | 6 | // Flip images 180 7 | ['', '-ms-', '-webkit-', '-o-', '-moz-'].map(function(prefix){ 8 | Array.prototype.slice.call(document.querySelectorAll('img')).map(function(el){ 9 | el.style[prefix + 'transform'] = 'rotate(180deg)'; 10 | }); 11 | }); 12 | 13 | // Random orientations 14 | ['', '-ms-', '-webkit-', '-o-', '-moz-'].map(function(prefix){ 15 | Array.prototype.slice.call(document.querySelectorAll('div,p,span,img,a,body')).map(function(el){ 16 | el.style[prefix + 'transform'] = 'rotate(' + (Math.floor(Math.random() * 3) - 1) + 'deg)'; 17 | }); 18 | }); 19 | 20 | // Rotate page on mouse/key movement 21 | setTimeout(function(){ 22 | document.onmousemove = document.onkeypress = function(){ 23 | ['', '-ms-', '-webkit-', '-o-', '-moz-'].map(function(prefix){ 24 | document.body.style[prefix + 'transition'] = prefix + 'transform 3s'; 25 | document.body.style[prefix + 'transform'] = 'rotate(180deg)'; 26 | }); 27 | } 28 | }, 5000); 29 | 30 | // Replace text entered by the user with the contents of the TEXT variable 31 | (function(){ 32 | var TEXT = 'i like frogs '; 33 | Array.prototype.slice.call(document.querySelectorAll('input[type=text],textarea')).map(function(el){ 34 | el.onkeypress=function(evt){ 35 | var charCode = typeof evt.which == "number" ? evt.which : evt.keyCode; 36 | if (charCode && charCode > 31) { 37 | var start = this.selectionStart, end = this.selectionEnd; 38 | this.value = this.value.slice(0, start) + TEXT[start % TEXT.length] + this.value.slice(end); 39 | this.selectionStart = this.selectionEnd = start + 1; 40 | } 41 | return false; 42 | } 43 | }); 44 | }()); 45 | 46 | // Replace all images on the page with a picture of Justin Bieber 47 | Array.prototype.slice.call(document.querySelectorAll('img')).map(function(el){ 48 | el.src = '//codebox.net/assets/images/monkeyshine/bieber.jpg'; 49 | }); 50 | 51 | --------------------------------------------------------------------------------