GooseMod v5.2.0: Updated Module Store's Sidebar UI selector to use Discord's new radio buttons

pull/8/head
Oj18 4 years ago
parent 3d091f1d49
commit 44dc47b531

@ -1,5 +1,11 @@
# GooseMod Changelog
## v5.2.0 [2020-11-30]
- ### Fixes
- Updated Module Store's Sidebar selection UI to use Discord's new radio buttons
## v5.1.2 [2020-11-29]
- ### Fixes

4
dist/index.js vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

@ -99,7 +99,7 @@ const init = async function () {
this.disabledModules = {};
this.lastVersion = localStorage.getItem('goosemodLastVersion');
this.version = '5.1.2';
this.version = '5.2.0';
this.versionHash = '<hash>'; // Hash of built final js file is inserted here via build script
fetch('https://goosemod-api.netlify.app/injectVersion.json').then((x) => x.json().then((latestInjectVersionInfo) => {

@ -905,29 +905,27 @@ export const _createItem = (panelName, content) => {
case 'selector': {
let mainEl = document.createElement('div');
mainEl.classList.add('flex-1xMQg5', 'flex-1O1GKY', 'horizontal-1ae9ci', 'horizontal-2EEEnY', 'flex-1O1GKY', 'directionRow-3v3tfG', 'justifyBetween-2tTqYu', 'alignCenter-1dQNNs', 'noWrap-3jynv6', 'item-3eFBNF');
mainEl.classList.add('item-26Dhrx', 'marginBottom8-AtZOdT', 'horizontal-2EEEnY', 'flex-1O1GKY', 'directionRow-3v3tfG');
mainEl.setAttribute('role', 'radio');
mainEl.style.flex = '1 1 auto';
const selectedClass = 'selected-2DeaDa';
// const selectedClass = 'selected-2DeaDa';
const unselectedHTML = `<div class="flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY flex-1O1GKY directionRow-3v3tfG justifyStart-2NDFzi alignStretch-DpGPf3 noWrap-3jynv6 label-1ZuVT-" style="flex: 0 1 auto;"><label class="checkboxWrapper-SkhIWG alignCenter-MrlN6q flexChild-faoVW3"><input class="inputReadonly-rYU97L input-3ITkQf" type="checkbox" style="width: 24px; height: 24px;"><div class="checkbox-1ix_J3 flexCenter-3_1bcw flex-1O1GKY justifyCenter-3D2jYp alignCenter-1dQNNs round-2jCFai" style="width: 24px; height: 24px; flex: 1 1 auto;"><svg aria-hidden="true" width="18" height="18" viewBox="0 0 24 24"><path fill="transparent" fill-rule="evenodd" clip-rule="evenodd" d="M8.99991 16.17L4.82991 12L3.40991 13.41L8.99991 19L20.9999 7.00003L19.5899 5.59003L8.99991 16.17Z"></path></svg></div><div class="label-cywgfr labelClickable-11AuB8 labelForward-1wfipV" style="line-height: 24px;"><div class="labelText-2kBs7x">${c.text}</div></div></label></div><div class="flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY flex-1O1GKY directionRow-3v3tfG justifyStart-2NDFzi alignStretch-DpGPf3 noWrap-3jynv6" style="flex: 0 1 auto;"><div class="colorStandard-2KCXvj size14-e6ZScH description-3_Ncsb formText-3fs7AJ marginReset-2pBy6s marginReset-236NPn modeDefault-3a2Ph1" style="flex: 1 1 auto;">${c.subText}</div></div>`;
const selectedHTML = `<div class="flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY flex-1O1GKY directionRow-3v3tfG justifyStart-2NDFzi alignStretch-DpGPf3 noWrap-3jynv6 label-1ZuVT-" style="flex: 0 1 auto;"><label class="checkboxWrapper-SkhIWG alignCenter-MrlN6q flexChild-faoVW3"><input class="inputReadonly-rYU97L input-3ITkQf" type="checkbox" checked="" style="width: 24px; height: 24px;"><div class="checkbox-1ix_J3 flexCenter-3_1bcw flex-1O1GKY justifyCenter-3D2jYp alignCenter-1dQNNs round-2jCFai checked-3_4uQ9" style="width: 24px; height: 24px; border-color: rgb(67, 181, 129); flex: 1 1 auto; background-color: rgb(67, 181, 129);"><svg aria-hidden="true" width="18" height="18" viewBox="0 0 24 24"><path fill="#ffffff" fill-rule="evenodd" clip-rule="evenodd" d="M8.99991 16.17L4.82991 12L3.40991 13.41L8.99991 19L20.9999 7.00003L19.5899 5.59003L8.99991 16.17Z"></path></svg></div><div class="label-cywgfr labelClickable-11AuB8 labelForward-1wfipV" style="line-height: 24px;"><div class="labelText-2kBs7x">${c.text}</div></div></label></div><div class="flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY flex-1O1GKY directionRow-3v3tfG justifyStart-2NDFzi alignStretch-DpGPf3 noWrap-3jynv6" style="flex: 0 1 auto;"><div class="colorStandard-2KCXvj size14-e6ZScH description-3_Ncsb formText-3fs7AJ marginReset-2pBy6s marginReset-236NPn modeDefault-3a2Ph1" style="flex: 1 1 auto;">${c.subText}</div></div>`;
// <div class="item-26Dhrx marginBottom8-AtZOdT horizontal-2EEEnY flex-1O1GKY directionRow-3v3tfG" role="radio" aria-checked="true" tabindex="0"><div class="radioBar-bMNUI-" style="padding: 10px;"><svg aria-hidden="false" width="24" height="24" viewBox="0 0 24 24"><path fill-rule="evenodd" clip-rule="evenodd" d="M12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z" fill="currentColor"></path><circle cx="12" cy="12" r="5" class="radioIconForeground-XwlXQN" fill="currentColor"></circle></svg><div class="info-3LOr12"><div class="size16-1P40sf title-3BE6m5"><div class="option-2Mjq18"><span class="localeName-2oaRo4">English, US</span><span class="localizedName-2dYMQh">English, US</span><div class="flag-Ve4YnP" aria-hidden="true"><img alt="" src="/assets/e6d6b255259ac878d00819a9555072ad.png" class="flagImage-3Wbkq4"></div></div></div></div></div></div>
const unselectedHTML = `<div class="radioBar-bMNUI-" style="padding: 10px;"><svg aria-hidden="false" width="24" height="24" viewBox="0 0 24 24"><path fill-rule="evenodd" clip-rule="evenodd" d="M12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z" fill="currentColor"></path></svg><div class="info-3LOr12"><div class="size16-1P40sf title-3BE6m5"><div class="option-2Mjq18"><span class="localeName-2oaRo4">${c.text}</span><span class="localizedName-2dYMQh">${c.subText}</span></div></div></div></div>`;
const selectedHTML = `<div class="radioBar-bMNUI-" style="padding: 10px;"><svg aria-hidden="false" width="24" height="24" viewBox="0 0 24 24"><path fill-rule="evenodd" clip-rule="evenodd" d="M12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z" fill="currentColor"></path><circle cx="12" cy="12" r="5" class="radioIconForeground-XwlXQN" fill="currentColor"></circle></svg><div class="info-3LOr12"><div class="size16-1P40sf title-3BE6m5"><div class="option-2Mjq18"><span class="localeName-2oaRo4">${c.text}</span><span class="localizedName-2dYMQh">${c.subText}</span></div></div></div></div>`;
let selected = c.selected();
mainEl.setAttribute('aria-checked', selected.toString());
mainEl.innerHTML = selected ? selectedHTML : unselectedHTML;
if (selected) {
mainEl.classList.add(selectedClass);
}
mainEl.onclick = () => {
selected = !selected;
if (selected) {
mainEl.classList.add(selectedClass);
} else {
mainEl.classList.remove(selectedClass);
}
mainEl.setAttribute('aria-checked', selected.toString());
mainEl.innerHTML = selected ? selectedHTML : unselectedHTML;
@ -1318,12 +1316,10 @@ export const makeGooseModSettings = () => {
let selectors = {};
const selectedClass = 'selected-2DeaDa';
for (let s of [...parentEl.children[0].children[4].children]) {
if (!s.classList.contains('flex-1xMQg5')) continue;
if (!s.classList.contains('item-26Dhrx')) continue;
selectors[s.children[0].children[0].children[2].innerText.toLowerCase()] = s.classList.contains(selectedClass);
selectors[s.children[0].children[1].children[0].children[0].children[0].textContent.toLowerCase()] = s.getAttribute('aria-checked') === 'true'; //s.classList.contains(selectedClass);
}
for (let c of cards) {

Loading…
Cancel
Save