Skip to content

Instantly share code, notes, and snippets.

View MeoMix's full-sized avatar

Sean Anderson MeoMix

  • San Francisco, CA
View GitHub Profile
// 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)) {
var constructor = _.once(function(){
return {
//Setup a played recently array!
previousSongs: [],
nowPlaying: null,
comingUp: [],
//Is being used when comingUp is empty
endQueue: []
};
});
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 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;
}
});
//Responsible for showing options when interacting with a song list or play list
define(function(){
'use strict';
var selector = $('#ContextMenu');
//Hide the context menu whenever any click occurs not just when selecting an item.
$(document).click(function(){
selector.offset({top:0, left:0}).hide();
});
//Responsible for showing options when interacting with a song list or play list
define(function(){
'use strict';
var selector = $('#ContextMenu');
//Hide the context menu whenever any click occurs not just when selecting an item.
$(document).click(function(){
selector.offset({top:0, left:0}).hide();
});
function OrdersEditDisplay() {
$('#OrdersEditTabs').tabs();
var onDisplayLoadSuccess = function () {
$.each(arguments, function() {
$($(this).selector).off('click').on('click', 'fieldset legend', function () {
var fieldset = $(this).parent();
var isWrappedInDiv = $(fieldset.children()[0]).is('div');
if (isWrappedInDiv) {
for (var i = 0; i < songs.length; i++){
//Wrap in a closure to preserve song index for each iteration.
//If you don't do this the contextmenu method will always have the last song.
(function(i){
var listItem = $('<li/>').appendTo(songList);
var song = songs[i];
var link = $('<a/>', {