|
34 | 34 | window.location.host === "web1.dawnofthedragons.com" || |
35 | 35 | window.location.host === "dotd-web1.5thplanetgames.com" |
36 | 36 | ) { |
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 | | - }; |
| 37 | + let f = function() { |
| 38 | + window.idrinth = { |
| 39 | + add: function(data) { |
| 40 | + let s = document.createElement("script"); |
| 41 | + s.appendChild(document.createTextNode(data)); |
| 42 | + document.getElementsByTagName("head")[0].appendChild(s); |
| 43 | + } |
| 44 | + }; |
45 | 45 | window.addEventListener( |
46 | 46 | "message", |
47 | 47 | function(event) { |
48 | 48 | try { |
49 | | - var data = JSON.parse(event.data); |
| 49 | + let data = JSON.parse(event.data); |
50 | 50 | if ( |
51 | 51 | !data || |
52 | 52 | data.to !== "idotd" || |
|
63 | 63 | false |
64 | 64 | ); |
65 | 65 | }; |
66 | | - var sc = document.createElement("script"); |
| 66 | + let sc = document.createElement("script"); |
67 | 67 | sc.setAttribute("id", "idotd-loader"); |
68 | 68 | sc.appendChild(document.createTextNode('('+f.toString()+'());')); |
69 | 69 | document.getElementsByTagName("head")[0].appendChild(sc); |
70 | 70 | return; |
71 | 71 | } |
72 | | - var sc = document.createElement("script"); |
| 72 | + let sc = document.createElement("script"); |
73 | 73 | sc.setAttribute( |
74 | 74 | "src", |
75 | 75 | "https://dotd.idrinth.de/static/userscript/" + GM_info.script.version + "/" |
|
78 | 78 | sc.setAttribute("async", "async"); |
79 | 79 | sc.errorCounter = 0; |
80 | 80 | sc.errorFunction = function() { |
81 | | - var self = document.getElementById("idotd-loader"); |
| 81 | + let self = document.getElementById("idotd-loader"); |
82 | 82 | self.parentNode.removeChild(self); |
83 | | - var sc = document.createElement("script"); |
| 83 | + let sc = document.createElement("script"); |
84 | 84 | sc.onerror = self.onerror; |
85 | 85 | sc.errorCounter = self.errorCounter + 1; |
86 | 86 | sc.errorFunction = self.errorFunction; |
|
0 commit comments