mirror of
https://github.com/2ec0b4/kaamelott-soundboard.git
synced 2025-12-08 23:53:24 +00:00
Révise l'affichage de l'infobulle donnant des informations sur les sons
This commit is contained in:
@@ -33,6 +33,9 @@ define(
|
||||
}
|
||||
|
||||
this.set('playing', false);
|
||||
},
|
||||
getSoundDetail: function() {
|
||||
return this.get('character')+', '+this.get('episode');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
<a href="#" role="button" title="{{character}}, {{episode}}" class="btn btn-play">{{title}}</a>
|
||||
<a href="#" role="button" class="btn btn-play">{{title}}</a>
|
||||
|
||||
@@ -16,7 +16,9 @@ define(
|
||||
soundItem: 'a'
|
||||
},
|
||||
events: {
|
||||
'click @ui.soundItem': 'toggleSound'
|
||||
'click @ui.soundItem': 'toggleSound',
|
||||
'mouseenter @ui.soundItem': 'toggleSoundDetail',
|
||||
'mouseleave @ui.soundItem': 'toggleSoundDetail'
|
||||
},
|
||||
initialize: function() {
|
||||
this.listenTo(this.model, "change:playing", this.playingAttributeChanged);
|
||||
@@ -40,6 +42,26 @@ define(
|
||||
} else {
|
||||
$(this.ui.soundItem).removeClass('playing');
|
||||
}
|
||||
},
|
||||
toggleSoundDetail: function(e) {
|
||||
var offset;
|
||||
|
||||
if (e.type === 'mouseleave') {
|
||||
$('.tooltip').remove();
|
||||
return;
|
||||
}
|
||||
|
||||
offset = $(this.el).offset();
|
||||
|
||||
$('<div/>')
|
||||
.addClass('tooltip')
|
||||
.append(
|
||||
$('<p/>').text(this.model.getSoundDetail())
|
||||
)
|
||||
.css({left: (offset.left+25)+'px', top: (offset.top+30)+'px'})
|
||||
.appendTo('body')
|
||||
.delay(1000)
|
||||
.show(0);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user