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

Commit 34011d5

Browse files
authored
Merge pull request #316 from IDotD/idrinth
fixes #315
2 parents 2c07b34 + c339bea commit 34011d5

3 files changed

Lines changed: 67 additions & 13 deletions

File tree

src/mods/settings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ idrinth.settings = {
310310
/**
311311
*
312312
* @param {String} field
313-
* @param {String|Booleab|Number} value
313+
* @param {String|Boolean|Number} value
314314
* @returns {undefined}
315315
*/
316316
change: function ( field, value ) {

src/mods/tier.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ idrinth.tier = {
353353
},
354354
makeButton (
355355
'copy',
356-
'idrinth.core.copyToClipboard.text("' + boss.name + '(NM): OS ' + idrinth.ui.formatNumber ( boss.os.nm ) + ', FS ' + idrinth.ui.formatNumber ( boss.fs.nm ) + ', Tiers ' + formattedList ( boss.nm ) + ' by IDotD")'
356+
'idrinth.core.copyToClipboard.text("' + boss.name + '(NM): OS ' + idrinth.ui.formatNumber ( boss.os.nm ) + ', AP ' + idrinth.ui.formatNumber ( boss.ap ) + ', Tiers ' + formattedList ( boss.nm ) + ' by IDotD")'
357357
),
358358
makeButton (
359359
'tag',
@@ -470,5 +470,19 @@ idrinth.tier = {
470470
type: document.getElementById ( 'idrinth-tierlist-typesearch' ).value,
471471
list: idrinth.tier.list
472472
} );
473+
},
474+
/**
475+
*
476+
* @param {Boolean} yes
477+
* @returns {undefined}
478+
*/
479+
allCheck: function ( yes ) {
480+
var boxes = document.getElementById ( 'idrinth-raid-may-join-list' ).getElementsByTagName ( 'input' );
481+
for (var counter = boxes.length - 1; counter >= 0; counter--) {
482+
if ( boxes[counter].getAttribute ( 'type' ) === 'checkbox' && boxes[counter].checked !== yes ) {
483+
boxes[counter].checked = yes;
484+
idrinth.settings.change ( ( boxes[counter].getAttribute ( 'id' ) ).replace ( /idrinth-/, '' ), yes );
485+
}
486+
}
473487
}
474488
};

src/mods/ui.js

Lines changed: 51 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,17 +1056,57 @@ idrinth.ui = {
10561056
* @returns {Array}
10571057
*/
10581058
var buildRaidJoinList = function () {
1059-
return [ {
1060-
content: idrinth.text.get ( "raids.clickCopy" ),
1061-
type: 'strong'
1062-
}, {
1063-
id: 'idrinth-raid-link-list'
1064-
}, {
1065-
content: idrinth.text.get ( "raids.disableSpecific" ),
1066-
type: 'strong'
1067-
}, {
1068-
id: 'idrinth-raid-may-join-list'
1069-
} ];
1059+
/**
1060+
*
1061+
* @param {Array} list
1062+
* @param {String} header
1063+
* @returns {object}
1064+
*/
1065+
var wrap = function ( list, header ) {
1066+
return {
1067+
children: [
1068+
{
1069+
type: 'strong',
1070+
content: idrinth.text.get ( "raids." + header )
1071+
},
1072+
{
1073+
children: list
1074+
}
1075+
],
1076+
css: 'idrinth-openclick'
1077+
};
1078+
};
1079+
return [
1080+
wrap ( [ {
1081+
id: 'idrinth-raid-link-list'
1082+
} ],
1083+
"clickCopy"
1084+
),
1085+
wrap ( [ {
1086+
content: idrinth.text.get ( "raids.disable.none" ),
1087+
type: 'button',
1088+
attributes: [
1089+
{
1090+
name: 'onclick',
1091+
value: 'idrinth.tier.allCheck(false)'
1092+
}, {
1093+
name: 'style',
1094+
value: 'width:50%;'
1095+
} ]
1096+
}, {
1097+
content: idrinth.text.get ( "raids.disable.all" ),
1098+
type: 'button',
1099+
attributes: [
1100+
{
1101+
name: 'onclick',
1102+
value: 'idrinth.tier.allCheck(true)'
1103+
}, {
1104+
name: 'style',
1105+
value: 'width:50%;'
1106+
} ]
1107+
}, {
1108+
id: 'idrinth-raid-may-join-list'
1109+
} ], "disableSpecific" ) ];
10701110
};
10711111
return makeTabs ( {
10721112
'Actions': buildActions (),

0 commit comments

Comments
 (0)