Code style cleanup, remove redundant comments

This commit is contained in:
Robin North
2018-01-31 22:17:06 +00:00
parent 9971c4c4f0
commit 1eb43f73fe
15 changed files with 87 additions and 120 deletions

View File

@@ -1,6 +1,8 @@
module.exports = function(el) {
// console.log("going to execute script", el)
var code = (el.text || el.textContent || el.innerHTML || "")
var src = (el.src || "");
var src = (el.src || "")
var parent = el.parentNode || document.querySelector("head") || document.documentElement
var script = document.createElement("script")
@@ -14,8 +16,8 @@ module.exports = function(el) {
script.type = "text/javascript"
if (src !== "") {
script.src = src;
script.async = false; // force synchronous loading of peripheral js
script.src = src
script.async = false // force asynchronous loading of peripheral js
}
if (code !== "") {
@@ -29,11 +31,11 @@ module.exports = function(el) {
}
// execute
parent.appendChild(script);
parent.appendChild(script)
// avoid pollution only in head or body tags
if (["head", "body"].indexOf(parent.tagName.toLowerCase()) > 0) {
parent.removeChild(script)
}
return true;
return true
}