mirror of
https://github.com/docsifyjs/docsify.git
synced 2025-12-08 19:55:52 +00:00
32 lines
768 B
JavaScript
32 lines
768 B
JavaScript
this.D = this.D || {};
|
|
(function () {
|
|
'use strict';
|
|
|
|
function handleExternalScript () {
|
|
var container = Docsify.dom.getNode('#main');
|
|
var scripts = Docsify.dom.findAll(container, 'script');
|
|
|
|
for (var i = scripts.length; i--;) {
|
|
var script = scripts[i];
|
|
|
|
if (script && script.src) {
|
|
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);
|
|
}
|
|
}
|
|
}
|
|
|
|
var install = function (hook) {
|
|
hook.doneEach(handleExternalScript);
|
|
};
|
|
|
|
window.$docsify.plugins = [].concat(install, window.$docsify.plugins);
|
|
|
|
}());
|