mirror of
https://github.com/gosticks/PiPer.git
synced 2026-08-13 05:20:19 +00:00
Fixed delayed captions in VRV
Fixed caption delays caused by DOM timer throttling in VRV
This commit is contained in:
Binary file not shown.
+17
-9
@@ -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
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user