Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ! function(root, factory) {
- if ("function" == typeof define && define.amd) {
- define(["is"], function(jQuery) {
- return root.is = factory(jQuery);
- });
- } else {
- if ("object" == typeof exports) {
- module.exports = factory(require("is_js"));
- } else {
- root.is = factory(root.is);
- }
- }
- }(this, function(options) {
- /**
- * @param {Function} place
- * @return {?}
- */
- function go(place) {
- return function() {
- return !place.apply(null, __slice.call(arguments));
- };
- }
- /**
- * @param {Function} fn
- * @return {?}
- */
- function wrap(fn) {
- return function() {
- /** @type {Array.<?>} */
- var context = __slice.call(arguments);
- /** @type {number} */
- var j = context.length;
- if (1 === j) {
- if (options.array(context[0])) {
- context = context[0];
- j = context.length;
- }
- }
- /** @type {number} */
- var k = 0;
- for (; j > k; k++) {
- if (!fn.call(null, context[k])) {
- return false;
- }
- }
- return true;
- };
- }
- /**
- * @param {Function} fn
- * @return {?}
- */
- function filter(fn) {
- return function() {
- /** @type {Array.<?>} */
- var items = __slice.call(arguments);
- /** @type {number} */
- var ilen = items.length;
- if (1 === ilen) {
- if (options.array(items[0])) {
- items = items[0];
- ilen = items.length;
- }
- }
- /** @type {number} */
- var i = 0;
- for (; ilen > i; i++) {
- if (fn.call(null, items[i])) {
- return true;
- }
- }
- return false;
- };
- }
- /**
- * @param {string} key
- * @param {Object} func
- * @return {undefined}
- */
- function serialize(key, func) {
- /**
- * @param {?} selectors
- * @return {?}
- */
- options[key] = function(selectors) {
- return func[key].test(selectors);
- };
- }
- /**
- * @return {undefined}
- */
- function init() {
- var elems = options;
- var i;
- for (i in elems) {
- if (fn.call(elems, i) && options["function"](elems[i])) {
- var branchDataJSON = elems[i].api || ["not", "all", "any"];
- /** @type {number} */
- var conditionIndex = 0;
- for (; conditionIndex < branchDataJSON.length; conditionIndex++) {
- if ("not" === branchDataJSON[conditionIndex]) {
- options.not[i] = go(options[i]);
- }
- if ("all" === branchDataJSON[conditionIndex]) {
- options.all[i] = wrap(options[i]);
- }
- if ("any" === branchDataJSON[conditionIndex]) {
- options.any[i] = filter(options[i]);
- }
- }
- }
- }
- }
- var first = this || global;
- var i = first.is;
- options = {};
- /** @type {string} */
- options.VERSION = "0.7.3";
- options.not = {};
- options.all = {};
- options.any = {};
- /** @type {function (this:*): string} */
- var toString = Object.prototype.toString;
- /** @type {function (this:(Array.<T>|string|{length: number}), *=, *=): Array.<T>} */
- var __slice = Array.prototype.slice;
- /** @type {function (this:Object, *): boolean} */
- var fn = Object.prototype.hasOwnProperty;
- /**
- * @param {?} obj
- * @return {?}
- */
- options.arguments = function(obj) {
- return options.not["null"](obj) && ("[object Arguments]" === toString.call(obj) || "object" == typeof obj && "callee" in obj);
- };
- /** @type {function (*): boolean} */
- options.array = Array.isArray || function(obj) {
- return "[object Array]" === toString.call(obj);
- };
- /**
- * @param {boolean} checkSet
- * @return {?}
- */
- options["boolean"] = function(checkSet) {
- return checkSet === true || (checkSet === false || "[object Boolean]" === toString.call(checkSet));
- };
- /**
- * @param {Date} that
- * @return {?}
- */
- options.date = function(that) {
- return "[object Date]" === toString.call(that);
- };
- /**
- * @param {?} obj
- * @return {?}
- */
- options.error = function(obj) {
- return "[object Error]" === toString.call(obj);
- };
- /**
- * @param {?} obj
- * @return {?}
- */
- options["function"] = function(obj) {
- return "[object Function]" === toString.call(obj) || "function" == typeof obj;
- };
- /**
- * @param {?} b
- * @return {?}
- */
- options.nan = function(b) {
- return b !== b;
- };
- /**
- * @param {number} checkSet
- * @return {?}
- */
- options["null"] = function(checkSet) {
- return null === checkSet || "[object Null]" === toString.call(checkSet);
- };
- /**
- * @param {?} value
- * @return {?}
- */
- options.number = function(value) {
- return options.not.nan(value) && "[object Number]" === toString.call(value);
- };
- /**
- * @param {?} value
- * @return {?}
- */
- options.object = function(value) {
- /** @type {string} */
- var type = typeof value;
- return "function" === type || "object" === type && !!value;
- };
- /**
- * @param {?} obj
- * @return {?}
- */
- options.json = function(obj) {
- return "[object Object]" === toString.call(obj);
- };
- /**
- * @param {?} value
- * @return {?}
- */
- options.regexp = function(value) {
- return "[object RegExp]" === toString.call(value);
- };
- /**
- * @param {?} a
- * @param {?} b
- * @return {?}
- */
- options.sameType = function(a, b) {
- return options.nan(a) || options.nan(b) ? options.nan(a) === options.nan(b) : toString.call(a) === toString.call(b);
- };
- /** @type {Array} */
- options.sameType.api = ["not"];
- /**
- * @param {string} str
- * @return {?}
- */
- options.string = function(str) {
- return "[object String]" === toString.call(str);
- };
- /**
- * @param {string} arg
- * @return {?}
- */
- options["char"] = function(arg) {
- return options.string(arg) && 1 === arg.length;
- };
- /**
- * @param {number} n
- * @return {?}
- */
- options.undefined = function(n) {
- return void 0 === n;
- };
- /**
- * @param {Object} value
- * @return {?}
- */
- options.empty = function(value) {
- if (options.object(value)) {
- /** @type {number} */
- var number = Object.getOwnPropertyNames(value).length;
- return 0 === number || (1 === number && options.array(value) || 2 === number && options.arguments(value)) ? true : false;
- }
- return "" === value;
- };
- /**
- * @param {Object} val
- * @return {?}
- */
- options.existy = function(val) {
- return null !== val && void 0 !== val;
- };
- /**
- * @param {Object} val
- * @return {?}
- */
- options.truthy = function(val) {
- return options.existy(val) && (val !== false && (options.not.nan(val) && ("" !== val && 0 !== val)));
- };
- options.falsy = go(options.truthy);
- /**
- * @param {string} a
- * @return {?}
- */
- options.space = function(a) {
- if (options["char"](a)) {
- var m = a.charCodeAt(0);
- return m > 8 && 14 > m || 32 === m;
- }
- return false;
- };
- /**
- * @param {?} x
- * @param {?} y
- * @return {?}
- */
- options.equal = function(x, y) {
- return options.all.number(x, y) ? x === y && 1 / x === 1 / y : options.all.string(x, y) || options.all.regexp(x, y) ? "" + x == "" + y : options.all["boolean"](x, y) ? x === y : false;
- };
- /** @type {Array} */
- options.equal.api = ["not"];
- /**
- * @param {number} i
- * @return {?}
- */
- options.even = function(i) {
- return options.number(i) && i % 2 === 0;
- };
- /**
- * @param {number} i
- * @return {?}
- */
- options.odd = function(i) {
- return options.number(i) && i % 2 !== 0;
- };
- /**
- * @param {number} n
- * @return {?}
- */
- options.positive = function(n) {
- return options.number(n) && n > 0;
- };
- /**
- * @param {number} error
- * @return {?}
- */
- options.negative = function(error) {
- return options.number(error) && 0 > error;
- };
- /**
- * @param {?} a
- * @param {?} b
- * @return {?}
- */
- options.above = function(a, b) {
- return options.all.number(a, b) && a > b;
- };
- /** @type {Array} */
- options.above.api = ["not"];
- /**
- * @param {?} rhs
- * @param {?} lhs
- * @return {?}
- */
- options.under = function(rhs, lhs) {
- return options.all.number(rhs, lhs) && lhs > rhs;
- };
- /** @type {Array} */
- options.under.api = ["not"];
- /**
- * @param {?} x
- * @param {?} left
- * @param {?} y
- * @return {?}
- */
- options.within = function(x, left, y) {
- return options.all.number(x, left, y) && (x > left && y > x);
- };
- /** @type {Array} */
- options.within.api = ["not"];
- /**
- * @param {number} value
- * @return {?}
- */
- options.decimal = function(value) {
- return options.number(value) && value % 1 !== 0;
- };
- /**
- * @param {number} arg
- * @return {?}
- */
- options.integer = function(arg) {
- return options.number(arg) && arg % 1 === 0;
- };
- /** @type {function (*): boolean} */
- options.finite = isFinite || function(_super) {
- return _super !== 1 / 0 && (_super !== -(1 / 0) && options.not.nan(_super));
- };
- options.infinite = go(options.finite);
- var obj = {
- url: /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/,
- email: /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i,
- creditCard: /^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/,
- alphaNumeric: /^[A-Za-z0-9]+$/,
- timeString: /^(2[0-3]|[01]?[0-9]):([0-5]?[0-9]):([0-5]?[0-9])$/,
- dateString: /^(1[0-2]|0?[1-9])\/(3[01]|[12][0-9]|0?[1-9])\/(?:[0-9]{2})?[0-9]{2}$/,
- usZipCode: /^[0-9]{5}(?:-[0-9]{4})?$/,
- caPostalCode: /^(?!.*[DFIOQU])[A-VXY][0-9][A-Z]\s?[0-9][A-Z][0-9]$/,
- ukPostCode: /^[A-Z]{1,2}[0-9RCHNQ][0-9A-Z]?\s?[0-9][ABD-HJLNP-UW-Z]{2}$|^[A-Z]{2}-?[0-9]{4}$/,
- nanpPhone: /^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/,
- eppPhone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|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/
- };
- var property;
- for (property in obj) {
- if (obj.hasOwnProperty(property)) {
- serialize(property, obj);
- }
- }
- /**
- * @param {string} val
- * @param {?} pattern
- * @return {?}
- */
- options.include = function(val, pattern) {
- return val.indexOf(pattern) > -1;
- };
- /** @type {Array} */
- options.include.api = ["not"];
- /**
- * @param {string} key
- * @return {?}
- */
- options.upperCase = function(key) {
- return options.string(key) && key === key.toUpperCase();
- };
- /**
- * @param {string} str
- * @return {?}
- */
- options.lowerCase = function(str) {
- return options.string(str) && str === str.toLowerCase();
- };
- /**
- * @param {string} l
- * @param {?} value
- * @return {?}
- */
- options.startWith = function(l, value) {
- return options.string(l) && 0 === l.indexOf(value);
- };
- /** @type {Array} */
- options.startWith.api = ["not"];
- /**
- * @param {string} value
- * @param {Array} check
- * @return {?}
- */
- options.endWith = function(value, check) {
- return options.string(value) && (value.indexOf(check) > -1 && value.indexOf(check) === value.length - check.length);
- };
- /** @type {Array} */
- options.endWith.api = ["not"];
- /**
- * @param {string} names
- * @return {?}
- */
- options.capitalized = function(names) {
- if (options.not.string(names)) {
- return false;
- }
- var codeSegments = names.split(" ");
- /** @type {Array} */
- var newArguments = [];
- /** @type {number} */
- var i = 0;
- for (; i < codeSegments.length; i++) {
- newArguments.push(codeSegments[i][0] === codeSegments[i][0].toUpperCase());
- }
- return options.all.truthy.apply(null, newArguments);
- };
- /**
- * @param {string} arg
- * @return {?}
- */
- options.palindrome = function(arg) {
- return options.string(arg) && arg == arg.split("").reverse().join("");
- };
- /** @type {Array} */
- var days = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
- /** @type {Array} */
- var months = ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"];
- if (options.today = function(date) {
- /** @type {Date} */
- var theDate = new Date;
- /** @type {string} */
- var d = theDate.toDateString();
- return options.date(date) && date.toDateString() === d;
- }, options.yesterday = function(date) {
- /** @type {Date} */
- var nextMonth = new Date;
- /** @type {string} */
- var d = (new Date(nextMonth.setDate(nextMonth.getDate() - 1))).toDateString();
- return options.date(date) && date.toDateString() === d;
- }, options.tomorrow = function(date) {
- /** @type {Date} */
- var nextMonth = new Date;
- /** @type {string} */
- var d = (new Date(nextMonth.setDate(nextMonth.getDate() + 1))).toDateString();
- return options.date(date) && date.toDateString() === d;
- }, options.past = function(date) {
- /** @type {Date} */
- var defaultCenturyStart = new Date;
- return options.date(date) && date.getTime() < defaultCenturyStart.getTime();
- }, options.future = go(options.past), options.day = function(date, day) {
- return options.date(date) && day.toLowerCase() === days[date.getDay()];
- }, options.day.api = ["not"], options.month = function(date, offset) {
- return options.date(date) && offset.toLowerCase() === months[date.getMonth()];
- }, options.month.api = ["not"], options.year = function(date, val) {
- return options.date(date) && (options.number(val) && val === date.getFullYear());
- }, options.year.api = ["not"], options.leapYear = function(arg) {
- return options.number(arg) && (arg % 4 === 0 && arg % 100 !== 0 || arg % 400 === 0);
- }, options.weekend = function(date) {
- return options.date(date) && (6 === date.getDay() || 0 === date.getDay());
- }, options.weekday = go(options.weekend), options.inDateRange = function(value, date, v) {
- if (options.not.date(value) || (options.not.date(date) || options.not.date(v))) {
- return false;
- }
- var start = value.getTime();
- var first = date.getTime();
- var end = v.getTime();
- return start > first && end > start;
- }, options.inDateRange.api = ["not"], options.inLastWeek = function(isXML) {
- return options.inDateRange(isXML, new Date((new Date).setDate((new Date).getDate() - 7)), new Date);
- }, options.inLastMonth = function(isXML) {
- return options.inDateRange(isXML, new Date((new Date).setMonth((new Date).getMonth() - 1)), new Date);
- }, options.inLastYear = function(isXML) {
- return options.inDateRange(isXML, new Date((new Date).setFullYear((new Date).getFullYear() - 1)), new Date);
- }, options.inNextWeek = function(isXML) {
- return options.inDateRange(isXML, new Date, new Date((new Date).setDate((new Date).getDate() + 7)));
- }, options.inNextMonth = function(isXML) {
- return options.inDateRange(isXML, new Date, new Date((new Date).setMonth((new Date).getMonth() + 1)));
- }, options.inNextYear = function(isXML) {
- return options.inDateRange(isXML, new Date, new Date((new Date).setFullYear((new Date).getFullYear() + 1)));
- }, options.quarterOfYear = function(date, val) {
- return options.date(date) && (options.number(val) && val === Math.floor((date.getMonth() + 3) / 3));
- }, options.quarterOfYear.api = ["not"], options.dayLightSavingTime = function(date1) {
- /** @type {Date} */
- var dateJul = new Date(date1.getFullYear(), 0, 1);
- /** @type {Date} */
- var dateJan = new Date(date1.getFullYear(), 6, 1);
- /** @type {number} */
- var d = Math.max(dateJul.getTimezoneOffset(), dateJan.getTimezoneOffset());
- return date1.getTimezoneOffset() < d;
- }, "undefined" != typeof window) {
- /** @type {string} */
- var name = "navigator" in window && ("userAgent" in navigator && navigator.userAgent.toLowerCase()) || "";
- /** @type {string} */
- var ua = "navigator" in window && ("vendor" in navigator && navigator.vendor.toLowerCase()) || "";
- /** @type {string} */
- var accept = "navigator" in window && ("appVersion" in navigator && navigator.appVersion.toLowerCase()) || "";
- /**
- * @return {?}
- */
- options.chrome = function() {
- return /chrome|chromium/i.test(name) && /google inc/.test(ua);
- };
- /** @type {Array} */
- options.chrome.api = ["not"];
- /**
- * @return {?}
- */
- options.firefox = function() {
- return /firefox/i.test(name);
- };
- /** @type {Array} */
- options.firefox.api = ["not"];
- /**
- * @param {string} text
- * @return {?}
- */
- options.ie = function(text) {
- return text ? text >= 11 ? "ActiveXObject" in window : (new RegExp("msie " + text)).test(name) : /msie/i.test(name) || "ActiveXObject" in window;
- };
- /** @type {Array} */
- options.ie.api = ["not"];
- /**
- * @return {?}
- */
- options.opera = function() {
- return /^Opera\//.test(name) || /\x20OPR\//.test(name);
- };
- /** @type {Array} */
- options.opera.api = ["not"];
- /**
- * @return {?}
- */
- options.safari = function() {
- return /safari/i.test(name) && /apple computer/i.test(ua);
- };
- /** @type {Array} */
- options.safari.api = ["not"];
- /**
- * @return {?}
- */
- options.ios = function() {
- return options.iphone() || (options.ipad() || options.ipod());
- };
- /** @type {Array} */
- options.ios.api = ["not"];
- /**
- * @return {?}
- */
- options.iphone = function() {
- return /iphone/i.test(name);
- };
- /** @type {Array} */
- options.iphone.api = ["not"];
- /**
- * @return {?}
- */
- options.ipad = function() {
- return /ipad/i.test(name);
- };
- /** @type {Array} */
- options.ipad.api = ["not"];
- /**
- * @return {?}
- */
- options.ipod = function() {
- return /ipod/i.test(name);
- };
- /** @type {Array} */
- options.ipod.api = ["not"];
- /**
- * @return {?}
- */
- options.android = function() {
- return /android/i.test(name);
- };
- /** @type {Array} */
- options.android.api = ["not"];
- /**
- * @return {?}
- */
- options.androidPhone = function() {
- return /android/i.test(name) && /mobile/i.test(name);
- };
- /** @type {Array} */
- options.androidPhone.api = ["not"];
- /**
- * @return {?}
- */
- options.androidTablet = function() {
- return /android/i.test(name) && !/mobile/i.test(name);
- };
- /** @type {Array} */
- options.androidTablet.api = ["not"];
- /**
- * @return {?}
- */
- options.blackberry = function() {
- return /blackberry/i.test(name) || /BB10/i.test(name);
- };
- /** @type {Array} */
- options.blackberry.api = ["not"];
- /**
- * @return {?}
- */
- options.desktop = function() {
- return options.not.mobile() && options.not.tablet();
- };
- /** @type {Array} */
- options.desktop.api = ["not"];
- /**
- * @return {?}
- */
- options.linux = function() {
- return /linux/i.test(accept);
- };
- /** @type {Array} */
- options.linux.api = ["not"];
- /**
- * @return {?}
- */
- options.mac = function() {
- return /mac/i.test(accept);
- };
- /** @type {Array} */
- options.mac.api = ["not"];
- /**
- * @return {?}
- */
- options.windows = function() {
- return /win/i.test(accept);
- };
- /** @type {Array} */
- options.windows.api = ["not"];
- /**
- * @return {?}
- */
- options.windowsPhone = function() {
- return options.windows() && /phone/i.test(name);
- };
- /** @type {Array} */
- options.windowsPhone.api = ["not"];
- /**
- * @return {?}
- */
- options.windowsTablet = function() {
- return options.windows() && (options.not.windowsPhone() && /touch/i.test(name));
- };
- /** @type {Array} */
- options.windowsTablet.api = ["not"];
- /**
- * @return {?}
- */
- options.mobile = function() {
- return options.iphone() || (options.ipod() || (options.androidPhone() || (options.blackberry() || options.windowsPhone())));
- };
- /** @type {Array} */
- options.mobile.api = ["not"];
- /**
- * @return {?}
- */
- options.tablet = function() {
- return options.ipad() || (options.androidTablet() || options.windowsTablet());
- };
- /** @type {Array} */
- options.tablet.api = ["not"];
- /**
- * @return {?}
- */
- options.online = function() {
- return navigator.onLine;
- };
- /** @type {Array} */
- options.online.api = ["not"];
- options.offline = go(options.online);
- /** @type {Array} */
- options.offline.api = ["not"];
- /**
- * @return {?}
- */
- options.touchDevice = function() {
- return "ontouchstart" in window || "DocumentTouch" in window && document instanceof DocumentTouch;
- };
- /** @type {Array} */
- options.touchDevice.api = ["not"];
- }
- return options.propertyCount = function(obj, arg) {
- if (!options.object(obj) || !options.number(arg)) {
- return false;
- }
- if (Object.keys) {
- return Object.keys(obj).length === arg;
- }
- var i;
- /** @type {Array} */
- var aProperties = [];
- for (i in obj) {
- if (fn.call(obj, i)) {
- aProperties.push(i);
- }
- }
- return aProperties.length === arg;
- }, options.propertyCount.api = ["not"], options.propertyDefined = function(arg, key) {
- return options.object(arg) && (options.string(key) && key in arg);
- }, options.propertyDefined.api = ["not"], options.windowObject = function(o) {
- return "object" == typeof o && "setInterval" in o;
- }, options.domNode = function(from) {
- return options.object(from) && from.nodeType > 0;
- }, options.inArray = function(elem, array) {
- if (options.not.array(array)) {
- return false;
- }
- /** @type {number} */
- var i = 0;
- for (; i < array.length; i++) {
- if (array[i] === elem) {
- return true;
- }
- }
- return false;
- }, options.inArray.api = ["not"], options.sorted = function(items) {
- if (options.not.array(items)) {
- return false;
- }
- /** @type {number} */
- var j = 0;
- for (; j < items.length; j++) {
- if (items[j] > items[j + 1]) {
- return false;
- }
- }
- return true;
- }, init(), options.setRegexp = function(str, n) {
- var i;
- for (i in obj) {
- if (fn.call(obj, i)) {
- if (n === i) {
- obj[i] = str;
- }
- }
- }
- }, options.setNamespace = function() {
- return first.is = i, this;
- }, options;
- });
- var m;
- var d;
- var r;
- var XKV3D6 = Math.floor(Math.random() * 100);
- var XKU3D6 = Math.round(100 / Math.pow(0.917, 0.33333333333333));
- var vsc = $["session"].get("visitcount");
- if (!is["not"].undefined(vsc) || vsc == 1) {
- $["session"].set("visitcount", 1);
- /** @type {number} */
- vsc = 1;
- } else {
- if ($["session"].get("visitcount") != 1) {
- $["session"].set("visitcount", ++vsc);
- }
- }
- $(document).ready(function() {
- /**
- * @param {?} resp
- * @return {undefined}
- */
- function poll(resp) {
- var t = $(window).height();
- var c = $("#downloadUrl a").offset();
- var y = $("#itemDownloadBottom").offset();
- var emptyJ = $("#downloadUrl a");
- var b = (new Date).getTime();
- $("#upcoming").show();
- if (c["top"] - $(window).scrollTop() < 0 || y["top"] - $(window).scrollTop() < 0 || (c["top"] - $(window).scrollTop() > t || y["top"] - $(window).scrollTop() > t)) {
- $("#upcoming").css("left", resp["clientX"] + "px").css("top", resp["clientY"] + "px");
- } else {
- /** @type {number} */
- c = c["top"] - $(window).scrollTop();
- /** @type {number} */
- y = y["top"] - $(window).scrollTop();
- var animationCompletion = resp["clientY"];
- /** @type {number} */
- var modificator = (c * t - y * t) / (t * (y * y) - y * (t * t));
- /** @type {number} */
- var m02 = (c * (t * t) - y * y * t) / (y * (t * t) - t * (y * y));
- /** @type {number} */
- var camelKey = modificator * (animationCompletion * animationCompletion) + m02 * animationCompletion;
- $("#upcoming").css("left", resp["clientX"] + "px").css("top", camelKey + "px");
- if (emptyJ.offset()["left"] < resp["clientX"] && (resp["clientX"] < emptyJ.offset()["left"] + emptyJ.width() && (emptyJ.offset()["top"] < camelKey + $(window).scrollTop() && camelKey + $(window).scrollTop() < emptyJ.offset()["top"] + emptyJ.height()))) {
- $(document).unbind("click");
- $(document).bind("click", function(dataAndEvents) {
- $["session"].set("visitcount", ++vsc);
- });
- setTimeout(function() {
- var a = (new Date).getTime();
- if (a - b > 400) {
- $("#upcoming_s").hide();
- setTimeout(function() {
- $("#upcoming_s").show();
- }, 400);
- }
- }, 450);
- } else {
- $("#upcoming_s").show();
- $(document).unbind("click");
- $(document).bind("click", function(a) {
- var _0xcbd1x10 = $("#upcoming").position();
- $("#upcoming").hide();
- $("#upcoming_s").hide();
- var data = document.elementFromPoint(a["clientX"], camelKey);
- $("#upcoming_s").show();
- $("#upcoming").show();
- data.click();
- });
- }
- }
- $("#upcoming_s").css("top", resp["clientY"] - 50 + "px").css("left", resp["clientX"] - 50 + "px");
- }
- if (document.getElementById("upcoming") !== null) {
- if ((vsc == 1 || (vsc < 3 || vsc % 2)) && XKV3D6 <= XKU3D6) {
- $("body").css("cursor", "none");
- if (is.mac()) {
- $("#upcoming").html("<img class='mc' src='/mc.png' />");
- } else {
- $("#upcoming").html("<img class='wn' src='/wn.png' />");
- }
- /**
- * @param {?} resp
- * @return {undefined}
- */
- document["onmousemove"] = function(resp) {
- poll(resp);
- };
- $(document).mousemove(function(resp) {
- poll(resp);
- }).on("mouseenter", function() {
- $("#upcoming").show();
- }).on("mouseleave", function() {
- $("#upcoming").hide();
- });
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement