Merge pull request #3181 from ColorlibHQ/lgtm-test

fix lgtm warnings/recommendations
pull/3182/head
REJack 2020-11-30 10:02:54 +01:00 committed by GitHub
commit c6926a5eea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 36 additions and 30 deletions

View File

@ -88,10 +88,10 @@ class IFrame {
const navId = `tab-${uniqueName}-${Math.floor(Math.random() * 1000)}` const navId = `tab-${uniqueName}-${Math.floor(Math.random() * 1000)}`
const newNavItem = `<li class="nav-item" role="presentation"><a class="nav-link" data-toggle="row" id="${navId}" href="#${tabId}" role="tab" aria-controls="${tabId}" aria-selected="false">${title}</a></li>` const newNavItem = `<li class="nav-item" role="presentation"><a class="nav-link" data-toggle="row" id="${navId}" href="#${tabId}" role="tab" aria-controls="${tabId}" aria-selected="false">${title}</a></li>`
$(SELECTOR_TAB_NAVBAR_NAV).append(newNavItem) $(SELECTOR_TAB_NAVBAR_NAV).append(escape(newNavItem))
const newTabItem = `<div class="tab-pane fade" id="${tabId}" role="tabpanel" aria-labelledby="${navId}"><iframe src="${link}"></iframe></div>` const newTabItem = `<div class="tab-pane fade" id="${tabId}" role="tabpanel" aria-labelledby="${navId}"><iframe src="${link}"></iframe></div>`
$(SELECTOR_TAB_CONTENT).append(newTabItem) $(SELECTOR_TAB_CONTENT).append(escape(newTabItem))
if (autoOpen) { if (autoOpen) {
if (this._config.loadingScreen) { if (this._config.loadingScreen) {

View File

@ -101,7 +101,7 @@ class SidebarSearch {
this._addNotFound() this._addNotFound()
} else { } else {
endResults.each((i, result) => { endResults.each((i, result) => {
$(SELECTOR_SEARCH_RESULTS_GROUP).append(this._renderItem(result.name, result.link, result.path)) $(SELECTOR_SEARCH_RESULTS_GROUP).append(this._renderItem(escape(result.name), escape(result.link), escape(result.path)))
}) })
} }

View File

@ -265,3 +265,5 @@ $(function () {
options: salesGraphChartOptions options: salesGraphChartOptions
}) })
}) })
// lgtm [js/unused-local-variable]

View File

@ -266,3 +266,5 @@ $(function () {
// ] // ]
// }) // })
}) })
// lgtm [js/unused-local-variable]

View File

@ -143,3 +143,5 @@ $(function () {
} }
}) })
}) })
// lgtm [js/unused-local-variable]

View File

@ -1077,7 +1077,7 @@
} }
// This will get the first returned node in the jQuery collection. // This will get the first returned node in the jQuery collection.
var areaChart = new Chart(areaChartCanvas, { new Chart(areaChartCanvas, {
type: 'line', type: 'line',
data: areaChartData, data: areaChartData,
options: areaChartOptions options: areaChartOptions
@ -1126,7 +1126,7 @@
} }
//Create pie or douhnut chart //Create pie or douhnut chart
// You can switch between pie and douhnut using the method below. // You can switch between pie and douhnut using the method below.
var donutChart = new Chart(donutChartCanvas, { new Chart(donutChartCanvas, {
type: 'doughnut', type: 'doughnut',
data: donutData, data: donutData,
options: donutOptions options: donutOptions
@ -1144,7 +1144,7 @@
} }
//Create pie or douhnut chart //Create pie or douhnut chart
// You can switch between pie and douhnut using the method below. // You can switch between pie and douhnut using the method below.
var pieChart = new Chart(pieChartCanvas, { new Chart(pieChartCanvas, {
type: 'pie', type: 'pie',
data: pieData, data: pieData,
options: pieOptions options: pieOptions
@ -1166,7 +1166,7 @@
datasetFill : false datasetFill : false
} }
var barChart = new Chart(barChartCanvas, { new Chart(barChartCanvas, {
type: 'bar', type: 'bar',
data: barChartData, data: barChartData,
options: barChartOptions options: barChartOptions
@ -1191,7 +1191,7 @@
} }
} }
var stackedBarChart = new Chart(stackedBarChartCanvas, { new Chart(stackedBarChartCanvas, {
type: 'bar', type: 'bar',
data: stackedBarChartData, data: stackedBarChartData,
options: stackedBarChartOptions options: stackedBarChartOptions

View File

@ -1730,26 +1730,26 @@
$('.my-colorpicker2').on('colorpickerChange', function(event) { $('.my-colorpicker2').on('colorpickerChange', function(event) {
$('.my-colorpicker2 .fa-square').css('color', event.color.toString()); $('.my-colorpicker2 .fa-square').css('color', event.color.toString());
}); })
$("input[data-bootstrap-switch]").each(function(){ $("input[data-bootstrap-switch]").each(function(){
$(this).bootstrapSwitch('state', $(this).prop('checked')); $(this).bootstrapSwitch('state', $(this).prop('checked'));
}); })
}) })
// BS-Stepper Init // BS-Stepper Init
document.addEventListener('DOMContentLoaded', function () { document.addEventListener('DOMContentLoaded', function () {
window.stepper = new Stepper(document.querySelector('.bs-stepper')) window.stepper = new Stepper(document.querySelector('.bs-stepper'))
}); })
// DropzoneJS Demo Code Start // DropzoneJS Demo Code Start
Dropzone.autoDiscover = false; Dropzone.autoDiscover = false
// Get the template HTML and remove it from the doumenthe template HTML and remove it from the doument // Get the template HTML and remove it from the doumenthe template HTML and remove it from the doument
var previewNode = document.querySelector("#template"); var previewNode = document.querySelector("#template")
previewNode.id = ""; previewNode.id = ""
var previewTemplate = previewNode.parentNode.innerHTML; var previewTemplate = previewNode.parentNode.innerHTML
previewNode.parentNode.removeChild(previewNode); previewNode.parentNode.removeChild(previewNode)
var myDropzone = new Dropzone(document.body, { // Make the whole body a dropzone var myDropzone = new Dropzone(document.body, { // Make the whole body a dropzone
url: "/target-url", // Set the url url: "/target-url", // Set the url
@ -1760,39 +1760,39 @@
autoQueue: false, // Make sure the files aren't queued until manually added autoQueue: false, // Make sure the files aren't queued until manually added
previewsContainer: "#previews", // Define the container to display the previews previewsContainer: "#previews", // Define the container to display the previews
clickable: ".fileinput-button" // Define the element that should be used as click trigger to select files. clickable: ".fileinput-button" // Define the element that should be used as click trigger to select files.
}); })
myDropzone.on("addedfile", function(file) { myDropzone.on("addedfile", function(file) {
// Hookup the start button // Hookup the start button
file.previewElement.querySelector(".start").onclick = function() { myDropzone.enqueueFile(file); }; file.previewElement.querySelector(".start").onclick = function() { myDropzone.enqueueFile(file) }
}); })
// Update the total progress bar // Update the total progress bar
myDropzone.on("totaluploadprogress", function(progress) { myDropzone.on("totaluploadprogress", function(progress) {
document.querySelector("#total-progress .progress-bar").style.width = progress + "%"; document.querySelector("#total-progress .progress-bar").style.width = progress + "%"
}); })
myDropzone.on("sending", function(file) { myDropzone.on("sending", function(file) {
// Show the total progress bar when upload starts // Show the total progress bar when upload starts
document.querySelector("#total-progress").style.opacity = "1"; document.querySelector("#total-progress").style.opacity = "1"
// And disable the start button // And disable the start button
file.previewElement.querySelector(".start").setAttribute("disabled", "disabled"); file.previewElement.querySelector(".start").setAttribute("disabled", "disabled")
}); })
// Hide the total progress bar when nothing's uploading anymore // Hide the total progress bar when nothing's uploading anymore
myDropzone.on("queuecomplete", function(progress) { myDropzone.on("queuecomplete", function(progress) {
document.querySelector("#total-progress").style.opacity = "0"; document.querySelector("#total-progress").style.opacity = "0"
}); })
// Setup the buttons for all transfers // Setup the buttons for all transfers
// The "add files" button doesn't need to be setup because the config // The "add files" button doesn't need to be setup because the config
// `clickable` has already been specified. // `clickable` has already been specified.
document.querySelector("#actions .start").onclick = function() { document.querySelector("#actions .start").onclick = function() {
myDropzone.enqueueFiles(myDropzone.getFilesWithStatus(Dropzone.ADDED)); myDropzone.enqueueFiles(myDropzone.getFilesWithStatus(Dropzone.ADDED))
}; }
document.querySelector("#actions .cancel").onclick = function() { document.querySelector("#actions .cancel").onclick = function() {
myDropzone.removeAllFiles(true); myDropzone.removeAllFiles(true)
}; }
// DropzoneJS Demo Code End // DropzoneJS Demo Code End
</script> </script>
</body> </body>