Commit d1b6f52f authored by Simon Daron's avatar Simon Daron
Browse files

Some log and style onAdd sound

parent cbc04e15
......@@ -117,21 +117,35 @@ body{
z-index:2000;
position: fixed;
bottom: 0px;
right: 0px;
}
#userLog .log{
margin:0.2em;
margin:0.3em;
-moz-box-shadow: 0px 0px 3px #000;
-webkit-box-shadow: 0px 0px 3px #000;
box-shadow: 0px 0px 3px #000;
border-radius:0.5em;-moz-border-radius:0.5em;-webkit-border-radius:0.5em;
text-align:center;
padding: 0.2em;
padding: 0.3em;
font-size:0.9em;
color:black;
background-color:orange;
border: 2px solid yellow;
border: 2px solid black;
background-image: linear-gradient(135deg, rgba(0, 0, 0, 0.04) 25%, transparent 25%, transparent 50%, rgba(0, 0, 0, 0.04) 50%, rgba(0, 0, 0, 0.04) 75%, transparent 75%, transparent);
}
#userLog .log.info{
background-color:grey;
color:white;
}
#userLog .log.ok{
background-color:green;
border-color:black;
color:white;
}
#userLog .log.error{
background-color:orange;
border-color:yellow;
}
#main {}
#mainLegend{
width:30%;
......@@ -273,6 +287,9 @@ body{
}
#player .playlist .item img{ float:left;}
/*Playlist*/
#Playlist{
}
#Playlist .playlistControls{
padding:0.5em;
text-align:center;
......@@ -287,10 +304,10 @@ body{
margin:0 0.5em 0 0.5em;
}
#Playlist .soundControls{
font-size:8px;
clear:right;
float:right;
}
#Playlist .soundControls button{}
#Playlist .active .title{
font-weight:bold;
}
......
......@@ -18,6 +18,7 @@
classes: "",
itemClasses: "",
playlistContainer: $('<ol>'),
onAdd: function(){},
},
_create: function() {
// Initialization logic here
......@@ -42,9 +43,9 @@
_update: function() {
this.playlist = [];
this.playlistContainer.find('audio').each(function(){
thePlaylist.playlist.push(thePlaylist.jsonifyAudio($(this)));
});
if(this.playlist.lenght >= 1){this.playlistContainer.show();}
this.savePlaylist();
this.debugContainer.text(
JSON.stringify(this.playlist, null, '\t')
......@@ -132,14 +133,19 @@
return container;
},
// Create a public method.
registerAudio: function(audio) {
registerAudio: function(audio,success=function(){}) {
var htmlAudio = this._htmlifyJsonSound(this.jsonifyAudio(audio));
this.playlistContainer.append(htmlAudio);
this.options.onAdd();
success();
this._update();
},
// Build controls
buildPlaylistControls: function() {
this.controls = $('<div>',{class:'playlistControls controls'});
this.toggleList = $('<button>',{class:"icon-list",click:function(){
thePlaylist.playlistContainer.toggle();
}});
this.playpause = $('<button>',{class:"icon-play",click:function(){
thePlaylist.playPauseList();
}});
......@@ -152,7 +158,7 @@
this.previous = $('<button>',{class:"icon-step-backward",click:function(){
thePlaylist.playPrevious();
}});
this.controls.append(this.previous).append(this.stop).append(this.playpause).append(this.next);
this.controls.append(this.toggleList).append(this.previous).append(this.stop).append(this.playpause).append(this.next);
this.controlContainer.append(this.controls);
return true;
},
......
$(function() {
var $main = $("#Changing");
var $log = $("#userLog");
var $localList = $('#localList').playlist({playlistContainer: $('<ol>',{class:"custom"}).sortable()});
doLog = function(aTextToLog, type){
var aLog = $('<div>',{class:"log",html:'<div class='+type+'>'+aTextToLog+'</div>'});
var aLog = $('<div>',{class:"log "+type,html:aTextToLog});
aLog.hide().prependTo($log).show('fast').delay(10000).hide('fast', function() {
$(this).remove();
});
}
var $main = $("#Changing");
var $log = $("#userLog");
var $localList = $('#localList').playlist({
playlistContainer: $('<ol>',{class:"custom"}).sortable()
});
String.prototype.decodeHTML = function() {
return $("<div>", {html: "" + this}).html();
};
......@@ -101,7 +104,7 @@ $(function() {
});
$('[data-playlist-add]').on('click',function(){
var audio = $($(this).attr('data-playlist-add'));
$localList.playlist("registerAudio",audio);
$localList.playlist("registerAudio",audio,doLog(audio.attr('title')+' has been added to your playlist.','ok'));
/*
try {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment