diff --git a/js/resume.js b/js/resume.js index e998151..2b981c3 100644 --- a/js/resume.js +++ b/js/resume.js @@ -1,10 +1,23 @@ (function($, window) { + window.jumpVid = function (id, time) { + $("video").each(function(e) { + if(btoa(this.currentSrc) == id) { + this.currentTime = time; + this.play(); + } + }); + }; $(window).on('load', function() { $("video").each(function(e) { var src = this.currentSrc; + var id = btoa(src); console.log(src); - var start = window.localStorage[btoa(src)]; + var start = window.localStorage[id]; if (start) { + if(!$(this).prev().find(".resume").length){ + $(this).prev().append('
'); + } + $(this).prev().find(".resume").html('Resume @'+Math.round(start / 60) +'min'); this.currentTime = parseFloat(start); } });