From a5f6ccd1d1638ba7e4aa17151c34132db78968e5 Mon Sep 17 00:00:00 2001 From: "qingwei.li" Date: Tue, 25 Apr 2017 12:41:16 +0800 Subject: [PATCH] bump: 3.6.3 --- lib/plugins/external-script.js | 12 ++++++------ lib/plugins/external-script.min.js | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/plugins/external-script.js b/lib/plugins/external-script.js index 710fb3b..09777af 100644 --- a/lib/plugins/external-script.js +++ b/lib/plugins/external-script.js @@ -6,20 +6,20 @@ function handleExternalScript () { var container = Docsify.dom.getNode('#main'); var scripts = Docsify.dom.findAll(container, 'script'); - var loop = function ( i ) { + for (var i = scripts.length; i--;) { var script = scripts[i]; if (script && script.src) { - var newScript = document.createElement('script');['src', 'async', 'defer'].forEach(function (attribute) { - newScript[attribute] = script[attribute]; + var newScript = document.createElement('script'); + + Array.prototype.slice.call(script.attributes).forEach(function (attribute) { + newScript[attribute.name] = attribute.value; }); script.parentNode.insertBefore(newScript, script); script.parentNode.removeChild(script); } - }; - - for (var i = scripts.length; i--;) loop( i ); + } } var install = function (hook) { diff --git a/lib/plugins/external-script.min.js b/lib/plugins/external-script.min.js index 79e26d8..27a016c 100644 --- a/lib/plugins/external-script.min.js +++ b/lib/plugins/external-script.min.js @@ -1 +1 @@ -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)}(); +this.D=this.D||{},function(){"use strict";function e(){for(var e=Docsify.dom.getNode("#main"),i=Docsify.dom.findAll(e,"script"),o=i.length;o--;){var t=i[o];if(t&&t.src){var n=document.createElement("script");Array.prototype.slice.call(t.attributes).forEach(function(e){n[e.name]=e.value}),t.parentNode.insertBefore(n,t),t.parentNode.removeChild(t)}}}var i=function(i){i.doneEach(e)};window.$docsify.plugins=[].concat(i,window.$docsify.plugins)}();