From 61dc6b7d8e1c180cee1ded8c920c216ffc7c7f3a Mon Sep 17 00:00:00 2001 From: shimunn <> Date: Fri, 26 Apr 2019 16:26:46 +0200 Subject: [PATCH] indicate last position --- js/resume.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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); } });