Created
August 25, 2011 21:06
-
-
Save zer0her0/1171953 to your computer and use it in GitHub Desktop.
Extension testing...
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
| <script type="text/javascript"> | |
| safari.application.addEventListener("command", tableGrab, false); | |
| function tableGrab() { | |
| var iDiv = document.getElementById("reservations"); | |
| var iTable = iDiv.getElementsByTagName("table"); | |
| var iRows = iDiv.getElementsByTagName("tr"); | |
| var iCells = iDiv.getElementsByTagName("td"); | |
| var ary = []; | |
| var ary2d = []; | |
| var y = irows.length; | |
| var z = icells.length; | |
| var x = Math.round( z/y ); | |
| ary = Array.prototype.slice.call(icells); | |
| for (var i = 0; i < x; i++) { | |
| if (ary2d[i] == null) { | |
| ary2d[i] = []; | |
| } | |
| for (var j = 0; j < y; j++){ | |
| ary2d[i][j] = ary[j]; | |
| } | |
| } | |
| } | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here here! Wish I knew jQuery