diff options
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | index.html | 2 | ||||
-rw-r--r-- | main.js | 43 |
3 files changed, 20 insertions, 29 deletions
@@ -1,9 +1,9 @@ # yt-frame-timer -A JavaScript-based program to determine the time between start and end points of a YouTube video down to the frame. The tool was originally created to help moderators retime speedruns on [speedrun.com](https://www.speedrun.com). Based on [Slush Puppy's Retime Tool (SPRT)](https://github.com/Slush0Puppy/retime) by Slush Puppy (big thanks to them for their work). +A JavaScript-based program to determine the time between start and end points of a YouTube video down to the frame. The tool was originally created to help moderators retime speedruns on [speedrun.com](https://www.speedrun.com). Based on [Slush Puppy's Retime Tool (SPRT)](https://github.com/Slush0Puppy/retime) by @SlushPuppy (big thanks to them for their work). ## Contributors * [SlushPuppy](https://www.speedrun.com/user/SlushPuppy) - Created [Slush Puppy's Retime Tool (SPRT)](https://github.com/Slush0Puppy/retime) in Python * [dadinfinitum](https://www.speedrun.com/user/dadinfinitum) - Rewrote SPRT into web-hosted JavaScript / yt-frame-retimer lead * [Oxknifer](https://www.speedrun.com/user/Oxknifer) - Original idea / beta tester on SPRT / yt-frame-retimer contributor -Interested in contributing? Message @dadinfinitum or @Oxknifer +Interested in contributing? Message @dadinfinitum or @Oxknifer on [speedrun.com](https://www.speedrun.com). @@ -4,7 +4,7 @@ <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <version>1.1.0</version> + <meta name="version" content="1.1.1" /> <title>YouTube Frame Timer</title> <link rel="stylesheet" href="https://stackedit.io/style.css" /> <script src="main.js"></script> @@ -17,32 +17,23 @@ function compute() { // Calculate framerate let frames = (endFrame - startFrame) * frameRate; - if (frames >= frameRate) { - seconds = Math.floor(frames / frameRate); - frames = frames % frameRate; - milliseconds = Math.round(frames / frameRate * 1000); - if (milliseconds < 10) { - milliseconds = '00' + milliseconds; - } else if (milliseconds < 100) { - milliseconds = '0' + milliseconds; - } - if (seconds >= 60) { - minutes = Math.floor(seconds / 60); - seconds = seconds % 60; - seconds = seconds < 10 ? '0' + seconds : seconds; - } - if (minutes >= 60) { - hours = Math.floor(minutes / 60); - minutes = minutes % 60; - minutes = minutes < 10 ? '0' + minutes : minutes; - } - } else { - milliseconds = Math.round(frames / frameRate * 1000); - if (milliseconds < 10) { - milliseconds = '00' + milliseconds; - } else if (milliseconds < 100) { - milliseconds = '0' + milliseconds; - } + seconds = Math.floor(frames / frameRate); + frames = frames % frameRate; + milliseconds = Math.round(frames / frameRate * 1000); + if (milliseconds < 10) { + milliseconds = '00' + milliseconds; + } else if (milliseconds < 100) { + milliseconds = '0' + milliseconds; + } + if (seconds >= 60) { + minutes = Math.floor(seconds / 60); + seconds = seconds % 60; + seconds = seconds < 10 ? '0' + seconds : seconds; + } + if (minutes >= 60) { + hours = Math.floor(minutes / 60); + minutes = minutes % 60; + minutes = minutes < 10 ? '0' + minutes : minutes; } // Show the time and mod message in the DOM |