function addGlobalStyle(text) { var style = document.createElement('style'); style.type='text/css'; if(style.styleSheet) { style.styleSheet.cssText = text; } else { style.appendChild(document.createTextNode(text)); } document.getElementsByTagName('head')[0].appendChild(style); return style; } function hasClass(ele, cls) { return ele && !!ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)')); } function addClass(ele, cls) { if(!hasClass(ele,cls)) ele.className += " "+cls; } Array.prototype.where = function(predicate) { var output = []; const ar = this; for(let i=0;i