|
2 | 2 | // @name Idrinth's DotD Script |
3 | 3 | // @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/ |
4 | 4 | // @author Idrinth |
5 | | -// @version 2.3.1 |
| 5 | +// @version 2.3.2 |
6 | 6 | // @grant none |
7 | 7 | // @hompage https://dotd.idrinth.de |
8 | 8 | // @include http://www.kongregate.com/games/5thplanetgames/dawn-of-the-dragons* |
|
34 | 34 | window.location.host === "web1.dawnofthedragons.com" || |
35 | 35 | window.location.host === "dotd-web1.5thplanetgames.com" |
36 | 36 | ) { |
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 |
54 | 61 | } |
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); |
62 | 70 | return; |
63 | 71 | } |
64 | 72 | var sc = document.createElement("script"); |
|
0 commit comments