Skip to content

Instantly share code, notes, and snippets.

View MeoMix's full-sized avatar

Sean Anderson MeoMix

  • San Francisco, CA
View GitHub Profile
var closestvideo = {
video: null,
difference: Number.MAX_VALUE
};
var videos = json.feed.entry;
$.each(videos, function () {
var duration = this.media$group.yt$duration.seconds;
console.log("song duration:", song.duration);
//Cross-Origin Resource Sharing unavailable from file://
if(window.location.protocol !== 'file:'){
if(window.location.protocol === 'chrome-extension:') {
$.ajax({
url: 'http://www.geoplugin.net/json.gp',
success: function(result) {
var geoplugin = JSON.parse(result.replace(/^[^\{]+/, '').replace(/\);?$/, ''));
countryCode = geoplugin.geoplugin_countryCode;
}
});
FROM THIS:
//Provides an interface to the YouTube iFrame.
//Starts up Player object after receiving a ready response from the YouTube API.
var onReady_funcs = [], api_isReady = false;
define(['onYouTubePlayerAPIReady'],function(){
'use strict';
//This code will trigger onYouTubePlayerAPIReady
$(window).load(function(){
//Load YouTube Frame API
var constructor = _.once(function(){
return {
//Setup a played recently array!
previousSongs: [],
nowPlaying: null,
comingUp: [],
//Is being used when comingUp is empty
endQueue: []
};
});
// open/close
open_node : function (obj, callback, skip_animation) {
console.log("Obj:", obj);
obj = this._get_node(obj);
console.log("calling open node", obj);
if(!obj.length) { return false; }
if(!obj.hasClass("jstree-closed")) { if(callback) { callback.call(); } return false; }
var s = skip_animation || is_ie6 ? 0 : this._get_settings().core.animation,
t = this;
if(!this._is_loaded(obj)) {
// open/close
open_node : function (obj, callback, skip_animation) {
console.log("Obj:", obj);
obj = this._get_node(obj);
console.log("calling open node", obj);
if(!obj.length) { return false; }
if(!obj.hasClass("jstree-closed")) { if(callback) { callback.call(); } return false; }
var s = skip_animation || is_ie6 ? 0 : this._get_settings().core.animation,
t = this;
if(!this._is_loaded(obj)) {
//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;
}
}
//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;
}
}
//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);
item.destroy({
data: $.param({
playlistId: playlistId,
userId: loginManager.get('user').get('id')
}),
processData: true,
success: callback,
error: function (error) {
console.error(error);
}