108 lines
2.0 KiB
JavaScript
108 lines
2.0 KiB
JavaScript
|
|
soundManager.url = '/wp-content/themes/soundmap/carnaval/swf/';
|
|
|
|
var files_reference=new Array();
|
|
var files = "";
|
|
|
|
|
|
|
|
soundManager.onready(function(){
|
|
carnaval.startAutoMode();
|
|
});
|
|
|
|
|
|
function Carnaval(){
|
|
|
|
var list_ = null;
|
|
var playlist_ = null;
|
|
var selBox_ = null;
|
|
var pointer_ = 0;
|
|
var self_=this;
|
|
|
|
var stEv_ = {
|
|
play_: self_.play_,
|
|
stop_: self_.stop_,
|
|
finish_: self_.finish_
|
|
};
|
|
|
|
var init_ = function (e){
|
|
console.log("CCCCCCAAAAAARRRRRRNNNNNNNAAAAAAVAVVVVVVVAAAAAALLLLLLLL");
|
|
list_ = eval('(' + files_reference + ')');
|
|
playlist_ = jQuery('.playlistLink').addEventListener('click', self_.playlistClick, false);
|
|
|
|
// console.log(list_['1398'][0].fileURI);
|
|
|
|
}
|
|
|
|
var playSong_ = function (e, ev){
|
|
var l_ = e;
|
|
var box_ = l_.rel;
|
|
if(selBox_){
|
|
jQuery('#' + selBox_).fadeOut(600);
|
|
soundManager.stop('s_' + selBox_);
|
|
}
|
|
selBox_ = box_;
|
|
jQuery('#' + selBox_).fadeIn(600);
|
|
var file_ = null;
|
|
if (list_[selBox_][0]){
|
|
file_ = list_[selBox_][0].fileURI;
|
|
}
|
|
soundManager.createSound({
|
|
id: 's_' + selBox_,
|
|
url: file_,
|
|
autoPlay: true,
|
|
onplay: ev.play_,
|
|
onstop: ev.stop_,
|
|
onfinish: ev.finish_
|
|
});
|
|
}
|
|
|
|
this.playlistClick = function (e) {
|
|
e.preventDefault();
|
|
|
|
var ev_ = {
|
|
play_: self_.play_,
|
|
stop_: self_.stop_,
|
|
finish_: function (){
|
|
setTimeout(self_.startAutoMode(), '2000');
|
|
|
|
}
|
|
};
|
|
|
|
playSong_(e.target, ev_);
|
|
}; //playlistClick
|
|
|
|
this.play_ = function(){
|
|
console.log("estamos sonando");
|
|
}; //play
|
|
this.stop_ = function(){
|
|
console.log("Estamos parando...");
|
|
}; //stop
|
|
this.finish_ = function(){
|
|
console.log("Acabado");
|
|
}
|
|
|
|
this.startAutoMode = function(){
|
|
var s_ = playlist_[pointer_];
|
|
|
|
var ev_ = {
|
|
play_: self_.play_,
|
|
stop_: self_.stop_,
|
|
finish_: function (){
|
|
console.log("estamos en buen camino");
|
|
self_.startAutoMode();
|
|
}
|
|
};
|
|
playSong_(s_, ev_);
|
|
pointer_++;
|
|
|
|
}
|
|
|
|
|
|
document.addEventListener('DOMContentLoaded', init_ ,false);
|
|
|
|
|
|
|
|
}
|
|
|
|
var carnaval = new Carnaval(); |