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

Commit 95ad9a9

Browse files
committed
prettyfiing branch
1 parent 15fd3cb commit 95ad9a9

19 files changed

Lines changed: 6135 additions & 5186 deletions

src/libs/big.js

Lines changed: 750 additions & 838 deletions
Large diffs are not rendered by default.

src/libs/matches-selector-polyfill.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22
* from https://developer.mozilla.org/de/docs/Web/API/Element/matches
33
*/
44
Element.prototype.matches =
5-
Element.prototype.matches ||
6-
Element.prototype.matchesSelector ||
7-
Element.prototype.mozMatchesSelector ||
8-
Element.prototype.msMatchesSelector ||
9-
Element.prototype.oMatchesSelector ||
10-
Element.prototype.webkitMatchesSelector ||
11-
function ( s ) {
12-
var matches = ( this.document || this.ownerDocument ).querySelectorAll ( s );
13-
var i = matches.length;
14-
while ( --i >= 0 ) {
15-
if ( matches.item ( i ) === this ) {
16-
return true;
17-
}
18-
}
19-
return false;
20-
};
5+
Element.prototype.matches ||
6+
Element.prototype.matchesSelector ||
7+
Element.prototype.mozMatchesSelector ||
8+
Element.prototype.msMatchesSelector ||
9+
Element.prototype.oMatchesSelector ||
10+
Element.prototype.webkitMatchesSelector ||
11+
function(s) {
12+
var matches = (this.document || this.ownerDocument).querySelectorAll(s);
13+
var i = matches.length;
14+
while (--i >= 0) {
15+
if (matches.item(i) === this) {
16+
return true;
17+
}
18+
}
19+
return false;
20+
};

src/loader.js

Lines changed: 69 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -27,51 +27,73 @@
2727
// @include https://web1.dawnofthedragons.com/*
2828
// @include https://50.18.191.15/*
2929
// ==/UserScript==
30-
( function () {
31-
if(window.location.host==='50.18.191.15'||window.location.host==='web1.dawnofthedragons.com') {
32-
window.idrinth = {};
33-
window.idrinth.add=function(data) {
34-
var s=document.createElement('script');
35-
s.appendChild(document.createTextNode(data));
36-
document.getElementsByTagName('head')[0].appendChild(s);
37-
};
38-
window.addEventListener(
39-
"message",
40-
function (event){
41-
try{
42-
var data = JSON.parse(event.data);
43-
if(data.to !== 'idotd'||!window.idrinth.hasOwnProperty (data.task)||!data.data) {
44-
return;
45-
}
46-
window.idrinth[data.task](data.data);
47-
} catch(e) {
48-
//nothing
49-
}
50-
},
51-
false
52-
);
53-
return;
54-
}
55-
var sc = document.createElement ( 'script' );
56-
sc.setAttribute ( 'src', 'https://dotd.idrinth.de/static/userscript/' + GM_info.script.version + '/' );
57-
sc.setAttribute ( 'id', 'idotd-loader' );
58-
sc.setAttribute ( 'async', 'async' );
59-
sc.errorCounter = 0;
60-
sc.errorFunction = function () {
61-
var self = document.getElementById ( 'idotd-loader' );
62-
self.parentNode.removeChild ( self );
63-
var sc = document.createElement ( 'script' );
64-
sc.onerror = self.onerror;
65-
sc.errorCounter = self.errorCounter + 1;
66-
sc.errorFunction = self.errorFunction;
67-
sc.setAttribute ( 'id', 'idotd-loader' );
68-
sc.setAttribute ( 'async', 'async' );
69-
sc.setAttribute ( 'src', ( self.getAttribute ( 'src' ) + '' ).replace ( /(userscript\/.*?\/).*$/, '$1' ) + Math.random () + '/' );
70-
document.getElementsByTagName ( 'head' )[0].appendChild ( sc );
30+
(function() {
31+
if (
32+
window.location.host === "50.18.191.15" ||
33+
window.location.host === "web1.dawnofthedragons.com"
34+
) {
35+
window.idrinth = {};
36+
window.idrinth.add = function(data) {
37+
var s = document.createElement("script");
38+
s.appendChild(document.createTextNode(data));
39+
document.getElementsByTagName("head")[0].appendChild(s);
7140
};
72-
sc.onerror = function () {
73-
console.log ( "Failed loading IDotD, retry in " + ( 500 + 100 * this.errorCounter * this.errorCounter ) / 1000 + "sec." );
74-
window.setTimeout ( this.errorFunction, 500 + 100 * this.errorCounter * this.errorCounter );
75-
};
76-
document.getElementsByTagName ( 'head' )[0].appendChild ( sc );
77-
} () );
41+
window.addEventListener(
42+
"message",
43+
function(event) {
44+
try {
45+
var data = JSON.parse(event.data);
46+
if (
47+
data.to !== "idotd" ||
48+
!window.idrinth.hasOwnProperty(data.task) ||
49+
!data.data
50+
) {
51+
return;
52+
}
53+
window.idrinth[data.task](data.data);
54+
} catch (e) {
55+
//nothing
56+
}
57+
},
58+
false
59+
);
60+
return;
61+
}
62+
var sc = document.createElement("script");
63+
sc.setAttribute(
64+
"src",
65+
"https://dotd.idrinth.de/static/userscript/" + GM_info.script.version + "/"
66+
);
67+
sc.setAttribute("id", "idotd-loader");
68+
sc.setAttribute("async", "async");
69+
sc.errorCounter = 0;
70+
sc.errorFunction = function() {
71+
var self = document.getElementById("idotd-loader");
72+
self.parentNode.removeChild(self);
73+
var sc = document.createElement("script");
74+
sc.onerror = self.onerror;
75+
sc.errorCounter = self.errorCounter + 1;
76+
sc.errorFunction = self.errorFunction;
77+
sc.setAttribute("id", "idotd-loader");
78+
sc.setAttribute("async", "async");
79+
sc.setAttribute(
80+
"src",
81+
(self.getAttribute("src") + "").replace(/(userscript\/.*?\/).*$/, "$1") +
82+
Math.random() +
83+
"/"
84+
);
85+
document.getElementsByTagName("head")[0].appendChild(sc);
86+
};
87+
sc.onerror = function() {
88+
console.log(
89+
"Failed loading IDotD, retry in " +
90+
(500 + 100 * this.errorCounter * this.errorCounter) / 1000 +
91+
"sec."
92+
);
93+
window.setTimeout(
94+
this.errorFunction,
95+
500 + 100 * this.errorCounter * this.errorCounter
96+
);
97+
};
98+
document.getElementsByTagName("head")[0].appendChild(sc);
99+
})();

0 commit comments

Comments
 (0)