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

Commit f083514

Browse files
authored
Merge pull request #139 from Idrinth/idrinth
not waiting for codacy, since it considers my commits fine and still didn't even start checking the pull request
2 parents 0ceea0a + d8f58fd commit f083514

File tree

5 files changed

+33
-18
lines changed

5 files changed

+33
-18
lines changed

Diff for: .lgtm

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
pattern = "(?i)^(:shipit:|:\\+1:|LGTM|Approved|Looks\\sGood\\sTo\\sMe)"
1+
pattern = "(?i)^(:shipit:|:\\+1:|LGTM|Approved|Looks\\s+Good\\s+To\\s+Me|Seems\\s+good|Looks\\s+good)"
22
approvals = 1
33
self_approval_off = true

Diff for: src/mods/chat.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -725,16 +725,17 @@ idrinth.chat = {
725725
);
726726
}, 2500 );
727727
window.setTimeout ( function () {
728-
idrinth.core.ajax.run (
729-
'https://dotd.idrinth.de/static/emoticons/data/',
728+
idrinth.core.ajax.runHome (
729+
'emoticons/data/',
730730
function ( reply ) {
731731
idrinth.chat.emotes = JSON.parse ( reply );
732732
},
733733
function ( reply ) {
734734
},
735735
function ( reply ) {
736736
},
737-
''
737+
'',
738+
true
738739
);
739740
}, 1 );
740741
},

Diff for: src/mods/core.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ idrinth.core = {
66
return parent && typeof parent === 'object' && field && parent.hasOwnProperty ( field ) && typeof parent[field] !== 'object' && typeof parent[field] !== 'function';
77
},
88
ajax: {
9-
runHome: function ( url, success, failure, timeout, additionalHeader ) {
10-
var homeUrl = 'https://dotd.idrinth.de/' + ( idrinth.settings.isWorldServer ? 'world-' : '' ) + idrinth.platform + ( '/' + url ).replace ( /\/\// );
11-
idrinth.core.ajax.run ( homeUrl, success, failure, timeout, additionalHeader )
9+
runHome: function ( url, success, failure, timeout, additionalHeader, isStatic ) {
10+
var homeUrl = 'https://dotd.idrinth.de/' + isStatic ? 'static/' : ( ( idrinth.settings.isWorldServer ? 'world-' : '' ) + idrinth.platform ) + ( '/' + url ).replace ( /\/\//, '/' );
11+
idrinth.core.ajax.run ( homeUrl, success, failure, timeout, additionalHeader );
1212
},
1313
active: { },
1414
run: function ( url, success, failure, timeout, additionalHeader ) {
@@ -23,7 +23,7 @@ idrinth.core = {
2323
try {
2424
return func ( value );
2525
} catch ( e ) {
26-
idrinth.core.log ( e.getMessage () );
26+
idrinth.core.log ( typeof e.getMessage === 'function' ? e.getMessage () : e );
2727
return null;
2828
}
2929
};

Diff for: src/mods/war.js

+10-8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ idrinth.war = {
22
from: null,
33
to: null,
44
element: null,
5+
warTO: null,
6+
setTO: function ( ) {
7+
if ( !idrinth.war.warTO ) {
8+
idrinth.war.warTO = window.setTimeout ( idrinth.war.getData, 1000 );
9+
}
10+
},
511
getData: function () {
612
var raids2Join = function () {
713
var list = [ ];
@@ -18,12 +24,8 @@ idrinth.war = {
1824
idrinth.core.ajax.runHome (
1925
"war-service/" + raids2Join () + "/" + Date.now () + "/",
2026
idrinth.war.updateData,
21-
function () {
22-
window.setTimeout ( idrinth.war.getData, 1000 );
23-
},
24-
function () {
25-
window.setTimeout ( idrinth.war.getData, 2000 );
26-
},
27+
idrinth.war.setTO,
28+
idrinth.war.setTO,
2729
idrinth.raids.knowRaids ()
2830
);
2931
},
@@ -178,7 +180,7 @@ idrinth.war = {
178180
}
179181
};
180182
process ( data );
181-
window.setTimeout ( idrinth.war.getData, 50000 + Math.random () % 20000 );
183+
idrinth.war.setTO ();
182184
},
183185
start: function () {
184186
var build = function ( ) {
@@ -239,7 +241,7 @@ idrinth.war = {
239241
);
240242
idrinth.ui.body.appendChild ( idrinth.war.element );
241243
};
242-
window.setTimeout ( idrinth.war.getData, 5000 );
244+
idrinth.war.warTO = window.setTimeout ( idrinth.war.getData, 5000 );
243245
build ();
244246
}
245247
};

Diff for: src/stable.js

+14-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,19 @@ var idrinth = {
8888
idrinth.settings.newgroundLoad * 1000 );
8989
}
9090
},
91-
reload: function () {
91+
clearTimeout: function ( timeout ) {
92+
if ( timeout ) {
93+
try {
94+
window.clearTimeout ( timeout );
95+
} catch ( e ) {
96+
idrinth.core.log ( typeof e.getMessage === 'function' ? e.getMessage : e )
97+
}
98+
}
99+
},
100+
reload: function ( ) {
101+
idrinth.clearTimeout ( idrinth.chat.updateTimeout );
102+
idrinth.clearTimeout ( idrinth.war.warTO );
103+
idrinth.raids.clearInterval ();
92104
idrinth.ui.removeElement ( 'idrinth-controls' );
93105
idrinth.ui.removeElement ( 'idrinth-chat' );
94106
idrinth.ui.removeElement ( 'idrinth-war' );
@@ -100,7 +112,7 @@ var idrinth = {
100112
}, 1 );
101113
},
102114
platform: '',
103-
startInternal: function () {
115+
startInternal: function ( ) {
104116
var startModules = function () {
105117
idrinth.settings.start ( );
106118
idrinth.ui.start ( );

0 commit comments

Comments
 (0)