Skip to content
Danny Arnold edited this page Feb 23, 2019 · 1 revision

Welcome to the sublink wiki! Subtitle Link java-script subtitles 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.

Clone this wiki locally