1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-04 10:19:25 +02:00

Fix some info level issues in codacy

This commit is contained in:
Phyks (Lucas Verney) 2016-06-20 14:46:23 +02:00
parent 5ab1ed2e93
commit e6eda3850c
5 changed files with 76 additions and 75 deletions

View file

@ -1,7 +1,7 @@
function loadContentData(data, status, jqXHR)
{
var $response = $(data);
if ($response.find("#guts").length === 0) {
$("body").undelegate("a");
$("body").undelegate("form");
@ -29,7 +29,7 @@ function loadContentPage(url)
.fadeOut(200, function() {
$.get(url, function (data, status, jqXHR) {
loadContentData(data, status, jqXHR);
}, 'html');
}, "html");
});
}
@ -41,16 +41,16 @@ function sse_worker(url) {
eval(event.data);
};
sseSource.onopen = function() {
displayNotification('Connected through Server-Sent Events, processing...', 5000);
displayNotification("Connected through Server-Sent Events, processing...", 5000);
};
sseSource.onerror = function() {
displayNotification('Server-Sent Events connection error. Re-connection...', 5000);
displayNotification("Server-Sent Events connection error. Re-connection...", 5000);
};
} else {
// Server-Sent Events not supported, call the update in ajax and the output result
$.get(url + '&html=1', function (data) {
$.get(url + "&html=1", function (data) {
$("#guts").append(data);
}, 'html')
}, "html")
}
}
@ -62,13 +62,13 @@ function stop_sse_worker() {
}
function display_sse_error(error) {
displayNotification('ERROR: ' + error, 10000);
displayNotification("ERROR: " + error, 10000);
}
$(function() {
var newHash = "";
$("body").delegate("a", "click", function() {
var link = $(this).attr("href");
if (link !== undefined && link != "" && link.indexOf("javascript:") != 0 && link != "#" && link != undefined && $(this).attr("onclick") == undefined && $(this).attr("rel") != "nohtml" && $(this).attr("target") != "_blank") {
@ -84,15 +84,15 @@ $(function() {
}
}
});
$("body").delegate("form", "submit", function(e) {
// We do not support ajax post with files or login form, neither specific target
var $file = $(this).find("input[type=file]");
if ($(this).attr('name') !== 'login' && $(this).attr('name') !== 'export' && (!$file || !$file.val() || $file.val() === "") && ($(this).attr('target') === undefined || $(this).attr('target') === '')) {
if ($(this).attr("name") !== "login" && $(this).attr("name") !== "export" && (!$file || !$file.val() || $file.val() === "") && ($(this).attr("target") === undefined || $(this).attr("target") === "")) {
var postData = $(this).serializeArray();
var formURL = $(this).attr("action");
if (formURL.indexOf('javascript:') !== 0) {
if (formURL.indexOf("javascript:") !== 0) {
$.ajax(
{
url : formURL,
@ -113,15 +113,15 @@ $(function() {
}
}
});
$(window).bind('hashchange', function(){
$(window).bind("hashchange", function(){
newHash = window.location.hash.substring(1);
if (newHash && newHash.indexOf("prettyPhoto") != 0 && newHash.indexOf(".php") > -1) {
loadContentPage(jsWebPath + '/' + newHash);
loadContentPage(jsWebPath + "/" + newHash);
return false;
};
});
$(window).trigger('hashchange');
});
$(window).trigger("hashchange");
});