diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-06-21 16:14:05 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-21 16:14:05 -0400 |
commit | f2991fb9ee8e83738b726eb558af992f4bb5d9dc (patch) | |
tree | 6323a3ec9549131a6ef19e16595fd08fb5c31b9f /ext/mixed/js/dom.js | |
parent | 244ab31bb2edb53ff7aecb51d2dd60b50a24c194 (diff) |
Frontend initialization refactor (#610)
* Create member functions for ignoreElements and ignorePoint
* Create addFullscreenChangeEventListener utility
* Move popup creation management into Frontend
* Move getUrl implementation
* Remove old setup
* Remove try/catch block
* Error wrap
* Add prepare call to TextScanner
* Update depth when popup changes
* Refactor how Frontend gets PopupFactory and frameId
* Update popup preview to work
* Update popup preview frame to use the frontend's popup
* Update how nested popups are set up
* Error wrap
* Update how popups are set up on the search page
* Error wrap
* Error unwrap
* Add missing prepare
* Remove use of frontendInitializationData
* Catch and log errors
Diffstat (limited to 'ext/mixed/js/dom.js')
-rw-r--r-- | ext/mixed/js/dom.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/ext/mixed/js/dom.js b/ext/mixed/js/dom.js index 05764443..59fea9f6 100644 --- a/ext/mixed/js/dom.js +++ b/ext/mixed/js/dom.js @@ -77,6 +77,24 @@ class DOM { return (typeof key === 'string' ? (key.length === 1 ? key.toUpperCase() : key) : ''); } + static addFullscreenChangeEventListener(onFullscreenChanged, eventListenerCollection=null) { + const target = document; + const options = false; + const fullscreenEventNames = [ + 'fullscreenchange', + 'MSFullscreenChange', + 'mozfullscreenchange', + 'webkitfullscreenchange' + ]; + for (const eventName of fullscreenEventNames) { + if (eventListenerCollection === null) { + target.addEventListener(eventName, onFullscreenChanged, options); + } else { + eventListenerCollection.addEventListener(target, eventName, onFullscreenChanged, options); + } + } + } + static getFullscreenElement() { return ( document.fullscreenElement || |