File tree Expand file tree Collapse file tree 1 file changed +19
-9
lines changed
devdocs-macos/user-scripts Expand file tree Collapse file tree 1 file changed +19
-9
lines changed Original file line number Diff line number Diff line change 1- ( function ( ) {
1+ ( async function ( ) {
22 // Need to patch app.views.Mobile.detect internals to force desktop mode.
33 const original = window . matchMedia
44 const patcher = function ( ) {
55 return { matches : false }
66 }
77 window . matchMedia = patcher
88
9- const afterInit = function ( ) {
10- if ( window . app && window . app . settings ) {
11- window . matchMedia = original
12- window . webkit . messageHandlers . vcBus . postMessage ( { type : 'afterInit' } )
13- } else {
14- requestAnimationFrame ( afterInit )
15- }
9+ const globalDefined = ( attr ) => {
10+ return new Promise ( function ( resolve , reject ) {
11+ const checker = ( ) => {
12+ if ( Object . prototype . hasOwnProperty . call ( window , attr ) ) {
13+ resolve ( window [ attr ] )
14+ } else {
15+ requestAnimationFrame ( checker )
16+ }
17+ }
18+ requestAnimationFrame ( checker )
19+ } )
1620 }
17- requestAnimationFrame ( afterInit )
21+
22+ const app = await globalDefined ( 'app' )
23+ app . isMobile = ( ) => false
24+ app . views . Mobile . detect = ( ) => false
25+
26+ window . matchMedia = original
27+ window . webkit . messageHandlers . vcBus . postMessage ( { type : 'afterInit' } )
1828} ( ) )
You can’t perform that action at this time.
0 commit comments