");
}
if (libraryColumnTypes[ele.mDataProp] == "s") {
- var obj = { sSelector: "#"+ele.mDataProp }
+ var obj = { sSelector: "#" + ele.mDataProp }
} else if (libraryColumnTypes[ele.mDataProp] == "tt") {
- var obj = { sSelector: "#"+ele.mDataProp, type: "select" }
+ var obj = { sSelector: "#" + ele.mDataProp, type: "select" }
} else {
- var obj = { sSelector: "#"+ele.mDataProp, type: "number-range" }
+ var obj = { sSelector: "#" + ele.mDataProp, type: "number-range" }
}
colsForAdvancedSearch.push(obj);
} else {
@@ -951,16 +951,16 @@ var AIRTIME = (function(AIRTIME) {
});
oTable.columnFilter({
- aoColumns: colsForAdvancedSearch,
- bUseColVis: true,
- sPlaceHolder: "head:before"
- }
+ aoColumns: colsForAdvancedSearch,
+ bUseColVis: true,
+ sPlaceHolder: "head:before"
+ }
);
}
- function setFilterElement(iColumn, bVisible){
+ function setFilterElement(iColumn, bVisible) {
var actualId = colReorderMap[iColumn];
- var selector = "div#advanced_search_col_"+actualId;
+ var selector = "div#advanced_search_col_" + actualId;
var $el = $(selector);
if (bVisible) {
@@ -1006,7 +1006,7 @@ var AIRTIME = (function(AIRTIME) {
}
- var selected = $("a[href$='"+location.hash+"']"), table;
+ var selected = $("a[href$='" + location.hash + "']"), table;
if (selected.parent().data("selection-id") == AIRTIME.library.MediaTypeIntegerEnum.PODCAST) {
table = mod.DataTableTypeEnum.PODCAST;
} else {
@@ -1020,7 +1020,7 @@ var AIRTIME = (function(AIRTIME) {
var simpleSearchText;
- $libContent.on("click", "legend", function(){
+ $libContent.on("click", "legend", function () {
$simpleSearch = $libContent.find("#library_display_filter label");
var $fs = $(this).parents("fieldset"),
searchHeight,
@@ -1042,9 +1042,9 @@ var AIRTIME = (function(AIRTIME) {
else {
// clear the advanced search fields
var divs = $("div#advanced_search").children(':visible');
- $.each(divs, function(i, div){
+ $.each(divs, function (i, div) {
fields = $(div).children().find('input');
- $.each(fields, function(i, field){
+ $.each(fields, function (i, field) {
if ($(field).val() !== "") {
$(field).val("");
// we need to reset the results when removing
@@ -1064,14 +1064,14 @@ var AIRTIME = (function(AIRTIME) {
AIRTIME.library.setupLibraryToolbar(oTable);
- $libTable.find("tbody").on("dblclick", "tr[class*='lib'] > td:not(.dataTables_empty)", function(ev) {
+ $libTable.find("tbody").on("dblclick", "tr[class*='lib'] > td:not(.dataTables_empty)", function (ev) {
var tr = $(this).parent(), data = tr.data("aData");
AIRTIME.library.dblClickAdd(data, data.ftype);
});
- $libTable.find("tbody").on("mousedown", "tr[class*='lib'] > td.library_checkbox", function(ev) {
+ $libTable.find("tbody").on("mousedown", "tr[class*='lib'] > td.library_checkbox", function (ev) {
var $tr = $(this).parent(),
- // Get the ID of the selected row
+ // Get the ID of the selected row
$rowId = $tr.attr("id");
if (!$tr.hasClass(LIB_SELECTED_CLASS)) {
@@ -1118,9 +1118,9 @@ var AIRTIME = (function(AIRTIME) {
return false;
});
- $libTable.find("tbody").on("mousedown", "tr[class*='lib'] > td:not(.library_checkbox, .dataTables_empty)", function(ev) {
+ $libTable.find("tbody").on("mousedown", "tr[class*='lib'] > td:not(.library_checkbox, .dataTables_empty)", function (ev) {
var $tr = $(this).parent(),
- // Get the ID of the selected row
+ // Get the ID of the selected row
$rowId = $tr.attr("id");
if (ev.which === 3 /* Right click */) {
@@ -1156,7 +1156,7 @@ var AIRTIME = (function(AIRTIME) {
}
});
- $libTable.find("tbody").on("click", "tr > td.library_checkbox", function() {
+ $libTable.find("tbody").on("click", "tr > td.library_checkbox", function () {
var tr = $(this).parent();
if (flagForDeselection) {
flagForDeselection = false;
@@ -1167,7 +1167,7 @@ var AIRTIME = (function(AIRTIME) {
}
});
- $libTable.find("tbody").on("click", "tr > td:not(.library_checkbox, .dataTables_empty)", function(e) {
+ $libTable.find("tbody").on("click", "tr > td:not(.library_checkbox, .dataTables_empty)", function (e) {
var tr = $(this).parent();
if (flagForDeselection) {
flagForDeselection = false;
@@ -1179,7 +1179,7 @@ var AIRTIME = (function(AIRTIME) {
}
});
- $libTable.find("thead").on("click", "th > input[type='checkbox']", function() {
+ $libTable.find("thead").on("click", "th > input[type='checkbox']", function () {
if ($(this).is(":checked")) {
AIRTIME.library.selectCurrentPage();
$(this).prop("checked", true);
@@ -1189,8 +1189,8 @@ var AIRTIME = (function(AIRTIME) {
}
});
- $('#sb-actions').on("click", function(e) {
- $("#library_display tr:has(td)").contextMenu({x: $(e.target).offset().left, y: $(e.target).offset().top});
+ $('#sb-actions').on("click", function (e) {
+ $("#library_display tr:has(td)").contextMenu({ x: $(e.target).offset().left, y: $(e.target).offset().top });
});
// begin context menu initialization.
@@ -1199,7 +1199,7 @@ var AIRTIME = (function(AIRTIME) {
//trigger: "left",
trigger: "custom",
- build: function($el, e) {
+ build: function ($el, e) {
var data, screen, items, callback, $tr;
$tr = $el;
@@ -1208,11 +1208,11 @@ var AIRTIME = (function(AIRTIME) {
function processMenuItems(oItems) {
- // define an add to playlist callback.
+ // define an add to playlist callback.
if (oItems.pl_add !== undefined) {
var aItems = [];
- callback = function() {
+ callback = function () {
aItems.push(new Array(data.id, data.ftype));
AIRTIME.playlist.fnAddItems(aItems, undefined, 'after');
};
@@ -1223,18 +1223,18 @@ var AIRTIME = (function(AIRTIME) {
// define an edit callback.
if (oItems.edit !== undefined) {
if (data.ftype === "audioclip") {
- callback = function() {
- $.get(oItems.edit.url, {format: "json"}, function(json){
+ callback = function () {
+ $.get(oItems.edit.url, { format: "json" }, function (json) {
AIRTIME.playlist.fileMdEdit(json, data.tr_id);
});
};
} else if (data.ftype === "playlist" || data.ftype === "block") {
- callback = function() {
- AIRTIME.playlist.fnEdit(data, baseUrl+'playlist/edit');
+ callback = function () {
+ AIRTIME.playlist.fnEdit(data, baseUrl + 'playlist/edit');
AIRTIME.playlist.validatePlaylistElements();
};
} else if (data.ftype === "stream") {
- callback = function() {
+ callback = function () {
AIRTIME.playlist.fnEdit(data, baseUrl + 'webstream/edit');
}
} else {
@@ -1252,8 +1252,8 @@ var AIRTIME = (function(AIRTIME) {
}
}
- callback = function() {
- if (data.ftype === 'playlist' && data.length !== '0.0'){
+ callback = function () {
+ if (data.ftype === 'playlist' && data.length !== '0.0') {
playlistIndex = $(this).attr('id').substring(3); // remove the pl_
open_playlist_preview(playlistIndex, 0);
} else if (data.ftype === 'audioclip' || data.ftype === 'stream') {
@@ -1273,22 +1273,22 @@ var AIRTIME = (function(AIRTIME) {
// playlist screen if this is the currently edited
// playlist.
if ((data.ftype === "playlist" || data.ftype === "block") && screen === "playlist") {
- callback = function() {
+ callback = function () {
aMedia = [];
- aMedia.push({"id": data.id, "type": data.ftype});
+ aMedia.push({ "id": data.id, "type": data.ftype });
if (confirm($.i18n._('Are you sure you want to delete the selected item?'))) {
AIRTIME.library.fnDeleteItems(aMedia);
}
};
}
else {
- callback = function() {
+ callback = function () {
var media = [];
if (confirm($.i18n._('Are you sure you want to delete the selected item?'))) {
- media.push({"id": data.id, "type": data.ftype});
- $.post(oItems.del.url, {format: "json", media: media }, function(json){
+ media.push({ "id": data.id, "type": data.ftype });
+ $.post(oItems.del.url, { format: "json", media: media }, function (json) {
var oTable;
if (json.message) {
@@ -1296,7 +1296,7 @@ var AIRTIME = (function(AIRTIME) {
}
oTable = $("#library_display").dataTable();
- oTable.fnDeleteRow( $tr[0] );
+ oTable.fnDeleteRow($tr[0]);
});
}
};
@@ -1308,7 +1308,7 @@ var AIRTIME = (function(AIRTIME) {
// Publish.
if (oItems.publish !== undefined) {
if (data.ftype === "audioclip") {
- callback = function() {
+ callback = function () {
AIRTIME.publish.openPublishDialog(data.id);
};
}
@@ -1319,7 +1319,7 @@ var AIRTIME = (function(AIRTIME) {
// define a download callback.
if (oItems.download !== undefined) {
- callback = function() {
+ callback = function () {
document.location.href = oItems.download.url;
};
oItems.download.callback = callback;
@@ -1327,8 +1327,8 @@ var AIRTIME = (function(AIRTIME) {
// add callbacks for duplicate menu items.
if (oItems.duplicate !== undefined) {
var url = oItems.duplicate.url;
- callback = function() {
- $.post(url, {format: "json", id: data.id }, function(json){
+ callback = function () {
+ $.post(url, { format: "json", id: data.id }, function (json) {
oTable.fnStandingRedraw();
});
};
@@ -1343,12 +1343,12 @@ var AIRTIME = (function(AIRTIME) {
}
request = $.ajax({
- url: baseUrl+"library/context-menu",
+ url: baseUrl + "library/context-menu",
type: "GET",
- data: {id : data.id, type: data.ftype, format: "json", "screen": screen},
+ data: { id: data.id, type: data.ftype, format: "json", "screen": screen },
dataType: "json",
async: false,
- success: function(json){
+ success: function (json) {
processMenuItems(json.items);
}
});
@@ -1377,7 +1377,7 @@ var AIRTIME = (function(AIRTIME) {
dt.fnClearTable(false);
}
// Don't redraw if we're switching to another hash for the library table
- $.when(redraw ? dt.fnDraw() : function () {}).done(function () {
+ $.when(redraw ? dt.fnDraw() : function () { }).done(function () {
$("#library_content").find(".dataTables_wrapper").hide();
wrapper.show();
});
@@ -1405,7 +1405,7 @@ var AIRTIME = (function(AIRTIME) {
// like images or video, so scroll it back up on open.
$(this).parent().scrollTop(0);
},
- close: function() {
+ close: function () {
$(this).dialog('destroy').remove();
}
});
@@ -1416,17 +1416,16 @@ var AIRTIME = (function(AIRTIME) {
*
* XXX: should this be moved to podcast.js
*/
- mod.initPodcastDatatable = function()
- {
+ mod.initPodcastDatatable = function () {
var aoColumns = [
- /* Title */ { "sTitle" : $.i18n._("Title") , "mDataProp" : "title" , "sClass" : "library_title" , "sWidth" : "170px" },
- /* Creator */ { "sTitle" : $.i18n._("Creator") , "mDataProp" : "creator" , "sClass" : "library_creator" , "sWidth" : "160px" },
- /* Website */ { "sTitle" : $.i18n._("Description") , "mDataProp" : "description" , "bVisible" : false , "sWidth" : "150px" },
- /* Year */ { "sTitle" : $.i18n._("Owner") , "mDataProp" : "owner" , "bVisible" : false , "sWidth" : "60px" },
- /* URL */ { "sTitle" : $.i18n._("Feed URL") , "mDataProp" : "url" , "bVisible" : false , "sWidth" : "60px" },
- /* Import Date */ { "sTitle" : $.i18n._("Import Date") ,"mDataProp" : "auto_ingest_timestamp", "bVisible" : true , "sWidth" : "60px" },
- ],
- ajaxSourceURL = baseUrl+"rest/podcast",
+ /* Title */ { "sTitle": $.i18n._("Title"), "mDataProp": "title", "sClass": "library_title", "sWidth": "170px" },
+ /* Creator */ { "sTitle": $.i18n._("Creator"), "mDataProp": "creator", "sClass": "library_creator", "sWidth": "160px" },
+ /* Website */ { "sTitle": $.i18n._("Description"), "mDataProp": "description", "bVisible": false, "sWidth": "150px" },
+ /* Year */ { "sTitle": $.i18n._("Owner"), "mDataProp": "owner", "bVisible": false, "sWidth": "60px" },
+ /* URL */ { "sTitle": $.i18n._("Feed URL"), "mDataProp": "url", "bVisible": false, "sWidth": "60px" },
+ /* Import Date */ { "sTitle": $.i18n._("Import Date"), "mDataProp": "auto_ingest_timestamp", "bVisible": true, "sWidth": "60px" },
+ ],
+ ajaxSourceURL = baseUrl + "rest/podcast",
podcastToolbarButtons = AIRTIME.widgets.Table.getStandardToolbarButtons();
$.extend(true, podcastToolbarButtons[AIRTIME.widgets.Table.TOOLBAR_BUTTON_ROLES.NEW],
@@ -1440,7 +1439,7 @@ var AIRTIME = (function(AIRTIME) {
$.extend(true, podcastToolbarButtons[AIRTIME.widgets.Table.TOOLBAR_BUTTON_ROLES.EDIT],
{
title: $.i18n._('Edit'),
- iconClass : "icon-pencil",
+ iconClass: "icon-pencil",
eventHandlers: {
click: AIRTIME.podcast.editSelectedPodcasts
},
@@ -1464,8 +1463,8 @@ var AIRTIME = (function(AIRTIME) {
true, //Enable item selection
podcastToolbarButtons, //Toolbar buttons
{ //Datatables overrides.
- aoColumns : aoColumns,
- sAjaxSource : ajaxSourceURL,
+ aoColumns: aoColumns,
+ sAjaxSource: ajaxSourceURL,
oColReorder: {
iFixedColumns: 1 // Checkbox
},
@@ -1507,25 +1506,25 @@ function validateAdvancedSearch(divs) {
searchTerm[0] = "";
searchTerm[1] = "";
- $.each(divs, function(i, div){
+ $.each(divs, function (i, div) {
fieldName = $(div).children('div').attr('id');
fields = $(div).children().find('input');
searchTermType = validationTypes[fieldName];
valid = true;
- $.each(fields, function(i, field){
+ $.each(fields, function (i, field) {
searchTerm[i] = $(field).val();
if (searchTerm[i] !== "") {
if (searchTermType === "l") {
- regExpr = new RegExp("^" +timeRegEx+ "$");
+ regExpr = new RegExp("^" + timeRegEx + "$");
} else if (searchTermType === "t") {
var pieces = searchTerm[i].split(" ");
if (pieces.length === 2) {
- regExpr = new RegExp("^" +dateRegEx+ " " +timeRegEx+ "$");
+ regExpr = new RegExp("^" + dateRegEx + " " + timeRegEx + "$");
} else if (pieces.length === 1) {
- regExpr = new RegExp("^" +dateRegEx+ "$");
+ regExpr = new RegExp("^" + dateRegEx + "$");
}
} else if (searchTermType === "i") {
regExpr = new RegExp(integerRegEx);
@@ -1551,7 +1550,7 @@ function validateAdvancedSearch(divs) {
* empty we need to keep the validation icon on screen.
*/
} else if (searchTerm[0] === "" && searchTerm[1] !== "" ||
- searchTerm[0] === "" && searchTerm[1] === ""){
+ searchTerm[0] === "" && searchTerm[1] === "") {
if ($(field).closest('div').prev().hasClass('checked-icon') ||
$(field).closest('div').prev().hasClass('not-available-icon')) {
$(field).closest('div').prev().remove();
@@ -1580,7 +1579,7 @@ function addRemoveValidationIcons(valid, field, searchTermType) {
}
var validIndicator = " ",
- invalidIndicator = " ";
+ invalidIndicator = " ";
if (valid) {
if (!field.closest('div').prev().hasClass('checked-icon')) {
@@ -1612,73 +1611,73 @@ function resizeAdvancedSearch() {
* whole/decimals) t => timestamp l => length
*/
var validationTypes = {
- "album_title" : "s",
- "artist_name" : "s",
- "bit_rate" : "i",
- "bpm" : "i",
- "comments" : "s",
- "composer" : "s",
- "conductor" : "s",
- "copyright" : "s",
- "cuein" : "l",
- "cueout" : "l",
- "description" : "s",
- "encoded_by" : "s",
- "utime" : "t",
- "mtime" : "t",
- "lptime" : "t",
- "disc_number" : "i",
- "genre" : "s",
- "isrc_number" : "s",
- "label" : "s",
- "language" : "s",
- "length" : "l",
- "lyricist" : "s",
- "mood" : "s",
- "mime" : "s",
- "name" : "s",
- "orchestra" : "s",
- "owner_id" : "s",
- "rating" : "i",
- "replay_gain" : "n",
- "sample_rate" : "n",
- "track_title" : "s",
- "track_number" : "i",
- "info_url" : "s",
- "artwork" : "s",
- "track_type" : "s",
- "year" : "i"
+ "album_title": "s",
+ "artist_name": "s",
+ "bit_rate": "i",
+ "bpm": "i",
+ "comments": "s",
+ "composer": "s",
+ "conductor": "s",
+ "copyright": "s",
+ "cuein": "l",
+ "cueout": "l",
+ "description": "s",
+ "encoded_by": "s",
+ "utime": "t",
+ "mtime": "t",
+ "lptime": "t",
+ "disc_number": "i",
+ "genre": "s",
+ "isrc_number": "s",
+ "label": "s",
+ "language": "s",
+ "length": "l",
+ "lyricist": "s",
+ "mood": "s",
+ "mime": "s",
+ "name": "s",
+ "orchestra": "s",
+ "owner_id": "s",
+ "rating": "i",
+ "replay_gain": "n",
+ "sample_rate": "n",
+ "track_title": "s",
+ "track_number": "i",
+ "info_url": "s",
+ "artwork": "s",
+ "track_type": "s",
+ "year": "i"
};
-function airtimeScheduleJsonpError(jqXHR, textStatus, errorThrown){
+function airtimeScheduleJsonpError(jqXHR, textStatus, errorThrown) {
}
function tracktypesJson() {
- $(function() {
+ $(function () {
jQuery.getJSON(
- baseUrl + "api/track-types",
- function(json){
- var ttSelect = $('#track_type .filter_select .select_filter');
- $.each(json, function(key, value) {
- var option = $("", {
- value: value['code'],
- text: value['type_name']
+ baseUrl + "api/track-types",
+ function (json) {
+ var ttSelect = $('#track_type .filter_select .select_filter');
+ $.each(json, function (key, value) {
+ var option = $("", {
+ value: value['code'],
+ text: value['type_name']
+ });
+ ttSelect.append(option);
});
- ttSelect.append(option);
- });
- });
- });
+ });
+ });
}
function readArtworkURL(input, id) {
if (input.files && input.files[0]) {
var reader = new FileReader();
- reader.onload = function(e) {
- $('.artwork-preview-'+id).css('background-image', 'url('+e.target.result +')');
- $('.artwork-preview-'+id).hide();
- $('.artwork-preview-'+id).fadeIn(500);
- $('.set_artwork_'+id).val(function() {
+ reader.onload = function (e) {
+ $('.artwork-preview-' + id).css('background-image', 'url(' + e.target.result + ')');
+ $('.artwork-preview-' + id).hide();
+ $('.artwork-preview-' + id).fadeIn(500);
+ $('.set_artwork_' + id).val(function () {
return e.target.result;
});
}
@@ -1691,7 +1690,7 @@ var resampleImg = (function (canvas) {
function resampleImg(img, width, height, onresample) {
var load = typeof img == "string",
- i = load || img;
+ i = load || img;
if (load) {
i = new Image;
i.onload = onload;
@@ -1709,9 +1708,9 @@ var resampleImg = (function (canvas) {
function onload() {
var img = this,
- width = img._width,
- height = img._height,
- onresample = img._onresample;
+ width = img._width,
+ height = img._height,
+ onresample = img._onresample;
var minValue = Math.min(img.height, img.width);
width == null && (width = round(img.width * height / img.height));
@@ -1722,54 +1721,54 @@ var resampleImg = (function (canvas) {
delete img._height;
canvas.width = width;
canvas.height = height;
- context.drawImage(img,0,0,minValue,minValue,0,0,width,height);
+ context.drawImage(img, 0, 0, minValue, minValue, 0, 0, width, height);
onresample(canvas.toDataURL("image/jpeg"));
}
var context = canvas.getContext("2d"),
- round = Math.round;
+ round = Math.round;
return resampleImg;
}(this.document.createElement("canvas")));
-$(document).ready(function() {
+$(document).ready(function () {
tracktypesJson();
if (window.location.href.indexOf("showbuilder") > -1) {
AIRTIME.library.initPodcastDatatable();
}
- $("#advanced-options").on("click", function() {
+ $("#advanced-options").on("click", function () {
resizeAdvancedSearch();
});
- $(window).resize(function() {
+ $(window).resize(function () {
resizeAdvancedSearch();
});
// delete artwork
- $(document).on('click', '.delete-artwork', function(event) {
+ $(document).on('click', '.delete-artwork', function (event) {
event.preventDefault();
event.stopPropagation();
var id = $(this).attr('data-id');
- $('.artwork-preview-'+id).css('background-image', 'url('+ baseUrl +'css/images/no-cover.jpg)');
- $('.artwork-preview-'+id).hide();
- $('.artwork-preview-'+id).fadeIn(500);
- $('.artwork_'+id).val(function() {
+ $('.artwork-preview-' + id).css('background-image', 'url(' + baseUrl + 'css/images/no-cover.jpg)');
+ $('.artwork-preview-' + id).hide();
+ $('.artwork-preview-' + id).fadeIn(500);
+ $('.artwork_' + id).val(function () {
return "";
});
- $('.set_artwork_'+id).val(function() {
+ $('.set_artwork_' + id).val(function () {
return "";
});
- $('.remove_artwork_'+id).val(function() {
+ $('.remove_artwork_' + id).val(function () {
return 1;
});
});
// image upload by clicking on the artwork container
- $(document).on('change', '.artworkUpload', 'input', function(event) {
+ $(document).on('change', '.artworkUpload', 'input', function (event) {
event.preventDefault();
event.stopPropagation();
var id = $(this).attr('data-id');
@@ -1778,21 +1777,21 @@ $(document).ready(function() {
// image upload by dragging onto the artwork container
$.event.props.push('dataTransfer');
- (function() {
+ (function () {
var s;
var Artwork = {
settings: {
- body: $("body")
+ body: $("body")
},
- init: function() {
+ init: function () {
s = Artwork.settings;
Artwork.bindUIActions();
},
- bindUIActions: function() {
+ bindUIActions: function () {
var timer;
- s.body.on('dragover', '.artwork-upload', function(event) {
+ s.body.on('dragover', '.artwork-upload', function (event) {
event.preventDefault();
event.stopPropagation();
@@ -1800,15 +1799,15 @@ $(document).ready(function() {
Artwork.showDroppableArea();
return false;
});
- s.body.on('dragleave', '.artwork-upload', function(event) {
+ s.body.on('dragleave', '.artwork-upload', function (event) {
event.preventDefault();
event.stopPropagation();
- timer = setTimeout(function() {
+ timer = setTimeout(function () {
Artwork.hideDroppableArea();
}, 200);
});
- s.body.on('drop', '.artwork-upload', function(event) {
+ s.body.on('drop', '.artwork-upload', function (event) {
event.preventDefault();
event.stopPropagation();
var id = $(this).attr('data-id');
@@ -1816,41 +1815,41 @@ $(document).ready(function() {
});
},
- showDroppableArea: function() {
+ showDroppableArea: function () {
s.body.addClass("droppable");
},
- hideDroppableArea: function() {
+ hideDroppableArea: function () {
s.body.removeClass("droppable");
},
- handleDrop: function(files, id) {
+ handleDrop: function (files, id) {
Artwork.hideDroppableArea();
var file = files[0];
if (typeof file !== 'undefined' && file.type.match('image.*')) {
- Artwork.resizeImage(file, 512, function(data) {
+ Artwork.resizeImage(file, 512, function (data) {
Artwork.placeImage(data, id);
});
} else {
alert("The file is not an image.");
}
},
- resizeImage: function(file, size, callback) {
+ resizeImage: function (file, size, callback) {
var fileTracker = new FileReader;
- fileTracker.onload = function() {
+ fileTracker.onload = function () {
resampleImg(this.result, size, size, callback);
}
fileTracker.readAsDataURL(file);
- fileTracker.onabort = function() {
+ fileTracker.onabort = function () {
alert("Upload aborted!");
}
- fileTracker.onerror = function() {
+ fileTracker.onerror = function () {
alert("File could not be read.");
}
},
- placeImage: function(data, id) {
- $('.artwork-preview-'+id).css('background-image', 'url('+ data +')');
- $('.artwork-preview-'+id).hide();
- $('.artwork-preview-'+id).fadeIn(500);
- $('.set_artwork_'+id).val(function() {
+ placeImage: function (data, id) {
+ $('.artwork-preview-' + id).css('background-image', 'url(' + data + ')');
+ $('.artwork-preview-' + id).hide();
+ $('.artwork-preview-' + id).fadeIn(500);
+ $('.set_artwork_' + id).val(function () {
return data;
});
}
diff --git a/legacy/public/js/airtime/playlist/smart_blockbuilder.js b/legacy/public/js/airtime/playlist/smart_blockbuilder.js
index 4dd3dc86c..c0b23072e 100644
--- a/legacy/public/js/airtime/playlist/smart_blockbuilder.js
+++ b/legacy/public/js/airtime/playlist/smart_blockbuilder.js
@@ -1,4 +1,4 @@
-$(document).ready(function() {
+$(document).ready(function () {
setSmartBlockEvents();
});
@@ -7,7 +7,7 @@ function setSmartBlockEvents() {
form = activeTab.find('.smart-block-form');
/********** ADD CRITERIA ROW **********/
- form.find('#criteria_add').live('click', function(){
+ form.find('#criteria_add').live('click', function () {
var div = $('dd[id="sp_criteria-element"]').children('div:visible:last');
@@ -47,7 +47,7 @@ function setSmartBlockEvents() {
});
/********** ADD MODIFIER ROW **********/
- form.find('a[id^="modifier_add"]').live('click', function(){
+ form.find('a[id^="modifier_add"]').live('click', function () {
var criteria_value = $(this).siblings('select[name^="sp_criteria_field"]').val();
@@ -95,7 +95,7 @@ function setSmartBlockEvents() {
});
/********** REMOVE ROW **********/
- form.find('a[id^="criteria_remove"]').live('click', function(){
+ form.find('a[id^="criteria_remove"]').live('click', function () {
var curr = $(this).parent();
var curr_pos = curr.index();
var list = curr.parent();
@@ -117,8 +117,8 @@ function setSmartBlockEvents() {
if (count == 0) {
disableAndHideDateTimeDropdown(curr.find(':first-child'), index);
- disableAndHideExtraDateTimeDropdown(curr.find(':first-child'),index);
- disableAndHideExtraField(curr.find(':first-child'),index);
+ disableAndHideExtraDateTimeDropdown(curr.find(':first-child'), index);
+ disableAndHideExtraField(curr.find(':first-child'), index);
}
/* assign next row to current row for all rows below and including
@@ -126,7 +126,7 @@ function setSmartBlockEvents() {
*/
- for (var i=0; i 0) {
/* If the criteria field is hidden we know it is a modifier row
* and can hide the previous row's modifier add button
@@ -425,7 +425,7 @@ function appendModAddButton() {
}
//always add modifier add button to the last row
- if (i+1 == divs.length) {
+ if (i + 1 == divs.length) {
$(div).find('a[id^="modifier_add"]').removeClass('sp-invisible');
}
});
@@ -443,7 +443,7 @@ function reindexElements() {
*/
$('.db-logic-label').text('').hide();
- $.each(divs, function(i, div){
+ $.each(divs, function (i, div) {
if (i > 0 && index < 26) {
/* If the current row's criteria field is hidden we know it is
@@ -462,32 +462,33 @@ function reindexElements() {
modIndex = 0;
}
- $(div).find('select[name^="sp_criteria_field"]').attr('name', 'sp_criteria_field_'+index+'_'+modIndex);
- $(div).find('select[name^="sp_criteria_field"]').attr('id', 'sp_criteria_field_'+index+'_'+modIndex);
- $(div).find('select[name^="sp_criteria_modifier"]').attr('name', 'sp_criteria_modifier_'+index+'_'+modIndex);
- $(div).find('select[name^="sp_criteria_modifier"]').attr('id', 'sp_criteria_modifier_'+index+'_'+modIndex);
- $(div).find('input[name^="sp_criteria_value"]').attr('name', 'sp_criteria_value_'+index+'_'+modIndex);
- $(div).find('input[name^="sp_criteria_value"]').attr('id', 'sp_criteria_value_'+index+'_'+modIndex);
- $(div).find('select[name^="sp_criteria_value"]').attr('name', 'sp_criteria_value_'+index+'_'+modIndex);
- $(div).find('select[name^="sp_criteria_value"]').attr('id', 'sp_criteria_value_'+index+'_'+modIndex);
- $(div).find('input[name^="sp_criteria_extra"]').attr('name', 'sp_criteria_extra_'+index+'_'+modIndex);
- $(div).find('input[name^="sp_criteria_extra"]').attr('id', 'sp_criteria_extra_'+index+'_'+modIndex);
- $(div).find('a[name^="modifier_add"]').attr('id', 'modifier_add_'+index);
- $(div).find('a[id^="criteria_remove"]').attr('id', 'criteria_remove_'+index+'_'+modIndex);
+ $(div).find('select[name^="sp_criteria_field"]').attr('name', 'sp_criteria_field_' + index + '_' + modIndex);
+ $(div).find('select[name^="sp_criteria_field"]').attr('id', 'sp_criteria_field_' + index + '_' + modIndex);
+ $(div).find('select[name^="sp_criteria_modifier"]').attr('name', 'sp_criteria_modifier_' + index + '_' + modIndex);
+ $(div).find('select[name^="sp_criteria_modifier"]').attr('id', 'sp_criteria_modifier_' + index + '_' + modIndex);
+ $(div).find('input[name^="sp_criteria_value"]').attr('name', 'sp_criteria_value_' + index + '_' + modIndex);
+ $(div).find('input[name^="sp_criteria_value"]').attr('id', 'sp_criteria_value_' + index + '_' + modIndex);
+ $(div).find('select[name^="sp_criteria_value"]').attr('name', 'sp_criteria_value_' + index + '_' + modIndex);
+ $(div).find('select[name^="sp_criteria_value"]').attr('id', 'sp_criteria_value_' + index + '_' + modIndex);
+ $(div).find('input[name^="sp_criteria_extra"]').attr('name', 'sp_criteria_extra_' + index + '_' + modIndex);
+ $(div).find('input[name^="sp_criteria_extra"]').attr('id', 'sp_criteria_extra_' + index + '_' + modIndex);
+ $(div).find('a[name^="modifier_add"]').attr('id', 'modifier_add_' + index);
+ $(div).find('a[id^="criteria_remove"]').attr('id', 'criteria_remove_' + index + '_' + modIndex);
} else if (i > 0) {
$(div).remove();
}
});
}
-function buttonClickAction(clickType, url){
+function buttonClickAction(clickType, url) {
var data = $('.active-tab .smart-block-form').serializeArray(),
obj_id = $('.active-tab .obj_id').val();
enableLoadingIcon();
- $.post(url, {format: "json", data: data, obj_id: obj_id, obj_type: "block",
- modified: AIRTIME.playlist.getModified()
- }, function(data){
+ $.post(url, {
+ format: "json", data: data, obj_id: obj_id, obj_type: "block",
+ modified: AIRTIME.playlist.getModified()
+ }, function (data) {
callback(data, clickType);
disableLoadingIcon();
});
@@ -536,8 +537,8 @@ function setupUI() {
$(".playlist_type_help_icon").qtip({
content: {
- text: $.i18n._("A static smart block will save the criteria and generate the block content immediately. This allows you to edit and view it in the Library before adding it to a show.")+"
" +
- $.i18n._("A dynamic smart block will only save the criteria. The block content will get generated upon adding it to a show. You will not be able to view and edit the content in the Library.")
+ text: $.i18n._("A static smart block will save the criteria and generate the block content immediately. This allows you to edit and view it in the Library before adding it to a show.") + "
" +
+ $.i18n._("A dynamic smart block will only save the criteria. The block content will get generated upon adding it to a show. You will not be able to view and edit the content in the Library.")
},
hide: {
delay: 500,
@@ -599,23 +600,23 @@ function setupUI() {
}
});
- activeTab.find('.collapsible-header').off('click').on('click', function(){
+ activeTab.find('.collapsible-header').off('click').on('click', function () {
$(this).toggleClass('visible');
$('.smart-block-advanced').toggle();
});
}
function enableAndShowTracktypeDropdown(valEle, index) {
- console.log('tracktype show');
- $("#sp_criteria_value_"+index).replaceWith('');
- $.each(stringTracktypeOptions, function(key, value){
- $("#sp_criteria_value_"+index).append($('').attr('value', key).text(value));
- });
+ console.log('tracktype show');
+ $("#sp_criteria_value_" + index).replaceWith('');
+ $.each(stringTracktypeOptions, function (key, value) {
+ $("#sp_criteria_value_" + index).append($('').attr('value', key).text(value));
+ });
}
function disableAndHideTracktypeDropdown(valEle, index) {
- console.log('tracktype hide');
- $("#sp_criteria_value_"+index).replaceWith('');
+ console.log('tracktype hide');
+ $("#sp_criteria_value_" + index).replaceWith('');
}
/* Utilizing jQuery this function finds the #datetime_select element on the given row
@@ -624,12 +625,12 @@ function disableAndHideTracktypeDropdown(valEle, index) {
function enableAndShowDateTimeDropdown(valEle, index) {
console.log('datetime show');
var spanDatetime = valEle.nextAll("#datetime_select");
- spanDatetime.children('#sp_criteria_datetime_select_'+index).removeAttr("disabled");
- spanDatetime.children('#sp_criteria_extra_datetime_select_'+index).removeAttr("disabled");
+ spanDatetime.children('#sp_criteria_datetime_select_' + index).removeAttr("disabled");
+ spanDatetime.children('#sp_criteria_extra_datetime_select_' + index).removeAttr("disabled");
spanDatetime.show();
//make value input smaller since we have extra element now
- var criteria_val = $('#sp_criteria_value_'+index);
+ var criteria_val = $('#sp_criteria_value_' + index);
sizeTextBoxes(criteria_val, 'sp_input_text', 'sp_extra_input_text');
}
@@ -641,11 +642,11 @@ function enableAndShowDateTimeDropdown(valEle, index) {
function disableAndHideDateTimeDropdown(valEle, index) {
console.log('datetime hide');
var spanDatetime = valEle.nextAll("#datetime_select");
- spanDatetime.children('#sp_criteria_datetime_select_'+index).val("").attr("disabled", "disabled");
+ spanDatetime.children('#sp_criteria_datetime_select_' + index).val("").attr("disabled", "disabled");
spanDatetime.hide();
//make value input larger since we don't have extra field now
- var criteria_value = $('#sp_criteria_value_'+index);
+ var criteria_value = $('#sp_criteria_value_' + index);
sizeTextBoxes(criteria_value, 'sp_extra_input_text', 'sp_input_text');
}
@@ -655,11 +656,11 @@ function disableAndHideDateTimeDropdown(valEle, index) {
function enableAndShowExtraDateTimeDropdown(valEle, index) {
console.log('datetime show');
var spanDatetime = valEle.nextAll("#extra_datetime_select");
- spanDatetime.children('#sp_criteria_extra_datetime_select_'+index).removeAttr("disabled");
+ spanDatetime.children('#sp_criteria_extra_datetime_select_' + index).removeAttr("disabled");
spanDatetime.show();
//make value input smaller since we have extra element now
- var criteria_val = $('#sp_criteria_value_'+index);
+ var criteria_val = $('#sp_criteria_value_' + index);
sizeTextBoxes(criteria_val, 'sp_input_text', 'sp_extra_input_text');
}
/* Utilizing jQuery this function finds the #datetime_select element on the given row
@@ -669,33 +670,33 @@ function enableAndShowExtraDateTimeDropdown(valEle, index) {
function disableAndHideExtraDateTimeDropdown(valEle, index) {
console.log('datetime hide');
var spanDatetime = valEle.nextAll("#extra_datetime_select");
- spanDatetime.children('#sp_criteria_extra_datetime_select_'+index).val("").attr("disabled", "disabled");
+ spanDatetime.children('#sp_criteria_extra_datetime_select_' + index).val("").attr("disabled", "disabled");
spanDatetime.hide();
//make value input larger since we don't have extra field now
- var criteria_value = $('#sp_criteria_value_'+index);
+ var criteria_value = $('#sp_criteria_value_' + index);
sizeTextBoxes(criteria_value, 'sp_extra_input_text', 'sp_input_text');
}
function enableAndShowExtraField(valEle, index) {
var spanExtra = valEle.nextAll("#extra_criteria");
console.log('shown');
- spanExtra.children('#sp_criteria_extra_'+index).removeAttr("disabled");
+ spanExtra.children('#sp_criteria_extra_' + index).removeAttr("disabled");
spanExtra.show();
//make value input smaller since we have extra element now
- var criteria_val = $('#sp_criteria_value_'+index);
+ var criteria_val = $('#sp_criteria_value_' + index);
sizeTextBoxes(criteria_val, 'sp_input_text', 'sp_extra_input_text');
}
function disableAndHideExtraField(valEle, index) {
var spanExtra = valEle.nextAll("#extra_criteria");
- spanExtra.children('#sp_criteria_extra_'+index).val("").attr("disabled", "disabled");
+ spanExtra.children('#sp_criteria_extra_' + index).val("").attr("disabled", "disabled");
spanExtra.hide();
console.log('hidden');
//make value input larger since we don't have extra field now
- var criteria_value = $('#sp_criteria_value_'+index);
+ var criteria_value = $('#sp_criteria_value_' + index);
sizeTextBoxes(criteria_value, 'sp_extra_input_text', 'sp_input_text');
}
function disableAndHideLimitValue() {
@@ -722,37 +723,37 @@ function populateModifierSelect(e, popAllMods) {
if (popAllMods) {
index = index.substring(0, 1);
}
- divs = $(e).parents().find('select[id^="sp_criteria_modifier_'+index+'"]');
+ divs = $(e).parents().find('select[id^="sp_criteria_modifier_' + index + '"]');
- $.each(divs, function(i, div){
+ $.each(divs, function (i, div) {
$(div).children().remove();
if (criteria_type == 's') {
- $.each(stringCriteriaOptions, function(key, value){
- $(div).append($('')
- .attr('value', key)
- .text(value));
- });
- }
- else if(criteria_type == 'd') {
- $.each(dateTimeCriteriaOptions, function(key, value){
+ $.each(stringCriteriaOptions, function (key, value) {
$(div).append($('')
.attr('value', key)
.text(value));
});
}
- else if(criteria_type == 'tt') {
- $.each(stringIsNotOptions, function(key, value){
+ else if (criteria_type == 'd') {
+ $.each(dateTimeCriteriaOptions, function (key, value) {
+ $(div).append($('')
+ .attr('value', key)
+ .text(value));
+ });
+ }
+ else if (criteria_type == 'tt') {
+ $.each(stringIsNotOptions, function (key, value) {
$(div).append($('')
.attr('value', key)
.text(value));
});
}
else {
- $.each(numericCriteriaOptions, function(key, value){
+ $.each(numericCriteriaOptions, function (key, value) {
$(div).append($('')
- .attr('value', key)
- .text(value));
+ .attr('value', key)
+ .text(value));
});
}
});
@@ -767,13 +768,13 @@ function populateTracktypeSelect(e, popAllMods) {
if (popAllMods) {
index = index.substring(0, 1);
}
- divs = $(e).parents().find('select[id^="sp_criteria_modifier_'+index+'"]');
- $.each(divs, function(i, div){
+ divs = $(e).parents().find('select[id^="sp_criteria_modifier_' + index + '"]');
+ $.each(divs, function (i, div) {
$(div).children().remove();
- $.each(stringIsNotOptions, function(key, value){
+ $.each(stringIsNotOptions, function (key, value) {
$(div).append($('')
- .attr('value', key)
- .text(value));
+ .attr('value', key)
+ .text(value));
});
});
}
@@ -804,7 +805,7 @@ function callback(json, type) {
if (type == 'shuffle') {
form.find('.success').text($.i18n._('Smart block shuffled'));
} else if (type == 'generate') {
- form.find('.success').text($.i18n._('Smart block generated and criteria saved'));
+ form.find('.success').text($.i18n._('Smart block generated and criteria saved'));
//redraw library table so the length gets updated
dt.fnStandingRedraw();
}
@@ -889,7 +890,7 @@ function groupCriteriaRows() {
var visibleRows = $("#sp_criteria-element > div:visible"),
prevRowGroup = "0";
- visibleRows.each(function (index){
+ visibleRows.each(function (index) {
if (index > 0) {
var fieldId = $(this).find('select[id^="sp_criteria_field"]').attr("id");
var currRowGroup = fieldId[fieldId.length - 3];
@@ -911,74 +912,74 @@ function groupCriteriaRows() {
// or numeric value in order to populate the modifier
// select list
var criteriaTypes = {
- 0 : "",
- "album_title" : "s",
- "bit_rate" : "n",
- "bpm" : "n",
- "composer" : "s",
- "conductor" : "s",
- "copyright" : "s",
- "cuein" : "n",
- "cueout" : "n",
- "description" : "s",
- "artist_name" : "s",
- "encoded_by" : "s",
- "utime" : "d",
- "mtime" : "d",
- "lptime" : "d",
- "genre" : "s",
- "isrc_number" : "s",
- "label" : "s",
- "language" : "s",
- "length" : "n",
- "mime" : "s",
- "mood" : "s",
- "owner_id" : "s",
- "replay_gain" : "n",
- "sample_rate" : "n",
- "track_title" : "s",
- "track_number" : "n",
- "info_url" : "s",
- "year" : "n",
- "track_type" : "tt"
+ 0: "",
+ "album_title": "s",
+ "bit_rate": "n",
+ "bpm": "n",
+ "composer": "s",
+ "conductor": "s",
+ "copyright": "s",
+ "cuein": "n",
+ "cueout": "n",
+ "description": "s",
+ "artist_name": "s",
+ "encoded_by": "s",
+ "utime": "d",
+ "mtime": "d",
+ "lptime": "d",
+ "genre": "s",
+ "isrc_number": "s",
+ "label": "s",
+ "language": "s",
+ "length": "n",
+ "mime": "s",
+ "mood": "s",
+ "owner_id": "s",
+ "replay_gain": "n",
+ "sample_rate": "n",
+ "track_title": "s",
+ "track_number": "n",
+ "info_url": "s",
+ "year": "n",
+ "track_type": "tt"
};
var stringCriteriaOptions = {
- "0" : $.i18n._("Select modifier"),
- "contains" : $.i18n._("contains"),
- "does not contain" : $.i18n._("does not contain"),
- "is" : $.i18n._("is"),
- "is not" : $.i18n._("is not"),
- "starts with" : $.i18n._("starts with"),
- "ends with" : $.i18n._("ends with")
+ "0": $.i18n._("Select modifier"),
+ "contains": $.i18n._("contains"),
+ "does not contain": $.i18n._("does not contain"),
+ "is": $.i18n._("is"),
+ "is not": $.i18n._("is not"),
+ "starts with": $.i18n._("starts with"),
+ "ends with": $.i18n._("ends with")
};
var numericCriteriaOptions = {
- "0" : $.i18n._("Select modifier"),
- "is" : $.i18n._("is"),
- "is not" : $.i18n._("is not"),
- "is greater than" : $.i18n._("is greater than"),
- "is less than" : $.i18n._("is less than"),
- "is in the range" : $.i18n._("is in the range")
+ "0": $.i18n._("Select modifier"),
+ "is": $.i18n._("is"),
+ "is not": $.i18n._("is not"),
+ "is greater than": $.i18n._("is greater than"),
+ "is less than": $.i18n._("is less than"),
+ "is in the range": $.i18n._("is in the range")
};
var dateTimeCriteriaOptions = {
- "0" : $.i18n._("Select modifier"),
- "before" : $.i18n._("before"),
- "after" : $.i18n._("after"),
- "between" : $.i18n._("between"),
- "is" : $.i18n._("is"),
- "is not" : $.i18n._("is not"),
- "is greater than" : $.i18n._("is greater than"),
- "is less than" : $.i18n._("is less than"),
- "is in the range" : $.i18n._("is in the range")
+ "0": $.i18n._("Select modifier"),
+ "before": $.i18n._("before"),
+ "after": $.i18n._("after"),
+ "between": $.i18n._("between"),
+ "is": $.i18n._("is"),
+ "is not": $.i18n._("is not"),
+ "is greater than": $.i18n._("is greater than"),
+ "is less than": $.i18n._("is less than"),
+ "is in the range": $.i18n._("is in the range")
};
var stringIsNotOptions = {
- "0" : $.i18n._("Select modifier"),
- "is" : $.i18n._("is"),
- "is not" : $.i18n._("is not")
+ "0": $.i18n._("Select modifier"),
+ "is": $.i18n._("is"),
+ "is not": $.i18n._("is not")
};
let tracktypes = TRACKTYPES;
-var stringTracktypeOptions = Object.assign({"": "Select Track Type"}, tracktypes);
+var stringTracktypeOptions = Object.assign({ "": "Select Track Type" }, tracktypes);