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

Commit 955e2a7

Browse files
authored
Merge pull request #292 from IDotD/idrinth
Idrinth
2 parents 13d31c2 + 7c30176 commit 955e2a7

5 files changed

Lines changed: 26 additions & 111 deletions

File tree

src/mods/facebook.js

Lines changed: 0 additions & 34 deletions
This file was deleted.

src/mods/inframe.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,22 @@ idrinth.inframe = {
4848
}
4949
}
5050
};
51+
/**
52+
* @returns {undefined}
53+
*/
54+
var joinRaid = function(data) {
55+
var requestHandler = new XMLHttpRequest ( );
56+
requestHandler.timeout = 30000;
57+
var error = function ( event ) {
58+
console.log ( 'Request to ' + ( event || window.event ).target._url + ' failed.' );
59+
};
60+
requestHandler.ontimeout = error;
61+
requestHandler.onerror = error;
62+
requestHandler.onabort = error;
63+
requestHandler.open ( "GET", data, true );
64+
requestHandler.withCredentials = true;
65+
requestHandler.send ( );
66+
};
5167
/**
5268
* @param {HTMLElement} parent
5369
*/
@@ -65,6 +81,7 @@ idrinth.inframe = {
6581
handleFrame ( document.getElementById ( 'gamefilearea' ) );
6682
}
6783
idrinth.inframe.send ( 'add', 'window.idrinth.reload=' + reload.toString () + ';' );
84+
idrinth.inframe.send ( 'add', 'window.idrinth.joinRaid=' + joinRaid.toString () + ';' );
6885
} catch ( e ) {
6986
idrinth.core.log ( 'failed to find frame' );
7087
}

src/mods/raids.js

Lines changed: 9 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -277,65 +277,16 @@ idrinth.raids = {
277277
* @returns {function[]}
278278
*/
279279
var getServerMethods = function () {
280-
var byAjax = function ( key ) {
281-
idrinth.core.ajax.run (
282-
idrinth.raids.join.getServerLink ( key ),
283-
function () {
284-
idrinth.raids.join.messages.success ( key );
285-
},
286-
function () {
287-
idrinth.raids.join.messages.failed ( key );
288-
},
289-
function () {
290-
idrinth.raids[key].joined = false;
291-
idrinth.raids.join.messages.failed ( key );
292-
}
293-
);
294-
};
295280
/**
296281
*
297282
* @param {String} key
298-
* @returns {undefined}
283+
* @returns {Function}
299284
*/
300-
var byFrame = function ( key ) {
301-
var exist = document.getElementsByClassName ( 'idrinth-join-frame' ).length;
302-
if ( exist >= idrinth.settings.get ( "windows" ) ) {
303-
idrinth.raids.list[key].joined = false;
304-
return;
305-
}
306-
var frame = idrinth.ui.buildElement ( {
307-
type: 'iframe',
308-
css: 'idrinth-join-frame',
309-
id: 'join-' + key,
310-
attributes: [
311-
{
312-
name: 'src',
313-
value: idrinth.raids.join.getServerLink ( key )
314-
},
315-
{
316-
name: 'sandbox',
317-
value: 'allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts'
318-
},
319-
{
320-
name: 'style',
321-
value: 'top:' + exist + 'px;'
322-
},
323-
{
324-
name: 'onload',
325-
value: 'try{event.stopPropagation();}catch(e){}idrinth.core.timeouts.add(\'raids.join.cleanup.' + key + '\',{function(){idrinth.ui.removeElement(\'' + key + '\');},1234);'
326-
},
327-
{
328-
name: 'onunload',
329-
value: 'try{event.stopPropagation();}catch(e){}'
330-
}
331-
]
332-
} );
333-
( ( function ( key ) {
334-
return idrinth.core.timeouts.add ( 'raids.join.remove.' + key, function () {
335-
idrinth.ui.removeElement ( 'join-' + key );
336-
}, 30000 );
337-
} ) ( key ) );
338-
idrinth.ui.base.appendChild ( frame );
285+
var byMessage = function(key) {
286+
idrinth.inframe.send (
287+
'joinRaid',
288+
(idrinth.raids.join.getServerLink ( key )).replace(/^.*raidjoin\.php/,'raidjoin.php')
289+
);
339290
idrinth.raids.join.messages.trying ( key );
340291
};
341292
/**
@@ -368,10 +319,8 @@ idrinth.raids = {
368319
}
369320
};
370321
var options = [ postLink ];
371-
if ( idrinth.platform === 'armorgames' || idrinth.platform === 'kongregate' ) {
372-
options.push ( byAjax );
373-
} else if ( idrinth.platform === 'facebook' || idrinth.platform === 'dawnofthedragons' ) {
374-
options.push ( byFrame );
322+
if ( idrinth.platform === 'armorgames' || idrinth.platform === 'kongregate') {
323+
options.push ( byMessage );
375324
}
376325
return options;
377326
};
@@ -381,7 +330,7 @@ idrinth.raids = {
381330
* @returns {Boolean}
382331
*/
383332
var reachedMax = function ( amount ) {
384-
return amount > 99 || ( ( idrinth.platform === 'facebook' || idrinth.platform === 'dawnofthedragons' ) && amount >= idrinth.settings.get ( "windows" ) );
333+
return amount > 99;
385334
};
386335
/**
387336
*

src/mods/settings.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,6 @@ idrinth.settings = {
4949
* @type Number
5050
*/
5151
timeout: 5000,
52-
/**
53-
*
54-
* @type Number
55-
*/
56-
loadtime: 5000,
57-
/**
58-
*
59-
* @type Number
60-
*/
61-
windows: 3,
6252
/**
6353
*
6454
* @type Boolean

src/mods/ui.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,6 @@ idrinth.ui = {
537537
buttonMaker ( idrinth.text.get ( "raids.clear" ), 'idrinth.raids.clearAll();' ),
538538
buttonMaker ( idrinth.text.get ( "button.reloadScript" ), 'idrinth.reload();' ),
539539
buttonMaker ( idrinth.text.get ( "raids.imports.restart" ), 'idrinth.raids.start();' ),
540-
buttonMaker ( idrinth.text.get ( "button.refreshFBGameLogin" ), 'idrinth.facebook.rejoin()', 'facebook' ),
541540
buttonMaker ( idrinth.text.get ( "button.ngRaidJoin" ), 'idrinth.newgrounds.joinRaids()', 'newgrounds' ),
542541
buttonMaker ( idrinth.settings.get ( "alarmActive" ) ? idrinth.text.get ( "button.disableTimedAutoJoin" ) : idrinth.text.get ( "button.enableTimedAutoJoin" ),
543542
'idrinth.settings.change(\'alarmActive\',!idrinth.settings.get("alarmActive"));this.innerHTML=idrinth.settings.get("alarmActive") ? idrinth.text.get ( "button.disableTimedAutoJoin" ):"button.enableTimedAutoJoin"', 'newgrounds' )
@@ -714,12 +713,6 @@ idrinth.ui = {
714713
type: 'text',
715714
platforms: [ 'newgrounds' ],
716715
label: "ui.timeAutoJoin"
717-
}, {
718-
name: 'windows',
719-
rType: '#input',
720-
type: 'number',
721-
platforms: [ 'dawnofthedragons', 'facebook' ],
722-
label: "ui.maxPopupsFrame"
723716
} ], 'raidjoining' ),
724717
wrap ( [ {
725718
name: 'chatting',

0 commit comments

Comments
 (0)