Add loop-protect

Remove webworkers
This commit is contained in:
Berkeley Martinez
2015-11-30 14:27:39 -08:00
parent 063d16383f
commit 3a299daa37
15 changed files with 597 additions and 513 deletions

View File

@@ -102,5 +102,19 @@ window.common = (function(global) {
});
};
const openScript = /\<\s?script\s?\>/gi;
const closingScript = /\<\s?\/\s?script\s?\>/gi;
// detects if there is JavaScript in the first script tag
common.hasJs = function hasJs(code) {
return !!common.getJsFromHtml(code);
};
// grabs the content from the first script tag in the code
common.getJsFromHtml = function getJsFromHtml(code) {
// grab user javaScript
return (code.split(openScript)[1] || '').split(closingScript)[0] || '';
};
return common;
})(window);