Skip to content

Commit aeb0947

Browse files
committed
Update integration script
1 parent c22dc8b commit aeb0947

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

devdocs-macos/user-scripts/integration.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
(function() {
2-
var original = document.addEventListener;
2+
// Need to patch app.views.Mobile.detect internals to force desktop mode.
3+
var original = window.matchMedia;
34
var patcher = function() {
4-
// Force desktop mode.
5-
if (arguments[0] === 'DOMContentLoaded') {
6-
app.views.Mobile.detect = function() {
7-
return false;
8-
};
9-
document.addEventListener = original;
10-
}
11-
original.apply(null, arguments);
5+
return { matches: false };
126
};
13-
document.addEventListener = patcher;
7+
window.matchMedia = patcher;
148

159
var afterInit = function() {
1610
if (typeof app.settings === 'object') {
11+
window.matchMedia = original;
1712
window.webkit.messageHandlers.vcBus.postMessage({ type: 'afterInit' });
1813
} else {
1914
requestAnimationFrame(afterInit);

0 commit comments

Comments
 (0)