1/* 2 * Copyright ETS Software Technology Co., Ltd 3 * 4 * NOTICE OF LICENSE 5 * 6 * This file is not open source! Each license that you purchased is only available for 1 website only. 7 * If you want to use this file on more websites (or projects), you need to purchase additional licenses. 8 * You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party. 9 * 10 * DISCLAIMER 11 * 12 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer 13 * versions in the future. 14 * 15 * @author ETS Software Technology Co., Ltd 16 * @copyright ETS Software Technology Co., Ltd 17 * @license Valid for 1 website (or project) for each purchase of license 18*/ 19var unicode_hack = (function() { 20 /* Regexps to match characters in the BMP according to their Unicode category. 21 Extracted from Unicode specification, version 5.0.0, source: 22 http://unicode.org/versions/Unicode5.0.0/ 23 */ 24 var unicodeCategories = { 25 Pi:'[\u00ab\u2018\u201b\u201c\u201f\u2039\u2e02\u2e04\u2e09\u2e0c\u2e1c]', 26 Sk:'[\u005e\u0060\u00a8\u00af\u00b4\u00b8\u02c2-\u02c5\u02d2-\u02df\u02e5-\u02ed\u02ef-\u02ff\u0374\u0375\u0384\u0385\u1fbd\u1fbf-\u1fc1\u1fcd-\u1fcf\u1fdd-\u1fdf\u1fed-\u1fef\u1ffd\u1ffe\u309b\u309c\ua700-\ua716\ua720\ua721\uff3e\uff40\uffe3]', 27 Sm:'[\u002b\u003c-\u003e\u007c\u007e\u00ac\u00b1\u00d7\u00f7\u03f6\u2044\u2052\u207a-\u207c\u208a-\u208c\u2140-\u2144\u214b\u2190-\u2194\u219a\u219b\u21a0\u21a3\u21a6\u21ae\u21ce\u21cf\u21d2\u21d4\u21f4-\u22ff\u2308-\u230b\u2320\u2321\u237c\u239b-\u23b3\u23dc-\u23e1\u25b7\u25c1\u25f8-\u25ff\u266f\u27c0-\u27c4\u27c7-\u27ca\u27d0-\u27e5\u27f0-\u27ff\u2900-\u2982\u2999-\u29d7\u29dc-\u29fb\u29fe-\u2aff\ufb29\ufe62\ufe64-\ufe66\uff0b\uff1c-\uff1e\uff5c\uff5e\uffe2\uffe9-\uffec]', 28 So:'[\u00a6\u00a7\u00a9\u00ae\u00b0\u00b6\u0482\u060e\u060f\u06e9\u06fd\u06fe\u07f6\u09fa\u0b70\u0bf3-\u0bf8\u0bfa\u0cf1\u0cf2\u0f01-\u0f03\u0f13-\u0f17\u0f1a-\u0f1f\u0f34\u0f36\u0f38\u0fbe-\u0fc5\u0fc7-\u0fcc\u0fcf\u1360\u1390-\u1399\u1940\u19e0-\u19ff\u1b61-\u1b6a\u1b74-\u1b7c\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211e-\u2123\u2125\u2127\u2129\u212e\u213a\u213b\u214a\u214c\u214d\u2195-\u2199\u219c-\u219f\u21a1\u21a2\u21a4\u21a5\u21a7-\u21ad\u21af-\u21cd\u21d0\u21d1\u21d3\u21d5-\u21f3\u2300-\u2307\u230c-\u231f\u2322-\u2328\u232b-\u237b\u237d-\u239a\u23b4-\u23db\u23e2-\u23e7\u2400-\u2426\u2440-\u244a\u249c-\u24e9\u2500-\u25b6\u25b8-\u25c0\u25c2-\u25f7\u2600-\u266e\u2670-\u269c\u26a0-\u26b2\u2701-\u2704\u2706-\u2709\u270c-\u2727\u2729-\u274b\u274d\u274f-\u2752\u2756\u2758-\u275e\u2761-\u2767\u2794\u2798-\u27af\u27b1-\u27be\u2800-\u28ff\u2b00-\u2b1a\u2b20-\u2b23\u2ce5-\u2cea\u2e80-\u2e99\u2e9b-\u2ef3\u2f00-\u2fd5\u2ff0-\u2ffb\u3004\u3012\u3013\u3020\u3036\u3037\u303e\u303f\u3190\u3191\u3196-\u319f\u31c0-\u31cf\u3200-\u321e\u322a-\u3243\u3250\u3260-\u327f\u328a-\u32b0\u32c0-\u32fe\u3300-\u33ff\u4dc0-\u4dff\ua490-\ua4c6\ua828-\ua82b\ufdfd\uffe4\uffe8\uffed\uffee\ufffc\ufffd]', 29 Po:'[\u0021-\u0023\u0025-\u0027\u002a\u002c\u002e\u002f\u003a\u003b\u003f\u0040\u005c\u00a1\u00b7\u00bf\u037e\u0387\u055a-\u055f\u0589\u05be\u05c0\u05c3\u05c6\u05f3\u05f4\u060c\u060d\u061b\u061e\u061f\u066a-\u066d\u06d4\u0700-\u070d\u07f7-\u07f9\u0964\u0965\u0970\u0df4\u0e4f\u0e5a\u0e5b\u0f04-\u0f12\u0f85\u0fd0\u0fd1\u104a-\u104f\u10fb\u1361-\u1368\u166d\u166e\u16eb-\u16ed\u1735\u1736\u17d4-\u17d6\u17d8-\u17da\u1800-\u1805\u1807-\u180a\u1944\u1945\u19de\u19df\u1a1e\u1a1f\u1b5a-\u1b60\u2016\u2017\u2020-\u2027\u2030-\u2038\u203b-\u203e\u2041-\u2043\u2047-\u2051\u2053\u2055-\u205e\u2cf9-\u2cfc\u2cfe\u2cff\u2e00\u2e01\u2e06-\u2e08\u2e0b\u2e0e-\u2e16\u3001-\u3003\u303d\u30fb\ua874-\ua877\ufe10-\ufe16\ufe19\ufe30\ufe45\ufe46\ufe49-\ufe4c\ufe50-\ufe52\ufe54-\ufe57\ufe5f-\ufe61\ufe68\ufe6a\ufe6b\uff01-\uff03\uff05-\uff07\uff0a\uff0c\uff0e\uff0f\uff1a\uff1b\uff1f\uff20\uff3c\uff61\uff64\uff65]', 30 Mn:'[\u0300-\u036f\u0483-\u0486\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u0615\u064b-\u065e\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0901\u0902\u093c\u0941-\u0948\u
30094d\u0951-\u0954\u0962\u0963\u0981\u09bc\u09c1-\u09c4\u09cd\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a70\u0a71\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3f\u0b41-\u0b43\u0b4d\u0b56\u0b82\u0bc0\u0bcd\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0cbc\u0cbf\u0cc6\u0ccc\u0ccd\u0ce2\u0ce3\u0d41-\u0d43\u0d4d\u0dca\u0dd2-\u0dd4\u0dd6\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032\u1036\u1037\u1039\u1058\u1059\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1dc0-\u1dca\u1dfe\u1dff\u20d0-\u20dc\u20e1\u20e5-\u20ef\u302a-\u302f\u3099\u309a\ua806\ua80b\ua825\ua826\ufb1e\ufe00-\ufe0f\ufe20-\ufe23]', 31 Ps:'[\u0028\u005b\u007b\u0f3a\u0f3c\u169b\u201a\u201e\u2045\u207d\u208d\u2329\u2768\u276a\u276c\u276e\u2770\u2772\u2774\u27c5\u27e6\u27e8\u27ea\u2983\u2985\u2987\u2989\u298b\u298d\u298f\u2991\u2993\u2995\u2997\u29d8\u29da\u29fc\u3008\u300a\u300c\u300e\u3010\u3014\u3016\u3018\u301a\u301d\ufd3e\ufe17\ufe35\ufe37\ufe39\ufe3b\ufe3d\ufe3f\ufe41\ufe43\ufe47\ufe59\ufe5b\ufe5d\uff08\uff3b\uff5b\uff5f\uff62]', 32 Cc:'[\u0000-\u001f\u007f-\u009f]', 33 Cf:'[\u00ad\u0600-\u0603\u06dd\u070f\u17b4\u17b5\u200b-\u200f\u202a-\u202e\u2060-\u2063\u206a-\u206f\ufeff\ufff9-\ufffb]', 34 Ll:'[\u0061-\u007a\u00aa\u00b5\u00ba\u00df-\u00f6\u00f8-\u00ff\u0101\u0103\u0105\u0107\u0109\u010b\u010d\u010f\u0111\u0113\u0115\u0117\u0119\u011b\u011d\u011f\u0121\u0123\u0125\u0127\u0129\u012b\u012d\u012f\u0131\u0133\u0135\u0137\u0138\u013a\u013c\u013e\u0140\u0142\u0144\u0146\u0148\u0149\u014b\u014d\u014f\u0151\u0153\u0155\u0157\u0159\u015b\u015d\u015f\u0161\u0163\u0165\u0167\u0169\u016b\u016d\u016f\u0171\u0173\u0175\u0177\u017a\u017c\u017e-\u0180\u0183\u0185\u0188\u018c\u018d\u0192\u0195\u0199-\u019b\u019e\u01a1\u01a3\u01a5\u01a8\u01aa\u01ab\u01ad\u01b0\u01b4\u01b6\u01b9\u01ba\u01bd-\u01bf\u01c6\u01c9\u01cc\u01ce\u01d0\u01d2\u01d4\u01d6\u01d8\u01da\u01dc\u01dd\u01df\u01e1\u01e3\u01e5\u01e7\u01e9\u01eb\u01ed\u01ef\u01f0\u01f3\u01f5\u01f9\u01fb\u01fd\u01ff\u0201\u0203\u0205\u0207\u0209\u020b\u020d\u020f\u0211\u0213\u0215\u0217\u0219\u021b\u021d\u021f\u0221\u0223\u0225\u0227\u0229\u022b\u022d\u022f\u0231\u0233-\u0239\u023c\u023f\u0240\u0242\u0247\u0249\u024b\u024d\u024f-\u0293\u0295-\u02af\u037b-\u037d\u0390\u03ac-\u03ce\u03d0\u03d1\u03d5-\u03d7\u03d9\u03db\u03dd\u03df\u03e1\u03e3\u03e5\u03e7\u03e9\u03eb\u03ed\u03ef-\u03f3\u03f5\u03f8\u03fb\u03fc\u0430-\u045f\u0461\u0463\u0465\u0467\u0469\u046b\u046d\u046f\u0471\u0473\u0475\u0477\u0479\u047b\u047d\u047f\u0481\u048b\u048d\u048f\u0491\u0493\u0495\u0497\u0499\u049b\u049d\u049f\u04a1\u04a3\u04a5\u04a7\u04a9\u04ab\u04ad\u04af\u04b1\u04b3\u04b5\u04b7\u04b9\u04bb\u04bd\u04bf\u04c2\u04c4\u04c6\u04c8\u04ca\u04cc\u04ce\u04cf\u04d1\u04d3\u04d5\u04d7\u04d9\u04db\u04dd\u04df\u04e1\u04e3\u04e5\u04e7\u04e9\u04eb\u04ed\u04ef\u04f1\u04f3\u04f5\u04f7\u04f9\u04fb\u04fd\u04ff\u0501\u0503\u0505\u0507\u0509\u050b\u050d\u050f\u0511\u0513\u0561-\u0587\u1d00-\u1d2b\u1d62-\u1d77\u1d79-\u1d9a\u1e01\u1e03\u1e05\u1e07\u1e09\u1e0b\u1e0d\u1e0f\u1e11\u1e13\u1e15\u1e17\u1e19\u1e1b\u1e1d\u1e1f\u1e21\u1e23\u1e25\u1e27\u1e29\u1e2b\u1e2d\u1e2f\u1e31\u1e33\u1e35\u1e37\u1e39\u1e3b\u1e3d\u1e3f\u1e41\u1e43\u1e45\u1e47\u1e49\u1e4b\u1e4d\u1e4f\u1e51\u1e53\u1e55\u1e57\u1e59\u1e5b\u1e5d\u1e5f\u1e61\u1e63\u1e65\u1e67\u1e69\u1e6b\u1e6d\u1e6f\u1e71\u1e73\u1e75\u1e77\u1e79\u1e7b\u1e7d\u1e7f\u1e81\u1e83\u1e85\u1e87\u1e89\u1e8b\u1e8d\u1e8f\u1e91\u1e93\u1e95-\u1e9b\u1ea1\u1ea3\u1ea5\u1ea7\u1ea9\u1eab\u1ead\u1eaf\u1eb1\u1eb3\u1eb5\u1eb7\u1eb9\u1ebb\u1ebd\u1ebf\u1ec1\u1ec3\u1ec5\u1ec7\u1ec9\u1ecb\u1ecd\u1ecf\u1ed1\u1ed3\u1ed5\u1ed7\u1ed9\u1edb\u1edd\u1edf\u1ee1\u1ee3\u1ee5\u1ee7\u1ee9\u1eeb\u1eed\u1eef\u1ef1\u1ef3\u1ef5\u1ef7\u1ef9\u1f00-\u1f07\u1f10-\u1f15\u1f20-\u1f27\u1f30-\u1f37\u1f40-\u1f45\u1f50-\u1f57\u1f60-\u1f67\u1f70-\u1f7d\u1f80-\u1f87\u1f90-\u1f97\u1fa0-\u1fa7\u1fb0-\u1fb4\u1fb6\u1fb7\u1fbe\u1fc2-\u1fc4\u1fc6\u1fc7\u1fd0-\u1fd3\u1fd6\u1fd7\u1fe0-\u1fe7\u1ff2-\u1ff4\u1ff6\u1ff7\u2071\u207f\u210a\u210e\u210f\u2113\u212f\u2134\u2139\u213c\u213d\u2146-\u2149\u214e\u2184\u2c30-\u2c5e\u2c61\u2c65\u2c66\u2c68\u2c6a\u2c6c\u2c74\u2c76\u2c77\u2c81\u2c83\u2c85\u2c87\u2c89\u2c8b\u2c8d\u2c8f\u2c91\u2c93\u2c95\u2c97\u2c99\u2c9b\u2c9d\u2c9f\u2ca1\u2ca3\u2ca5\u2ca7\u2ca9\u2cab\u2cad\u2caf\u2cb1\u2cb3\u2cb5\u2cb7\u2cb9\u2cbb\u2cbd\u2cbf\u2cc1\u2cc3\u2cc5\u2cc7\u2cc9\u2ccb\u2ccd\u2ccf\u2cd1\u2cd3\u2cd5\u2cd7\u2cd9\u2cdb\u2cdd\u2cdf\u2ce1\u2ce3\u2ce4\u2d00-\u2d25\ufb00-\ufb06\ufb13-\ufb17\uff41-\uff5a]',
35 Lm:'[\u02b0-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ee\u037a\u0559\u0640\u06e5\u06e6\u07f4\u07f5\u07fa\u0e46\u0ec6\u10fc\u17d7\u1843\u1d2c-\u1d61\u1d78\u1d9b-\u1dbf\u2090-\u2094\u2d6f\u3005\u3031-\u3035\u303b\u309d\u309e\u30fc-\u30fe\ua015\ua717-\ua71a\uff70\uff9e\uff9f]', 36 Lo:'[\u01bb\u01c0-\u01c3\u0294\u05d0-\u05ea\u05f0-\u05f2\u0621-\u063a\u0641-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u076d\u0780-\u07a5\u07b1\u07ca-\u07ea\u0904-\u0939\u093d\u0950\u0958-\u0961\u097b-\u097f\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d28\u0d2a-\u0d39\u0d60\u0d61\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e45\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0edc\u0edd\u0f00\u0f40-\u0f47\u0f49-\u0f6a\u0f88-\u0f8b\u1000-\u1021\u1023-\u1027\u1029\u102a\u1050-\u1055\u10d0-\u10fa\u1100-\u1159\u115f-\u11a2\u11a8-\u11f9\u1200-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u1676\u1681-\u169a\u16a0-\u16ea\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17dc\u1820-\u1842\u1844-\u1877\u1880-\u18a8\u1900-\u191c\u1950-\u196d\u1970-\u1974\u1980-\u19a9\u19c1-\u19c7\u1a00-\u1a16\u1b05-\u1b33\u1b45-\u1b4b\u2135-\u2138\u2d30-\u2d65\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3006\u303c\u3041-\u3096\u309f\u30a1-\u30fa\u30ff\u3105-\u312c\u3131-\u318e\u31a0-\u31b7\u31f0-\u31ff\u3400\u4db5\u4e00\u9fbb\ua000-\ua014\ua016-\ua48c\ua800\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\uac00\ud7a3\uf900-\ufa2d\ufa30-\ufa6a\ufa70-\ufad9\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff66-\uff6f\uff71-\uff9d\uffa0-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]', 37 Co:'[\ue000\uf8ff]', 38 Nd:'[\u0030-\u0039\u0660-\u0669\u06f0-\u06f9\u07c0-\u07c9\u0966-\u096f\u09e6-\u09ef\u0a66-\u0a6f\u0ae6-\u0aef\u0b66-\u0b6f\u0be6-\u0bef\u0c66-\u0c6f\u0ce6-\u0cef\u0d66-\u0d6f\u0e50-\u0e59\u0ed0-\u0ed9\u0f20-\u0f29\u1040-\u1049\u17e0-\u17e9\u1810-\u1819\u1946-\u194f\u19d0-\u19d9\u1b50-\u1b59\uff10-\uff19]', 39 Lt:'[\u01c5\u01c8\u01cb\u01f2\u1f88-\u1f8f\u1f98-\u1f9f\u1fa8-\u1faf\u1fbc\u1fcc\u1ffc]', 40 Lu:'[\u0041-\u005a\u00c0-\u00d6\u00d8-\u00de\u0100\u0102\u0104\u0106\u0108\u010a\u010c\u010e\u0110\u0112\u0114\u0116\u0118\u011a\u011c\u011e\u0120\u0122\u0124\u0126\u0128\u012a\u012c\u012e\u0130\u0132\u0134\u0136\u0139\u013b\u013d\u013f\u0141\u0143\u0145\u0147\u014a\u014c\u014e\u0150\u0152\u0154\u0156\u0158\u015a\u015c\u015e\u0160\u0162\u0164\u0166\u0168\u016a\u016c\u016e\u0170\u0172\u0174\u0176\u01
4078\u0179\u017b\u017d\u0181\u0182\u0184\u0186\u0187\u0189-\u018b\u018e-\u0191\u0193\u0194\u0196-\u0198\u019c\u019d\u019f\u01a0\u01a2\u01a4\u01a6\u01a7\u01a9\u01ac\u01ae\u01af\u01b1-\u01b3\u01b5\u01b7\u01b8\u01bc\u01c4\u01c7\u01ca\u01cd\u01cf\u01d1\u01d3\u01d5\u01d7\u01d9\u01db\u01de\u01e0\u01e2\u01e4\u01e6\u01e8\u01ea\u01ec\u01ee\u01f1\u01f4\u01f6-\u01f8\u01fa\u01fc\u01fe\u0200\u0202\u0204\u0206\u0208\u020a\u020c\u020e\u0210\u0212\u0214\u0216\u0218\u021a\u021c\u021e\u0220\u0222\u0224\u0226\u0228\u022a\u022c\u022e\u0230\u0232\u023a\u023b\u023d\u023e\u0241\u0243-\u0246\u0248\u024a\u024c\u024e\u0386\u0388-\u038a\u038c\u038e\u038f\u0391-\u03a1\u03a3-\u03ab\u03d2-\u03d4\u03d8\u03da\u03dc\u03de\u03e0\u03e2\u03e4\u03e6\u03e8\u03ea\u03ec\u03ee\u03f4\u03f7\u03f9\u03fa\u03fd-\u042f\u0460\u0462\u0464\u0466\u0468\u046a\u046c\u046e\u0470\u0472\u0474\u0476\u0478\u047a\u047c\u047e\u0480\u048a\u048c\u048e\u0490\u0492\u0494\u0496\u0498\u049a\u049c\u049e\u04a0\u04a2\u04a4\u04a6\u04a8\u04aa\u04ac\u04ae\u04b0\u04b2\u04b4\u04b6\u04b8\u04ba\u04bc\u04be\u04c0\u04c1\u04c3\u04c5\u04c7\u04c9\u04cb\u
4004cd\u04d0\u04d2\u04d4\u04d6\u04d8\u04da\u04dc\u04de\u04e0\u04e2\u04e4\u04e6\u04e8\u04ea\u04ec\u04ee\u04f0\u04f2\u04f4\u04f6\u04f8\u04fa\u04fc\u04fe\u0500\u0502\u0504\u0506\u0508\u050a\u050c\u050e\u0510\u0512\u0531-\u0556\u10a0-\u10c5\u1e00\u1e02\u1e04\u1e06\u1e08\u1e0a\u1e0c\u1e0e\u1e10\u1e12\u1e14\u1e16\u1e18\u1e1a\u1e1c\u1e1e\u1e20\u1e22\u1e24\u1e26\u1e28\u1e2a\u1e2c\u1e2e\u1e30\u1e32\u1e34\u1e36\u1e38\u1e3a\u1e3c\u1e3e\u1e40\u1e42\u1e44\u1e46\u1e48\u1e4a\u1e4c\u1e4e\u1e50\u1e52\u1e54\u1e56\u1e58\u1e5a\u1e5c\u1e5e\u1e60\u1e62\u1e64\u1e66\u1e68\u1e6a\u1e6c\u1e6e\u1e70\u1e72\u1e74\u1e76\u1e78\u1e7a\u1e7c\u1e7e\u1e80\u1e82\u1e84\u1e86\u1e88\u1e8a\u1e8c\u1e8e\u1e90\u1e92\u1e94\u1ea0\u1ea2\u1ea4\u1ea6\u1ea8\u1eaa\u1eac\u1eae\u1eb0\u1eb2\u1eb4\u1eb6\u1eb8\u1eba\u1ebc\u1ebe\u1ec0\u1ec2\u1ec4\u1ec6\u1ec8\u1eca\u1ecc\u1ece\u1ed0\u1ed2\u1ed4\u1ed6\u1ed8\u1eda\u1edc\u1ede\u1ee0\u1ee2\u1ee4\u1ee6\u1ee8\u1eea\u1eec\u1eee\u1ef0\u1ef2\u1ef4\u1ef6\u1ef8\u1f08-\u1f0f\u1f18-\u1f1d\u1f28-\u1f2f\u1f38-\u1f3f\u1f48-\u1f4d\u1f59\u1f5b\u1f5d\u1f5f\u1f68-\u1f6f\u1fb8-\u1fbb\u1fc8-\u1fcb\u1fd8-\u1fdb\u1fe8-\u1fec\u1ff8-\u1ffb\u2102\u2107\u210b-\u210d\u2110-\u2112\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u2130-\u2133\u213e\u213f\u2145\u2183\u2c00-\u2c2e\u2c60\u2c62-\u2c64\u2c67\u2c69\u2c6b\u2c75\u2c80\u2c82\u2c84\u2c86\u2c88\u2c8a\u2c8c\u2c8e\u2c90\u2c92\u2c94\u2c96\u2c98\u2c9a\u2c9c\u2c9e\u2ca0\u2ca2\u2ca4\u2ca6\u2ca8\u2caa\u2cac\u2cae\u2cb0\u2cb2\u2cb4\u2cb6\u2cb8\u2cba\u2cbc\u2cbe\u2cc0\u2cc2\u2cc4\u2cc6\u2cc8\u2cca\u2ccc\u2cce\u2cd0\u2cd2\u2cd4\u2cd6\u2cd8\u2cda\u2cdc\u2cde\u2ce0\u2ce2\uff21-\uff3a]', 41 Cs:'[\ud800\udb7f\udb80\udbff\udc00\udfff]', 42 Zl:'[\u2028]', 43 Nl:'[\u16ee-\u16f0\u2160-\u2182\u3007\u3021-\u3029\u3038-\u303a]', 44 Zp:'[\u2029]', 45 No:'[\u00b2\u00b3\u00b9\u00bc-\u00be\u09f4-\u09f9\u0bf0-\u0bf2\u0f2a-\u0f33\u1369-\u137c\u17f0-\u17f9\u2070\u2074-\u2079\u2080-\u2089\u2153-\u215f\u2460-\u249b\u24ea-\u24ff\u2776-\u2793\u2cfd\u3192-\u3195\u3220-\u3229\u3251-\u325f\u3280-\u3289\u32b1-\u32bf]', 46 Zs:'[\u0020\u00a0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000]', 47 Sc:'[\u0024\u00a2-\u00a5\u060b\u09f2\u09f3\u0af1\u0bf9\u0e3f\u17db\u20a0-\u20b5\ufdfc\ufe69\uff04\uffe0\uffe1\uffe5\uffe6]', 48 Pc:'[\u005f\u203f\u2040\u2054\ufe33\ufe34\ufe4d-\ufe4f\uff3f]', 49 Pd:'[\u002d\u058a\u1806\u2010-\u2015\u2e17\u301c\u3030\u30a0\ufe31\ufe32\ufe58\ufe63\uff0d]', 50 Pe:'[\u0029\u005d\u007d\u0f3b\u0f3d\u169c\u2046\u207e\u208e\u232a\u2769\u276b\u276d\u276f\u2771\u2773\u2775\u27c6\u27e7\u27e9\u27eb\u2984\u2986\u2988\u298a\u298c\u298e\u2990\u2992\u2994\u2996\u2998\u29d9\u29db\u29fd\u3009\u300b\u300d\u300f\u3011\u3015\u3017\u3019\u301b\u301e\u301f\ufd3f\ufe18\ufe36\ufe38\ufe3a\ufe3c\ufe3e\ufe40\ufe42\ufe44\ufe48\ufe5a\ufe5c\ufe5e\uff09\uff3d\uff5d\uff60\uff63]', 51 Pf:'[\u00bb\u2019\u201d\u203a\u2e03\u2e05\u2e0a\u2e0d\u2e1d]', 52 Me:'[\u0488\u0489\u06de\u20dd-\u20e0\u20e2-\u20e4]', 53 Mc:'[\u0903\u093e-\u0940\u0949-\u094c\u0982\u0983\u09be-\u09c0\u09c7\u09c8\u09cb\u09cc\u09d7\u0a03\u0a3e-\u0a40\u0a83\u0abe-\u0ac0\u0ac9\u0acb\u0acc\u0b02\u0b03\u0b3e\u0b40\u0b47\u0b48\u0b4b\u0b4c\u0b57\u0bbe\u0bbf\u0bc1\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcc\u0bd7\u0c01-\u0c03\u0c41-\u0c44\u0c82\u0c83\u0cbe\u0cc0-\u0cc4\u0cc7\u0cc8\u0cca\u0ccb\u0cd5\u0cd6\u0d02\u0d03\u0d3e-\u0d40\u0d46-\u0d48\u0d4a-\u0d4c\u0d57\u0d82\u0d83\u0dcf-\u0dd1\u0dd8-\u0ddf\u0df2\u0df3\u0f3e\u0f3f\u0f7f\u102c\u1031\u1038\u1056\u1057\u17b6\u17be-\u17c5\u17c7\u17c8\u1923-\u1926\u1929-\u192b\u1930\u1931\u1933-\u1938\u19b0-\u19c0\u19c8\u19c9\u1a19-\u1a1b\u1b04\u1b35\u1b3b\u1b3d-\u1b41\u1b43\u1b44\ua802\ua823\ua824\ua827]' 54 }; 55 /* Also supports the general category (only the first letter) */ 56 var firstLetters = {}; 57 for (var p in unicodeCategories) 58 { 59 if (firstLetters[p[0]]) 60 firstLetters[p[0]] = unicodeCategories[p].substring(0,unicodeCategories[p].length-1) + firstLetters[p[0]].substring(1); 61 else 62 firstLetters[p[0]] = unicodeCategories[p]; 63 } 64 for (var p in firstLetters) 65 unicodeCategories[p] = firstLetters[p]; 66 67 /* Gets a regex written in a dialect that supports unicode categories and 68 translates it to a dialect supported by JavaScript. */ 69 return function(regexpString, classes) 70 { 71 var modifiers = ""; 72 if ( regexpString instanceof RegExp ) { 73 modifiers = (regexpString.global ? "g" : "") + 74 (regexpString.ignoreCase ? "i" : "") + 75 (regexpString.multiline ? "m" : ""); 76 regexpString = regexpString.source; 77 } 78 regexpString = regexpString.replace(/\\p\{(..?)\}/g, function(match,group) { 79 var unicode_categorie = unicodeCategories[group]; 80 if (!classes) 81 unicode_category = unicode_categorie.replace(/\[(.*?)\]/g,"$1") 82 return unicode_category || match; 83 }); 84 return new RegExp(regexpString,modifiers); 85 }; 86 87})(); 88var eamLineChart, eamLineChartCtx, eamLineChartReward, eamLineChartRewardData, checkAmountXhr, eamProductChart, 89 eamProductChartData; 90var eamChartPieReward; 91var eamChartPieRewardData; 92var eamLineChartTmp = []; 93jQuery.fn.eamTooltip = jQuery.fn.tooltip; 94$(document).ready(function () { 95 $('.ets-am-content').find('input').attr('autocomplete','off'); 96 $(document).on('change','.type_date_filter',function(){ 97 if($(this).val()=='time_ranger') 98 { 99 if($(this).next('.box-date-ranger').length) 100 { 101 $(this).next('.box-date-ranger').addClass('show'); 102 } 103 } 104 else { 105 if($(this).next('.box-date-ranger').length) 106 { 107 $(this).next('.box-date-ranger').removeClass('show'); 108 } 109 } 110 });
111 $(document).mouseup(function (e) 112 { 113 var container_pop_table=$('.aff-product-popup-share-mail'); 114 if (!container_pop_table.is(e.target)&& container_pop_table.has(e.target).length === 0) 115 { 116 $('.aff-product-popup-share-mail').removeClass('show'); 117 } 118 if (!$('.aff-product-share-frontend').is(e.target)&& $('.aff-product-share-frontend').has(e.target).length === 0) 119 { 120 if(!$('.aff-product-share-list').hasClass('product-page')) 121 $('.aff-product-share-list').hide(); 122 } 123 }); 124 $(document).on('click','button[name="affSubmitSharEmail"]',function(e){ 125 e.preventDefault(); 126 if(!$(this).hasClass('loading')) 127 { 128 $('.aff-product-popup-share-mail .module_error').parent().remove(); 129 $('.aff-product-popup-share-mail .alert-success').parent().remove(); 130 $(this).addClass('loading'); 131 var url_ajax = $(this).data('link'); 132 $.ajax({ 133 url: url_ajax, 134 type: 'POST', 135 dataType: 'json', 136 data: { 137 affSubmitSharEmail: 1, 138 aff_mails: $('input[name="aff-emails"]').val(), 139 aff_name: $('input[name="aff-name"]').val(), 140 aff_message: $('textarea[name="aff-messages"]').val(), 141 aff_product_share_link :$('#aff-product-share-link').val(), 142 aff_product_share_name :$('#aff-product-share-name').val(), 143 token:eam_token, 144 }, 145 success: function (json) { 146 if(json.errors) 147 { 148 $('.aff-product-popup-share-mail .form-wrapper').append(json.errors); 149 } 150 if(json.success) 151 { 152 $('.aff-product-popup-share-mail .form-wrapper').append(json.success); 153 } 154 $('button[name="affSubmitSharEmail"]').removeClass('loading'); 155 } 156 }); 157 } 158 159 }); 160 161 $(document).on('click','.aff-product-share',function(){ 162 $(this).next('.aff-product-share-list').toggle(); 163 }); 164 165 $(document).on('click','.aff-product-share-email',function(e){ 166 e.preventDefault(); 167 var link_share = $(this).attr('href'); 168 $('#aff-product-share-link').val(link_share); 169 $('#aff-product-share-name').val($(this).data('product-name')); 170 $('.aff-product-popup-share-mail').addClass('show'); 171 }); 172 $(document).on('click','.aff-close',function(){ 173 $('.aff-product-popup-share-mail').removeClass('show'); 174 }); 175 $('.eam-tooltip-bs').eamTooltip(); 176 $(document).on('click', '#eam-affiliate-link-add-on', function (e) { 177 e.preventDefault(); 178 var copyButton = $(this); 179 var input = copyButton.closest('.input-group').find('input'); 180 var value = input.val(); 181 if (eamCopyToClipboard(value)) { 182 var origin = copyButton.attr('data-eam-tooltip'); 183 var success = copyButton.attr('data-eam-copy'); 184 copyButton.attr('data-eam-tooltip', success); 185 setTimeout(function () { 186 copyButton.attr('data-eam-tooltip', origin); 187 }, 2000); 188 } 189 }); 190 191 $(document).on('click', '.eam-input-link', function (e) { 192 $(this).select(); 193 var input = $(this); 194 var value = input.val(); 195 var copyButton = input.parent('.input-group').find('span.input-group-addon.eam-tooltip'); 196 if (eamCopyToClipboard(value, this)) { 197 var origin = copyButton.attr('data-eam-tooltip'); 198 var success = copyButton.attr('data-eam-copy'); 199 copyButton.attr('data-eam-tooltip', success); 200 setTimeout(function () { 201 copyButton.attr('data-eam-tooltip', origin); 202 }, 2000); 203 } 204 }); 205 $(document).on('focus', '.eam-input-link', function(event) { 206 event.preventDefault(); 207 $(this).select(); 208 });
209 if ($('body[id=cart]').length > 0 && link_cart && link_reward) { 210 $(document).ajaxComplete(function (event, xhr, settings) { 211 if (settings.url.indexOf(link_cart) !== -1) { 212 $('#ets_affiliatemarketing_cart_message').addClass('loading'); 213 $.ajax({ 214 type: 'POST', 215 dataType: 'json', 216 url: link_reward, 217 data: {ajax: 1, token: eam_token}, 218 success: function (data) { 219 $('#ets_affiliatemarketing_cart_message').removeClass('loading'); 220 var htmlRenderer = ''; 221 if (data.message) { 222 htmlRenderer += '<div class="alert alert-info">' + data.message + '</div>' 223 } 224 $('#ets_affiliatemarketing_cart_message').empty().html(htmlRenderer); 225 } 226 }); 227 } 228 }); 229 } 230 if ($('.eam-input-file').length > 0) { 231 var eam_fileInput = document.querySelector(".eam-input-file"), 232 eam_button = document.querySelector(".eam-input-file-trigger"), 233 eam_the_return = document.querySelector(".eam-file-return"); 234 eam_button.addEventListener("keydown", function (event) { 235 if (event.keyCode == 13 || event.keyCode == 32) { 236 eam_fileInput.focus(); 237 } 238 }); 239 eam_button.addEventListener("click", function (event) { 240 eam_fileInput.focus(); 241 return false; 242 }); 243 eam_fileInput.addEventListener("change", function (event) { 244 var path_img_arr = this.value.split('\\'); 245 if (path_img_arr[path_img_arr.length - 1]) { 246 eam_the_return.innerHTML = path_img_arr[path_img_arr.length - 1]; 247 } 248 249 }); 250 $('.eam-input-file-trigger').on("click", function () { 251 $('#eam_ref_banner').trigger('click'); 252 }) 253 } 254 if ($('#eam-input-upload-invoice').length > 0) { 255 var eam_fileInput = document.querySelector("#eam-input-upload-invoice"), 256 eam_button = document.querySelector(".eam-input-upload-invoice-trigger"), 257 eam_the_return = document.querySelector(".eam-file-upload-invoice-return"); 258 eam_button.addEventListener("keydown", function (event) { 259 if (event.keyCode == 13 || event.keyCode == 32) { 260 eam_fileInput.focus(); 261 } 262 }); 263 eam_button.addEventListener("click", function (event) { 264 eam_fileInput.focus(); 265 return false; 266 }); 267 eam_fileInput.addEventListener("change", function (event) { 268 var path_img_arr = this.value.split('\\'); 269 if(path_img_arr[path_img_arr.length - 1]) { 270 eam_the_return.innerHTML = path_img_arr[path_img_arr.length - 1]; 271 } 272 }); 273 } 274 $('.stats-loading').hide(); 275 eamLineChartCtx = document.getElementById('eam-stats-programs'); 276 $('.ets-am-program .js-add-mail-inviting-ref').click(function (event) { 277 if ($('.ets-am-program .mail-inviting-item').length < 10) { 278 mail_item = $('.ets-am-program .mail-inviting-item').last().clone().html(); 279 mail_order = $('.ets-am-program .mail-inviting-item').last().find('.js-order-number').first().html(); 280 281 mail_item = mail_item.replace('<span class="js-order-number">' + mail_order + '</span>', '<span class="js-order-number">' + (parseInt(mail_order) + 1) + '</span>'); 282 mail_item = mail_item.replace('invite_email_' + mail_order, 'invite_email_' + (parseInt(mail_order) + 1)); 283 mail_item = mail_item.replace('invite_name_' + mail_order, 'invite_name_' + (parseInt(mail_order) + 1)); 284 $('.ets-am-program .mail-inviting-item').last().after('<div class="mail-inviting-item mail-inviting-item-added"><span class="remove-mail-inviting-item">×</span>' + mail_item + '</div>'); 285 } else { 286 $('.js-add-mail-inviting-ref').hide(); 287 } 288 });
289 $('.ets-am-program ').on('click', '.remove-mail-inviting-item', function (event) { 290 event.preventDefault(); 291 $(this).parent().remove(); 292 }); 293 $('.ets-am-program input[type=email]').focusout(function (event) { 294 if (!eamValidateEmail($(this).val())) { 295 $(this).closest('.form-group').find('.error').remove(); 296 if (typeof eam_email_invalid !== 'undefined') { 297 error_html = '<div class="error">' + eam_email_invalid + '</div>'; 298 $(this).closest('.form-group').append(error_html); 299 } else { 300 $(this).closest('.form-group').find('.error').remove(); 301 } 302 $('.ets-am-program .js-send-email-inviting').prop('disabled', true); 303 } 304 }); 305 $('.ets-am-program input[type=email]').focus(function (event) { 306 $('.ets-am-program .js-send-email-inviting').prop('disabled', false); 307 }); 308 $('.ets-am-program .js-send-email-inviting').click(function (event) { 309 button_html = $(this).html(); 310 $this = $(this); 311 var error = false; 312 $('.error').remove(); 313 if($('form.eam-form-email-inviting input[name=name]').val()=='') 314 { 315 $('.eam-form-email-inviting input[name="name"]').after('<p class="error">'+name_is_blank+'</p>'); 316 error = true; 317 } 318 if($('form.eam-form-email-inviting input[name=email]').val()=='') 319 { 320 $('form.eam-form-email-inviting input[name=email]').after('<p class="error">'+email_is_blank+'</p>'); 321 error = true; 322 } 323 else if(!eamIsEmail($('form.eam-form-email-inviting input[name=email]').val())) 324 { 325 $('form.eam-form-email-inviting input[name=email]').after('<p class="error">'+email_is_invalid+'</p>'); 326 error = true; 327 } 328 if(!error) 329 { 330 var mail_datas = { 331 name: $('form.eam-form-email-inviting input[name=name]').val(), 332 email: $('form.eam-form-email-inviting input[name=email]').val() 333 }; 334 $.ajax({
335 url: '', 336 type: 'POST', 337 data: { 338 send_mail_invite: true, 339 mails: mail_datas, 340 token: eam_token 341 }, 342 beforeSend: function () { 343 if (typeof eam_sending_email !== 'undefined') { 344 $this.html(eam_sending_email); 345 } 346 $this.prop('disabled', true); 347 }, 348 success: function (res) { 349 if (typeof res !== 'object') { 350 res = JSON.parse(res); 351 } 352 if (res.success) { 353 $('.eam-alert-sent-mail').html('<div class="alert alert-success">'+res.message+'</div>'); 354 if (typeof res.limited !== 'undefined' && res.limited) { 355 limited_html = '<div class="alert alert-info">'; 356 limited_html = '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>'; 357 limited_html += eam_email_sent_limited; 358 limited_html += '</div>'; 359 $('form.eam-form-email-inviting').after(limited_html); 360 $('form.eam-form-email-inviting').remove(); 361 } 362 location.reload(); 363 } else { 364 $('.eam-alert-sent-mail').html('<div class="alert alert-danger"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>'+res.message+'</div>'); 365 } 366 }, 367 complete: function () { 368 $this.html(button_html); 369 $this.prop('disabled', false); 370 }, 371 error: function (xhr) { 372 } 373 }) 374 } 375 376 }); 377 378 $('.ets-am-program .js-upload-your-banner').click(function (event) { 379 file_banner = $('#eam_ref_banner').prop('files')[0]; 380 formData = new FormData(); 381 formData.append('banner', file_banner); 382 formData.append('upload_banner', true); 383 formData.append('token', eam_token); 384 $.ajax({
385 url: '', 386 type: 'POST', 387 data: formData, 388 cache: false, 389 contentType: false, 390 processData: false, 391 success: function (res) { 392 if (typeof res !== 'object') { 393 res = JSON.parse(res); 394 } 395 if (res.success) { 396 eamShowAlert(res.message, 'success'); 397 img_banner = '<img src="' + res.img + '?v=' + (Math.random()) + '" class="img-preview"><span class="delete-banner" title="' + eam_trans['delete'] + '"><i class="ets_svg"><svg width="16" height="16" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M704 736v576q0 14-9 23t-23 9h-64q-14 0-23-9t-9-23v-576q0-14 9-23t23-9h64q14 0 23 9t9 23zm256 0v576q0 14-9 23t-23 9h-64q-14 0-23-9t-9-23v-576q0-14 9-23t23-9h64q14 0 23 9t9 23zm256 0v576q0 14-9 23t-23 9h-64q-14 0-23-9t-9-23v-576q0-14 9-23t23-9h64q14 0 23 9t9 23zm128 724v-948h-896v948q0 22 7 40.5t14.5 27 10.5 8.5h832q3 0 10.5-8.5t14.5-27 7-40.5zm-672-1076h448l-48-117q-7-9-17-11h-317q-10 2-17 11zm928 32v64q0 14-9 23t-23 9h-96v948q0 83-47 143.5t-113 60.5h-832q-66 0-113-58.5t-47-141.5v-952h-96q-14 0-23-9t-9-23v-64q0-14 9-23t23-9h309l70-167q15-37 54-63t79-26h320q40 0 79 26t54 63l70 167h309q14 0 23 9t9 23z"/></svg></i></span>'; 398 $('#eam_ref_banner').closest('form').find('.preview-banner').html(img_banner); 399 $('#eam-ref-banner-code').text(res.embed_code); 400 $('.ets-am-program .delete-banner').show(); 401 } else { 402 eamShowAlert(res.message, 'danger'); 403 } 404 } 405 }); 406 }); 407 408 $(document).on('click', '.ets-am-program .delete-banner', function (event) { 409 event.preventDefault(); 410 if (!confirm(eam_trans['confirm_delete_banner'])) { 411 return false; 412 } 413 $.ajax({
414 url: '', 415 type: 'POST', 416 data: {delete_banner: true, token: eam_token}, 417 success: function (res) { 418 if (typeof res !== 'undefined') { 419 res = JSON.parse(res); 420 } 421 if (res.success) { 422 eamShowAlert(res.message, 'success'); 423 img_banner = ''; 424 if (res.img) { 425 img_banner = '<img src="' + res.img + '?v=' + (Math.random()) + '" class="img-preview"><span class="delete-banner" title="' + eam_trans['delete'] + '"><i class="ets_svg"><svg width="16" height="16" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M704 736v576q0 14-9 23t-23 9h-64q-14 0-23-9t-9-23v-576q0-14 9-23t23-9h64q14 0 23 9t9 23zm256 0v576q0 14-9 23t-23 9h-64q-14 0-23-9t-9-23v-576q0-14 9-23t23-9h64q14 0 23 9t9 23zm256 0v576q0 14-9 23t-23 9h-64q-14 0-23-9t-9-23v-576q0-14 9-23t23-9h64q14 0 23 9t9 23zm128 724v-948h-896v948q0 22 7 40.5t14.5 27 10.5 8.5h832q3 0 10.5-8.5t14.5-27 7-40.5zm-672-1076h448l-48-117q-7-9-17-11h-317q-10 2-17 11zm928 32v64q0 14-9 23t-23 9h-96v948q0 83-47 143.5t-113 60.5h-832q-66 0-113-58.5t-47-141.5v-952h-96q-14 0-23-9t-9-23v-64q0-14 9-23t23-9h309l70-167q15-37 54-63t79-26h320q40 0 79 26t54 63l70 167h309q14 0 23 9t9 23z"/></svg></i></span>'; 426 } 427 $('#eam_ref_banner').closest('form').find('.preview-banner').html(img_banner); 428 $('#eam-ref-banner-code').text(res.embed_code); 429 $('.ets-am-program .delete-banner').hide(); 430 } else { 431 eamShowAlert(res.message, 'danger'); 432 } 433 }, 434 error: function (xhr) { 435 436 } 437 }); 438 }); 439 440 var eamRefPopup = document.getElementById('ets-am-ref-popup'); 441 var eamRefPopupVoucher = document.getElementById('ets-am-ref-popup-voucher'); 442 var eamRefPopupClose = document.getElementsByClassName("ets-am-ref-popup-close")[0]; 443 var eamRefPopupClose2 = document.getElementsByClassName("js-eam-close-popup-ref")[0]; 444 var eamAffPopupVoucher = document.getElementById('ets_am_aff_modal_promo_code'); 445 446 if (typeof eamRefPopupClose !== 'undefined') { 447 eamRefPopupClose.onclick = function () { 448 eamRefPopup.style.display = "none"; 449 } 450 } 451 if (typeof eamRefPopupClose2 !== 'undefined') { 452 eamRefPopupClose2.onclick = function () { 453 eamRefPopup.style.display = "none"; 454 } 455 } 456 window.onclick = function (event) { 457 if (event.target == eamRefPopup) { 458 eamRefPopup.style.display = "none"; 459 } 460 if (event.target == eamRefPopupVoucher) { 461 eamRefPopupVoucher.style.display = "none"; 462 } 463 464 if (event.target == eamAffPopupVoucher) { 465 eamAffPopupVoucher.style.display = "none"; 466 } 467 } 468 469 if (typeof eam_show_popup_ref !== 'undefined' && typeof eam_link_ajax_exec !== 'undefined') { 470 eam_show_popup_ref = parseInt(eam_show_popup_ref); 471 if (eam_show_popup_ref) { 472 setTimeout(function () { 473 eamRefPopup.style.display = 'block'; 474 $.ajax({
475 url: eam_link_ajax_exec, 476 type: 'POST', 477 data: { 478 save_cookie_ref_popup: true, 479 token: eam_token 480 }, 481 success: function (res) { 482 } 483 }) 484 }, 3000); 485 } 486 } 487 488 $('#ets-am-ref-popup-voucher .ets-am-ref-popup-voucher-close').click(function (event) { 489 $('#ets-am-ref-popup-voucher').hide(); 490 }); 491 $(document).keyup(function(e) { 492 if(e.keyCode == 27 ) { 493 $('#ets_am_aff_modal_promo_code').hide(); 494 $('.aff-product-popup-share-mail').removeClass('show'); 495 } 496 }); 497 $('#ets_am_aff_modal_promo_code .ets-am-ref-popup-voucher-close,.shop_now_aff').click(function (event) { 498 $('#ets_am_aff_modal_promo_code').hide(); 499 }); 500 var eamDate = new Date(); 501 if (typeof moment !== 'undefined') { 502 $('.eam_date_ranger_filter').daterangepicker({ 503 startDate: moment(new Date(eamDate.getFullYear(), eamDate.getMonth(), 1)), 504 endDate: moment(new Date(eamDate.getFullYear(), eamDate.getMonth() + 1, 0)), 505 locale: { 506 format: 'YYYY/MM/DD' 507 } 508 }); 509 } 510 511 eamSetDateFilterStat('.eam_date_ranger_filter','/','-'); 512 $('.eam_date_ranger_filter').on('apply.daterangepicker', function (ev, picker) { 513 eamSetDateFilterStat('.eam_date_ranger_filter','/','-'); 514 eamLoadStats(); 515 }); 516 $('.eam-statistic-reward .filter_status_reward').change(function (event) { 517 eamLoadStats(); 518 }); 519 $('.eam-statistic-reward .js-btn-reset-filter').click(function (event) { 520 $('#eam_data_filter_stat_reward input[type=text], #eam_data_filter_stat_reward input[type=hidden]').val(''); 521 $('#eam_data_filter_stat_reward input[type=checkbox]').prop('checked', false); 522 eamLoadStats(); 523 }); 524 //Get stat data 525 eamLoadStats(); 526 eam_url_vars = eamGetUrlVars(); 527 eam_data_stats_req = { 528 get_stat_reward: true, 529 filter_type_stats: 'reward' 530 }; 531 if (typeof eam_data_stats !== 'undefined') { 532 if (typeof eam_data_stats !== 'object') { 533 eam_data_stats = JSON.parse(eam_data_stats); 534 } 535 var init_define_columns = []; 536 $.each(eam_data_stats.data[0].values, function(index, el) { 537 init_define_columns.push(el.x); 538 }); 539 nv.addGraph(function () { 540 eamLineChartReward = nv.models.lineChart() 541 .margin({left: 80}) 542 .useInteractiveGuideline(true) 543 .transitionDuration(350) 544 .showLegend(true) 545 .showYAxis(true) 546 .showXAxis(true); 547 var axisLabel = eam_data_stats.x_asis == 'date'? eam_chart_day : (eam_data_stats.x_asis == 'month'? eam_chart_month : eam_chart_year); 548 eamLineChartReward.xAxis 549 .tickValues(init_define_columns) 550 .axisLabel(axisLabel) 551 .rotateLabels(eam_data_stats.count_values > 31? -45 : 0) 552 .tickFormat(function (d) { 553 if (eamLineChartTmp.indexOf(d) < 0) { 554 eamLineChartTmp.push(d); 555 } else { 556 return; 557 } 558 if (eam_data_stats.x_asis == 'date') { 559 return parseInt(d3.time.format('%d')(new Date(d))); 560 } else if (eam_data_stats.x_asis == 'month') { 561 return parseInt(d3.time.format('%m')(new Date(d))); 562 } else if (eam_data_stats.x_asis == 'year') { 563 return d3.time.format('%Y')(new Date(d)) 564 } 565 return d; 566 }); 567 eamLineChartReward.yAxis 568 .axisLabel(eam_chart_currency_code) 569 .tickFormat(d3.format('.02f')); 570 eamLineChartRewardData = d3.select('#eam_stats_reward_line svg') 571 .datum(eam_data_stats.data) 572 .call(eamLineChartReward); 573 nv.utils.windowResize(eamLineChartReward.update); 574 return eamLineChartReward; 575 }); 576 } 577 if (typeof ets_am_product_stats !== 'undefined') { 578 var init_define_columns2 = []; 579 $.each(ets_am_product_stats.data[0].values, function(index, el) { 580 init_define_columns2.push(el.x); 581 }); 582 nv.addGraph(function () { 583 eamProductChart = nv.models.lineChart() 584 .margin({left: 60, bottom: 80}) 585 .useInteractiveGuideline(true) 586 .transitionDuration(350) 587 .showLegend(true) 588 .showYAxis(true) 589 .showXAxis(true); 590 var axisLabel = ets_am_product_stats.x_asis == 'date'? eam_chart_day : (ets_am_product_stats.x_asis == 'month'? eam_chart_month : eam_chart_year); 591 eamProductChart.xAxis 592 .tickValues(init_define_columns2) 593 .axisLabel(axisLabel) 594 .rotateLabels(-45) 595 .tickFormat(function (d) { 596 if (eamLineChartTmp.indexOf(d) < 0) { 597 eamLineChartTmp.push(d); 598 } else { 599 return; 600 } 601 if (ets_am_product_stats.x_asis == 'date') { 602 return parseInt(d3.time.format('%d')(new Date(d))); 603 } else if (ets_am_product_stats.x_asis == 'month') { 604 return parseInt(d3.time.format('%m')(new Date(d))); 605 } else if (ets_am_product_stats.x_asis == 'year') { 606 return d3.time.format('%Y')(new Date(d)) 607 } 608 return d; 609 }); 610 eamProductChart.yAxis 611 .axisLabel(eam_chart_currency_code) 612 .tickFormat(d3.format('.02f')); 613 eamProductChartData = d3.select('#eam_aff_stats svg') 614 .datum(ets_am_product_stats.data) 615 .call(eamProductChart); 616 nv.utils.windowResize(eamProductChart.update); 617 return eamProductChart; 618 }); 619 } 620 /* ====== PIE CHART ======*/ 621 if(typeof eam_data_pie_chart !== 'undefined'){ 622 if(typeof eam_data_pie_chart !== 'object'){ 623 eam_data_pie_chart = JSON.parse(eam_data_pie_chart); 624 } 625 nv.addGraph(function() { 626 eamChartPieReward = nv.models.pieChart() 627 .x(function(d) { return d.label }) 628 .y(function(d) { return d.value }) 629 .margin({left: 0, right: 0, top : 25, bottom : 0}) 630 .showLabels(true) 631 .labelThreshold(.05) 632 .pieLabelsOutside(false) 633 .labelType("percent"); 634 eamChartPieReward.noData('No Data found'); 635 eamChartPieRewardData = d3.select("#eam_stats_reward_pie svg") 636 .datum(eam_data_pie_chart) 637 .transition().duration(350) 638 .call(eamChartPieReward); 639 nv.utils.windowResize(eamChartPieReward.update); 640 eamChartPieReward.tooltipContent(function(key, y, e, graph) { 641 return '<h3>' + key + '</h3>' + 642 '<p>' + y + ' '+eam_chart_currency_code+ '</p>'; 643 }); 644 eamChartPieReward.update(); 645 return eamChartPieReward; 646 }); 647 } 648 649 650 /* ====== END PIE CHART ======*/ 651 if ($('.stats-data-reward button[data-type=time_ranger]').hasClass('active')) { 652 $('.stats-data-reward .box-date-ranger').addClass('show'); 653 } else { 654 $('.stats-data-reward .box-date-ranger').removeClass('show'); 655 } 656 $('.eam_date_ranger_filter').on('apply.daterangepicker', function (ev, picker) { 657 $(this).closest('.box-date-ranger').find('.date_from_reward').val(picker.startDate.format('YYYY-MM-DD')); 658 $(this).closest('.box-date-ranger').find('.date_to_reward').val(picker.endDate.format('YYYY-MM-DD')); 659 });
660 $('.eam_date_ranger_filter').on('hide.daterangepicker', function (ev, picker) { 661 $(this).closest('.box-date-ranger').find('.date_from_reward').val(picker.startDate.format('YYYY-MM-DD')); 662 $(this).closest('.box-date-ranger').find('.date_to_reward').val(picker.endDate.format('YYYY-MM-DD')); 663 }); 664 $('.eam-dashboard .js-type-info-stats').click(function (event) { 665 var type_stats = $(this).attr('data-type'); 666 var bg_stats = $(this).attr('data-bg'); 667 if (type_stats) { 668 $('.eam-dashboard input[name=type_stats]').val(type_stats); 669 $('.eam-dashboard .js-type-info-stats').each(function (index, el) { 670 $(el).find('.box-inner').removeClass($(el).attr('data-bg')); 671 }); 672 $(this).find('.box-inner').addClass(bg_stats); 673 $('.stats-data-reward .js-btn-submit-filter').click(); 674 } 675 }); 676 $('.stats-data-reward .js-btn-submit-filter').click(function (event) { 677 from = $('.stats-data-reward .date_from_reward').val(); 678 to = $('.stats-data-reward .date_to_reward').val(); 679 if (from && to) { 680 regex_date = /^\d{4}\-\d{1,2}\-\d{1,2}$/; 681 if (!regex_date.test(from) || !regex_date.test(to)) { 682 showErrorMessage('The format of date is invalid'); 683 return false; 684 } 685 } 686 if ($('#eam_stats_reward_line').length > 0 || $('#eam_aff_stats').length > 0) { 687 eam_data_stats_req = { 688 get_stat_reward: true, 689 tab_active: eam_url_vars.tabActive !== 'undefined' ? eam_url_vars.tabActive : '', 690 program: $('.stats-data-reward select[name=program]').val() 691 }; 692 eam_data_stats_req.filter_date_type = $('.stats-data-reward select[name=type_date_filter]').val(); 693 if ($('.stats-data-reward select[name=type_date_filter]').val() == 'time_ranger') { 694 eam_data_stats_req.filter_date_from = from; 695 eam_data_stats_req.filter_date_to = to; 696 } 697 eam_data_stats_req.filter_status = []; 698 eam_data_stats_req.filter_type_stats = $('.eam-dashboard input[name=type_stats]').val(); 699 eam_data_stats_req.filter_status.push($('.stats-data-reward select[name=status]').val()); 700 eamAjaxChartStat(eam_data_stats_req); 701 702 } 703 }); 704 705 $('.stats-data-reward .js-btn-reset-filter').click(function (event) { 706 $('.stats-data-reward .stat-filter input[type=text]').val(''); 707 $('.stats-data-reward .stat-filter select option:first-child').prop('selected', 'selected'); 708 $(this).closest('form').submit(); 709 if ($('#eam_stats_reward_line').length > 0) { 710 eam_data_stats_req = { 711 get_stat_reward: true, 712 tab_active: eam_url_vars.tabActive !== 'undefined' ? eam_url_vars.tabActive : '', 713 }; 714 eam_data_stats_req_pie = { 715 get_pie_reward: true, 716 tab_active: eam_url_vars.tabActive !== 'undefined' ? eam_url_vars.tabActive : '', 717 }; 718 eamAjaxChartStat(eam_data_stats_req); 719 } 720 721 }); 722 $('.eam-box-filter .js-btn-reset-form-filter').click(function (event) { 723 $('.eam-box-filter input[type=text]').val(''); 724 $('.eam-box-filter select').val(''); 725 }); 726 727 $('.stats-data-reward select[name=type_date_filter]').change(function (event) { 728 if ($(this).val() == 'time_ranger') { 729 $(this).next('.box-date-ranger').addClass('show'); 730 } else { 731 $(this).next('.box-date-ranger').removeClass('show'); 732 } 733 }); 734 735 $('.eam-box-filter select[name="type_date_filter"]').change(function (event) { 736 if ($(this).val() == 'time_ranger') { 737 $(this).next('.box-date-ranger').addClass('show'); 738 } else { 739 $(this).next('.box-date-ranger').removeClass('show'); 740 } 741 }); 742 743 $('.eam_select_filter select[name=type_date_filter]').change(function () { 744 if ($(this).val() === 'time_ranger') { 745 $(this).closest('.eam_select_filter').find('.box-date-ranger').addClass('show'); 746 } else { 747 $(this).closest('.eam_select_filter').find('.box-date-ranger').removeClass('show'); 748 } 749 });
750 751 if ($('.eam-box-filter select[name=type_date_filter]').val() === 'time_ranger') { 752 $('.eam-box-filter select[name=type_date_filter]').closest('.eam_select_filter').find('.box-date-ranger').addClass('show'); 753 } else { 754 $('.eam-box-filter select[name=type_date_filter]').closest('.eam_select_filter').find('.box-date-ranger').removeClass('show'); 755 } 756 757 if ($('.stats-data-reward select[name=type_date_filter]').val() == 'time_ranger') { 758 $('.stats-data-reward select[name=type_date_filter]').next('.box-date-ranger').show(); 759 } else { 760 $('.stats-data-reward select[name=type_date_filter]').next('.box-date-ranger').removeClass('show'); 761 } 762 763 if ($('.eam_select_filter select.type_date_filter').val() == 'time_ranger') { 764 $('.eam-box-filter select.type_date_filter').next('.box-date-ranger').addClass('show'); 765 } else { 766 $('.eam-box-filter select.type_date_filter').next('.box-date-ranger').removeClass('show'); 767 } 768 769 if(!$('.eam-withdraw-form input[name=EAM_AMOUNT_WITHDRAW]').val() || !eamIsFloat($('.eam-withdraw-form input[name=EAM_AMOUNT_WITHDRAW]').val())){ 770 $('.eam-withdraw-form').find('button.eam-submit-request').prop('disabled', true); 771 } 772 else{ 773 $('.eam-withdraw-form').find('button.eam-submit-request').prop('disabled', false); 774 } 775 $('.eam-withdraw-form input[name=EAM_AMOUNT_WITHDRAW]').keyup(function(event) { 776 if(!$(this).val() || !eamIsFloat($(this).val())){ 777 $('.eam-withdraw-form').find('button.eam-submit-request').prop('disabled', true); 778 } 779 else{ 780 $('.eam-withdraw-form').find('button.eam-submit-request').prop('disabled', false); 781 } 782 }); 783 var withdrawForm = $('.eam-withdraw-form'); 784 var submit = withdrawForm.find('button.eam-submit-request'); 785 786 submit.on('click', function (e) { 787 e.preventDefault(); 788 if ($.trim($('input[name=EAM_AMOUNT_WITHDRAW]').val()) && eamIsFloat($.trim($('input[name=EAM_AMOUNT_WITHDRAW]').val()))){ 789 var message = eam_confirmation_withdraw; 790 message = message.replace(':%d', $.trim($('input[name=EAM_AMOUNT_WITHDRAW]').val())); 791 if (confirm(message)) { 792 withdrawForm.submit(); 793 } 794 } 795 }); 796 var default_amount = $('input[name=EAM_AMOUNT_WITHDRAW]').val(); 797 if ($.trim(default_amount) !== '') { 798 eamCheckAmount($('input[name=EAM_AMOUNT_WITHDRAW]')); 799 } 800 $('input[name=EAM_AMOUNT_WITHDRAW]').on('change', function () { 801 eamCheckAmount($(this)) 802 }); 803 $('[data-toggle="tooltip"]').tooltip(); 804 $('.eam-pagination a').click(function (event) { 805 var query_url = window.location.href; 806 var _page = $(this).attr('data-page'); 807 query_url = eamUpdateQueryStringParameter(query_url, 'page', _page); 808 window.location.href = query_url; 809 }); 810 var convertVoucherForm = $('.eam-voucher-form form'); 811 var submitVoucher = $('.eam-voucher-form button[type=submit]'); 812 submitVoucher.on('click', function (e) { 813 e.preventDefault(); 814 if (confirm(eam_confirm_convert_voucher)) { 815 convertVoucherForm.submit(); 816 } 817 }); 818 $('.eam-box-filter .js-btn-reset-filter').click(function (event) { 819 $(this).closest('form').find('input[type=text]').val(''); 820 $(this).closest('form').find('select option:first-child').prop('selected', 'selected'); 821 var form_data = $(this).closest('form').serializeArray(); 822 var query_url = window.location.href; 823 $.each(form_data, function (index, el) { 824 query_url = eamUpdateQueryStringParameter(query_url, el.name, el.value); 825 }); 826 window.location.href = query_url; 827 }); 828 829 $('.js-eam-btn-copylink').click(function (event) { 830 $this = $(this); 831 var $this = $(this); 832 var input = $this.closest('.input-group').find('input'); 833 var value = input.val(); 834 if (eamCopyToClipboard(value,null)) { 835 var origin = $this.attr('data-eam-tooltip'); 836 var success = $this.attr('data-eam-copy'); 837 $this.attr('data-eam-tooltip', success); 838 setTimeout(function () { 839 $this.attr('data-eam-tooltip', origin); 840 }, 2000); 841 } 842 });
843 $('.js-eam-order-data').click(function (event) { 844 /* Act on the event */ 845 var order_by = $(this).attr('data-order-by'); 846 var order_way = $(this).attr('data-order-way'); 847 if (order_by && order_way) { 848 var query_url = window.location.href; 849 query_url = eamUpdateQueryStringParameter(query_url, 'orderBy', order_by); 850 query_url = eamUpdateQueryStringParameter(query_url, 'orderWay', order_way); 851 window.location.href = query_url; 852 } 853 }); 854 $(document).on('click', 'a.eam-apply-voucher', function (e) { 855 e.preventDefault(); 856 var apply_voucher = $(this); 857 var id_cart_rule = apply_voucher.attr('data-voucher-code'); 858 $.ajax({ 859 type: 'POST', 860 url: window.location.href, 861 data: { 862 eam_apply_voucher: true, 863 id_cart_rule: id_cart_rule, 864 token: eam_token 865 }, beforeSend: function () { 866 apply_voucher.prop('disabled', true); 867 }, success: function (data) { 868 if (typeof data !== "object") { 869 data = JSON.parse(data); 870 } 871 $('.eam-voucer-message').find('.alert').remove(); 872 var alert_class = data.success ? 'success' : 'danger'; 873 $('.eam-voucer-message').append('<div class="alert alert-' + alert_class + ' alert-dismissible"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>' + data.message + '</div>') 874 }, complete: function () { 875 apply_voucher.prop('disabled', false); 876 } 877 }) 878 }); 879 if (typeof ets_am_product_view_link !== 'undefined' && ets_am_product_view_link) { 880 setTimeout(function () { 881 $.ajax({
882 type: 'POST', 883 url: ets_am_product_view_link, 884 data: { 885 eam_get_access_key: true, 886 eam_id_seller: eam_id_seller, 887 token: eam_token 888 }, success: function (data) { 889 if (typeof data !== 'object') { 890 data = JSON.parse(data); 891 } 892 if (data.success) { 893 var key = data.access_key; 894 setTimeout(function () { 895 checkAccessKey(key, eam_id_seller, ets_am_product_view_link); 896 }, 8000); 897 } 898 } 899 }); 900 }, 2000); 901 } 902 var loading = $('.stats-loading'); 903 $('.stats-box-info').on('click', '.box-info', function (e) { 904 e.preventDefault(); 905 var box = $(this); 906 $('.stats-box-info .box-inner').removeClass('active'); 907 box.find('.box-inner').addClass('active'); 908 var type = box.attr('data-type'); 909 var type_date_filter = $('select[name="type_date_filter"]').val(); 910 var date_from = $('input[name="date_from_reward"]').val(); 911 var date_to = $('input[name="date_to_reward"]').val(); 912 if (date_from && date_to) { 913 getDataStats(type_date_filter, date_from, date_to, type, loading); 914 } 915 }); 916 917 $('.product-sales-filter').on('click', function (e) { 918 e.preventDefault(); 919 var box = $('.stats-box-info .box-info.active'); 920 if (box.length) { 921 var type = box.attr('data-type'); 922 var type_date_filter = $('select[name="type_date_filter"]').val(); 923 var date_from = $('input[name="date_from_reward"]').val(); 924 var date_to = $('input[name="date_to_reward"]').val(); 925 if (date_from && date_to) { 926 getDataStats(type_date_filter, date_from, date_to, type, loading); 927 } 928 } 929 }); 930 $('.product-sales-reset').on('click', function () { 931 $('.box-info .box-inner').removeClass('active'); 932 $('.box-info.eam-turnover .box-inner').addClass('active'); 933 var type = 'TURNOVER'; 934 var type_date_filter = 'this_month'; 935 var date = new Date(); 936 var firstDay = new Date(date.getFullYear(), date.getMonth(), 1); 937 var lastDay = new Date(date.getFullYear(), date.getMonth() + 1, 0); 938 var date_from = (firstDay.getFullYear()) + '-' + (firstDay.getMonth() + 1) + '-' + firstDay.getDate(); 939 var date_to = (lastDay.getFullYear()) + '-' + (lastDay.getMonth() + 1) + '-' + lastDay.getDate(); 940 $('select[name="type_date_filter"]').val(type_date_filter); 941 $('input[name="date_from_reward"]').val(date_from); 942 $('input[name="date_to_reward"]').val(date_to); 943 getDataStats(type_date_filter, date_from, date_to, type, loading); 944 }); 945 946 $('.affiliate_product_filter').on('click', 'submit-filter', function (e) { 947 e.preventDefault(); 948 var category = $('select[name="category"]').val(); 949 }); 950 951 $('.eam-box-tooltip').hover(function () { 952 var box = $(this); 953 var content = box.attr('data-title'); 954 var position = box.attr('data-placement'); 955 var tooltipContent = '<div class="box-tooltip ' + position + '">' + content + '<div class="arrow arrow-' + position + '"></div></div>'; 956 box.append(tooltipContent); 957 },function(){ 958 $(this).find('.box-tooltip').remove(); 959 }); 960 $('.ets-am-register-program .term_required').change(function (event) { 961 if ($(this).is(':checked')) { 962 $('.ets-am-register-program button[name=submitEamRegisterProgram]').prop('disabled', false); 963 } else { 964 $('.ets-am-register-program button[name=submitEamRegisterProgram]').prop('disabled', true); 965 } 966 }); 967 968 $('.eam-ref-banner-code').click(function(event) { 969 $(this).focus(); 970 $(this).select(); 971 document.execCommand("copy"); 972 $(this).prev('.eam-txt-tooltip').show(); 973 var $this = $(this); 974 setTimeout(function(){ 975 $this.prev('.eam-txt-tooltip').hide(); 976 }, 2000); 977 });
978 if($('input[name=eam_code_ref]').length) 979 { 980 $('input[name=eam_code_ref]').closest('form').submit(function(event) { 981 $(this).find('input[name=eam_code_ref]').next('.help-block').hide(); 982 var code_ref = $(this).find('input[name=eam_code_ref]').val(); 983 if(code_ref!=''){ 984 if(eamValidateEmail(code_ref) || (eamIsPositiveInteger(code_ref) && code_ref > 0)){ 985 return true; 986 } 987 else{ 988 $(this).find('input[name=eam_code_ref]').next('.help-block').css('color', 'red'); 989 $(this).find('input[name=eam_code_ref]').next('.help-block').show(); 990 } 991 return false; 992 } 993 994 return true; 995 }); 996 } 997 $('.eam-copy-clipboard').click(function(event) { 998 if(eamCopyToClipboard($(this).attr('data-text'),null)){ 999 var old_html = $(this).find('.eam-inner-copy-tooltip').html(); 1000 var $this = $(this); 1001 $(this).find('.eam-inner-copy-tooltip').html($(this).find('.eam-inner-copy-tooltip').attr('data-copied')); 1002 setTimeout(function(){ 1003 $this.find('.eam-inner-copy-tooltip').hide(); 1004 $this.find('.eam-inner-copy-tooltip').html(old_html); 1005 }, 2500) 1006 } 1007 }); 1008 $('.eam-copy-clipboard').hover(function() { 1009 $(this).find('.eam-inner-copy-tooltip').show(); 1010 }); 1011 $('.eam-copy-clipboard').mouseout(function() { 1012 $(this).find('.eam-inner-copy-tooltip').hide(); 1013 }); 1014}); 1015 1016$('.js-btn-submit-filter').closest('form').submit(function (event) { 1017 var filter_url = window.location.href; 1018 var form_data = $(this).serializeArray(); 1019 $.each(form_data, function (index, el) { 1020 filter_url = eamUpdateQueryStringParameter(filter_url, el.name, el.value); 1021 }); 1022 window.location.href = filter_url; 1023 return false; 1024}); 1025 1026function eamIsPositiveInteger(s) { 1027 return /^\+?[1-9][\d]*$/.test(s); 1028} 1029 1030function checkAccessKey(key, id_seller, url) { 1031 $.ajax({
1032 type: 'POST', 1033 url: url, 1034 data: { 1035 eam_check_access_key: true, 1036 eam_access_key: key, 1037 eam_id_seller: id_seller, 1038 token: eam_token 1039 }, success: function () { 1040 } 1041 }) 1042} 1043 1044function getDataStats(type_date_filter, from, to, type, loading) { 1045 $.ajax({ 1046 type: 'POST', 1047 url: window.location.href, 1048 data: { 1049 get_stat_reward: true, 1050 time_frame: type_date_filter, 1051 date_from: from, 1052 date_to: to, 1053 statistic: type, 1054 token: eam_token 1055 }, 1056 beforeSend: function () { 1057 loading.show(); 1058 }, success: function (data) { 1059 if (typeof data !== 'object') { 1060 data = JSON.parse(data); 1061 } 1062 var stats = data.stats; 1063 var countable = data.countable; 1064 var box = $('.box-info'); 1065 box.each(function (index, element) { 1066 if ($(element).hasClass('eam-turnover')) { 1067 $(element).find('.box-info-content').empty().text(countable.turnover) 1068 } 1069 if ($(element).hasClass('eam-rewards')) { 1070 $(element).find('.box-info-content').empty().text(countable.total_earn) 1071 } 1072 if ($(element).hasClass('eam-orders')) { 1073 $(element).find('.box-info-content').empty().text(countable.total_order) 1074 } 1075 if ($(element).hasClass('eam-views')) { 1076 $(element).find('.box-info-content').empty().text(countable.view_count) 1077 } 1078 if ($(element).hasClass('eam-conversion-rate')) { 1079 $(element).find('.box-info-content').empty().text(countable.conversion_rate) 1080 } 1081 if ($(element).hasClass('eam-net-profit')) { 1082 $(element).find('.box-info-content').empty().text(countable.net_profit) 1083 } 1084 }); 1085 var values = stats.data[0].values; 1086 var type = stats.type; 1087 var define_columns = []; 1088 $.each(values, function (k, v) { 1089 define_columns.push(v.x); 1090 }); 1091 var axisLabel = stats.x_asis == 'date'? eam_chart_day : (stats.x_asis == 'month'? eam_chart_month : eam_chart_year); 1092 eamProductChart.xAxis.axisLabel(axisLabel).tickValues(define_columns).tickFormat(function (d) { 1093 if (stats.x_asis == 'date') { 1094 return parseInt(d3.time.format('%d')(new Date(d))); 1095 } else if (stats.x_asis == 'month') { 1096 return parseInt(d3.time.format('%m')(new Date(d))); 1097 } else if (stats.x_asis == 'year') { 1098 return d3.time.format('%Y')(new Date(d)) 1099 } 1100 return d; 1101 }); 1102 eamProductChart.yAxis.tickFormat(function (d) { 1103 if (type == 'TURNOVER') { 1104 return ets_am_currency_sign + ' ' + parseFloat(d).toFixed(1); 1105 } else if (type == 'ORDERS' || type == 'VIEWS') { 1106 return (d == Math.floor(d)) ? d : null; 1107 } else if (type == 'CONVERSION_RATE') { 1108 return parseFloat(d).toFixed(1) + '%'; 1109 } else { 1110 return parseFloat(d).toFixed(2); 1111 } 1112 }); 1113 eamProductChartData.datum(stats.data) 1114 .call(eamProductChart); 1115 nv.utils.windowResize(eamProductChart.update); 1116 }, complete: function () { 1117 loading.hide(); 1118 } 1119 }) 1120} 1121 1122function eamCopyToClipboard(text, el) { 1123 1124 if (window.clipboardData && window.clipboardData.setData) { 1125 return clipboardData.setData("Text", text); 1126 } else if (document.queryCommandSupported && document.queryCommandSupported("copy")) { 1127 if(el){ 1128 $(el).select(); 1129 return document.execCommand("copy"); 1130 } 1131 var textarea = document.createElement("textarea"); 1132 textarea.textContent = text; 1133 textarea.style.position = "fixed"; 1134 document.body.appendChild(textarea); 1135 textarea.select(); 1136 try { 1137 textarea.focus(); 1138 return document.execCommand("copy"); 1139 } catch (ex) { 1140 console.warn("Copy to clipboard failed.", ex); 1141 return false; 1142 } finally { 1143 document.body.removeChild(textarea); 1144 } 1145 } 1146} 1147 1148 1149function eamUpdateQueryStringParameter(uri, key, value) { 1150 var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i"); 1151 var separator = uri.indexOf('?') !== -1 ? "&" : "?"; 1152 if (uri.match(re)) { 1153 return uri.replace(re, '$1' + key + "=" + value + '$2'); 1154 } else { 1155 return uri + separator + key + "=" + value; 1156 } 1157} 1158 1159function eamCheckAmount(input) { 1160 formErrors = []; 1161 if (checkAmountXhr && checkAmountXhr.readyState !== 4) { 1162 checkAmountXhr.abort(); 1163 } 1164 var eam_amount = input.val(); 1165 if ($.trim(eam_amount) !== '') { 1166 if (!isNaN(eam_amount)) { 1167 checkAmountXhr = $.ajax({
1168 url: window.location.href, 1169 type: 'POST', 1170 data: { 1171 check_withdraw_amount: true, 1172 amount: eam_amount, 1173 token: eam_token 1174 }, 1175 beforeSend: function () { 1176 input.closest('.form-group').removeClass('has-error'); 1177 input.closest('.form-group').find('span.help-block').remove(); 1178 }, 1179 success: function (data) { 1180 if (typeof data !== 'object') { 1181 data = JSON.parse(data); 1182 } 1183 if (data.valid) { 1184 var recevied = data.amount; 1185 $('.eam-withdraw-boxes span.price').empty().append(recevied); 1186 } else { 1187 input.closest('.form-group').addClass('has-error'); 1188 input.closest('.form-group').find('span.help-block').remove(); 1189 var msg = data.msg; 1190 formErrors.push(msg); 1191 input.closest('.form-group').append('<span class="help-block">' + msg + '</span>'); 1192 $('.eam-withdraw-boxes span.price').empty().append(eam_currency_sign + '0.00'); 1193 } 1194 } 1195 }) 1196 } else { 1197 $('.eam-withdraw-boxes span.price').empty().append(eam_currency_sign + '0.00'); 1198 } 1199 } else { 1200 $('.eam-withdraw-boxes span.price').empty().append(eam_currency_sign + '0.00'); 1201 } 1202} 1203 1204function displayFormErrors(formInput, message) { 1205 formInput.closest('.form-group').addClass('has-error'); 1206 formInput.closest('.form-group').find('span.help-block').remove().append('<span class="help-block">' + message + '</span>'); 1207} 1208 1209function affProductStats(data_ajax) { 1210 $.ajax({
1211 url: window.location.href, 1212 type: 'GET', 1213 data: data_ajax, 1214 beforeSend: function () { 1215 var loading = '<div class="stats-loading" style="display: block; padding: 0;">'; 1216 loading += '<div class="loading-text"></div>'; 1217 loading += '</div>'; 1218 $('.js-btn-submit-filter').closest('#module-ets_affiliatemarketing-reward .card-block').prepend(loading); 1219 }, 1220 success: function (res) { 1221 if (typeof res !== 'object') { 1222 res = JSON.parse(res); 1223 } 1224 var define_columns = []; 1225 $.each(res.data[0].values, function (index, el) { 1226 define_columns.push(el.x); 1227 }); 1228 var axisLabel = res.x_asis == 'date'? eam_chart_day : (res.x_asis == 'month'? eam_chart_month : eam_chart_year); 1229 eamLineChartReward.xAxis 1230 .axisLabel(axisLabel) 1231 .rotateLabels(res.count_values > 31? -45 : 0) 1232 .tickValues(define_columns) 1233 .tickFormat(function (d) { 1234 if (res.x_asis == 'date') { 1235 return parseInt(d3.time.format('%d')(new Date(d))); 1236 } else if (res.x_asis == 'month') { 1237 return parseInt(d3.time.format('%m')(new Date(d))); 1238 } else if (res.x_asis == 'year') { 1239 return d3.time.format('%Y')(new Date(d)) 1240 } 1241 return d; 1242 }); 1243 1244 eamLineChartRewardData.datum(res.data) 1245 .call(eamLineChartReward); 1246 nv.utils.windowResize(eamLineChartReward.update); 1247 1248 }, 1249 complete: function () { 1250 $('.js-btn-submit-filter').closest('#module-ets_affiliatemarketing-reward .card-block').find('.stats-loading').remove(); 1251 } 1252 }); 1253 1254} 1255function eamDisplayChartStat(res) { 1256 if (typeof res !== 'object') { 1257 res = JSON.parse(res); 1258 } 1259 var define_columns = []; 1260 $.each(res.data[0].values, function (index, el) { 1261 define_columns.push(el.x); 1262 }); 1263 var axisLabel = res.x_asis == 'date'? eam_chart_day : (res.x_asis == 'month'? eam_chart_month : eam_chart_year); 1264 eamLineChartReward.xAxis 1265 .axisLabel(axisLabel) 1266 .rotateLabels(res.count_values > 31? -45 : 0) 1267 .tickValues(define_columns) 1268 .tickFormat(function (d) { 1269 if (res.x_asis == 'date') { 1270 return parseInt(d3.time.format('%d')(new Date(d))); 1271 } else if (res.x_asis == 'month') { 1272 return parseInt(d3.time.format('%m')(new Date(d))); 1273 } else if (res.x_asis == 'year') { 1274 return d3.time.format('%Y')(new Date(d)) 1275 } 1276 return d; 1277 }); 1278 1279 eamLineChartRewardData.datum(res.data) 1280 .call(eamLineChartReward); 1281 nv.utils.windowResize(eamLineChartReward.update); 1282} 1283function eamAjaxChartStat(data_ajax) { 1284 $.ajax({
1285 url: window.location.href, 1286 type: 'GET', 1287 data: data_ajax, 1288 dataType:'json', 1289 beforeSend: function () { 1290 var loading = '<div class="stats-loading" style="display: block; padding: 0;">'; 1291 loading += '<div class="loading-text"></div>'; 1292 loading += '</div>'; 1293 $('.js-btn-submit-filter').closest('#module-ets_affiliatemarketing-reward .card-block').prepend(loading); 1294 }, 1295 success: function (res) { 1296 eamDisplayChartStat(res.stat_reward); 1297 eamDisplayPieChartReward(res.pie_reward) 1298 }, 1299 complete: function () { 1300 $('.js-btn-submit-filter').closest('#module-ets_affiliatemarketing-reward .card-block').find('.stats-loading').remove(); 1301 } 1302 }); 1303 1304} 1305 1306function eamDisplayPieChartReward(res){ 1307 if (typeof res !== 'object') { 1308 res = JSON.parse(res); 1309 } 1310 if(!res.length){ 1311 d3.select("#eam_stats_reward_pie svg").selectAll('*').remove(); 1312 $('#eam_stats_reward_pie .eam-chart-no-data').addClass('active'); 1313 } 1314 else{ 1315 $('#eam_stats_reward_pie .eam-chart-no-data').removeClass('active'); 1316 nv.addGraph(function() { 1317 eamChartPieReward = nv.models.pieChart() 1318 .x(function(d) { return d.label }) 1319 .y(function(d) { return d.value }) 1320 .margin({left: 0, right: 0, top : 25, bottom : 0}) 1321 .showLabels(true) 1322 .labelThreshold(.05) 1323 .pieLabelsOutside(false) 1324 .labelType("percent"); 1325 eamChartPieReward.noData('No Data found'); 1326 eamChartPieRewardData = d3.select("#eam_stats_reward_pie svg") 1327 .datum(res) 1328 .transition().duration(350) 1329 .call(eamChartPieReward); 1330 nv.utils.windowResize(eamChartPieReward.update); 1331 eamChartPieReward.tooltipContent(function(key, y, e, graph) { 1332 return '<h3>' + key + '</h3>' + 1333 '<p>' + y + ' '+eam_chart_currency_code+ '</p>'; 1334 }); 1335 eamChartPieReward.update(); 1336 return eamChartPieReward; 1337 }); 1338 } 1339} 1340 1341function eamGetUrlVars() { 1342 vars = {}; 1343 parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (m, key, value) { 1344 vars[key] = value; 1345 }); 1346 return vars; 1347} 1348 1349function eamShowMessage(message, type) { 1350 1351 notify_html = '<div class="eam-notify ' + type + '" style="display: none;">'; 1352 notify_html += message; 1353 notify_html += '</div>'; 1354 1355 if ($('body .eam-notify').length == 0) { 1356 $('body').append(notify_html); 1357 $('body .eam-notify').fadeIn(500); 1358 setTimeout(function () { 1359 $('body .eam-notify').fadeOut(1000, function () { 1360 $('body .eam-notify').remove(); 1361 }); 1362 1363 }, 4000) 1364 1365 } 1366} 1367 1368function eamShowAlert(message, type) { 1369 var div_alert = '<div class="eam-alert alert alert-' + type + '">'; 1370 div_alert += '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>'; 1371 div_alert += message; 1372 div_alert += '</div>'; 1373 $('.eam-alert-box').html(div_alert); 1374} 1375 1376function eamValidateEmail(email) { 1377 var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; 1378 return re.test(String(email).toLowerCase()); 1379} 1380 1381 1382function eamLoadStats() { 1383 if ($('#eam_data_filter_stat_reward').length == 0) { 1384 return; 1385 } 1386 formData = $('#eam_data_filter_stat_reward').serializeArray(); 1387 data_ajax = { 1388 getStatDataReward: true, 1389 token: eam_token 1390 }; 1391 data_ajax.filter_status = []; 1392 $.each(formData, function (index, el) { 1393 if (el.name == 'date_from') { 1394 data_ajax.filter_date_from = el.value; 1395 } 1396 if (el.name == 'date_to') { 1397 data_ajax.filter_date_to = el.value; 1398 } 1399 if (el.name == 'status[]') { 1400 data_ajax.filter_status.push(el.value); 1401 } 1402 });
1403 1404 $.ajax({ 1405 url: window.location.href, 1406 type: 'GET', 1407 data: data_ajax, 1408 beforeSend: function () { 1409 $('.eam-statistic-reward .stats-loading').show(); 1410 }, 1411 success: function (res) { 1412 1413 if (typeof res !== 'object') { 1414 res = JSON.parse(res); 1415 } 1416 1417 if (typeof eamLineChart == 'undefined') { 1418 eamLineChart = new Chart(eamLineChartCtx, { 1419 type: 'line', 1420 data: { 1421 labels: res.labels, 1422 datasets: res.datasets 1423 }, 1424 options: { 1425 scales: { 1426 yAxes: [{ 1427 ticks: { 1428 beginAtZero: true 1429 }, 1430 scaleLabel: { 1431 display: true, 1432 labelString: res.y_label 1433 } 1434 }], 1435 xAxes: [{ 1436 scaleLabel: { 1437 display: true, 1438 labelString: res.x_label 1439 } 1440 }], 1441 } 1442 } 1443 }); 1444 } else { 1445 eamLineChart.data.labels = res.labels; 1446 eamLineChart.data.datasets = res.datasets; 1447 eamLineChart.update(); 1448 } 1449 }, 1450 complete: function () { 1451 $('.eam-statistic-reward .stats-loading').hide(); 1452 } 1453 }) 1454} 1455 1456function eamSetDateFilterStat(input_dateranger, separate_date, separate_ranger) { 1457 if ($(input_dateranger).length == 0) { 1458 return; 1459 } 1460 dateranger = $(input_dateranger).val(); 1461 if(dateranger){ 1462 dateRangerArray = dateranger.split(' ' + separate_ranger + ' '); 1463 from = dateRangerArray[0]; 1464 to = dateRangerArray[1]; 1465 1466 $(input_dateranger).parent().find('input[name=date_from]').val(from.replace(new RegExp(separate_date, "g"), '-')); 1467 $(input_dateranger).parent().find('input[name=date_to]').val(to.replace(new RegExp(separate_date, "g"), '-')); 1468 } 1469 1470} 1471 1472function eamIsFloat(n) { 1473 return !isNaN(n) || (!isNaN(n) && n.toString().indexOf('.') != -1); 1474} 1475function eamIsEmail(s) 1476{ 1477 var reg = unicode_hack(/^[a-z\p{L}0-9!#$%&'*+\/=?^`{}|~_-]+[.a-z\p{L}0-9!#$%&'*+\/=?^`{}|~_-]*@[a-z\p{L}0-9]+[._a-z\p{L}0-9-]*\.[a-z\p{L}0-9]+$/i, false); 1478 return reg.test(s); 1479}
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.