Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Design Entscheidung
var wrapper = $(
'<div class="podlovewebplayer_wrapper">'+
'<div class="podlovewebplayer_meta">'+
'<a class="bigplay" href="#"></a>'+
'<div class="coverart"><img src="samples/coverimage.png" alt=""></div>'+
'<h3 class="episodetitle">'+
'<a href="{URL}">{TITLE}</a>'+
'</h3>'+
'<div class="subtitle">{SUBTITLE}</div>'+
'<div class="togglers">'+
'<a href="#" class="infowindow infobuttons icon-info-circle" title="More information about this"></a>'+
'<a href="#" class="chaptertoggle infobuttons icon-list-bullet" title="Show/hide chapters"></a>'+
'<a href="#" class="showcontrols infobuttons icon-clock" title="Show/hide time navigation controls"></a>'+
'<a href="#" class="showsharebuttons infobuttons icon-export" title="Show/hide sharing controls"></a>'+
'</div>'+
'</div>'+
/*snip*/
'<div class="podlovewebplayer_chapterbox showonplay">{CHAPTERS}</div>'+
'<div class="podlovewebplayer_tableend"></div>'+
'</div>');
wrapper.find('.prevbutton').on('click.podlovewebplayer', function(){
var wrapper = $(this).closest('.podlovewebplayer_wrapper'),
curr = wrapper.find('.chaptertr.active');
wrapper.podlovewebplayer('play', function( oldTime){
return oldTime > curr.data('start') + 10 ? curr.data('start') : curr.prev().data('start');
});
});
var wrapper = $(/* wie oben */);
wrapper.on('click.podlovewebplayer','.prevbutton', function(event){
var wrapper = $(event.delegateTarget),
curr = wrapper.find('.chaptertr.active');
wrapper.podlovewebplayer('play', function( oldTime){
return oldTime > curr.data('start') + 10 ? curr.data('start') : curr.prev().data('start');
});
});
@Kambfhase

This comment has been minimized.

Copy link
Owner Author

commented Mar 9, 2013

Option A ist das, wie ihr es bisher gehandhabt habt.

Option B ist sowohl bei der Erstellung als auch bei der Ausführung schneller. Leider kann ich das nicht quantifizieren. Ich kann auch nicht sagen, wie sich der wrapper verhält, wenn man viele Events daran delegiert. Zudem vermute ich, dass außer mir niemand versteht, warum das so funktioniert.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.