1function define(name, value) { 2 Object.defineProperty(window, name, { 3 get: function() { 4 return value; 5 }, 6 set: function() { 7 throw (name + " is a constant and can't be redeclared."); 8 } 9 }); 10} 11function defined(name) { 12 if (window[name]) return true; 13 else return false; 14} 15 16define("FCBase", {}); 17 18FCBase.isFunction = function(fn, checkEmpty) { 19 // if (fn && fn.constructor == Function) return checkEmpty ? (fn.toString().trim().replace(/\s+/g, "").replace(/^function\s*[^(]*\(\)[ ]*{(.*)}$/gi, "").trim() !== "") : true; 20 if (fn && fn.constructor == Function) return checkEmpty ? (fn.toString().replace(/(\/\*[\w\'\-\;\s\r\n\*]*\*\/)|(^\s*\/\/[^\n]*$\s*)|(^\s*<!--[^\-\-\>]*\s*-->\s*$\s*)/gim, "").replace(/\r*\n+/g, "").replace(/^function\s*[^(]*\([^\)]*\)\s*\{/gi, "").trim().replace(/\}$/, "").trim() !== "") : true; 21 22 return false; 23}; 24 25FCBase.device = { 26 userAgent: function(lower) { 27 return lower ? navigator.userAgent.toLowerCase() : navigator.userAgent; 28 }, 29 iPhone: function() { 30 return ((navigator.platform.indexOf("iPhone") != -1) || (navigator.platform.indexOf("iPod") != -1)); 31 }, 32 iPad: function () { 33 return (navigator.platform.indexOf("iPad") != -1); 34 }, 35 iOS: function() { 36 return (this.iPhone() || this.iPad()); 37 }, 38 androidMobile: function() { 39 return ((this.userAgent(true).indexOf("android") > -1) && this.userAgent(true).indexOf("mobile")); 40 }, 41 androidTablet: function() { 42 return ((this.userAgent(true).indexOf("android") > -1) && !(this.userAgent(true).indexOf("mobile"))); 43 }, 44 android: function() { 45 return (this.androidMobile() || this.androidTablet()); 46 }, 47 blackBerry: function() { 48 return (this.userAgent(true).indexOf("blackberry") > -1); 49 }, 50 opera: function() { 51 return (this.userAgent(true).indexOf("opera mini") > -1); 52 }, 53 windows: function() { 54 return (this.userAgent(true).indexOf("iemobile") > -1); 55 }, 56 touch: function() { 57 try { 58 document.createEvent("TouchEvent"); 59 return true; 60 } 61 catch(e){ 62 return false; 63 } 64 }, 65 tablet: function() { 66 return (this.iPad() || this.androidTablet()); 67 }, 68 mobile: function() { 69 return (this.iOS() || this.android() || this.blackberry() || this.opera() || this.windows() || this.touch()); 70 }, 71 desktop: function() { 72 return (!this.mobile()); 73 }, 74 portrait: function() { 75 return (window.innerHeight > window.innerWidth); 76 }, 77 landscape: function() { 78 return ((window.orientation === 90) || (window.orientation === -90)); 79 } 80};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.