mirror of https://github.com/calzoneman/sync.git
Minor fixes for Google Drive subtitles
This commit is contained in:
parent
4a0cbce575
commit
f12397db23
|
@ -68,12 +68,15 @@ window.VideoJSPlayer = class VideoJSPlayer extends Player
|
|||
|
||||
if data.meta.gdrive_subtitles
|
||||
data.meta.gdrive_subtitles.available.forEach((subt) ->
|
||||
label = subt.lang_original
|
||||
if subt.name
|
||||
label += " (#{subt.name})"
|
||||
$('<track/>').attr(
|
||||
src: "/gdvtt/#{data.id}/#{subt.lang}/#{subt.name}.vtt?\
|
||||
vid=#{data.meta.gdrive_subtitles.vid}"
|
||||
kind: 'subtitles'
|
||||
srclang: subt.lang
|
||||
label: subt.name or subt.lang_original
|
||||
label: label
|
||||
).appendTo(video)
|
||||
)
|
||||
|
||||
|
@ -102,6 +105,15 @@ window.VideoJSPlayer = class VideoJSPlayer extends Player
|
|||
@player.on('seeked', =>
|
||||
$('.vjs-waiting').removeClass('vjs-waiting')
|
||||
)
|
||||
|
||||
$('#ytapiplayer .vjs-subtitles-button .vjs-menu-item').each((i, elem) ->
|
||||
if elem.textContent == localStorage.lastSubtitle
|
||||
elem.click()
|
||||
|
||||
elem.onclick = ->
|
||||
if this.attributes['aria-selected'].value == 'true'
|
||||
localStorage.lastSubtitle = this.textContent
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -631,3 +631,7 @@ table td {
|
|||
#videowrap .embed-responsive:-ms-full-screen { width: 100%; }
|
||||
#videowrap .embed-responsive:-o-full-screen { width: 100%; }
|
||||
#videowrap .embed-responsive:full-screen { width: 100%; }
|
||||
|
||||
li.vjs-menu-item.vjs-selected {
|
||||
background-color: #66a8cc !important;
|
||||
}
|
||||
|
|
|
@ -445,7 +445,7 @@
|
|||
})(Player);
|
||||
|
||||
sortSources = function(sources) {
|
||||
var flv, flvOrder, i, idx, len, nonflv, pref, qualities, quality, qualityOrder, sourceOrder;
|
||||
var flv, flvOrder, idx, j, len, nonflv, pref, qualities, quality, qualityOrder, sourceOrder;
|
||||
if (!sources) {
|
||||
console.error('sortSources() called with null source list');
|
||||
return [];
|
||||
|
@ -459,8 +459,8 @@
|
|||
qualityOrder = qualities.slice(idx).concat(qualities.slice(0, idx));
|
||||
sourceOrder = [];
|
||||
flvOrder = [];
|
||||
for (i = 0, len = qualityOrder.length; i < len; i++) {
|
||||
quality = qualityOrder[i];
|
||||
for (j = 0, len = qualityOrder.length; j < len; j++) {
|
||||
quality = qualityOrder[j];
|
||||
if (quality in sources) {
|
||||
flv = [];
|
||||
nonflv = [];
|
||||
|
@ -526,11 +526,16 @@
|
|||
});
|
||||
if (data.meta.gdrive_subtitles) {
|
||||
data.meta.gdrive_subtitles.available.forEach(function(subt) {
|
||||
var label;
|
||||
label = subt.lang_original;
|
||||
if (subt.name) {
|
||||
label += " (" + subt.name + ")";
|
||||
}
|
||||
return $('<track/>').attr({
|
||||
src: "/gdvtt/" + data.id + "/" + subt.lang + "/" + subt.name + ".vtt?vid=" + data.meta.gdrive_subtitles.vid,
|
||||
kind: 'subtitles',
|
||||
srclang: subt.lang,
|
||||
label: subt.name || subt.lang_original
|
||||
label: label
|
||||
}).appendTo(video);
|
||||
});
|
||||
}
|
||||
|
@ -557,9 +562,19 @@
|
|||
return sendVideoUpdate();
|
||||
}
|
||||
});
|
||||
return _this.player.on('seeked', function() {
|
||||
_this.player.on('seeked', function() {
|
||||
return $('.vjs-waiting').removeClass('vjs-waiting');
|
||||
});
|
||||
return $('#ytapiplayer .vjs-subtitles-button .vjs-menu-item').each(function(i, elem) {
|
||||
if (elem.textContent === localStorage.lastSubtitle) {
|
||||
elem.click();
|
||||
}
|
||||
return elem.onclick = function() {
|
||||
if (this.attributes['aria-selected'].value === 'true') {
|
||||
return localStorage.lastSubtitle = this.textContent;
|
||||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
};
|
||||
})(this));
|
||||
|
|
Loading…
Reference in New Issue