Created
December 29, 2011 22:30
-
-
Save NullUserException/1536489 to your computer and use it in GitHub Desktop.
Angry Birds Cursor Position
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
// ==UserScript== | |
// @name Angry Birds Cursor Position | |
// @description Tells you the exact position of the cursor while on Angry Birds | |
// @include http://chrome.angrybirds.com/ | |
// @author Royal Flush | |
// ==/UserScript== | |
/* | |
Based on code by C. Peter Chen, available at: | |
http://dev-notes.com/code.php?q=33 | |
*/ | |
var boxes = document.createElement('tr'); | |
boxes.innerHTML = '<tr><td colspan="2">X: <input type="text" id="cursorX"> Y: <input type="text" id="cursorY"></td><br />&nbps;<br /></tr>'; | |
var table = document.getElementsByTagName('tbody')[0]; table.insertBefore(boxes, table.childNodes[0]); | |
function init() { | |
document.captureEvents(Event.MOUSEMOVE); | |
document.onmousemove = getCursorXY; | |
} | |
function getCursorXY(e) { | |
document.getElementById('cursorX').value = e.pageX | |
document.getElementById('cursorY').value = e.pageY; | |
} | |
init(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment