mirror of
https://github.com/wahyd4/docsify.git
synced 2026-08-09 21:36:10 +10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d5caa1f89 | ||
|
|
1dfd6cdcfe | ||
|
|
91c6db2902 | ||
|
|
94d6603c06 | ||
|
|
920f624b5c | ||
|
|
8fb1350728 | ||
|
|
c1df94662a | ||
|
|
9b7e5f5814 |
@@ -1,3 +1,11 @@
|
||||
# 3.6.2/ 2017-04-12
|
||||
|
||||
* feat(external-script): detect more than one script dom, fixed #146
|
||||
* GA: Send hash instead of complete href (#147)
|
||||
|
||||
# 3.6.1 / 2017-04-09
|
||||
|
||||
* feat(event): Collapse the sidebar when click outside element in the small screen
|
||||
|
||||
# 3.6.0 / 2017-04-09
|
||||
|
||||
|
||||
+9
-6
@@ -416,17 +416,20 @@ var title = $.title;
|
||||
* Toggle button
|
||||
*/
|
||||
function btn (el) {
|
||||
var toggle = function () { return body.classList.toggle('close'); };
|
||||
var toggle = function (_) { return body.classList.toggle('close'); };
|
||||
|
||||
el = getNode(el);
|
||||
on(el, 'click', toggle);
|
||||
on(el, 'click', function (e) {
|
||||
e.stopPropagation();
|
||||
toggle();
|
||||
});
|
||||
|
||||
var sidebar = getNode('.sidebar');
|
||||
|
||||
on(sidebar, 'click', function () {
|
||||
isMobile && toggle();
|
||||
setTimeout(function () { return getAndActive(sidebar, true, true); }, 0);
|
||||
});
|
||||
isMobile && on(body, 'click', function (_) { return body.classList.contains('close') && toggle(); }
|
||||
);
|
||||
on(sidebar, 'click', function (_) { return setTimeout((function (_) { return getAndActive(sidebar, true, true); }, 0)); }
|
||||
);
|
||||
}
|
||||
|
||||
function sticky () {
|
||||
|
||||
Vendored
+2
-2
File diff suppressed because one or more lines are too long
@@ -4,16 +4,22 @@ this.D = this.D || {};
|
||||
|
||||
function handleExternalScript () {
|
||||
var container = Docsify.dom.getNode('#main');
|
||||
var script = Docsify.dom.find(container, 'script');
|
||||
var scripts = Docsify.dom.findAll(container, 'script');
|
||||
|
||||
if (script && script.src) {
|
||||
var newScript = document.createElement('script');['src', 'async', 'defer'].forEach(function (attribute) {
|
||||
newScript[attribute] = script[attribute];
|
||||
});
|
||||
var loop = function ( i ) {
|
||||
var script = scripts[i];
|
||||
|
||||
script.parentNode.insertBefore(newScript, script);
|
||||
script.parentNode.removeChild(script);
|
||||
}
|
||||
if (script && script.src) {
|
||||
var newScript = document.createElement('script');['src', 'async', 'defer'].forEach(function (attribute) {
|
||||
newScript[attribute] = script[attribute];
|
||||
});
|
||||
|
||||
script.parentNode.insertBefore(newScript, script);
|
||||
script.parentNode.removeChild(script);
|
||||
}
|
||||
};
|
||||
|
||||
for (var i = scripts.length; i--;) loop( i );
|
||||
}
|
||||
|
||||
var install = function (hook) {
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
this.D=this.D||{},function(){"use strict";function i(){var i=Docsify.dom.getNode("#main"),n=Docsify.dom.find(i,"script");if(n&&n.src){var o=document.createElement("script");["src","async","defer"].forEach(function(i){o[i]=n[i]}),n.parentNode.insertBefore(o,n),n.parentNode.removeChild(n)}}var n=function(n){n.doneEach(i)};window.$docsify.plugins=[].concat(n,window.$docsify.plugins)}();
|
||||
this.D=this.D||{},function(){"use strict";function n(){for(var n=Docsify.dom.getNode("#main"),i=Docsify.dom.findAll(n,"script"),o=function(n){var o=i[n];if(o&&o.src){var c=document.createElement("script");["src","async","defer"].forEach(function(n){c[n]=o[n]}),o.parentNode.insertBefore(c,o),o.parentNode.removeChild(o)}},c=i.length;c--;)o(c)}var i=function(i){i.doneEach(n)};window.$docsify.plugins=[].concat(i,window.$docsify.plugins)}();
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ function init (id) {
|
||||
|
||||
function collect () {
|
||||
init(window.$docsify.ga);
|
||||
window.ga('set', 'page', location.href);
|
||||
window.ga('set', 'page', location.hash);
|
||||
window.ga('send', 'pageview');
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
this.D=this.D||{},function(){"use strict";function n(){var n=document.createElement("script");n.async=!0,n.src="https://www.google-analytics.com/analytics.js",document.body.appendChild(n)}function o(o){window.ga||(n(),window.ga=window.ga||function(){(window.ga.q=window.ga.q||[]).push(arguments)},window.ga.l=Number(new Date),window.ga("create",o,"auto"))}function i(){o(window.$docsify.ga),window.ga("set","page",location.href),window.ga("send","pageview")}var w=function(n){return window.$docsify.ga?void n.beforeEach(i):void console.error("[Docsify] ga is required.")};window.$docsify.plugins=[].concat(w,window.$docsify.plugins)}();
|
||||
this.D=this.D||{},function(){"use strict";function n(){var n=document.createElement("script");n.async=!0,n.src="https://www.google-analytics.com/analytics.js",document.body.appendChild(n)}function o(o){window.ga||(n(),window.ga=window.ga||function(){(window.ga.q=window.ga.q||[]).push(arguments)},window.ga.l=Number(new Date),window.ga("create",o,"auto"))}function i(){o(window.$docsify.ga),window.ga("set","page",location.hash),window.ga("send","pageview")}var w=function(n){return window.$docsify.ga?void n.beforeEach(i):void console.error("[Docsify] ga is required.")};window.$docsify.plugins=[].concat(w,window.$docsify.plugins)}();
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "docsify",
|
||||
"version": "3.6.0",
|
||||
"version": "3.6.2",
|
||||
"description": "A magical documentation generator.",
|
||||
"author": {
|
||||
"name": "qingwei-li",
|
||||
|
||||
@@ -7,17 +7,22 @@ const title = dom.$.title
|
||||
* Toggle button
|
||||
*/
|
||||
export function btn (el) {
|
||||
const toggle = () => dom.body.classList.toggle('close')
|
||||
const toggle = _ => dom.body.classList.toggle('close')
|
||||
|
||||
el = dom.getNode(el)
|
||||
dom.on(el, 'click', toggle)
|
||||
dom.on(el, 'click', e => {
|
||||
e.stopPropagation()
|
||||
toggle()
|
||||
})
|
||||
|
||||
const sidebar = dom.getNode('.sidebar')
|
||||
|
||||
dom.on(sidebar, 'click', () => {
|
||||
isMobile && toggle()
|
||||
setTimeout(() => getAndActive(sidebar, true, true), 0)
|
||||
})
|
||||
isMobile && dom.on(dom.body, 'click', _ =>
|
||||
dom.body.classList.contains('close') && toggle()
|
||||
)
|
||||
dom.on(sidebar, 'click', _ =>
|
||||
setTimeout((_ => getAndActive(sidebar, true, true), 0))
|
||||
)
|
||||
}
|
||||
|
||||
export function sticky () {
|
||||
|
||||
@@ -1,16 +1,20 @@
|
||||
function handleExternalScript () {
|
||||
const container = Docsify.dom.getNode('#main')
|
||||
const script = Docsify.dom.find(container, 'script')
|
||||
const scripts = Docsify.dom.findAll(container, 'script')
|
||||
|
||||
if (script && script.src) {
|
||||
const newScript = document.createElement('script')
|
||||
for (let i = scripts.length; i--;) {
|
||||
const script = scripts[i]
|
||||
|
||||
;['src', 'async', 'defer'].forEach(attribute => {
|
||||
newScript[attribute] = script[attribute]
|
||||
})
|
||||
if (script && script.src) {
|
||||
const newScript = document.createElement('script')
|
||||
|
||||
script.parentNode.insertBefore(newScript, script)
|
||||
script.parentNode.removeChild(script)
|
||||
;['src', 'async', 'defer'].forEach(attribute => {
|
||||
newScript[attribute] = script[attribute]
|
||||
})
|
||||
|
||||
script.parentNode.insertBefore(newScript, script)
|
||||
script.parentNode.removeChild(script)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ function init (id) {
|
||||
|
||||
function collect () {
|
||||
init(window.$docsify.ga)
|
||||
window.ga('set', 'page', location.href)
|
||||
window.ga('set', 'page', location.hash)
|
||||
window.ga('send', 'pageview')
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user