Fixed delayed captions in VRV

Fixed caption delays caused by DOM timer throttling in VRV
This commit is contained in:
amarcu5
2017-06-13 00:16:32 +01:00
parent ad9ac66aad
commit 4ebaab2368
3 changed files with 18 additions and 10 deletions
Binary file not shown.
+17 -9
View File
@@ -167,7 +167,7 @@ const processCaptions = function() {
} else if (style.textDecoration == 'underline') {
caption += '<u>' + segment + '</u>';
} else {
caption += segment;
caption += segment;
}
caption += ' ';
} else if (caption.charAt(caption.length - 1) != '\n') {
@@ -233,6 +233,20 @@ const initialiseCaches = function() {
currentResource.buttonParent = cacheElementWrapper(currentResource.buttonParent);
};
/**
* Applies fix to bypass background DOM timer throttling
*/
const bypassBackgroundTimerThrottling = function() {
const request = new XMLHttpRequest();
request.open('GET', safari.extension.baseURI + 'scripts/fix.js');
request.onload = function() {
const script = document.createElement('script');
script.appendChild(document.createTextNode(request.responseText));
button.appendChild(script);
};
request.send();
}
/** @type {!IObject<string, PIPResource>} */
const resources = {
@@ -540,6 +554,7 @@ const resources = {
const video = /** @type {?HTMLVideoElement} */ (currentResource.videoElement());
if (video) video.webkitSetPresentationMode('inline');
});
bypassBackgroundTimerThrottling();
},
buttonHoverStyle: 'opacity:1!important',
buttonInsertBefore: function(/** Element */ parent) {
@@ -574,14 +589,7 @@ const resources = {
neighbourButton.dispatchEvent(new Event('mouseout'));
neighbourButton.title = neighbourTitle;
});
const request = new XMLHttpRequest();
request.open('GET', safari.extension.baseURI + 'scripts/fix.js');
request.onload = function() {
const script = document.createElement('script');
script.appendChild(document.createTextNode(request.responseText));
button.appendChild(script);
};
request.send();
bypassBackgroundTimerThrottling();
},
buttonInsertBefore: function(/** Element */ parent) {
return parent.lastChild;
+1 -1
View File
@@ -10,7 +10,7 @@
<key>CFBundleShortVersionString</key>
<string>0.2.0</string>
<key>CFBundleVersion</key>
<string>43</string>
<string>44</string>
<key>Developer Identifier</key>
<string>BQ6Q24MF9X</string>
<key>URL</key>