diff --git a/SignItVideosGallery.js b/SignItVideosGallery.js index 2c9a53f..9e8b907 100644 --- a/SignItVideosGallery.js +++ b/SignItVideosGallery.js @@ -41,7 +41,7 @@ SignItVideosGallery.prototype.refresh = async function ( files ) { console.log(await banana.i18n("si-panel-videos-gallery-attribution",url, speaker, i+1, total)); this.$videos.push( $( `
- + ${await banana.i18n("si-panel-videos-gallery-attribution",url, speaker, i+1, total)}
` ) ); @@ -57,7 +57,7 @@ SignItVideosGallery.prototype.switchVideo = function ( newIndex ) { this.$videos[ this.currentIndex ].hide(); this.currentIndex = newIndex; this.$videos[ this.currentIndex ].show(); - $currentVideo = this.$videos[ this.currentIndex ].children( 'video' )[ 0 ]; + $currentVideo = this.$videos[ this.currentIndex ].children( 'iframe' )[ 0 ]; $( async function () { param = await browser.storage.local.get( 'twospeed' ); @@ -84,9 +84,6 @@ SignItVideosGallery.prototype.switchVideo = function ( newIndex ) { } }) - // After switching, play - $currentVideo.play(); - // Arrows disables when on edges this.currentIndex === 0 ? this.previousVideoButton.setDisabled( true ) diff --git a/background-script.js b/background-script.js index 5375542..a11d4d7 100644 --- a/background-script.js +++ b/background-script.js @@ -332,24 +332,6 @@ async function checkActiveTabInjections( tab ) { } } -// Edit the header of all pages on-the-fly to bypass Content-Security-Policy -browser.webRequest.onHeadersReceived.addListener(info => { - const headers = info.responseHeaders; // original headers - for (let i=headers.length-1; i>=0; --i) { - let header = headers[i].name.toLowerCase(); - if (header === "content-security-policy") { // csp header is found - // modifying media-src; this implies that the directive is already present - headers[i].value = headers[i].value.replace("media-src", "media-src https://commons.wikimedia.org https://upload.wikimedia.org"); - } - } - // return modified headers - return {responseHeaders: headers}; -}, { - urls: [ "" ], // match all pages - types: [ "main_frame" ] // to focus only the main document of a tab -}, ["blocking", "responseHeaders"]); - - /* *************************************************************** */ /* Browser interactions ****************************************** */ var callModal = async function(msg){ diff --git a/content_scripts/signit.css b/content_scripts/signit.css index 0d7697c..d4a3bab 100644 --- a/content_scripts/signit.css +++ b/content_scripts/signit.css @@ -69,7 +69,7 @@ align-items: center; } -.signit-video video { +.signit-video iframe { box-shadow: 0 0 0.5rem #999; width: 100%; } diff --git a/content_scripts/wpintegration.css b/content_scripts/wpintegration.css index 83876ef..cd9d733 100644 --- a/content_scripts/wpintegration.css +++ b/content_scripts/wpintegration.css @@ -6,7 +6,7 @@ max-width: 300px; } -.signit-inline-container video { +.signit-inline-container iframe { box-shadow: 0 0 .5rem #999; } diff --git a/manifest.json b/manifest.json index 46a9f54..2c03f8c 100644 --- a/manifest.json +++ b/manifest.json @@ -16,9 +16,9 @@ "contextMenus", "storage", "webRequest", - "webRequestBlocking", "alarms" ], + "host_permissions":["https://*/*"], "content_scripts": [ { "matches": [ diff --git a/popup/popup.css b/popup/popup.css index 2cbcc41..92f8591 100644 --- a/popup/popup.css +++ b/popup/popup.css @@ -185,7 +185,7 @@ html, body { align-items: center; } -.signit-video video { +.signit-video iframe { box-shadow: 0 0 .5rem #999; width: 345px; } diff --git a/rules.json b/rules.json new file mode 100644 index 0000000..855c669 --- /dev/null +++ b/rules.json @@ -0,0 +1,22 @@ +[ + { + "id": 1, + "priority": 1, + "action": { + "type": "modifyHeaders", + "responseHeaders": [ + { + "header": "Content-Security-Policy", + "operation": "set", + "value": "media-src https://commons.wikimedia.org https://upload.wikimedia.org" + } + ] + }, + "condition": { + "urlFilter": "|https*", + "resourceTypes": [ + "main_frame" + ] + } + } +] \ No newline at end of file