diff --git a/src/mods/settings.js b/src/mods/settings.js index 9fc1c2f..d8efb83 100644 --- a/src/mods/settings.js +++ b/src/mods/settings.js @@ -310,7 +310,7 @@ idrinth.settings = { /** * * @param {String} field - * @param {String|Booleab|Number} value + * @param {String|Boolean|Number} value * @returns {undefined} */ change: function ( field, value ) { diff --git a/src/mods/tier.js b/src/mods/tier.js index f99aa6e..23e7563 100644 --- a/src/mods/tier.js +++ b/src/mods/tier.js @@ -353,7 +353,7 @@ idrinth.tier = { }, makeButton ( 'copy', - '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")' + '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")' ), makeButton ( 'tag', @@ -470,5 +470,19 @@ idrinth.tier = { type: document.getElementById ( 'idrinth-tierlist-typesearch' ).value, list: idrinth.tier.list } ); + }, + /** + * + * @param {Boolean} yes + * @returns {undefined} + */ + allCheck: function ( yes ) { + var boxes = document.getElementById ( 'idrinth-raid-may-join-list' ).getElementsByTagName ( 'input' ); + for (var counter = boxes.length - 1; counter >= 0; counter--) { + if ( boxes[counter].getAttribute ( 'type' ) === 'checkbox' && boxes[counter].checked !== yes ) { + boxes[counter].checked = yes; + idrinth.settings.change ( ( boxes[counter].getAttribute ( 'id' ) ).replace ( /idrinth-/, '' ), yes ); + } + } } }; \ No newline at end of file diff --git a/src/mods/ui.js b/src/mods/ui.js index 52122e6..1cb4c13 100644 --- a/src/mods/ui.js +++ b/src/mods/ui.js @@ -1056,17 +1056,57 @@ idrinth.ui = { * @returns {Array} */ var buildRaidJoinList = function () { - return [ { - content: idrinth.text.get ( "raids.clickCopy" ), - type: 'strong' - }, { - id: 'idrinth-raid-link-list' - }, { - content: idrinth.text.get ( "raids.disableSpecific" ), - type: 'strong' - }, { - id: 'idrinth-raid-may-join-list' - } ]; + /** + * + * @param {Array} list + * @param {String} header + * @returns {object} + */ + var wrap = function ( list, header ) { + return { + children: [ + { + type: 'strong', + content: idrinth.text.get ( "raids." + header ) + }, + { + children: list + } + ], + css: 'idrinth-openclick' + }; + }; + return [ + wrap ( [ { + id: 'idrinth-raid-link-list' + } ], + "clickCopy" + ), + wrap ( [ { + content: idrinth.text.get ( "raids.disable.none" ), + type: 'button', + attributes: [ + { + name: 'onclick', + value: 'idrinth.tier.allCheck(false)' + }, { + name: 'style', + value: 'width:50%;' + } ] + }, { + content: idrinth.text.get ( "raids.disable.all" ), + type: 'button', + attributes: [ + { + name: 'onclick', + value: 'idrinth.tier.allCheck(true)' + }, { + name: 'style', + value: 'width:50%;' + } ] + }, { + id: 'idrinth-raid-may-join-list' + } ], "disableSpecific" ) ]; }; return makeTabs ( { 'Actions': buildActions (),