112 lines
2.4 KiB
JavaScript
112 lines
2.4 KiB
JavaScript
|
$('ul.image-gallery-slider').each(function(index, element) {
|
||
|
$(this).slidesjs({
|
||
|
width: 400,
|
||
|
height: 260,
|
||
|
navigation: true,
|
||
|
start: 1,
|
||
|
play: {
|
||
|
auto: true,
|
||
|
interval: Math.random() * 100000 + 5000,
|
||
|
},
|
||
|
pagination: {
|
||
|
active: false
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
$('ul.image-gallery-slider-static').each(function(index, element) {
|
||
|
$(this).slidesjs({
|
||
|
width: 400,
|
||
|
height: 260,
|
||
|
navigation: false,
|
||
|
start: 1,
|
||
|
play: {
|
||
|
auto: false,
|
||
|
},
|
||
|
pagination: {
|
||
|
active: false
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
$('.voices').each(function(index, element) {
|
||
|
$(this).hover(
|
||
|
function(){
|
||
|
$(this).children('.voice-ctl').show();
|
||
|
},
|
||
|
function(){
|
||
|
$(this).children('.voice-ctl').hide();
|
||
|
}
|
||
|
);
|
||
|
});
|
||
|
var mp3player = {
|
||
|
loaded : function(){
|
||
|
var track = {
|
||
|
mp3 : "",
|
||
|
id : 0,
|
||
|
ctl : null,
|
||
|
ctl_play : null,
|
||
|
ctl_pause : null,
|
||
|
ctl_stop : null
|
||
|
}
|
||
|
|
||
|
var my_jPlayer = $("#jquery_jplayer");
|
||
|
|
||
|
my_jPlayer.jPlayer({
|
||
|
swfPath: "/static/lib/jplayer",
|
||
|
supplied: "mp3",
|
||
|
solution:"flash,html",
|
||
|
ended: function(event){
|
||
|
track.ctl_play.show();
|
||
|
track.ctl_pause.hide();
|
||
|
mp3player.playcount(track.id);
|
||
|
}
|
||
|
});
|
||
|
|
||
|
$(".jp-play").click(function(e) {
|
||
|
if($(this).prev('input[name=trackid]').val() != track.id)
|
||
|
{
|
||
|
track.id = $(this).prev('input[name=trackid]').val();
|
||
|
track.ctl = $('#voice-ctl-' + track.id);
|
||
|
track.mp3 = track.ctl.children('input[name=track]').val();
|
||
|
my_jPlayer.jPlayer("setMedia", {
|
||
|
mp3: track.mp3,
|
||
|
});
|
||
|
track.ctl_play = track.ctl.children('.jp-play');
|
||
|
track.ctl_pause = track.ctl.children('.jp-pause');
|
||
|
track.ctl_stop = track.ctl.children('.jp-stop');
|
||
|
}
|
||
|
|
||
|
my_jPlayer.jPlayer("play");
|
||
|
|
||
|
track.ctl_play.hide();
|
||
|
track.ctl_pause.show();
|
||
|
|
||
|
$(this).blur();
|
||
|
return false;
|
||
|
});
|
||
|
$('.jp-pause').click(function(e){
|
||
|
my_jPlayer.jPlayer("pause");
|
||
|
track.ctl_play.show();
|
||
|
track.ctl_pause.hide();
|
||
|
$(this).blur();
|
||
|
});
|
||
|
$('.jp-stop').click(function(e){
|
||
|
track.ctl_play.show();
|
||
|
track.ctl_pause.hide();
|
||
|
my_jPlayer.jPlayer("stop");
|
||
|
mp3player.playcount(track.id);
|
||
|
});
|
||
|
},
|
||
|
playcount : function(id){
|
||
|
$.ajax({
|
||
|
'type':"POST",
|
||
|
'url':"/voice/count/id/"+id,
|
||
|
'data':"",
|
||
|
'success':function(){},
|
||
|
'timeout': 5000,
|
||
|
'error': function(){},
|
||
|
'beforeSend': function(){},
|
||
|
'complete': function(){}
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
mp3player.loaded();
|