Skip to content

Commit

Permalink
fixed options menu
Browse files Browse the repository at this point in the history
  • Loading branch information
kiawildberger committed Aug 14, 2020
1 parent a4379a0 commit bd1fe6a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
22 changes: 10 additions & 12 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,6 @@ function id(e) { return document.getElementById(e) }
let loggedin = false;
let cdnUrl = /https?:\/\/cdn.discordapp.com\/attachments\/\d+\/\d+\/[a-zA-Z0-9_-]+\.[a-zA-Z]{2,5}/g
let imagetypes = ["jpg", "JPG", 'png', 'PNG', 'gif', 'GIF', 'webp', 'WEBP', 'tiff', 'TIFF', 'jpeg', 'JPEG', 'svg', 'SVG']


// populate settings with appropriate values
if (Rsettings.cachedlength) id('cachedlength').value = Rsettings.cachedlength

if (!conf[0]) {
id("clearcache").disabled = true;
id("clearcache").setAttribute('title', 'no tokens to clear')
}

// voice?

let gids = [], index = 0, currentchannel;
ipcRenderer.on("msg", processmsg)
function processmsg(event, arg) {
Expand Down Expand Up @@ -221,17 +209,27 @@ id('cached-btn').addEventListener('click', () => {
}
})
id('topt').addEventListener('click', () => {
document.querySelector('.container').style.display = 'none'
id('options').style.display = "block"
// populate settings with stored values
if (Rsettings.cachedlength) id('cachedlength').value = Rsettings.cachedlength
if (!Object.keys(require("./config.json"))) {
id("clearcache").disabled = true;
id("clearcache").setAttribute('title', 'no tokens to clear')
}
})
id("leaveopts").addEventListener("click", () => { // write settings to settings.json
id('options').style.display = "none"
document.querySelector('.container').style.display = 'block'
let settings = {
cachedlength: id("cachedlength").value
}
fs.writeFileSync("./settings.json", JSON.stringify(settings))
})
id('clearcache').addEventListener("click", () => {
fs.writeFileSync("./config.json", "{ }")
id('clearcache').disabled = true
id("clearcache").setAttribute('title', 'no tokens to clear')
document.querySelector("label[for='clearcache']").style.display = 'block'
setTimeout(() => document.querySelector("label[for='clearcache']").style.display = 'none', 1500)
})
4 changes: 2 additions & 2 deletions src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ select {
width:10em;
}
.user-img { width:150px; margin:0 0 1em 1em; border-left:2px solid green; padding-left:4px; display:block; }
#topt { position:absolute; bottom: 0; cursor:pointer; padding:6px 6px 6px 6px; z-index:2; background-color:#4A4D5D; }
#topt { position:absolute; bottom: 0; cursor:pointer; padding-bottom:6px; z-index:2; background-color:#4A4D5D; }
#topt:hover {text-decoration:underline;}
#options { width:100%; height:100%; z-index:69; background:#4A4D5D; }
#options { width:100%; height:100%; background:#4A4D5D; }
#leaveopts { position:absolute; right:0; bottom:0; }
label[for="clearcache"] { color:coral; font-size:14px; margin-left:1em; }

Expand Down

0 comments on commit bd1fe6a

Please sign in to comment.