Subtitle Link java-script subtitles for your videos with a glossary of hyperlinks for content providers
How to use:
Insert a script tag pointing to sublink.js
<script type='javascript' src='PATH_TO_\sublink.js'></script>
Two files required - the subtitles of the video playing in srt format. And a json file of the glossery of hyperlinks with keywords to match.
hyperlink.json
{
"Country": "UK",
"Search": [
"DMCA"
],
"Link": [
"https://en.wikipedia.org/wiki/DMCA"
],
"Version": "0.1a"
}
Theory of operation:
During loading of the page a fetch is called on the srt file and json file, when the promises are fulfilled, build a select/option block in transcript, while parsing subtitles match json file and insert link index marker (in the form '{'index'}') after the target word found in the json file. When the video is in playback, read transcript text element when the timestamp matches and then print it to the titles element, if there is a index marker match (regex '{\d{1,4}}') substitute keyword with a hypertext link added around the keyword.
Design Goals for V0.1
1 No dependant framework ..................... needs refactor to eliminate global vars
2 Inline ..................................... can be loaded in one script tag ( with css )
3 X Basic Config X............................ not complete
4 Fullscreen ................................. Fullscreen with subtitles working.
5 scrubbing transport ........................ Working.
TODO:
remove var tick and replace with call to video.currenttime
slow down setInterval callback - parameterize callback time
rationalize subtitle font size for auto sizing
refactor to support jQuery.
change hyperlink.json to make country the root node of the tree
a link history tab for reference fixed number of tabs for tab n-n
setup panel - local language choice
auto-localization
NEW = support me on Patreon - https://www.patreon.com/dannyarnold