diff --git a/templates/lecture.html b/templates/lecture.html index 9a2cf3e497b1ce98db3db62f223c3ec9992f7333..ab0fc0df65140229855ba4ac917fad39f8743598 100644 --- a/templates/lecture.html +++ b/templates/lecture.html @@ -37,8 +37,19 @@ $(function() { { html:true, title:'Kapitelmarkierung vorschlagen', - content:'<form method="post" action="{{url_for('suggest_chapter', ref=request.url, lectureid=lecture.id)}}"><input placeholder="00:00.000" name="time" type="text"><br><input placeholder="Kapitel" name="text" type="texz"><br><input type="submit" value="Vorschlagen"></form>' + content: function() { + var zeropad = function (num, places) { + var zero = places - num.toString().length + 1; + return Array(+(zero > 0 && zero)).join("0") + num; + }; + var timestamp = $('.player video')[0].currentTime + var h = zeropad( Math.trunc(timestamp/3600),2); + var m = zeropad( Math.trunc((timestamp%3600)/60),2); + var s = zeropad( Math.trunc(timestamp%60),2); + var timeasstring = h+':'+m+':'+s + return '<form method="post" action="{{url_for('suggest_chapter', ref=request.url, lectureid=lecture.id)}}"><input placeholder="00:00.000" name="time" type="text" value="'+timeasstring+'"><br><input placeholder="Kapitel" name="text" type="texz"><br><input type="submit" value="Vorschlagen"></form>' + } }) });