Skip to content

Instantly share code, notes, and snippets.

@NullUserException
Created December 29, 2011 22:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NullUserException/1536489 to your computer and use it in GitHub Desktop.
Save NullUserException/1536489 to your computer and use it in GitHub Desktop.
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