This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var YouTubeDataAPI = Backbone.Model.extend({ | |
sendV2ApiRequest: function(options) { | |
return $.ajax({ | |
url: options.url, | |
data: $.extend({}, options.data, { | |
// The v parameter specifies the version of the API that YouTube should use to handle the API request. | |
v: 2, | |
// The alt parameter specifies the format of the feed to be returned. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// JavaScript micro-templating, similar to John Resig's implementation. | |
// Underscore templating handles arbitrary delimiters, preserves whitespace, | |
// and correctly escapes quotes within interpolated code. | |
_.template = function (text, data, settings) { | |
var render; | |
settings = _.defaults({}, settings, _.templateSettings); | |
// Combine delimiters into one regular expression via alternation. | |
var matcher = new RegExp([ | |
(settings.escape || noMatch).source, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define([ | |
'utility' | |
], function (Utility) { | |
'use strict'; | |
var PlaylistItemView = Backbone.View.extend({ | |
tagName: 'li', | |
className: 'playlistItem', | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(['jquery', 'underscore'], function () { | |
// Backbone.js 0.9.9 | |
// (c) 2010-2012 Jeremy Ashkenas, DocumentCloud Inc. | |
// Backbone may be freely distributed under the MIT license. | |
// For all details and documentation: | |
// http://backbonejs.org | |
(function () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
item.destroy({ | |
data: $.param({ | |
playlistId: playlistId, | |
userId: loginManager.get('user').get('id') | |
}), | |
processData: true, | |
success: callback, | |
error: function (error) { | |
console.error(error); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Create a storage location for the tree view dialog. | |
var treeViewDialog = $('<div />', { | |
id: 'TreeViewDialog' | |
}).appendTo(workflowDialog); | |
//Create a storage location for the lookup tree which is about to be created inside of our dialog. | |
var dialogContent = $('<div />', { | |
id: 'TreeViewDialogContent' | |
}); | |
dialogContent.appendTo(treeViewDialog); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Takes a song's UID and returns the index of that song in the playlist if found. | |
var getSongIndexById = function(songs, id) { | |
var songIndex = -1; | |
for (var i = 0; i < songs.length; i++) { | |
if (songs[i] && songs[i].id === id) { | |
songIndex = i; | |
break; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Takes a song's UID and returns the index of that song in the playlist if found. | |
var getSongIndexById = function(songs, id) { | |
var songIndex = -1; | |
for (var i = 0; i < songs.length; i++) { | |
if (songs[i] && songs[i].id === id) { | |
songIndex = i; | |
break; | |
} | |
} |