mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-05 10:49:37 +02:00
Fix some info level issues in codacy
This commit is contained in:
parent
5ab1ed2e93
commit
e6eda3850c
5 changed files with 76 additions and 75 deletions
|
@ -23,17 +23,17 @@ $(document).ready(function () {
|
|||
// Enable caching of AJAX responses, including script and jsonp
|
||||
cache: true
|
||||
});
|
||||
$('#notification').click(function() {
|
||||
$("#notification").click(function() {
|
||||
clearNotification();
|
||||
});
|
||||
});
|
||||
|
||||
function initTabs()
|
||||
{
|
||||
$('.default_hidden').hide();
|
||||
$(".default_hidden").hide();
|
||||
|
||||
$("#tabs li").click(function() {
|
||||
$("#tabs li").removeClass('tab_active');
|
||||
$("#tabs li").removeClass("tab_active");
|
||||
$(this).addClass("tab_active");
|
||||
$(".tab_content").hide();
|
||||
var selected_tab = $(this).find("a").attr("href");
|
||||
|
@ -46,16 +46,16 @@ function initTabs()
|
|||
$(function() {
|
||||
var rightmenu = $("#rightbar");
|
||||
var pos = rightmenu.offset();
|
||||
if (rightmenu.hasClass('rightbar-float')) {
|
||||
if (rightmenu.hasClass("rightbar-float")) {
|
||||
$(window).scroll(function() {
|
||||
var rightsubmenu = $("#rightbar .submenu");
|
||||
if ($(this).scrollTop() > (pos.top)) {
|
||||
rightmenu.addClass('fixedrightbar');
|
||||
rightsubmenu.addClass('fixedrightbarsubmenu');
|
||||
rightmenu.addClass("fixedrightbar");
|
||||
rightsubmenu.addClass("fixedrightbarsubmenu");
|
||||
}
|
||||
else if ($(this).scrollTop() <= pos.top && rightmenu.hasClass('fixedrightbar')) {
|
||||
rightmenu.removeClass('fixedrightbar');
|
||||
rightsubmenu.removeClass('fixedrightbarsubmenu');
|
||||
else if ($(this).scrollTop() <= pos.top && rightmenu.hasClass("fixedrightbar")) {
|
||||
rightmenu.removeClass("fixedrightbar");
|
||||
rightsubmenu.removeClass("fixedrightbarsubmenu");
|
||||
}
|
||||
else {
|
||||
rightmenu.offset({ left: pos.left, top: pos.top });
|
||||
|
@ -78,14 +78,14 @@ function flipField(field) {
|
|||
// updateText
|
||||
// Changes the specified elements innards. Used for the catalog mojo fluff.
|
||||
function updateText(field, value) {
|
||||
$('#'+field).html(value);
|
||||
$("#"+field).html(value);
|
||||
}
|
||||
|
||||
// toggleVisible
|
||||
// Toggles display type between block and none. Used for ajax loading div.
|
||||
function toggleVisible(element) {
|
||||
var target = $('#' + element);
|
||||
if (target.is(':visible')) {
|
||||
var target = $("#" + element);
|
||||
if (target.is(":visible")) {
|
||||
target.hide();
|
||||
} else {
|
||||
target.show();
|
||||
|
@ -97,15 +97,15 @@ function displayNotification(message, timeout) {
|
|||
if (notificationTimeout != null || !message) {
|
||||
clearNotification();
|
||||
}
|
||||
|
||||
|
||||
if (message) {
|
||||
if ($('#webplayer').css('display') !== 'block') {
|
||||
$('#notification').css('bottom', '20px');
|
||||
if ($("#webplayer").css("display") !== "block") {
|
||||
$("#notification").css("bottom", "20px");
|
||||
} else {
|
||||
$('#notification').css('bottom', '120px');
|
||||
$("#notification").css("bottom", "120px");
|
||||
}
|
||||
$('#notification-content').html(message);
|
||||
$('#notification').removeClass('notification-out');
|
||||
$("#notification-content").html(message);
|
||||
$("#notification").removeClass("notification-out");
|
||||
notificationTimeout = setTimeout(function() {
|
||||
clearNotification();
|
||||
}, timeout);
|
||||
|
@ -115,7 +115,7 @@ function displayNotification(message, timeout) {
|
|||
function clearNotification() {
|
||||
clearTimeout(notificationTimeout);
|
||||
notificationTimeout = null;
|
||||
$('#notification').addClass("notification-out");
|
||||
$("#notification").addClass("notification-out");
|
||||
}
|
||||
|
||||
// delayRun
|
||||
|
@ -136,7 +136,7 @@ function delayRun(element, time, method, page, source) {
|
|||
// IE issue fixed by Spocky, we have to use the iframe for Democratic Play &
|
||||
// Localplay, which don't actually prompt for a new file
|
||||
function reloadUtil(target) {
|
||||
$('#util_iframe').prop('src', target);
|
||||
$("#util_iframe").prop("src", target);
|
||||
}
|
||||
|
||||
function reloadDivUtil(target) {
|
||||
|
|
|
@ -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");
|
||||
|
||||
});
|
||||
|
|
|
@ -11,8 +11,8 @@ jPlayerPlaylist.prototype._createListItem = function(media) {
|
|||
attrClass += '" ';
|
||||
|
||||
var listItem = "<li" + attrClass + " name=\"" + $(jplaylist.cssSelector.playlist + " ul li").length + "\" " +
|
||||
"data-poster=\"" + media['poster'] + "\" data-media_id=\"" + media['media_id'] + "\" data-album_id=\"" + media['album_id'] + "\" data-artist_id=\"" + media['artist_id'] + "\" " +
|
||||
"data-replaygain_track_gain=\"" + media['replaygain_track_gain'] + "\" data-replaygain_track_peak=\"" + media['replaygain_track_peak'] + "\" data-replaygain_album_gain=\"" + media['replaygain_album_gain'] + "\" data-replaygain_album_peak=\"" + media['replaygain_album_peak'] + "\"" +
|
||||
"data-poster=\"" + media.poster + "\" data-media_id=\"" + media.media_id + "\" data-album_id=\"" + media.album_id + "\" data-artist_id=\"" + media.artist_id + "\" " +
|
||||
"data-replaygain_track_gain=\"" + media.replaygain_track_gain + "\" data-replaygain_track_peak=\"" + media.replaygain_track_peak + "\" data-replaygain_album_gain=\"" + media.replaygain_album_gain + "\" data-replaygain_album_peak=\"" + media.replaygain_album_peak + "\"" +
|
||||
"><div>";
|
||||
|
||||
// Create image
|
||||
|
@ -131,8 +131,9 @@ jPlayerPlaylist.prototype.scan = function() {
|
|||
var replace = [];
|
||||
var maxName = 0; // maximum value that name attribute assumes.
|
||||
$.each($(this.cssSelector.playlist + " ul li"), function(index, value) {
|
||||
if ($(value).attr('name') > maxName)
|
||||
if ($(value).attr('name') > maxName) {
|
||||
maxName = parseInt($(value).attr('name'));
|
||||
}
|
||||
});
|
||||
|
||||
var diffCount = maxName + 1 != $(this.cssSelector.playlist + " ul li").length; // Flag that marks if the number of "ul li" elements doesn't match the name attribute counting.
|
||||
|
|
|
@ -180,10 +180,10 @@ var SearchRow = {
|
|||
}
|
||||
});
|
||||
|
||||
if (type['widget'][0] == 'subtypes') {
|
||||
if (type.widget[0] == 'subtypes') {
|
||||
var $select = SearchRow.createSelect({
|
||||
name: 'rule_' + targetID + '_subtype'
|
||||
}, type['subtypes']);
|
||||
}, type.subtypes);
|
||||
$(this).after($select);
|
||||
}
|
||||
else {
|
||||
|
@ -218,7 +218,7 @@ var SearchRow = {
|
|||
if (type['widget'][0] == 'subtypes') {
|
||||
var $input = SearchRow.createSelect({
|
||||
name: 'rule_' + ruleNumber + '_subtype'
|
||||
}, type['subtypes'], subtype);
|
||||
}, type.subtypes, subtype);
|
||||
return $input[0];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License v2
|
||||
// as published by the Free Software Foundation.
|
||||
//
|
||||
//
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
@ -35,7 +35,7 @@ function showFilters(element) {
|
|||
|
||||
var closeplaylist;
|
||||
function showPlaylistDialog(e, item_type, item_ids) {
|
||||
$("#playlistdialog").dialog("close");
|
||||
$('#playlistdialog').dialog('close');
|
||||
|
||||
var parent = this;
|
||||
parent.itemType = item_type;
|
||||
|
@ -51,7 +51,7 @@ function showPlaylistDialog(e, item_type, item_ids) {
|
|||
height: 100,
|
||||
autoOpen: false,
|
||||
position: {
|
||||
my: "left+10 top",
|
||||
my: 'left+10 top',
|
||||
of: e
|
||||
},
|
||||
open: function () {
|
||||
|
@ -67,24 +67,24 @@ function showPlaylistDialog(e, item_type, item_ids) {
|
|||
close: function (e) {
|
||||
$(document).unbind('click');
|
||||
$(this).empty();
|
||||
$(this).dialog("destroy");
|
||||
$(this).dialog('destroy');
|
||||
}
|
||||
});
|
||||
|
||||
$("#playlistdialog").dialog("open");
|
||||
$('#playlistdialog').dialog('open');
|
||||
closeplaylist = 0;
|
||||
}
|
||||
|
||||
function overlayclickclose() {
|
||||
if (closeplaylist) {
|
||||
$("#playlistdialog").dialog("close");
|
||||
$('#playlistdialog').dialog('close');
|
||||
}
|
||||
closeplaylist = 1;
|
||||
}
|
||||
|
||||
function handlePlaylistAction(url, id) {
|
||||
ajaxPut(url, id);
|
||||
$("#playlistdialog").dialog("close");
|
||||
$('#playlistdialog').dialog('close');
|
||||
}
|
||||
|
||||
function createNewPlaylist(title, url, id) {
|
||||
|
@ -101,7 +101,7 @@ function createNewPlaylist(title, url, id) {
|
|||
|
||||
var closebroadcasts;
|
||||
function showBroadcastsDialog(e) {
|
||||
$("#broadcastsdialog").dialog("close");
|
||||
$('#broadcastsdialog').dialog('close');
|
||||
|
||||
var parent = this;
|
||||
parent.contentUrl = jsAjaxServer + '/ajax.server.php?page=player&action=show_broadcasts';
|
||||
|
@ -116,7 +116,7 @@ function showBroadcastsDialog(e) {
|
|||
height: 70,
|
||||
autoOpen: false,
|
||||
position: {
|
||||
my: "left-180 top",
|
||||
my: 'left-180 top',
|
||||
of: e
|
||||
},
|
||||
open: function () {
|
||||
|
@ -132,24 +132,24 @@ function showBroadcastsDialog(e) {
|
|||
close: function (e) {
|
||||
$(document).unbind('click');
|
||||
$(this).empty();
|
||||
$(this).dialog("destroy");
|
||||
$(this).dialog('destroy');
|
||||
}
|
||||
});
|
||||
|
||||
$("#broadcastsdialog").dialog("open");
|
||||
$('#broadcastsdialog').dialog('open');
|
||||
closebroadcasts = 0;
|
||||
}
|
||||
|
||||
function broverlayclickclose() {
|
||||
if (closebroadcasts) {
|
||||
$("#broadcastsdialog").dialog("close");
|
||||
$('#broadcastsdialog').dialog('close');
|
||||
}
|
||||
closebroadcasts = 1;
|
||||
}
|
||||
|
||||
function handleBroadcastAction(url, id) {
|
||||
ajaxPut(url, id);
|
||||
$("#broadcastsdialog").dialog("close");
|
||||
$('#broadcastsdialog').dialog('close');
|
||||
}
|
||||
|
||||
/************************************************************/
|
||||
|
@ -158,7 +158,7 @@ function handleBroadcastAction(url, id) {
|
|||
|
||||
var closeshare;
|
||||
function showShareDialog(e, object_type, object_id) {
|
||||
$("#sharedialog").dialog("close");
|
||||
$('#sharedialog').dialog('close');
|
||||
|
||||
var parent = this;
|
||||
parent.contentUrl = jsAjaxServer + '/ajax.server.php?page=browse&action=get_share_links&object_type=' + object_type + '&object_id=' + object_id;
|
||||
|
@ -173,7 +173,7 @@ function showShareDialog(e, object_type, object_id) {
|
|||
height: 90,
|
||||
autoOpen: false,
|
||||
position: {
|
||||
my: "left+10 top",
|
||||
my: 'left+10 top',
|
||||
of: e
|
||||
},
|
||||
open: function () {
|
||||
|
@ -189,24 +189,24 @@ function showShareDialog(e, object_type, object_id) {
|
|||
close: function (e) {
|
||||
$(document).unbind('click');
|
||||
$(this).empty();
|
||||
$(this).dialog("destroy");
|
||||
$(this).dialog('destroy');
|
||||
}
|
||||
});
|
||||
|
||||
$("#sharedialog").dialog("open");
|
||||
$('#sharedialog').dialog('open');
|
||||
closeshare = 0;
|
||||
}
|
||||
|
||||
function shoverlayclickclose(e) {
|
||||
if (closeshare) {
|
||||
$("#sharedialog").dialog("close");
|
||||
$('#sharedialog').dialog('close');
|
||||
}
|
||||
closeshare = 1;
|
||||
}
|
||||
|
||||
function handleShareAction(url) {
|
||||
window.open(url);
|
||||
$("#sharedialog").dialog("close");
|
||||
$('#sharedialog').dialog('close');
|
||||
}
|
||||
|
||||
|
||||
|
@ -271,7 +271,7 @@ function showEditDialog(edit_type, edit_id, edit_form_id, edit_title, refresh_ro
|
|||
type: 'POST',
|
||||
data: $(parent.editFormId).serializeArray(),
|
||||
success: function (resp) {
|
||||
$("#editdialog").dialog("close");
|
||||
$('#editdialog').dialog('close');
|
||||
|
||||
if (parent.refreshRowPrefix != '') {
|
||||
var new_id = $.trim(resp.lastChild.textContent);
|
||||
|
@ -285,7 +285,7 @@ function showEditDialog(edit_type, edit_id, edit_form_id, edit_title, refresh_ro
|
|||
// Reload only table
|
||||
$('#' + parent.refreshRowPrefix + parent.editId).load(url, function() {
|
||||
// Update the current row identifier with new id
|
||||
$('#' + parent.refreshRowPrefix + parent.editId).attr("id", parent.refreshRowPrefix + new_id);
|
||||
$('#' + parent.refreshRowPrefix + parent.editId).attr('id', parent.refreshRowPrefix + new_id);
|
||||
});
|
||||
} else {
|
||||
var reloadp = window.location;
|
||||
|
@ -297,12 +297,12 @@ function showEditDialog(edit_type, edit_id, edit_form_id, edit_title, refresh_ro
|
|||
}
|
||||
},
|
||||
error: function(resp) {
|
||||
$("#editdialog").dialog("close");
|
||||
$('#editdialog').dialog('close');
|
||||
}
|
||||
});
|
||||
}
|
||||
this.dialog_buttons[jsCancelTitle] = function() {
|
||||
$("#editdialog").dialog("close");
|
||||
$('#editdialog').dialog('close');
|
||||
}
|
||||
|
||||
$(parent.editDialogId).dialog({
|
||||
|
@ -312,11 +312,11 @@ function showEditDialog(edit_type, edit_id, edit_form_id, edit_title, refresh_ro
|
|||
resizable: false,
|
||||
width: 666,
|
||||
autoOpen: false,
|
||||
show: { effect: "fade", duration: 400 },
|
||||
show: { effect: 'fade', duration: 400 },
|
||||
open: function () {
|
||||
$(this).load(parent.contentUrl, function() {
|
||||
if ($('#edit_tags').length > 0) {
|
||||
$("#edit_tags").tagit({
|
||||
$('#edit_tags').tagit({
|
||||
allowSpaces: true,
|
||||
singleField: true,
|
||||
singleFieldDelimiter: ',',
|
||||
|
@ -324,7 +324,7 @@ function showEditDialog(edit_type, edit_id, edit_form_id, edit_title, refresh_ro
|
|||
});
|
||||
}
|
||||
if ($('#edit_labels').length > 0) {
|
||||
$("#edit_labels").tagit({
|
||||
$('#edit_labels').tagit({
|
||||
allowSpaces: true,
|
||||
singleField: true,
|
||||
singleFieldDelimiter: ',',
|
||||
|
@ -335,16 +335,16 @@ function showEditDialog(edit_type, edit_id, edit_form_id, edit_title, refresh_ro
|
|||
},
|
||||
close: function (e) {
|
||||
$(this).empty();
|
||||
$(this).dialog("destroy");
|
||||
$(this).dialog('destroy');
|
||||
},
|
||||
buttons: dialog_buttons
|
||||
});
|
||||
|
||||
$("#editdialog").dialog("open");
|
||||
$('#editdialog').dialog('open');
|
||||
}
|
||||
|
||||
$(window).resize(function() {
|
||||
$("#editdialog").dialog("option", "position", {my: "center", at: "center", of: window});
|
||||
$('#editdialog').dialog('option', 'position', {my: 'center', at: 'center', of: window});
|
||||
});
|
||||
|
||||
function check_inline_song_edit(type, song) {
|
||||
|
@ -386,7 +386,7 @@ function submitNewItemsOrder(itemId, tableid, rowPrefix, updateUrl, refreshActio
|
|||
var rowLength = table.rows.length;
|
||||
var offset = 0;
|
||||
var finalOrder = '';
|
||||
|
||||
|
||||
if ($('#' + tableid).attr('data-offset')) {
|
||||
offset = $('#' + tableid).attr('data-offset');
|
||||
}
|
||||
|
@ -395,7 +395,7 @@ function submitNewItemsOrder(itemId, tableid, rowPrefix, updateUrl, refreshActio
|
|||
var row = table.rows[i];
|
||||
if (row.id != '') {
|
||||
var songid = row.id.replace(rowPrefix, '');
|
||||
finalOrder += songid + ";"
|
||||
finalOrder += songid + ';'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -434,7 +434,7 @@ function geolocate_user() {
|
|||
if(navigator.geolocation) {
|
||||
navigator.geolocation.getCurrentPosition(geolocate_user_callback);
|
||||
} else {
|
||||
console.error("This browser does not support geolocation");
|
||||
console.error('This browser does not support geolocation');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue