Skip to content

Commit

Permalink
Merge pull request gorhill#27 from nikrolls/youtube-window-onload-wor…
Browse files Browse the repository at this point in the history
…karound

Workaround for YouTube / window.onload issue gorhill#16
  • Loading branch information
nicole-ashley authored Nov 29, 2016
2 parents e57ebbe + 6292b46 commit 1b16563
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
6 changes: 6 additions & 0 deletions platform/edge/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@
"js": ["js/scriptlets/subscriber.js"],
"run_at": "document_idle",
"all_frames": false
},
{
"matches": ["*://*.youtube.com/*"],
"js": ["js/window-onload-workaround.js"],
"run_at": "document_start",
"all_frames": false
}
],
"incognito": "split",
Expand Down
34 changes: 34 additions & 0 deletions platform/edge/window-onload-workaround.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*******************************************************************************
uBlock Origin - a browser extension to block requests.
Copyright (C) 2014-2016 The uBlock Origin authors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see {http://www.gnu.org/licenses/}.
Home: https://github.com/gorhill/uBlock
*/

'use strict';

// Workaround Edge issue where window.onload is not fired under certain circumstances

/******************************************************************************/

(function() {

document.addEventListener('DOMContentLoaded', () => window.dispatchEvent(new Event('load')));

})();

/******************************************************************************/

0 comments on commit 1b16563

Please sign in to comment.