forked from dzsquared/MSDocsSidebarCollapser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fullWidth.js
23 lines (21 loc) · 1013 Bytes
/
fullWidth.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function setupDocs() {
// add jquery
var jq = document.createElement('script');
jq.src = chrome.runtime.getURL('jquery.js');
(document.head || document.documentElement).appendChild(jq);
// add a script element for the button actions JS
var s = document.createElement('script');
s.src = chrome.runtime.getURL('buttonActions.js');
s.onload = function() {
this.remove();
};
(document.head || document.documentElement).appendChild(s);
// prepand a button to the page metadata area
var pageMetadata = document.getElementsByClassName("page-metadata")[0];
if (typeof pageMetadata !== 'undefined') {
var sidebarButton = document.createElement("LI");
sidebarButton.innerHTML = "<button class='button is-small' id='docController' data-bi-name='sidebarController' onclick='sidebarButton()' currentSidebar='collapseSide'>Collapse Sidebar</button>"
pageMetadata.insertBefore(sidebarButton, pageMetadata.childNodes[0]);
}
}
setupDocs();