CC-3896: Playlist Builder: Using "select this page" to add songs to playlist, those songs will be added in by opposite order, like a stack

-fixed whitespace in library.js
This commit is contained in:
denise 2012-06-06 10:45:27 -04:00
parent 226ef262ba
commit 8e0c886350
1 changed files with 171 additions and 171 deletions

View File

@ -1,12 +1,12 @@
var AIRTIME = (function(AIRTIME) {
var mod,
libraryInit,
oTable,
$libContent,
$libTable,
LIB_SELECTED_CLASS = "lib-selected",
chosenItems = {},
visibleChosenItems = {};
oTable,
$libContent,
$libTable,
LIB_SELECTED_CLASS = "lib-selected",
chosenItems = {},
visibleChosenItems = {};
if (AIRTIME.library === undefined) {
AIRTIME.library = {};
@ -28,14 +28,14 @@ var AIRTIME = (function(AIRTIME) {
}
});
selected = Object.keys(visibleChosenItems).length;
visibleChosenItems = {};
return selected;
selected = Object.keys(visibleChosenItems).length;
visibleChosenItems = {};
return selected;
};
mod.getChosenAudioFilesLength = function(){
//var files = Object.keys(chosenItems),
var files,
//var files = Object.keys(chosenItems),
var files,
$trs,
cItem,
i, length,
@ -54,19 +54,19 @@ var AIRTIME = (function(AIRTIME) {
files = Object.keys(visibleChosenItems);
for (i = 0, length = files.length; i < length; i++) {
for (i = 0, length = files.length; i < length; i++) {
if (files[i].search(reAudio) !== -1) {
count++;
}
}
if (files[i].search(reAudio) !== -1) {
count++;
}
}
return count;
return count;
};
mod.createToolbarDropDown = function() {
$.contextMenu({
$.contextMenu({
selector: '#library_content .ui-icon-document-b',
trigger: "left",
ignoreRightClick: true,
@ -79,38 +79,38 @@ var AIRTIME = (function(AIRTIME) {
};
mod.checkDeleteButton = function() {
var selected = mod.getChosenItemsLength(),
check = false;
var selected = mod.getChosenItemsLength(),
check = false;
if (selected !== 0) {
check = true;
}
if (selected !== 0) {
check = true;
}
if (check === true) {
AIRTIME.button.enableButton("lib-button-delete");
}
else {
AIRTIME.button.disableButton("lib-button-delete");
}
if (check === true) {
AIRTIME.button.enableButton("lib-button-delete");
}
else {
AIRTIME.button.disableButton("lib-button-delete");
}
};
mod.checkToolBarIcons = function() {
AIRTIME.library.checkAddButton();
AIRTIME.library.checkDeleteButton();
AIRTIME.library.checkAddButton();
AIRTIME.library.checkDeleteButton();
};
mod.getSelectedData = function() {
var id,
var id,
data = [],
cItem,
$trs;
$.fn.reverse = [].reverse;
$.fn.reverse = [].reverse;
// Get visible items and check if any chosenItems are visible
// Get visible items and check if any chosenItems are visible
$trs = $libTable.find("tbody input:checkbox").parents("tr").reverse();
$trs.each(function(i){
$trs.each(function(i){
for (cItem in chosenItems) {
if (cItem === $(this).attr("id")) {
visibleChosenItems[cItem] = $(this).data('aData');
@ -118,79 +118,79 @@ var AIRTIME = (function(AIRTIME) {
}
});
for (id in visibleChosenItems) {
for (id in visibleChosenItems) {
if (visibleChosenItems.hasOwnProperty(id)) {
data.push(visibleChosenItems[id]);
}
}
return data;
return data;
};
mod.redrawChosen = function() {
var ids = Object.keys(chosenItems),
i, length,
$el;
var ids = Object.keys(chosenItems),
i, length,
$el;
for (i = 0, length = ids.length; i < length; i++) {
$el = $libTable.find("#"+ids[i]);
for (i = 0, length = ids.length; i < length; i++) {
$el = $libTable.find("#"+ids[i]);
if ($el.length !== 0) {
mod.highlightItem($el);
}
}
if ($el.length !== 0) {
mod.highlightItem($el);
}
}
};
mod.isChosenItem = function($el) {
var id = $el.attr("id"),
item = chosenItems[id];
var id = $el.attr("id"),
item = chosenItems[id];
return item !== undefined ? true : false;
return item !== undefined ? true : false;
};
mod.addToChosen = function($el) {
var id = $el.attr("id");
var id = $el.attr("id");
chosenItems[id] = $el.data('aData');
chosenItems[id] = $el.data('aData');
};
mod.removeFromChosen = function($el) {
var id = $el.attr("id");
var id = $el.attr("id");
//used to not keep dragged items selected.
if (!$el.hasClass(LIB_SELECTED_CLASS)) {
delete chosenItems[id];
}
//used to not keep dragged items selected.
if (!$el.hasClass(LIB_SELECTED_CLASS)) {
delete chosenItems[id];
}
};
mod.highlightItem = function($el) {
var $input = $el.find("input");
var $input = $el.find("input");
$input.attr("checked", true);
$el.addClass(LIB_SELECTED_CLASS);
$input.attr("checked", true);
$el.addClass(LIB_SELECTED_CLASS);
};
mod.unHighlightItem = function($el) {
var $input = $el.find("input");
var $input = $el.find("input");
$input.attr("checked", false);
$el.removeClass(LIB_SELECTED_CLASS);
$input.attr("checked", false);
$el.removeClass(LIB_SELECTED_CLASS);
};
mod.selectItem = function($el) {
mod.highlightItem($el);
mod.addToChosen($el);
mod.highlightItem($el);
mod.addToChosen($el);
mod.checkToolBarIcons();
mod.checkToolBarIcons();
};
mod.deselectItem = function($el) {
mod.unHighlightItem($el);
mod.removeFromChosen($el);
mod.unHighlightItem($el);
mod.removeFromChosen($el);
mod.checkToolBarIcons();
mod.checkToolBarIcons();
};
/*
@ -202,13 +202,13 @@ var AIRTIME = (function(AIRTIME) {
*/
mod.selectCurrentPage = function() {
$.fn.reverse = [].reverse;
var $trs = $libTable.find("tbody input:checkbox").parents("tr").reverse();
var $trs = $libTable.find("tbody input:checkbox").parents("tr").reverse();
$trs.each(function(i, el){
$el = $(this);
$trs.each(function(i, el){
$el = $(this);
mod.selectItem($el);
});
mod.selectItem($el);
});
};
/*
@ -217,25 +217,25 @@ var AIRTIME = (function(AIRTIME) {
*/
mod.deselectCurrentPage = function() {
var $trs = $libTable.find("tbody input:checkbox").filter(":checked").parents("tr");
var $trs = $libTable.find("tbody input:checkbox").filter(":checked").parents("tr");
$trs.each(function(i, el){
$el = $(this);
$trs.each(function(i, el){
$el = $(this);
mod.deselectItem($el);
});
mod.deselectItem($el);
});
};
mod.selectNone = function() {
var $inputs = $libTable.find("tbody input:checkbox"),
$trs = $inputs.parents("tr");
var $inputs = $libTable.find("tbody input:checkbox"),
$trs = $inputs.parents("tr");
$inputs.attr("checked", false);
$trs.removeClass(LIB_SELECTED_CLASS);
$inputs.attr("checked", false);
$trs.removeClass(LIB_SELECTED_CLASS);
chosenItems = {};
chosenItems = {};
mod.checkToolBarIcons();
mod.checkToolBarIcons();
};
mod.fnDeleteItems = function(aMedia) {
@ -276,18 +276,18 @@ var AIRTIME = (function(AIRTIME) {
* Icon hover states in the toolbar.
*/
$libContent.on("mouseenter", ".fg-toolbar ul li", function(ev) {
$el = $(this);
$el = $(this);
if (!$el.hasClass("ui-state-disabled")) {
$el.addClass("ui-state-hover");
}
if (!$el.hasClass("ui-state-disabled")) {
$el.addClass("ui-state-hover");
}
});
$libContent.on("mouseleave", ".fg-toolbar ul li", function(ev) {
$el = $(this);
$el = $(this);
if (!$el.hasClass("ui-state-disabled")) {
$el.removeClass("ui-state-hover");
}
if (!$el.hasClass("ui-state-disabled")) {
$el.removeClass("ui-state-hover");
}
});
$libTable = $libContent.find("table");
@ -337,9 +337,9 @@ var AIRTIME = (function(AIRTIME) {
},
"fnStateSave": function (oSettings, oData) {
localStorage.setItem('datatables-library', JSON.stringify(oData));
localStorage.setItem('datatables-library', JSON.stringify(oData));
$.ajax({
$.ajax({
url: "/usersettings/set-library-datatable",
type: "POST",
data: {settings : oData, format: "json"},
@ -347,11 +347,11 @@ var AIRTIME = (function(AIRTIME) {
});
},
"fnStateLoad": function fnLibStateLoad(oSettings) {
var settings = localStorage.getItem('datatables-library');
var settings = localStorage.getItem('datatables-library');
if (settings !== "") {
return JSON.parse(settings);
}
if (settings !== "") {
return JSON.parse(settings);
}
},
"fnStateLoadParams": function (oSettings, oData) {
var i,
@ -361,16 +361,16 @@ var AIRTIME = (function(AIRTIME) {
//putting serialized data back into the correct js type to make
//sure everything works properly.
for (i = 0, length = a.length; i < length; i++) {
if (typeof(a[i]) === "string") {
a[i] = (a[i] === "true") ? true : false;
}
if (typeof(a[i]) === "string") {
a[i] = (a[i] === "true") ? true : false;
}
}
a = oData.ColReorder;
for (i = 0, length = a.length; i < length; i++) {
if (typeof(a[i]) === "string") {
a[i] = parseInt(a[i], 10);
}
if (typeof(a[i]) === "string") {
a[i] = parseInt(a[i], 10);
}
}
oData.iEnd = parseInt(oData.iEnd, 10);
@ -465,11 +465,11 @@ var AIRTIME = (function(AIRTIME) {
});
},
//remove any selected nodes before the draw.
"fnPreDrawCallback": function( oSettings ) {
"fnPreDrawCallback": function( oSettings ) {
//make sure any dragging helpers are removed or else they'll be stranded on the screen.
$("#draggingContainer").remove();
},
//make sure any dragging helpers are removed or else they'll be stranded on the screen.
$("#draggingContainer").remove();
},
"fnDrawCallback": AIRTIME.library.fnDrawCallback,
"aaSorting": [[3, 'asc']],
@ -515,27 +515,27 @@ var AIRTIME = (function(AIRTIME) {
$libTable.find("tbody").on("click", "input[type=checkbox]", function(ev) {
var $cb = $(this),
$prev,
$tr = $cb.parents("tr"),
$trs;
var $cb = $(this),
$prev,
$tr = $cb.parents("tr"),
$trs;
if ($cb.is(":checked")) {
if ($cb.is(":checked")) {
if (ev.shiftKey) {
$prev = $libTable.find("tbody").find("tr."+LIB_SELECTED_CLASS).eq(-1);
$trs = $prev.nextUntil($tr);
if (ev.shiftKey) {
$prev = $libTable.find("tbody").find("tr."+LIB_SELECTED_CLASS).eq(-1);
$trs = $prev.nextUntil($tr);
$trs.each(function(i, el){
mod.selectItem($(el));
});
}
$trs.each(function(i, el){
mod.selectItem($(el));
});
}
mod.selectItem($tr);
}
else {
mod.deselectItem($tr);
}
mod.selectItem($tr);
}
else {
mod.deselectItem($tr);
}
});
checkImportStatus();
@ -729,8 +729,8 @@ function addProgressIcon(id) {
function checkLibrarySCUploadStatus(){
var url = '/Library/get-upload-to-soundcloud-status',
span,
id;
span,
id;
function checkSCUploadStatusCallback(json) {