Skip to content

Commit 8b41a48

Browse files
authored
Merge pull request #10 from dteoh/9-fix-devdocs-integration
Update integration script
2 parents c22dc8b + aeb0947 commit 8b41a48

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)