summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Seguin <guillaume@segu.in>2010-05-13 06:04:01 +0200
committerGuillaume Seguin <guillaume@segu.in>2010-05-13 06:04:01 +0200
commit408870ad134bed7c2d8d95bd6b7453696254894c (patch)
tree3ab6b87392f4413adf41ab6f041be659fe0d014f
parent3dd995f2bbc1a0512081129968f6d5e698a26aa2 (diff)
downloadsqwarea-helper-408870ad134bed7c2d8d95bd6b7453696254894c.tar.gz
sqwarea-helper-408870ad134bed7c2d8d95bd6b7453696254894c.tar.bz2
Use hack for cross-browser compatibilityHEADmaster
-rw-r--r--sqwarea-helper.user.js26
1 files changed, 16 insertions, 10 deletions
diff --git a/sqwarea-helper.user.js b/sqwarea-helper.user.js
index b86fd50..ed93aab 100644
--- a/sqwarea-helper.user.js
+++ b/sqwarea-helper.user.js
@@ -6,18 +6,19 @@
// @include http://www.sqwarea.com/Game
// ==/UserScript==
-(function () {
+var elmt = document.createElement("script");
+elmt.type = "text/javascript";
+elmt.text = "(" + (function() {
var Map, Tools, $;
-
function sqwarea_init_wait() {
- if (typeof unsafeWindow.Map == 'undefined'
- || typeof unsafeWindow.Tools == 'undefined'
- || typeof unsafeWindow.$ == 'undefined') {
+ if (typeof window.Map == 'undefined'
+ || typeof window.Tools == 'undefined'
+ || typeof window.$ == 'undefined') {
window.setTimeout(sqwarea_init_wait, 100);
} else {
- Map = unsafeWindow.Map;
- Tools = unsafeWindow.Tools;
- $ = unsafeWindow.$;
+ Map = window.Map;
+ Tools = window.Tools;
+ $ = window.$;
try {
sqwarea_helper_run();
} catch (e) {
@@ -70,5 +71,10 @@
$("div.Actions ol").append (gotobutton);
}
- sqwarea_init_wait();
-})();
+ try {
+ sqwarea_init_wait();
+ } catch (e) {
+ alert("UserScript exception:\n" + e);
+ }
+}).toString() + ")();";
+document.body.appendChild(elmt);