Angry Birds Cursor Position
// ==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