Last active
August 29, 2015 14:02
-
-
Save loadletter/135a671cb02f6a13bdc0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// ==UserScript== | |
// @name OpenHotel fun | |
// @namespace loadletter | |
// @description Fun things | |
// @match http://openhotel-dev.zapto.org:8080/ | |
// @match http://openhotel.herokuapp.com/ | |
// @match http://207.12.89.21:8080/ | |
// @version 3 | |
// @grant none | |
// ==/UserScript== | |
function run_userscript() { | |
var oscript = document.createElement('script'); | |
oscript.appendChild(document.createTextNode('('+ userscript_insert +')();')); | |
(document.body || document.head || document.documentElement).appendChild(oscript); | |
} | |
function userscript_insert() { | |
var emptygifforbackground = 'http://upload.wikimedia.org/wikipedia/commons/c/c0/Blank.gif'; | |
socket.removeAllListeners("updateImage"); | |
socket.on("updateImage", function(data) {img.src = emptygifforbackground;}); | |
setTimeout(function() {img.src = emptygifforbackground;}, 5000); | |
$(document).mousedown(function(event) | |
{ | |
if(event.which == 3) { | |
socket.emit("position", {id: id, x: mouseX, y: mouseY, session: sessionID}); | |
} else if (event.which == 1) { | |
for(i=0;i<10;i++) socket.emit("fireBullet", {id: id, x: mouseX + 50*Math.cos(i)|0, y: mouseY + 50*Math.sin(i)|0, session: sessionID}); | |
} | |
}); | |
BULLET_FIRE_RATE = 2; | |
} | |
run_userscript(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment