coursera开启中英双字幕(coursera subtitle CN+EN)

添加了coursera视频开启和关闭中英双字幕的功能

نووسەر
zhhsh
Daily installs
0
Total installs
1,697
Ratings
2 1 0
وەشان
0.1
Created
2019-04-29
Updated
2019-04-29
مۆڵەت
نییە
Applies to

if you want to change the subtitles of other languages or add more subtitles, change the language tag of subtitles in line 36:'["en", "zh-CN"]'

核心代码如下:

    var myvideo = document.getElementsByTagName('video')[0];
    for (var i = 0; i < myvideo.textTracks.length; i++) {
        ["en", "zh-CN"].indexOf(myvideo.textTracks[i].language) > -1 ? myvideo.textTracks[i].mode = "showing" : myvideo.textTracks[i].mode = "hidden";
    }

不使用脚本或脚本失效时,只需在控制台执行以上代码,就能开启双字幕,但是每次切换视频都要重新执行一遍 核心代码是从别人的文章里看来的,来源