Created
July 8, 2014 18:25
-
-
Save neurosnap/f7f9989941ef21346332 to your computer and use it in GitHub Desktop.
V3 SpokenLayer landing.js
This file contains hidden or 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
$(function() { | |
$("#nol_start").on("click", function() { | |
$("#sl_queue > div").each(function() { | |
sl_start(this); | |
}); | |
}); | |
$(".nol_play").on("click", function() { | |
//sl_start(this); | |
add_to_queue(this); | |
}); | |
$("#nol_play_all").on("click", function() { | |
$(".nol_play").each(function() { | |
sl_start(this); | |
}); | |
}); | |
function add_to_queue(element) { | |
var link = $(element).data("link"); | |
var title = $(element).parent().find(".media-heading").text(); | |
$("#sl_queue").append('<div data-link="' + link + '">' + title + '</div>'); | |
$(element).prop("disabled", true); | |
$("#nol_start").show(); | |
} | |
function sl_start(element) { | |
$(".nol_play").prop("disabled", true); | |
$("#nol_play_all").prop("disabled", true); | |
var link = $(element).data("link"); | |
if ($(".sl_player").length == 0) | |
init_player(element); | |
queue(link); | |
}; | |
function init_player(element) { | |
var options = { | |
'targetSelector':'#sl_player_container', | |
'autoDetectArticle': false | |
}; | |
sl = new SpokenLayer(options); | |
console.log("testing"); | |
//$("#sl_player_container").html("<script id='sl-player-init'> var options = {'targetSelector':'#sl_player_container', 'autoDetectArticle': false}; sl = new SpokenLayer(options); </script>"); | |
//$("#sl_player_container").html('<script class="sl_player">sl = new SpokenLayer({ "autoDetectArticle": false });</script>'); | |
//setTimeout(function() { $(".sl_play").click() }, 2000); | |
}; | |
function queue(link) { | |
//SpokenLayer.getAudioByUrl(link); | |
SpokenLayer.queue(link); | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment