Loading js/youtube-cookies.js +12 −0 Original line number Diff line number Diff line Loading @@ -190,6 +190,17 @@ YoutubeCookies.prototype.removeFakeThumbnailAndPlay = function (iframeWrapper) { iframeWrapper.querySelector('[data-yc-oembed-button]').click(); }; /** * Dispatch event to allow other modules to add * their specific behaviours when the thumbnail * button is clicked. */ YoutubeCookies.prototype.eventDispatch = function(button) { var iframeWrapper = button.currentTarget.parentNode; const event = new Event('youtube-cookies-thumbnail-click'); iframeWrapper.querySelector('iframe').dispatchEvent(event); }; /** * Remove the popup. */ Loading Loading @@ -449,6 +460,7 @@ YoutubeCookies.prototype.processYoutubeIframes = function (container) { button.style.display = 'none'; var newButton = iframe.parentNode.querySelector('button:not([data-yc-oembed-button])'); newButton.addEventListener('click', this.onThumbnailClick.bind(this)); button.addEventListener('click', this.eventDispatch.bind(this)); newButton.setAttribute('data-yc-fake-button', 1); } } Loading Loading
js/youtube-cookies.js +12 −0 Original line number Diff line number Diff line Loading @@ -190,6 +190,17 @@ YoutubeCookies.prototype.removeFakeThumbnailAndPlay = function (iframeWrapper) { iframeWrapper.querySelector('[data-yc-oembed-button]').click(); }; /** * Dispatch event to allow other modules to add * their specific behaviours when the thumbnail * button is clicked. */ YoutubeCookies.prototype.eventDispatch = function(button) { var iframeWrapper = button.currentTarget.parentNode; const event = new Event('youtube-cookies-thumbnail-click'); iframeWrapper.querySelector('iframe').dispatchEvent(event); }; /** * Remove the popup. */ Loading Loading @@ -449,6 +460,7 @@ YoutubeCookies.prototype.processYoutubeIframes = function (container) { button.style.display = 'none'; var newButton = iframe.parentNode.querySelector('button:not([data-yc-oembed-button])'); newButton.addEventListener('click', this.onThumbnailClick.bind(this)); button.addEventListener('click', this.eventDispatch.bind(this)); newButton.setAttribute('data-yc-fake-button', 1); } } Loading