mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-01-19 01:31:34 +00:00
Updated dashboard.js and home.js
Continuation of the previous commit.
This commit is contained in:
parent
5e765f4935
commit
fcdac004f3
@ -364,12 +364,12 @@ page.selectAllFiles = function (element) {
|
||||
var table = document.getElementById('table')
|
||||
var checkboxes = table.getElementsByClassName('file-checkbox')
|
||||
|
||||
for (var checkbox of checkboxes) {
|
||||
var id = parseInt(checkbox.dataset.id)
|
||||
for (var i = 0; i < checkboxes.length; i++) {
|
||||
var id = parseInt(checkboxes[i].dataset.id)
|
||||
if (isNaN(id)) { continue }
|
||||
if (checkbox.checked !== element.checked) {
|
||||
checkbox.checked = element.checked
|
||||
if (checkbox.checked) {
|
||||
if (checkboxes[i].checked !== element.checked) {
|
||||
checkboxes[i].checked = element.checked
|
||||
if (checkboxes[i].checked) {
|
||||
page.selectedFiles.push(id)
|
||||
} else {
|
||||
page.selectedFiles.splice(page.selectedFiles.indexOf(id), 1)
|
||||
@ -450,9 +450,9 @@ page.clearSelection = function () {
|
||||
var table = document.getElementById('table')
|
||||
var checkboxes = table.getElementsByClassName('file-checkbox')
|
||||
|
||||
for (var checkbox of checkboxes) {
|
||||
if (checkbox.checked) {
|
||||
checkbox.checked = false
|
||||
for (var i = 0; i < checkboxes.length; i++) {
|
||||
if (checkboxes[i].checked) {
|
||||
checkboxes[i].checked = false
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,14 +149,12 @@ page.prepareAlbums = function () {
|
||||
return swal('An error occurred!', response.data.description, 'error')
|
||||
}
|
||||
|
||||
var albums = response.data.albums
|
||||
|
||||
// If the user doesn't have any albums we don't really need to display
|
||||
// an album selection
|
||||
if (albums.length === 0) { return }
|
||||
if (!response.data.albums.length) { return }
|
||||
|
||||
// Loop through the albums and create an option for each album
|
||||
for (var album of albums) {
|
||||
for (var album of response.data.albums) {
|
||||
var option = document.createElement('option')
|
||||
option.value = album.id
|
||||
option.innerHTML = album.name
|
||||
|
Loading…
Reference in New Issue
Block a user