Skip to content
This repository was archived by the owner on Mar 29, 2021. It is now read-only.

Commit f9429b6

Browse files
authored
Merge pull request #327 from IDotD/idrinth
hopefully fixing loader in FF
2 parents 9e0f92a + 09cb46c commit f9429b6

1 file changed

Lines changed: 33 additions & 25 deletions

File tree

src/loader.js

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// @name Idrinth's DotD Script
33
// @description A userscript for the game Dawn of the Dragons which provides multiple useful tools, like time-saving raid catching, private chatrooms and much more to discover, see the manual at https://idotd.github.io/
44
// @author Idrinth
5-
// @version 2.3.1
5+
// @version 2.3.2
66
// @grant none
77
// @hompage https://dotd.idrinth.de
88
// @include http://www.kongregate.com/games/5thplanetgames/dawn-of-the-dragons*
@@ -34,31 +34,39 @@
3434
window.location.host === "web1.dawnofthedragons.com" ||
3535
window.location.host === "dotd-web1.5thplanetgames.com"
3636
) {
37-
window.idrinth = {};
38-
window.idrinth.add = function(data) {
39-
var s = document.createElement("script");
40-
s.appendChild(document.createTextNode(data));
41-
document.getElementsByTagName("head")[0].appendChild(s);
42-
};
43-
window.addEventListener(
44-
"message",
45-
function(event) {
46-
try {
47-
var data = JSON.parse(event.data);
48-
if (
49-
data.to !== "idotd" ||
50-
!window.idrinth.hasOwnProperty(data.task) ||
51-
!data.data
52-
) {
53-
return;
37+
var f = function() {
38+
console.log("s");
39+
window.idrinth = {};
40+
window.idrinth.add= function(data) {
41+
var s = document.createElement("script");
42+
s.appendChild(document.createTextNode(data));
43+
document.getElementsByTagName("head")[0].appendChild(s);
44+
};
45+
window.addEventListener(
46+
"message",
47+
function(event) {
48+
try {
49+
var data = JSON.parse(event.data);
50+
if (
51+
!data ||
52+
data.to !== "idotd" ||
53+
!window.idrinth.hasOwnProperty(data.task) ||
54+
!data.data
55+
) {
56+
return;
57+
}
58+
window.idrinth[data.task](data.data);
59+
} catch (e) {
60+
//nothing
5461
}
55-
window.idrinth[data.task](data.data);
56-
} catch (e) {
57-
//nothing
58-
}
59-
},
60-
false
61-
);
62+
},
63+
false
64+
);
65+
};
66+
var sc = document.createElement("script");
67+
sc.setAttribute("id", "idotd-loader");
68+
sc.appendChild(document.createTextNode('('+f.toString()+'());'));
69+
document.getElementsByTagName("head")[0].appendChild(sc);
6270
return;
6371
}
6472
var sc = document.createElement("script");

0 commit comments

Comments
 (0)