diff --git a/src/Miscellaneous/AntiAutoplay.coffee b/src/Miscellaneous/AntiAutoplay.coffee index 3cdba9c34..7aec63f74 100644 --- a/src/Miscellaneous/AntiAutoplay.coffee +++ b/src/Miscellaneous/AntiAutoplay.coffee @@ -22,9 +22,12 @@ AntiAutoplay = process: (root) -> for iframe in $$ 'iframe[src*="youtube"][src*="autoplay=1"]', root - iframe.src = iframe.src.replace(/\?autoplay=1&?/, '?').replace('&autoplay=1', '') - $.addClass iframe, 'autoplay-removed' + AntiAutoplay.processVideo iframe, 'src' for object in $$ 'object[data*="youtube"][data*="autoplay=1"]', root - object.data = object.data.replace(/\?autoplay=1&?/, '?').replace('&autoplay=1', '') - $.addClass object, 'autoplay-removed' + AntiAutoplay.processVideo object, 'data' return + + processVideo: (el, attr) -> + el[attr] = el[attr].replace(/\?autoplay=1&?/, '?').replace('&autoplay=1', '') + el.style.display = 'block' if window.getComputedStyle(el).display is 'hidden' + $.addClass el, 'autoplay-removed' diff --git a/src/css/style.css b/src/css/style.css index a5bf1bbc7..ee9b56269 100644 --- a/src/css/style.css +++ b/src/css/style.css @@ -156,10 +156,9 @@ audio.controls-added { text-align: center; } :root.anti-autoplay .autoplay-removed { - display: block !important; visibility: visible !important; min-width: 640px; - min-height: 390px; + min-height: 360px; } /* fixed, z-index */