Created
March 9, 2013 23:40
-
-
Save Kambfhase/5126318 to your computer and use it in GitHub Desktop.
Design Entscheidung
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.