UNPKG

gitbook-plugin-msc

Version:

This is a plugin for msc.

40 lines (32 loc) 1.2 kB
require(['gitbook', 'jquery'], function(gitbook, $) { // yundeng sider ball // const { // YUNDENG_HOST = '//lamp-carrier.quanxi.aliyun.com', // } = window.lampMeta || {}; const YUNDENG_HOST = location.protocol + '//' + location.hostname document.body.setAttribute("style", "display:flex"); // 得到第一个元素 const firstDOM = document.body.firstChild; let child = document.createElement('div'); child.setAttribute("id", 'MscSideBar'); child.setAttribute("style", "width: 48px;left:0"); // child.innerHTML = str; // child = child.firstChild; document.body.insertBefore(child, firstDOM); function appendScript () { let script = document.createElement('script'); // fn = callback || function() {}; script.type = 'application/javascript' script.src = `${YUNDENG_HOST}/msc-console/sidebar_umi.js`; document.body.append(script); }; function appendCSS () { let link = document.createElement('link'); // fn = callback || function() {}; link.rel = 'stylesheet' link.href = `${YUNDENG_HOST}/msc-console/sidebar_umi.css`; document.getElementsByTagName('head')[0].append(link); }; appendCSS(); appendScript(); });