From 5626b5005a5e6a09afed0cf4b5c9d25c685f56f7 Mon Sep 17 00:00:00 2001 From: gorhill Date: Tue, 12 Sep 2017 11:43:43 -0400 Subject: [PATCH] fix #2946 --- src/js/pagestore.js | 4 ++-- src/js/ublock.js | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/js/pagestore.js b/src/js/pagestore.js index ea3a42816..429d8bd91 100644 --- a/src/js/pagestore.js +++ b/src/js/pagestore.js @@ -485,10 +485,10 @@ PageStore.prototype.injectLargeMediaElementScriptlet = function() { µb.contextMenu.update(this.tabId); }; -PageStore.prototype.temporarilyAllowLargeMediaElements = function() { +PageStore.prototype.temporarilyAllowLargeMediaElements = function(state) { this.largeMediaCount = 0; µb.contextMenu.update(this.tabId); - this.allowLargeMediaElementsUntil = Date.now() + 86400000; + this.allowLargeMediaElementsUntil = state ? Date.now() + 86400000 : 0; µb.scriptlets.injectDeep(this.tabId, 'load-large-media-all'); }; diff --git a/src/js/ublock.js b/src/js/ublock.js index 924802da7..5ad8e8861 100644 --- a/src/js/ublock.js +++ b/src/js/ublock.js @@ -493,11 +493,9 @@ var reInvalidHostname = /[^a-z0-9.\-\[\]:]/, ); break; case 'no-large-media': - if ( details.state === false ) { - var pageStore = this.pageStoreFromTabId(details.tabId); - if ( pageStore !== null ) { - pageStore.temporarilyAllowLargeMediaElements(); - } + var pageStore = this.pageStoreFromTabId(details.tabId); + if ( pageStore !== null ) { + pageStore.temporarilyAllowLargeMediaElements(!details.state); } break; }