1(function() { 2 window.isArray = function(val) { 3 return Object.prototype.toString.call(val) === '[object Array]'; 4 }; 5 window.isString = function(val) { 6 return typeof val === 'string'; 7 }; 8 9 window.decodeUrl = function(str) { 10 return str ? decodeURIComponent(str.replace(/\+/g, '%20')) : ''; 11 }; 12 13 window.hasEvent = function(event) { 14 return 'on'.concat(event) in window.document; 15 }; 16 17 window.isOverallScroller = function(node) { 18 return node === document.documentElement || node === document.body || node === window; 19 }; 20 21 window.isFormElement = function(node) { 22 var tagName = node.tagName; 23 return tagName === 'INPUT' || tagName === 'SELECT' || tagName === 'TEXTAREA'; 24 }; 25 26 window.pageLoad = (function () { 27 var loaded = false, cbs = []; 28 window.addEventListener('load', function () { 29 var i; 30 loaded = true; 31 if (cbs.length > 0) { 32 for (i = 0; i < cbs.length; i++) { 33 cbs[i](); 34 } 35 } 36 }); 37 return { 38 then: function(cb) { 39 cb && (loaded ? cb() : (cbs.push(cb))); 40 } 41 }; 42 })(); 43})();