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

Commit

Permalink
Merge pull request #327 from IDotD/idrinth
Browse files Browse the repository at this point in the history
hopefully fixing loader in FF
  • Loading branch information
Idrinth authored Dec 6, 2017
2 parents 9e0f92a + 09cb46c commit f9429b6
Showing 1 changed file with 33 additions and 25 deletions.
58 changes: 33 additions & 25 deletions src/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// @name Idrinth's DotD Script
// @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/
// @author Idrinth
// @version 2.3.1
// @version 2.3.2
// @grant none
// @hompage https://dotd.idrinth.de
// @include http://www.kongregate.com/games/5thplanetgames/dawn-of-the-dragons*
Expand Down Expand Up @@ -34,31 +34,39 @@
window.location.host === "web1.dawnofthedragons.com" ||
window.location.host === "dotd-web1.5thplanetgames.com"
) {
window.idrinth = {};
window.idrinth.add = function(data) {
var s = document.createElement("script");
s.appendChild(document.createTextNode(data));
document.getElementsByTagName("head")[0].appendChild(s);
};
window.addEventListener(
"message",
function(event) {
try {
var data = JSON.parse(event.data);
if (
data.to !== "idotd" ||
!window.idrinth.hasOwnProperty(data.task) ||
!data.data
) {
return;
var f = function() {
console.log("s");
window.idrinth = {};
window.idrinth.add= function(data) {
var s = document.createElement("script");
s.appendChild(document.createTextNode(data));
document.getElementsByTagName("head")[0].appendChild(s);
};
window.addEventListener(
"message",
function(event) {
try {
var data = JSON.parse(event.data);
if (
!data ||
data.to !== "idotd" ||
!window.idrinth.hasOwnProperty(data.task) ||
!data.data
) {
return;
}
window.idrinth[data.task](data.data);
} catch (e) {
//nothing
}
window.idrinth[data.task](data.data);
} catch (e) {
//nothing
}
},
false
);
},
false
);
};
var sc = document.createElement("script");
sc.setAttribute("id", "idotd-loader");
sc.appendChild(document.createTextNode('('+f.toString()+'());'));
document.getElementsByTagName("head")[0].appendChild(sc);
return;
}
var sc = document.createElement("script");
Expand Down

0 comments on commit f9429b6

Please sign in to comment.