From 252bf7995ae860bf400ee5dde058088d50645109 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Sat, 15 Aug 2020 15:54:58 -0500 Subject: [PATCH] eslint nannt --- web/skins/classic/views/js/events.js | 49 ++++++++++++---------------- 1 file changed, 21 insertions(+), 28 deletions(-) diff --git a/web/skins/classic/views/js/events.js b/web/skins/classic/views/js/events.js index 0edddb102..f55e2d132 100644 --- a/web/skins/classic/views/js/events.js +++ b/web/skins/classic/views/js/events.js @@ -19,18 +19,18 @@ function thumbnail_onmouseout(event) { function getIdSelections() { var table = $j('#eventTable'); - - return $j.map(table.bootstrapTable('getSelections'), function (row) { - return row.Id.replace(/(<([^>]+)>)/gi, "") // strip the html from the element before sending - }) + + return $j.map(table.bootstrapTable('getSelections'), function(row) { + return row.Id.replace(/(<([^>]+)>)/gi, ""); // strip the html from the element before sending + }); } function getArchivedSelections() { - var table = $j('#eventTable'); - var selection = $j.map(table.bootstrapTable('getSelections'), function (row) { - return row.Archived - }) - return selection.includes("Yes") + var table = $j('#eventTable'); + var selection = $j.map(table.bootstrapTable('getSelections'), function(row) { + return row.Archived; + }); + return selection.includes("Yes"); } function initPage() { @@ -51,22 +51,20 @@ function initPage() { }); // Manage the VIEW button document.getElementById("viewBtn").addEventListener("click", function onViewClick(evt) { - var table = $j('#eventTable'); var selections = getIdSelections(); - + evt.preventDefault(); var filter = '&filter[Query][terms][0][attr]=Id&filter[Query][terms][0][op]=%3D%5B%5D&filter[Query][terms][0][val]='+selections.join('%2C'); window.location.href = thisUrl+'?view=event&eid='+selections[0]+filter+sortQuery+'&page=1&play=1'; }); // Manage the ARCHIVE button document.getElementById("archiveBtn").addEventListener("click", function onArchiveClick(evt) { - var table = $j('#eventTable'); var selections = getIdSelections(); - + evt.preventDefault(); $j.getJSON(thisUrl + '?view=events&action=archive&eids_json='+JSON.stringify(selections)); window.location.reload(true); - }); + }); // Manage the UNARCHIVE button document.getElementById("unarchiveBtn").addEventListener("click", function onUnarchiveClick(evt) { if ( ! canEditEvents ) { @@ -74,12 +72,11 @@ function initPage() { return; } - var table = $j('#eventTable'); var selections = getIdSelections(); - + evt.preventDefault(); $j.getJSON(thisUrl + '?view=events&action=unarchive&eids_json='+JSON.stringify(selections)); - + if ( openFilterWindow ) { //opener.location.reload(true); createPopup( '?view=filter&page='+thisPage+filterQuery, 'zmFilter', 'filter' ); @@ -94,26 +91,23 @@ function initPage() { alert("You do not have permission to edit events."); return; } - - var table = $j('#eventTable'); + var selections = getIdSelections(); - + evt.preventDefault(); createPopup('?view=eventdetail&eids[]='+selections.join('&eids[]='), 'zmEventDetail', 'eventdetail'); }); // Manage the EXPORT button document.getElementById("exportBtn").addEventListener("click", function onExportClick(evt) { - var table = $j('#eventTable'); var selections = getIdSelections(); - + evt.preventDefault(); window.location.assign('?view=export&eids[]='+selections.join('&eids[]=')); }); // Manage the DOWNLOAD VIDEO button document.getElementById("downloadBtn").addEventListener("click", function onDownloadClick(evt) { - var table = $j('#eventTable'); var selections = getIdSelections(); - + evt.preventDefault(); createPopup('?view=download&eids[]='+selections.join('&eids[]='), 'zmDownload', 'download'); }); @@ -124,9 +118,8 @@ function initPage() { return; } - var table = $j('#eventTable'); var selections = getIdSelections(); - + evt.preventDefault(); $j.getJSON(thisUrl + '?view=events&action=delete&eids[]='+selections.join('&eids[]=')); window.location.reload(true); @@ -146,7 +139,7 @@ $j(document).ready(function() { table.bootstrapTable('hideColumn', 'Archived') table.on('check.bs.table uncheck.bs.table ' + 'check-all.bs.table uncheck-all.bs.table', - function () { + function() { viewBtn.prop('disabled', !(table.bootstrapTable('getSelections').length && canViewEvents)); archiveBtn.prop('disabled', !(table.bootstrapTable('getSelections').length && canEditEvents)); unarchiveBtn.prop('disabled', !(getArchivedSelections()) && canEditEvents); @@ -154,5 +147,5 @@ $j(document).ready(function() { exportBtn.prop('disabled', !(table.bootstrapTable('getSelections').length && canViewEvents)); downloadBtn.prop('disabled', !(table.bootstrapTable('getSelections').length && canViewEvents)); deleteBtn.prop('disabled', !(table.bootstrapTable('getSelections').length && canEditEvents)); - }) + }); });