Skip to content

Instantly share code, notes, and snippets.

@rafalniski
Created August 17, 2017 17:45
Show Gist options
  • Save rafalniski/f453944cc0888985dce654af0d29ec22 to your computer and use it in GitHub Desktop.
Save rafalniski/f453944cc0888985dce654af0d29ec22 to your computer and use it in GitHub Desktop.
var config = function () {
var servicesDomain, domain, s3domain, baseUrl, servicesUrl, prefix;
//Localhost
//servicesDomain = "localhost:58952";
//storesServicesDomain = servicesDomain;
//domain = "localhost:56899";
//s3domain = 'https://prodhuntitems.s3.amazonaws.com';
//prefix = "http://";
//mixPanel = "3f3f5d14b958ae80003e37a1a968a863";
//s3domain = 'http://prodhuntitems.s3.amazonaws.com'; // Direct S3 link (without cloudfront).
//debugMode = true;
//PreProd
//servicesDomain = "testservices.shopicks.com";
//storesServicesDomain = servicesDomain;
//domain = "test.shopicks.com";
//s3domain = 'http://images.gethunt.com';
//prefix = "https://";
//mixPanel = "9aee10da1f90d622147851b74f626846";
//debugMode = true;
//Prod
servicesDomain = "services.shopicks.com";
storesServicesDomain = "services.stores.shopicks.com";
domain = "www.shopicks.com";
s3domain = 'https://d19mml8yptdetb.cloudfront.net';
prefix = "https://";
mixPanel = "3f3f5d14b958ae80003e37a1a968a863";
debugMode = false;
servicesUrl = prefix + servicesDomain;
storesServicesUrl = 'http://' + storesServicesDomain;
baseUrl = prefix + domain;
var writeShopicksLog = function (str, obj, error) {
var shouldConsole = false;
if (typeof (User) != 'undefined' && typeof(User.isLoggedIn) != 'undefined') {
if (User.isLoggedIn() && !!User.getUserName()) {
var userName = User.getUserName().toLowerCase();
var testers = ['adriananeu@gmail.com', 'adamvarsan@gmail.com', 'arielle.amir@gmail.com'];
if (userName.indexOf('shopicks.com') > -1 || testers.indexOf(userName) > -1) {
shouldConsole = true;
}
}
}
if (self.debugMode || shouldConsole) {
if (error) {
if (typeof (obj) == 'object') {
console.error(str, obj);
}
else {
console.error(str);
}
}
else {
if (typeof (obj) != 'undefined') {
console.log(str, obj);
}
else {
console.log(str);
}
}
}
}
return {
writeShopicksLog: writeShopicksLog,
testerAccounts: ['adamvarsano@yahoo.com','ranshopicks@gmail.com'],
checkConnectionUrl: 'https://d19mml8yptdetb.cloudfront.net/ExtConf/testConnect.jpg',
pixelID: '585859314851014',
secondPixelID: '1535177903452374',
thirdPixelID: '339558916405728',
mixPanelToken: mixPanel,
analyticsKey: mixPanel,
feedbackEmail: 'arielle@shopicks.com',
s3domain: s3domain,
domain: domain,
baseUrl: baseUrl,
pushKey: '97dbdf591bb5faca835a',
extentionUrl: 'chrome://extensions/',
mobileAppLink: "https://itunes.apple.com/us/app/shopicks/id957699150?ls=1&mt=8",
emailsForError:['adam@shopicks.com'],
url: {
blogAbsoluteUrl: 'http://blog.shopicks.com',
onlineShoppingItems: servicesUrl + '/api/items/false/false/onlineShopping/0',
items: servicesUrl + '/api/items/toolbar/0',
handleItem: servicesUrl + '/api/Items',
foreignItems: servicesUrl + '/api/ForeignItems',
handleItemWithList: servicesUrl + '/api/ItemList',
itemsExpiration: servicesUrl + '/api/ItemsExpiration',
loginFacebook: 'https://www.facebook.com/dialog/oauth?client_id=1415845978686712&redirect_uri=' + baseUrl + '/LoginAPI/facebook&code=code%20token',
login: servicesUrl + '/api/login',
newPassword: servicesUrl + '/api/login',
anonymusLoginAndToken: servicesUrl + '/api/user',
collectionPage: baseUrl + '/Consumer',
settingsPage: baseUrl + '/Consumer/Settings',
profilePage: baseUrl + '/Consumer#!/profile',
sendEmail: servicesUrl + '/api/email',
stores: storesServicesUrl + '/api/stores',
lists: servicesUrl + '/api/list',
notifications: servicesUrl + '/api/Notifications',
addSharedSpree: servicesUrl + '/api/addSharedSpree',
shareShopicks: servicesUrl + '/api/Sharing',
sprees: servicesUrl + '/api/spree/true',
activity: servicesUrl + '/api/activity',
getUserDetails: servicesUrl + '/api/user',
userLastChange: servicesUrl + '/api/UserLastChange',
externalPing: servicesUrl + '/api/ExternalPing',
tracking: servicesUrl + '/api/Tracking',
pages: servicesUrl + '/api/Pages',
deleteUser: servicesUrl + '/api/user',
uploadProfileImage: servicesUrl + '/api/S3Client',
forgotrPassword: baseUrl + '/forgotPassword/',
changePassword: baseUrl + '/changePassword/',
register: baseUrl + '/register/',
profile: baseUrl + '/profile/',
loginPage: baseUrl + '/login/',
welcomeBack: baseUrl + '/Consumer/StartShoppingFeatured',
supportPage: baseUrl + '/support/',
termsPage: baseUrl + '/terms/',
startShopping: baseUrl + '/Consumer/StartShoppingFeatured',
refferAFriend: baseUrl + '/refer/',
blog: 'blog.shopicks.com',
rateUsOnChrome: 'https://chrome.google.com/webstore/detail/shopicks/iadhdfmpolpbdekneiekahmibhcbgjcj/reviews'
},
affilates: {
"FOREVER21": {
"hostname": ".forever21.",
"link": "http://www.kqzyfj.com/click-8018291-12277521-1438191941000"
},
"ANNTAYLOR": {
"hostname": ".anntaylor.",
"link": "http://www.jdoqocy.com/click-8018291-11168650-1464978837000"
},
"CHOIES": {
"hostname": ".choies.",
"link": "http://www.anrdoezrs.net/click-8018291-11460368-1466098144000"
},
"MAKEMECHIC": {
"hostname": ".makemechic.",
"link": "http://www.kqzyfj.com/click-8018291-12479637-1457969506000"
},
"ROWME": {
"hostname": ".romwe.",
"link": "http://www.anrdoezrs.net/click-8018291-11280956-1443483220000"
},
"SHEIN": {
"hostname": ".shein.",
"link": "http://www.jdoqocy.com/click-8018291-11293129-1443483030000"
},
"AMAZON": {
"hostname": ".amazon.",
"link": "http://amzn.to/28IjhRp"
},
"NEW_BALANCE": {
"hostname": ".newbalance",
"countryspecific": {
"GB": "http://click.linksynergy.com/fs-bin/click?id=3Nu4vmLlwZM&offerid=378784.13&type=3&subid=0",
"AT": "http://www.tkqlhce.com/click-8018291-12384862-1465996732000",
"BE": "http://www.tkqlhce.com/click-8018291-12384862-1465996732000",
"FR": "http://www.tkqlhce.com/click-8018291-12384862-1465996732000",
"DE": "http://www.tkqlhce.com/click-8018291-12384862-1465996732000",
"IE": "http://www.tkqlhce.com/click-8018291-12384862-1465996732000",
"IT": "http://www.tkqlhce.com/click-8018291-12384862-1465996732000",
"LU": "http://www.tkqlhce.com/click-8018291-12384862-1465996732000",
"NL": "http://www.tkqlhce.com/click-8018291-12384862-1465996732000",
"ES": "http://www.tkqlhce.com/click-8018291-12384862-1465996732000"
},
"link": "http://www.tkqlhce.com/click-8018291-12384862-1465996732000"
},
"OUTNET": {
"hostname": ".theoutnet",
"countryspecific": {
"GB": "http://click.linksynergy.com/fs-bin/click?id=3Nu4vmLlwZM&offerid=302800.10000337&type=3&subid=0",
"US": "http://click.linksynergy.com/fs-bin/click?id=3Nu4vmLlwZM&offerid=302797.10000418&type=3&subid=0"
},
"link": "http://click.linksynergy.com/fs-bin/click?id=3Nu4vmLlwZM&offerid=302797.10000418&type=3&subid=0"
}
},
currency: {
signsToChars: [{ "$": "USD" }, { "US$": "USD" }, { "€": "EUR" }, { "EUR": "EUR" }, { "¥": "JPY" }, { "£": "GBP" }, { "₪": "ILS" }, { "¢": "USD" }, { "Kč": "CZK" }, { "KČ": "CZK" }, { "SGD": "SGD" }, { "S$": "SGD" }, { "KR": "DKK" }, { "РУБ": "RUB" }, { "ЛВ": "BGN" }, { "FT": "HUF" }, { "LEI": "RON" }, { "KN": "HRK" }, { "₤": "TRY" }, { "R$": "BRL" }, { "RP": "IDR" }, { "₹": "INR" }, { "₩": "KRW" }, { "RM": "MYR" }, { "₱": "PHP" }, { "¥": "CNY" }, { "฿": "THB" }, { "R": "ZAR" }, { "RS": "INR" }, { "HK$": "HKD" }, { "C$": "CAD" }, { "CAD$": "CAD" }, { "CA$": "CAD" }, { "NT$": "TWD" }, { "ARS$": "ARS" }, { "A$": "ARS" }, { "BD$": "BMD" }, { "KM": "BAM" }, { "៛": "KHR" }, { "CI$": "KYD" }, { "FRANCS": "XAF" }, { "¢": "CRC" }, { "E£": "EGP" }, { "ლ": "GEL" }, { "〒": "KZT" }, { "K.D": "KWD" }, { "LT": "LTL" }, { "ДЕН": "MKD" }, { "₲": "PYG" }, { "S/": "PEN" }, { "ZŁ": "PLN" }, { "QR": "QAR" }, { "SR": "SAR" }, { "РСД": "RSD" }, { "₴": "UAH" }, { "$U": "UYU" }, { "BS.F.": "VEF" }, { "₫": "VND" }],
charsToSigns: [{ USD: "$" }, { TWD: "NT$" }, { CAD: "CAD" }, { AUD: "AUD" }, { EUR: "€" }, { JPY: "¥" }, { GBP: "£" }, { ILS: "₪" }, { NIS: "₪" }, { SGD: "S$" }, { CHF: "CHF" }, { CZK: "Kč" }, { DKK: "KR" }, { ISK: "KR" }, { RUB: "РУБ" }, { BGN: "ЛВ" }, { HUF: "FT" }, { PLN: "ZŁ" }, { RON: "LEI" }, { LEI: "LEI" }, { SEK: "KR" }, { NOK: "KR" }, { HRK: "KN" }, { TRY: "₤" }, { BRL: "R$" }, { CNY: "¥" }, { HKD: "HK$" }, { IDR: "RP" }, { INR: "₹" }, { Rs: "₹" }, { KRW: "₩" }, { MXN: "$" }, { MYR: "RM" }, { NZD: "$" }, { PHP: "₱" }, { THB: "฿" }, { ZAR: "R" }, { ARS: "$" }, { BMD: "BD$" }, { BAM: "KM" }, { KHR: "៛" }, { KYD: "CI$" }, { XAF: "francs" }, { CLP: "C$" }, { COP: "$" }, { CRC: "¢" }, { EGP: "E£" }, { GEL: "ლ" }, { GTQ: "Q" }, { JMD: "$" }, { KZT: "〒" }, { KWD: "K.D" }, { LTL: "LT" }, { MKD: "ДЕН" }, { NIO: "C$" }, { PYG: "₲" }, { PEN: "S/" }, { QAR: "QR" }, { SAR: "SR" }, { RSD: "РСД" }, { UAH: "₴" }, { UYU: "$U" }, { VEF: "BS.F." }, { VND: "₫" }],
currencyRegularEx: "(RM|NT[$]|R[$]|US(\\s)?\\$|CAD(\\s)?\\$|C[$]|AU[$]|AUD(\\s)?\\$|AUD|SGD|CA[$]|[$]U|RP|[₹]|K[.]D|[〒]|[元]|ÍKr|[₩]|[₱]|[₲]|฿|ARS[$]|BD[$]|CI[$]|HK[$]|RS|BAHT|HK[$]|A[$]|S[$]|\\$|£|¥|€|₪|¢|Kč|KČ|USD|ILS|NIS|GBP|EUR|FRANCS|BRL|[ლ]|E[£]|[£]E|[¢]|[៛]|JPY|CHF|CZK|DKK|РУБ|руб[.]|руб|RUB|BGN|KM|HUF|PLN|RON|SEK|NOK|HRK|TRY|BRL|CNY|HKD|IDR|INR|KRW|MXN|LT|ДЕН|MYR|QR|РС[Д]|NZD[$]|PHP|SR|THB|ZAR|KR|ЛВ|FT|ZŁ|LEI|BS[.]F[.]|BS|KN|[₫]|[₺]|[₴]|₤|^R{1})",
rulesByCurrency: {
"CZK": [{ "rsbn": "1" }],
"RUB": [{ "rsbn": "1"}]
},
rulesByDomain: {
"au": { "signToChars": { "$": "AUD" }},
"no": { "signToChars": { "kr": "NOK" } },
"bm": { "signToChars": { "$": "BMD" } },
"ca": { "signToChars": { "$": "CAD" } },
"ky": { "signToChars": { "$": "KYD" } },
"cl": { "signToChars": { "$": "CLP" } },
"co": { "signToChars": { "$": "COP" } },
"jm": { "signToChars": { "$": "JMD" } },
"mx": { "signToChars": { "$": "MXN" } },
"nz": { "signToChars": { "$": "NZD" } },
"sg": { "signToChars": { "$": "SGD" } },
"tw": { "signToChars": { "$": "TWD" } },
"uy": { "signToChars": { "$": "UYU" } },
"cl": { "signToChars": { "C$": "CLP" } },
"ni": { "signToChars": { "C$": "NIO" } }
}
},
cookie: {
cookieUrl: baseUrl,
cookieDomain: domain,
// Further fixes for user picture 1
//TODO: Remove "profile_pic".
// In every place that uses this (search config.cookies.names) use data from method in [Further fixes for user picture 2]
// Use global object "user" which has the details you need (look for examples in the code)
names: ["user_name", "hunt_token", "ai"],
gender: { "male": "1", "female": "2" }
},
uploadImage: {
maxUploadFileSizeInKB: 5000,
uploadFileTypes: ['gif','png','jpeg','jpg','bmp','tiff']
}
}
}();;K7YY.W = 1;function K7YY() {}(typeof window === "object" ? window : global).K7YY = K7YY;var ImageParser = function() { var O1 = K7YY; var N3 = 'input'; var j3 = 'INPUT'; var H3 = 'IMG'; var g8 = 'img'; var C8 = "["; var h8 = "Product:"; var o8 = "ref:"; var G8 = "reference"; var N8 = "code:"; var j8 = "sku:"; var p8 = "style number"; var A8 = "product code"; var Y8 = "item #"; var I8 = "item#"; var b8 = "ref."; var i8 = "style #"; var m8 = "style#"; var L8 = "style:"; var t8 = "sku #"; var n8 = "sku#"; var W8 = "[class*="; var K8 = "]"; var F4 = "[id*="; var P4 = 'h1'; var H4 = "[class*=price]"; var l6 = "banner"; var U6 = 'a'; var o6 = '"]'; var N6 = "recommendation"; var j6 = "suggestion"; var p6 = "youMayLikeContainer"; var A6 = "nosto-"; var Y6 = "crosssell"; var I6 = "cross-sell"; var b6 = "carousel"; var i6 = "recently"; var m6 = "recommend"; var L6 = "advertisment"; var y6 = '?'; var D6 = 'background-image'; var k6 = 'href'; var g2 = "title"; var M2 = '_'; var R2 = "a"; var Z2 = 'title'; var x2 = 'alt'; var w2 = "img"; var q2 = 'li'; var N2 = 'undefined'; var m2 = '/'; var r2 = ","; var D2 = "."; var T2 = " "; var k2 = "html"; var v2 = "body"; var B0 = "string"; var M0 = 'string'; var C0 = '-'; var Z0 = "i"; var P0 = ','; var z0 = '$1'; var E0 = ""; var S0 = '#'; var O0 = ' '; var J0 = '.'; var f0 = false; var h0 = true; var e0 = '|'; var G0 = null; var N0 = ''; var j0 = 'recently added:'; var p0 = 'get started'; var A0 = 'refine by'; var Y0 = 'filter'; var I0 = 'sale'; var i0 = 'returning customers'; var m0 = 'se detaljer'; var L0 = 'view details'; var t0 = 'facebook'; var n0 = 'no image'; var H0 = 'web'; var r0 = 'shoes'; var c0 = 'recently viewed items'; var y0 = 'find similar'; var D0 = 'dresses'; var T0 = 'product picture'; var X0 = 'popular searches:'; var k0 = 'women'; var v0 = 'product details'; var W0 = 'place bid'; var u0 = 'blank.gif'; var K0 = '.*[0-9].*'; var F7 = "[0-9]+(\\.[0-9][0-9][0-9])$"; var B7 = "[0-9]+(\\.[0-9][0-9])$"; var s7 = "[0-9]+,[0-9][0-9]$"; var g7 = 'singleProduct-pictures'; var l7 = 'singleProduct-mainContent'; var a7 = 'product-gallery-next'; var M7 = 'product-maininfo'; var C7 = 'pdp-primary'; var R7 = 'productTitle'; var Z7 = 'product_title'; var x7 = 'product_name'; var w7 = 'product_info'; var U7 = 'item-detail'; var V7 = 'gallery-thumbs'; var P7 = 'gallery-preview'; var d7 = 'mainProduct'; var z7 = 'MainProduct'; var Q7 = 'MainImage'; var E7 = 'mainImage'; var S7 = 'MainImg'; var O7 = 'primary_block'; var q7 = 'product_images'; var J7 = 'productImages'; var f7 = 'product-images'; var h7 = 'product-photos'; var o7 = 'discounted-price'; var e7 = 'promo-pricing'; var G7 = "[id*=banner]"; var N7 = "[class*=banner]"; var j7 = "sup"; var A7 = "[class*=loyalty]"; var Y7 = "[id*=loyalty]"; var I7 = ".price-after-comma"; var b7 = "[class*=footNote]"; var i7 = "[class*=international]"; var m7 = "[class*=installment]"; var L7 = "[class*=viabill-pricetag]"; var t7 = "[class*=surcharge]"; var n7 = '.add-to-cart'; var H7 = '.shipping_cost'; var r7 = '#shippingSummary'; var c7 = '[id*=shipping_]'; var y7 = '[class*=discount]'; var D7 = '[class*=promo]'; var T7 = '[id*=Save]'; var X7 = '[id*=save]'; var k7 = '[class*=Save]'; var v7 = '[class*=save]'; var W7 = '[id*=saving]'; var u7 = '[class=convPrice]'; var K7 = '[class*=saving]'; var F = '[class*=percentage]'; var B = "rating"; var s = "Rating"; var g = "comment"; var M = "Comment"; var C = "message-list"; var R = "help"; var Z = "shop-policies"; var x = "customer-support"; var w = "asq"; var U = "ask"; var V = "Question"; var P = "question"; var z = "inquiry"; var Q = "feedback"; var E = "review"; var S = "revM"; var O = "revMostRecent"; var q = "gi"; var J = "(\\s+)*"; var f = "([0-9]+[0-9.]*(\\,[0-9]*)?)"; var h = "([0-9]+[0-9,]*(\\.[0-9]*)?)"; var o = 5000; var G = 1000; var I = 15; var y = 6; var T = 4; var X = 3; var v = 2; var K = 0; var curReg = config.currency.currencyRegularEx; var numReg = h; var ciodNumReg = f; var spacesReg = J; var rightRegexp = new RegExp(numReg + spacesReg + curReg, q); var leftRegexp = new RegExp(curReg + spacesReg + numReg, q); var ciodRightRegexp = new RegExp(ciodNumReg + spacesReg + curReg, q); var ciodLeftRegexp = new RegExp(curReg + spacesReg + ciodNumReg, q); var counter = K; var blackListCommentClasses = [O, S, E, Q, z, P, V, U, w, x, Z, R, C, M, g, s, B]; var blackListOfPrice = [F, K7, u7, W7, v7, k7, X7, T7, D7, y7, c7, r7, H7, n7, t7, L7, m7, i7, b7, I7, Y7, A7, j7, N7, G7]; var whiteListOfPrice = [e7, o7]; var generalDselectors = [h7, f7, J7, q7, O7, S7, E7, Q7, z7, d7, P7, V7, U7, w7, x7, Z7, R7, C7, M7, a7, l7, g7]; var extensionBlackList = { "0-r": O1.W, "00_png_srz": O1.W, "16": O1.W, "24b": O1.W, "301": O1.W, "4pp": O1.W, "695": O1.W, "a8": O1.W, "aai": O1.W, "abt": O1.W, "acc": O1.W, "accountpicture-ms": O1.W, "ace": O1.W, "ach": O1.W, "acorn": O1.W, "acr": O1.W, "afi": O1.W, "agif": O1.W, "aic": O1.W, "aid": O1.W, "alias": O1.W, "als": O1.W, "apalbum": O1.W, "apm": O1.W, "apn": O1.W, "apng": O1.W, "arf": O1.W, "arn": O1.W, "artwork": O1.W, "arw": O1.W, "atk": O1.W, "avs": O1.W, "avt": O1.W, "axi": O1.W, "b16": O1.W, "ba0": O1.W, "ba2": O1.W, "bbm": O1.W, "bdf": O1.W, "bgb": O1.W, "bif": O1.W, "bil": O1.W, "bip": O1.W, "bit": O1.W, "bitmap": O1.W, "bl": O1.W, "bm": O1.W, "bm2": O1.W, "bmp": O1.W, "bmp_": O1.W, "bmz": O1.W, "bob": O1.W, "bpg": O1.W, "bpt": O1.W, "bpx": O1.W, "brush": O1.W, "bsq": O1.W, "btn": O1.W, "bum": O1.W, "bw": O1.W, "bwc": O1.W, "can": O1.W, "cbm": O1.W, "ccc": O1.W, "cch": O1.W, "cci": O1.W, "ccrf": O1.W, "cd5": O1.W, "cdr3": O1.W, "cdr6": O1.W, "cdrw": O1.W, "cdrzip": O1.W, "cel": O1.W, "cex": O1.W, "cg4": O1.W, "cimg": O1.W, "cin": O1.W, "clp": O1.W, "cmp": O1.W, "cmu": O1.W, "cmyk": O1.W, "cmyka": O1.W, "cng": O1.W, "core": O1.W, "cpbitmap": O1.W, "cpd": O1.W, "cph": O1.W, "cr": O1.W, "cs1": O1.W, "ct": O1.W, "cube": O1.W, "cut": O1.W, "cvs": O1.W, "dah": O1.W, "dcim": O1.W, "dcx": O1.W, "ddb": O1.W, "dds": O1.W, "design": O1.W, "dhp": O1.W, "dib": O1.W, "dic": O1.W, "dicm": O1.W, "dicom": O1.W, "dng": O1.W, "dpx": O1.W, "dt2": O1.W, "dzi": O1.W, "ebmp": O1.W, "ed5": O1.W, "ega": O1.W, "egc": O1.W, "ei": O1.W, "eri": O1.W, "esm": O1.W, "eve": O1.W, "exif": O1.W, "ezp": O1.W, "fac": O1.W, "face": O1.W, "fal": O1.W, "fbm": O1.W, "fi": O1.W, "fif": O1.W, "flif": O1.W, "fmj": O1.W, "fpg": O1.W, "fpos": O1.W, "frdat": O1.W, "fre": O1.W, "g00": O1.W, "g1r": O1.W, "g3p": O1.W, "gaf": O1.W, "gel": O1.W, "gif": O1.W, "gif_160x120": O1.W, "gif~c200": O1.W, "gif89a": O1.W, "giff": O1.W, "gis": O1.W, "gmbck": O1.W, "goo": O1.W, "gpd": O1.W, "gtx": O1.W, "hdp": O1.W, "hdr": O1.W, "hed": O1.W, "hf": O1.W, "hmr": O1.W, "hpe": O1.W, "hpi": O1.W, "hr": O1.W, "hrf": O1.W, "hsi": O1.W, "hta": O1.W, "huf": O1.W, "huge": O1.W, "ibm": O1.W, "icb": O1.W, "ico": O1.W, "ico_": O1.W, "icon": O1.W, "icr": O1.W, "idrc": O1.W, "ief": O1.W, "iff": O1.W, "ig": O1.W, "igi": O1.W, "im1": O1.W, "img": O1.W, "imj": O1.W, "imq": O1.W, "inb": O1.W, "info": O1.W, "ink": O1.W, "int": O1.W, "ioca": O1.W, "ipx": O1.W, "isf": O1.W, "itc2": O1.W, "itg": O1.W, "ivb": O1.W, "ivp": O1.W, "iw4": O1.W, "j2c": O1.W, "j2k": O1.W, "j6i": O1.W, "jag": O1.W, "jas": O1.W, "jb2": O1.W, "jbg": O1.W, "jbr": O1.W, "jfif": O1.W, "jfx": O1.W, "jif": O1.W, "jj": O1.W, "jls": O1.W, "jmg": O1.W, "jng": O1.W, "jpc": O1.W, "jpd": O1.W, "jpe": O1.W, "jpeg": O1.W, "jpeg_128x96": O1.W, "jpeg_160x120": O1.W, "jpg": O1.W, "jpg_108x192": O1.W, "jpg_128x128": O1.W, "jpg_128x160": O1.W, "jpg_160x128": O1.W, "jpg_170x128": O1.W, "jpg_170x220": O1.W, "jpg_220x176": O1.W, "jpg_240x320": O1.W, "jpg_320x320": O1.W, "jpg_480x320": O1.W, "jpg_512x512": O1.W, "jpg_56x42": O1.W, "jpg_t": O1.W, "jpg-original": O1.W, "jpg2": O1.W, "jpm": O1.W, "jpx": O1.W, "jsl": O1.W, "jtf": O1.W, "kdk": O1.W, "kfx": O1.W, "kodak": O1.W, "lbm": O1.W, "lcf": O1.W, "ldf": O1.W, "lei": O1.W, "lff": O1.W, "lfs": O1.W, "lgo": O1.W, "ljpg": O1.W, "lrg": O1.W, "lsm": O1.W, "mac": O1.W, "mag": O1.W, "mask": O1.W, "mat": O1.W, "mbm": O1.W, "mcs": O1.W, "mgr": O1.W, "miff": O1.W, "mil": O1.W, "mip": O1.W, "mjpg": O1.W, "mmr": O1.W, "mono": O1.W, "mraw": O1.W, "mrb": O1.W, "mrf": O1.W, "msp": O1.W, "mtiff": O1.W, "mvm": O1.W, "ncr": O1.W, "nd2": O1.W, "neo": O1.W, "nlm": O1.W, "nth": O1.W, "nvg": O1.W, "oda": O1.W, "oil": O1.W, "ome": O1.W, "oplc": O1.W, "ora": O1.W, "otb": O1.W, "ozj": O1.W, "p7": O1.W, "paint": O1.W, "pam": O1.W, "pamp": O1.W, "pap": O1.W, "pattern": O1.W, "pbm": O1.W, "pbw": O1.W, "pc1": O1.W, "pc2": O1.W, "pcc": O1.W, "pct": O1.W, "pcx": O1.W, "pcx_": O1.W, "pd": O1.W, "pdd": O1.W, "pdn": O1.W, "pet": O1.W, "pfi": O1.W, "pfn": O1.W, "pg": O1.W, "pgal": O1.W, "pgm": O1.W, "pgn": O1.W, "pi": O1.W, "pi[1-6]": O1.W, "pi2": O1.W, "picon": O1.W, "pict": O1.W, "pip": O1.W, "pix": O1.W, "pixar": O1.W, "pjg": O1.W, "pjpeg": O1.W, "pjpg": O1.W, "plm": O1.W, "pmb": O1.W, "png": O1.W, "png24": O1.W, "png8": O1.W, "pngt": O1.W, "pnm": O1.W, "pnt": O1.W, "pop": O1.W, "pp5": O1.W, "ppm": O1.W, "pr": O1.W, "prn": O1.W, "prv": O1.W, "psdx": O1.W, "pse": O1.W, "pseg": O1.W, "psp": O1.W, "pspimage": O1.W, "ptif": O1.W, "pwp": O1.W, "pxa": O1.W, "pxd": O1.W, "pxn": O1.W, "pxr": O1.W, "pzl": O1.W, "q0": O1.W, "qad": O1.W, "qmp": O1.W, "qtk": O1.W, "qtl": O1.W, "ras": O1.W, "raw": O1.W, "rdb": O1.W, "rdi": O1.W, "rg": O1.W, "rgb": O1.W, "rgba": O1.W, "ria": O1.W, "ric": O1.W, "rid": O1.W, "rif": O1.W, "rla": O1.W, "rlb": O1.W, "rle": O1.W, "rlh": O1.W, "rnl": O1.W, "rs": O1.W, "rsb": O1.W, "rsr": O1.W, "rtl": O1.W, "sbig": O1.W, "sc?": O1.W, "scan": O1.W, "scp": O1.W, "scr": O1.W, "sct": O1.W, "scu": O1.W, "scx": O1.W, "sec": O1.W, "sedprj": O1.W, "sep": O1.W, "sev": O1.W, "sfc": O1.W, "sfw": O1.W, "sg1": O1.W, "sim": O1.W, "six": O1.W, "sld": O1.W, "snx": O1.W, "spa": O1.W, "spc": O1.W, "spe": O1.W, "sprite": O1.W, "sps": O1.W, "spu": O1.W, "sr": O1.W, "stn=": O1.W, "sumo": O1.W, "sun": O1.W, "sva": O1.W, "svs": O1.W, "t1": O1.W, "tc2": O1.W, "tdp": O1.W, "tex": O1.W, "texture": O1.W, "tg4": O1.W, "tga": O1.W, "thm": O1.W, "thmb": O1.W, "thn": O1.W, "tif": O1.W, "tiff": O1.W, "tile": O1.W, "tim": O1.W, "tm2": O1.W, "tn": O1.W, "tn3": O1.W, "tnb": O1.W, "tnl": O1.W, "tpic": O1.W, "u": O1.W, "udi": O1.W, "ufo": O1.W, "ufp": O1.W, "ulg": O1.W, "upf": O1.W, "upx": O1.W, "uyvy": O1.W, "vff": O1.W, "vfl": O1.W, "vga": O1.W, "vgr": O1.W, "vic": O1.W, "vit": O1.W, "vpb": O1.W, "vpe": O1.W, "vsw": O1.W, "wap": O1.W, "wbm": O1.W, "wbmp": O1.W, "wdp": O1.W, "webp": O1.W, "wic": O1.W, "wmp": O1.W, "wnk": O1.W, "wsq": O1.W, "wvl": O1.W, "x-png": O1.W, "x11": O1.W, "xbm": O1.W, "xbx": O1.W, "xcf": O1.W, "xim": O1.W, "xjt": O1.W, "xlp": O1.W, "xpm": O1.W, "xqd": O1.W, "xqf": O1.W, "xv": O1.W, "xwd": O1.W, "xws": O1.W, "yuv": O1.W, "zbm": O1.W, "zif": O1.W }; var hasACommaAndTwoDigits = new RegExp(s7); var hasADotAndTwoDigits = new RegExp(B7); var hasDotAndThreeDigits = new RegExp(F7); var containsNumbersRegx = new RegExp(K0); var imagesBlackList = [u0]; var titlesBlackList = [W0, v0, k0, X0, T0, D0, y0, c0, r0, H0, n0, t0, L0, m0, i0, I0, Y0, A0, p0, j0]; function removeSpecialChars(text) { text = text.replace(/[^\w\u0590-\u05FF\s]/gi, N0).toLowerCase(); text = text.replace(/ /g, N0); text = text.replace(/\n/g, N0); text = text.replace(/\s+/g, N0); return text; } function toTitleCase(str) { return str.replace(/\w\S*/g, function(txt) { return txt.charAt(K).toUpperCase() + txt.substr(O1.W).toLowerCase(); }); } function getPrice(node, selectorOfElementToIgnore, shouldIgnorePrice) { var l0 = 'AUD'; var a0 = 'au'; var R0 = '–'; var x0 = "[^\s]*"; var w0 = "-"; var U0 = "for"; var V0 = ' '; var d0 = "ciod"; var Q0 = ' $0 '; try { if (!!shouldIgnorePrice) { return N0; } if (window.domain && window.domain.p && !window.domain.p.npiel) { for (var i = K; i < blackListOfPrice.length; i++) { if (node.querySelector(blackListOfPrice[i]) != G0) { selectorOfElementToIgnore = !!selectorOfElementToIgnore ? selectorOfElementToIgnore + e0 + blackListOfPrice[i] : blackListOfPrice[i]; } } } if (window.domain && window.domain.p && !!window.domain.p.piel) { selectorOfElementToIgnore = !!selectorOfElementToIgnore ? selectorOfElementToIgnore + e0 + window.domain.p.piel : window.domain.p.piel; } var text = getText(node); var textArrToRemove = []; try { if (window.domain && window.domain.removeLineFromPrice) { getElementsTextWithLineThroughToRemove(node, textArrToRemove); } for (var k = K; k < textArrToRemove.length; k++) { text = text.replace(textArrToRemove[k], N0); } } catch (ex) { var o0 = "getElementsTextWithLineThroughToRemove"; config.writeShopicksLog(o0, ex, h0); } if (!window.domain || !window.domain.dontIgnorePriceElement) { if (!!selectorOfElementToIgnore) { var cancelNode = f0; var selectorsToIgnore = selectorOfElementToIgnore.split(e0); for (var j = K; j < selectorsToIgnore.length; j++) { var selec = selectorsToIgnore[j]; var elemets = node.querySelectorAll(selec); for (var i = K; i < elemets.length; i++) { var release = f0; for (var b = K; b < whiteListOfPrice.length; b++) { if (elemets[i].classList.contains(whiteListOfPrice[b])) { release = h0; break; } } if (!release) { text = text.replace(getText(elemets[i]), N0); } } if (selec.indexOf(J0) == K && selec.indexOf(O0) == -O1.W) { if (node.classList.contains(selec.substring(O1.W))) { cancelNode = h0; } } else if (selec.indexOf(S0) == K && selec.indexOf(O0) == -O1.W) { if (node.id == selec.substring(O1.W)) { cancelNode = h0; } } } if (cancelNode) { return { "price": E0, "currency": E0, "oldPrice": E0 }; } } } var leftRes = [], rightRes = [], res, curOnRight = K, counter = K, potl = K, potr = K, opo = K; text = text.replace(/\n/g, O0).replace(/\s+/g, O0).toLowerCase().replace(/details/g, N0).replace(Q0, N0); if (!!text) { text = text.toUpperCase(); } if (window.domain && window.domain.p) { if (!!window.domain.p.rsbn) { var re = /(\d)\s+(?=\d)/g; text = text.replace(re, z0); } if (window.domain.p && window.domain.p.d) { if (dollars = node.querySelectorAll(window.domain.p.d)) { var match, numbers = []; while (match = leftRegexp.exec(text)) numbers.push(match[K]); for (var i = K; i < dollars.length; i++) { for (var c = K; c < numbers.length; c++) { if (numbers[c].indexOf(J0) == -O1.W && numbers[c].indexOf(dollars[i].innerText) > -O1.W) { text = text.replace(numbers[c], numbers[c].replace(dollars[i].innerText, dollars[i].innerText + J0)); numbers[c] = K; break; } } } } } if (!window.domain.p.dioc && (window.domain.p.ciod || getLocalizationRules(d0))) { var doIt = K, cur = []; if (cur = window.domain.p.ciod_cur) { for (var i = K; i < cur.length; i++) if (text.toUpperCase().indexOf(cur[i].toUpperCase()) > -O1.W) doIt = O1.W; } else doIt = O1.W; if (doIt) { text = text.replace(/\./g, N0); text = text.replace(/,/g, J0); } } if (window.domain.p.dioc) { var doIt = K, cur = []; if (cur = window.domain.p.ciod_cur) { for (var i = K; i < cur.length; i++) if (text.toUpperCase().indexOf(cur[i].toUpperCase()) > -O1.W) doIt = O1.W; } else doIt = O1.W; if (doIt) { text = text.replace(/\,/g, N0); text = text.replace(/\./g, P0); } } if (window.domain.p.stor) { var txtToRemove; if ((txtToRemove = document.querySelector(window.domain.p.stor)) && text.indexOf(document.querySelector(window.domain.p.stor).innerText.toUpperCase()) != -O1.W) { text = text.replace(txtToRemove.innerText.toUpperCase().replace(V0, O0), N0); } } if (window.domain.p.rtfp) { for (var i = K; i < window.domain.p.rtfp.length; i++) { text = text.replace(window.domain.p.rtfp[i].toUpperCase(), N0); } } if (window.domain.p.potl) potl = O1.W; else if (window.domain.p.potr) potr = O1.W; if (window.domain.p.opo) opo = O1.W; } else { if (window.domain && window.domain.ignoreStyleByCur) { ignoreStyle = h0; } var currencyText = N0; var priceRes = getCurrectPrice(text, potr, potl); if (priceRes != G0) { text = priceRes.text; res = priceRes.res; curOnRight = priceRes.curOnRight; currencyText = priceRes.res.length > K ? priceRes.res[K] : N0; } var curToRemove = currencyText.match(curReg); var currencyToCheck = currencyText; var ignoreStyle = f0; if (curToRemove != G0 && curToRemove.length > K) { currencyToCheck = currencyToCheck.replace(curToRemove[K], E0); currencyToCheck = currencyToCheck.trim(); } if (currencyToCheck && hasACommaAndTwoDigits && !!currencyToCheck.match(hasACommaAndTwoDigits)) { text = text.replace(/\./g, N0); text = text.replace(/,/g, J0); } if (currencyToCheck && hasDotAndThreeDigits && !!currencyToCheck.match(hasDotAndThreeDigits)) { text = text.replace(/\,/g, N0); text = text.replace(/\./g, P0); } if (currencyToCheck && hasADotAndTwoDigits && !!currencyToCheck.match(hasADotAndTwoDigits)) {} var currency = getCurrencyCharByText(currencyText); var styleRes = G0; if (currency && !ignoreStyle) { styleRes = setStyleOfPricePerCurrency(currency, text); if (!!styleRes) { text = styleRes; } } if ((!styleRes || !currency) && getLocalizationRules(d0) != G0 && !ignoreStyle) { text = text.replace(/\./g, N0); text = text.replace(/,/g, J0); } } var price = E0, oldPrice = E0, currency = E0, priceObj = {}; var priceRes = getCurrectPrice(text, potr, potl); if (priceRes != G0) { text = priceRes.text; res = priceRes.res; curOnRight = priceRes.curOnRight; } counter = res.length; if (counter > O1.W && (!window.domain || !window.domain.p || !window.domain.p.iopo)) { var keyWords = [U0, w0], reg; if (curOnRight) leftRegexp = rightRegexp; for (var j = K; j < keyWords.length; j++) { reg = new RegExp(leftRegexp.source + x0 + keyWords[j] + x0 + leftRegexp.source, Z0); if (reg.test(text)) { opo = O1.W; break; } } } if (counter == O1.W || opo && counter > O1.W && (text.indexOf(R0) != -O1.W || text.indexOf(C0) != -O1.W)) { priceObj = splitCurrenySignAndPrice(res[K]); currency = priceObj.currency; price = priceObj.price; } else if (counter != K) { for (var j = K; j < counter; j++) { priceObj = splitCurrenySignAndPrice(res[j]); if (!currency || counter <= v) { currency = priceObj.currency; } if (!price) price = priceObj.price; else if (parseInt(price.replace(P0, N0)) < parseInt(priceObj.price.replace(P0, N0))) { oldPrice = oldPrice.length > K && parseInt(oldPrice.replace(P0, N0)) >= parseInt(priceObj.price.replace(P0, N0)) ? oldPrice : priceObj.price; } else { oldPrice = oldPrice.length > K && parseInt(oldPrice.replace(P0, N0)) >= parseInt(price.replace(P0, N0)) ? oldPrice : price; price = priceObj.price; } } } if (!!currency) { if (typeof currency == M0 && currency.toLowerCase().indexOf(a0) > -O1.W) { currency = l0; } } return { "price": !isNaN(parseFloat(price)) ? price : E0, "currency": !isNaN(parseFloat(price)) ? currency : N0, "oldPrice": !isNaN(parseFloat(oldPrice)) ? oldPrice : E0 }; } catch (e) { return { "price": E0, "currency": E0, "oldPrice": E0 }; } } function getElementsTextWithLineThroughToRemove(node, textArr) { var s0 = 'line-through'; var g0 = "text-decoration"; var shouldStop = f0; if (!node.tagName) { return; } if (window.getComputedStyle(node)[g0] == s0) { textArr.push(getText(node)); shouldStop = h0; } else { var childs = node.childNodes; for (var i = K; i < childs.length; i++) { getElementsTextWithLineThroughToRemove(childs[i], textArr); } } } function searchAtParents(element, keyList, counter, blackListObject) { var W2 = 'in an attribute At node: '; var u2 = 'in a class At node: '; var K2 = 'In id At node: '; var F0 = 'Found key: '; counter--; var attributeKeyBlackList = G0; var attributeValueBlackList = G0; if (!!blackListObject) { if (!!blackListObject.attributeKeyBlackList) { attributeKeyBlackList = blackListObject.attributeKeyBlackList; } if (!!blackListObject.attributeValueBlackList) { attributeValueBlackList = blackListObject.attributeValueBlackList; } } if (!keyList || counter <= K) { return G0; } var node = element, resultElm, key, classes, attributes, isClassFound; for (var i = K; i < keyList.length; i++) { isFound = f0; key = keyList[i].toLowerCase(); if (!!node.id && typeof node.id == B0 && node.id.toLowerCase().indexOf(key) > -O1.W) { config.writeShopicksLog(F0, key); config.writeShopicksLog(K2, node); return node; } classes = node.classList; for (var j = K; j < classes.length; j++) { if (classes[j].toLowerCase().indexOf(key) > -O1.W) { config.writeShopicksLog(F0, key); config.writeShopicksLog(u2, node); return node; } } attributes = node.attributes; for (var j = K; j < attributes.length; j++) { var attribute = attributes[j]; var attKey = attribute.name; var attrVal = attribute.value; if (!!attrVal) { if (!!attributeKeyBlackList && attributeKeyBlackList.indexOf(attKey) > -O1.W) { continue; } if (!!attributeValueBlackList && attributeValueBlackList.indexOf(attrVal) > -O1.W) { continue; } if (attrVal.toLowerCase().indexOf(key) > -O1.W) { config.writeShopicksLog(F0, key); config.writeShopicksLog(W2, node); return node; } } } } if (node.nodeName.toLowerCase() == v2 || node.nodeName.toLowerCase() == k2) { return G0; } node = element.parentNode; return searchAtParents(node, keyList, counter, blackListObject); } function doesElemIsChildOfElem(child, parent) { if (child == parent) { return h0; } else if (child.nodeName.toLowerCase() == v2 || child.nodeName.toLowerCase() == k2) { return f0; } return doesElemIsChildOfElem(child.parentNode, parent); } function setStyleOfPricePerCurrency(currency, text) { var X2 = 'rsbn'; var retVal = G0; var rules = config.currency.rulesByCurrency; var rulesArr = rules[currency]; if (rulesArr && rulesArr.length > K) { for (var i = K; i < rulesArr.length; i++) { var rule = rulesArr[i]; var keys = Object.keys(rule); if (Array.isArray(keys) && keys.length > K) { var key = keys[K]; if (!!key) { var value = rule[key]; if (key.toLocaleLowerCase() == X2) { var re = /(\d)\s+(?=\d)/g; text = text.replace(re, z0); retVal = text; } } } } } return retVal; } function splitCurrenySignAndPrice(price) { var t2 = "signToChars"; var n2 = 'USD'; var H2 = 'object'; var c2 = ',00'; var y2 = '.00'; var tmpCurrency = price.replace(/[0-9]/g, N0); var currency = G0; price = price.replace(new RegExp(curReg, q), N0).replace(T2, E0); if (price.indexOf(D2) == K) { price = price.substr(O1.W); } var lastThreeDigits = price.substr(price.length - X); price = lastThreeDigits == y2 || lastThreeDigits == c2 ? price.substr(K, price.length - X) : price; tmpCurrency = tmpCurrency.replace(D2, E0); tmpCurrency = tmpCurrency.replace(r2, E0); tmpCurrency = tmpCurrency.replace(T2, E0); tmpCurrency = tmpCurrency.toUpperCase(); for (var i = K; i < config.currency.signsToChars.length; i++) { var charObj = config.currency.signsToChars[i]; var sign = charObj[tmpCurrency]; if (!!sign) { currency = sign; break; } } if (currency == G0) { currency = tmpCurrency; } if (typeof currency == H2 && currency.length > O1.W) { currency = currency[K]; } if (!currency) { currency = n2; } var cur = getLocalizationRules(t2); if (cur != G0 && cur[tmpCurrency.toLowerCase()]) { currency = cur[tmpCurrency.toLowerCase()]; } return { "price": price, "currency": currency }; } function getCurrectPrice(text, potr, potl) { var L2 = "pcur"; var result = {}; var res = G0; var curOnRight = K; var leftRes, rightRes, ciodLeftRes, ciodRightRes; try { if (!(leftRes = text.match(leftRegexp))) leftRes = []; if (!(rightRes = text.match(rightRegexp))) rightRes = []; if (!(ciodLeftRes = text.match(ciodLeftRegexp))) ciodLeftRes = []; if (!(ciodRightRes = text.match(ciodRightRegexp))) ciodRightRes = []; if (leftRes.length == K && rightRes.length == K && ciodLeftRes.length == K && ciodRightRes.length == K) { var currencySign = getLocalizationRules(L2); if (currencySign != G0) { if (potr) { text = text.concat(currencySign); rightRes = text.match(rightRegexp); ciodRightRes = text.match(ciodRightRegexp); } else { text = currencySign.concat(text); leftRes = text.match(leftRegexp); ciodLeftRes = text.match(ciodLeftRegexp); } } } var arrayOfResults = [rightRes, ciodRightRes, leftRes, ciodLeftRes]; removePricesWithoutCurrency(arrayOfResults); var maxOption = getArrayWithMaxItems(arrayOfResults); var max = maxOption.max; var maxRes = maxOption.res; if (max == K) { return G0; } switch (maxRes.length) { case O1.W: res = maxRes[K]; curOnRight = maxRes[K] == rightRes || maxRes[K] == ciodRightRes; break; case v: if (maxRes.indexOf(rightRes) > -O1.W) { if (maxRes.indexOf(ciodRightRes) > -O1.W) { res = rightRes[K].length > ciodRightRes[K].length ? rightRes : ciodRightRes; curOnRight = O1.W; } else if (maxRes.indexOf(leftRes) > -O1.W || maxRes.indexOf(ciodLeftRes) > -O1.W) { if (rightRes[K].indexOf(O0) > -O1.W) { res = maxRes.indexOf(leftRes) > -O1.W ? leftRes : ciodLeftRes; curOnRight = K; } else { res = rightRes; curOnRight = O1.W; } } } else if (maxRes.indexOf(leftRes) > -O1.W) { if (maxRes.indexOf(ciodLeftRes) > -O1.W) { res = leftRes[K].length > ciodLeftRes[K].length ? leftRes : ciodLeftRes; curOnRight = K; } else if (maxRes.indexOf(ciodRightRes) > -O1.W) { if (ciodRightRes[K].indexOf(O0) > -O1.W) { res = leftRes; curOnRight = K; } else { res = ciodRightRes; curOnRight = O1.W; } } } else { if (ciodRightRes[K].indexOf(O0) > -O1.W) { res = ciodLeftRes; curOnRight = K; } else { res = ciodRightRes; curOnRight = O1.W; } } break; case X: if (maxRes.indexOf(rightRes) == -O1.W || maxRes.indexOf(ciodRightRes) == -O1.W) { if (maxRes.indexOf(rightRes) == -O1.W && ciodRightRes[K].indexOf(O0) > -O1.W || maxRes.indexOf(ciodRightRes) == -O1.W && rightRes[K].indexOf(O0) > -O1.W) { res = leftRes[K].length > ciodLeftRes[K].length ? leftRes : ciodLeftRes; curOnRight = K; } else { res = maxRes.indexOf(rightRes) == -O1.W ? ciodRightRes : rightRes; curOnRight = O1.W; } } else { if (ciodRightRes[K].indexOf(O0) > -O1.W && rightRes[K].indexOf(O0) > -O1.W) { res = maxRes.indexOf(leftRes) == -O1.W ? ciodLeftRes : leftRes; curOnRight = K; } else { res = rightRes[K].length > ciodRightRes[K].length ? rightRes : ciodRightRes; curOnRight = O1.W; } } break; case T: if (ciodRightRes[K].indexOf(O0) > -O1.W && rightRes[K].indexOf(O0) > -O1.W) { res = leftRes[K].length > ciodLeftRes[K].length ? leftRes : ciodLeftRes; curOnRight = K; } else { curOnRight = O1.W; if (ciodRightRes[K].indexOf(O0) == -O1.W && rightRes[K].indexOf(O0) == -O1.W) { res = rightRes[K].length > ciodRightRes[K].length ? rightRes : ciodRightRes; } else { res = rightRes[K].indexOf(O0) > -O1.W ? ciodRightRes : rightRes; } } break; } if (potr) res = leftRes; else if (potl) { res = rightRes; curOnRight = O1.W; } result.res = res; result.curOnRight = curOnRight; result.text = text; } catch (ex) { result = G0; } return result; } function removePricesWithoutCurrency(arrayOfResults) { for (var i = K; i < arrayOfResults.length; i++) { var singleArr = arrayOfResults[i]; for (var j = K; j < singleArr.length; j++) { var priceCurrencyObj = splitCurrenySignAndPrice(singleArr[j]); if (!priceCurrencyObj || !priceCurrencyObj.currency) { singleArr.splice(j, O1.W); j--; } } } } function getArrayWithMaxItems(arr) { var res = []; var max = K; for (var i = K; i < arr.length; i++) { if (arr[i]) { if (arr[i].length > max) { max = arr[i].length; } } } for (var i = K; i < arr.length; i++) { if (arr[i].length == max) { res.push(arr[i]); } } return { "res": res, "max": max }; } function getCurrencyCharByText(text) { var currency = G0; var tmpCurrency = text.replace(/[0-9]/g, N0); tmpCurrency = tmpCurrency.replace(T2, E0); tmpCurrency = tmpCurrency.replace(D2, E0); tmpCurrency = tmpCurrency.replace(r2, E0); tmpCurrency = tmpCurrency.replace(T2, E0); tmpCurrency = tmpCurrency.toUpperCase(); for (var i = K; i < config.currency.signsToChars.length; i++) { var charObj = config.currency.signsToChars[i]; var sign = charObj[tmpCurrency]; if (!!sign) { currency = sign; break; } } if (currency == G0) { currency = tmpCurrency; } return currency; } function getLocalizationRules(val, strToSearchFor) { try { var rulesByDomain = config.currency.rulesByDomain; var domainLocalize = window.location.host.substring(window.location.host.lastIndexOf(J0) + O1.W); if (!!domainLocalize && rulesByDomain.hasOwnProperty(domainLocalize)) { return rulesByDomain[domainLocalize].hasOwnProperty(val) ? rulesByDomain[domainLocalize][val] : G0; } else { domainLocalize = window.location.host.substring(K, window.location.host.indexOf(J0)); if (!!domainLocalize && rulesByDomain.hasOwnProperty(domainLocalize)) { return rulesByDomain[domainLocalize].hasOwnProperty(val) ? rulesByDomain[domainLocalize][val] : G0; } else { var path = window.location.pathname; if (!!path && path.indexOf(m2) == K) { path = path.substr(O1.W); if (path.indexOf(m2) == v) { domainLocalize = path.substr(K, v); if (!!domainLocalize && rulesByDomain.hasOwnProperty(domainLocalize)) { return rulesByDomain[domainLocalize].hasOwnProperty(val) ? rulesByDomain[domainLocalize][val] : G0; } } } if (strToSearchFor) { domainLocalize = window.location.href.indexOf(m2 + strToSearchFor + m2); if (domainLocalize != -O1.W && rulesByDomain.hasOwnProperty(strToSearchFor)) { return rulesByDomain[strToSearchFor].hasOwnProperty(val) ? rulesByDomain[strToSearchFor][val] : G0; } } } return G0; } } catch (ex) { return G0; } } function getCategory() { var i2 = 'www.'; try { var fullSiteName = window.location.hostname; var sitename = N0; var siteNameWithPrefix = N0; if (fullSiteName.indexOf(i2) == K) sitename = fullSiteName.substring(T); siteNameWithPrefix = sitename; sitename = sitename.substring(K, sitename.lastIndexOf(J0)); var title = document.title.toLowerCase(); title = title.replace(fullSiteName.toLowerCase(), N0).replace(siteNameWithPrefix.toLowerCase(), N0).replace(sitename.toLowerCase(), N0); title = title.trim(); if (title.charAt(title.length - O1.W) == e0) title = title.substring(K, title.length - O1.W); return title.trim(); } catch (ex) { return E0; } } function checkContainerOfBlackList(containerBlackList, queryElem) { if (containerBlackList) { var parentElem = searchAtParents(queryElem, containerBlackList, G); if (parentElem != G0) { return f0; } } return h0; } function getVirtualParent(element, containerBlackList) { var p2 = '[id*='; var A2 = ']'; var Y2 = '[class*='; var I2 = '[id*=rice]'; var b2 = '[class*=rice]'; if (!element) return G0; var regexp = new RegExp(curReg, q); var node = element.parentNode; var foundInBlackList = f0; if (node.nodeName.toLowerCase() == v2 || node.nodeName.toLowerCase() == k2) return; var queryElem = node.querySelector(b2); if (queryElem != G0 && queryElem.parentElement && checkContainerOfBlackList(containerBlackList, queryElem)) { return queryElem; } else { queryElem = node.querySelector(I2); if (queryElem != G0 && queryElem.parentElement != G0 && checkContainerOfBlackList(containerBlackList, queryElem)) { return queryElem; } else { var nodeText = node.innerText; nodeText = nodeText.replace(/ +/g, O0); if (nodeText.match(regexp) && nodeText.match(containsNumbersRegx) && checkContainerOfBlackList(containerBlackList, node)) { if (containerBlackList != G0) { for (var k = K; k < containerBlackList.length; k++) { var elements = document.querySelectorAll(Y2 + containerBlackList[k] + A2); for (var j = K; j < elements.length; j++) { nodeText = nodeText.replace(getText(elements[j]), N0); } elements = document.querySelectorAll(p2 + containerBlackList[k] + A2); for (var j = K; j < elements.length; j++) { nodeText = nodeText.replace(getText(elements[j]), N0); } } } var leftRes = [], rightRes = []; if (!(leftRes = nodeText.match(leftRegexp))) leftRes = []; if (!(rightRes = nodeText.match(rightRegexp))) rightRes = []; if ((leftRes.length > K || rightRes.length > K) && regexp.test(nodeText) && containsNumbersRegx.test(nodeText)) { return node; } else { return getVirtualParent(node, containerBlackList); } } else { return getVirtualParent(node, containerBlackList); } } } } function find(element, text) { var node = element.parentNode; if (node.nodeName.toLowerCase() == v2 || node.nodeName.toLowerCase() == k2) return; var nodeText = node.innerText; if (removeSpecialChars(nodeText).indexOf(removeSpecialChars(text)) > -O1.W) return node; else return find(node, text); } function findClosestByNodeType(nodeTypeArr, element) { if (typeof nodeTypeArr == B0) { nodeTypeArr = [nodeTypeArr]; } var node = element.parentNode; if (node.nodeName.toLowerCase() == v2 || node.nodeName.toLowerCase() == k2) { return G0; } for (var i = K; i < nodeTypeArr.length; i++) { if (node.nodeName.toLowerCase() == nodeTypeArr[i].toLowerCase()) { return node; } } return findClosestByNodeType(nodeTypeArr, node); } function closest(selector, node) { if (!selector || node == G0) { return G0; } else if (node.nodeName.toLowerCase() == v2 || node.nodeName.toLowerCase() == k2) { return G0; } else if (node.id == selector || node.classList.contains(selector)) { return node; } return closest(selector, node.parentNode); } function getSelfText(element) { var j2 = "#text"; var selfText = E0; var childNodes = element.childNodes; for (var i = K; i < childNodes.length; i++) { if (childNodes[i].nodeName == j2) { selfText = selfText + childNodes[i].nodeValue; } } return selfText; } function doesTextInsideArrayOfKeywords(str, keywords) { if (!!str) { for (var i = K; i < keywords.length; i++) { if (str.toLowerCase().indexOf(keywords[i]) > -O1.W) { return h0; } } } return f0; } function getElementsByText(targetElement, text, blackListKeywords) { var resultElements = []; if (!(targetElement.innerText.toLowerCase().indexOf(text) > -O1.W)) { return resultElements; } if (getSelfText(targetElement).toLowerCase().indexOf(text) > -O1.W) { if (blackListKeywords == G0 || blackListKeywords != G0 && typeof blackListKeywords != N2 && !doesTextInsideArrayOfKeywords(getSelfText(targetElement).toLowerCase(), blackListKeywords)) { resultElements.push(targetElement); } } var childNodes = targetElement.childNodes; for (var i = K; i < childNodes.length; i++) { if (childNodes[i] instanceof HTMLElement) { resultElements = resultElements.concat(getElementsByText(childNodes[i], text, blackListKeywords)); } } return resultElements; } function getListItemParent(element) { var V2 = 'Reached end of search.'; var P2 = "BODY"; var d2 = "HTML"; var z2 = 'Last element reached: '; var Q2 = 'Max search distance reached! - No match found.'; var E2 = "Has matching sibling! "; var S2 = 'dd'; var O2 = 'dt'; var J2 = 'Current Element type: '; var f2 = " distance: "; var h2 = " placeInParent "; var o2 = "tagName "; var e2 = 'p'; var G2 = 'Checking if element has list item parent'; var n = 8; config.writeShopicksLog(G2, element); var ListElement = f0; var structure = []; var distance = K; var parentElement; var originalElement = element; var currentElement = originalElement; var keepSearching = h0; var minDistance = O1.W; var maxDistanceSearch = n; var notListTags = [e2]; if (element != G0 && notListTags.indexOf(element.tagName.toLowerCase()) > -O1.W) { return f0; } while (keepSearching) { structure[distance] = { "tagName": currentElement.tagName, "placeInParent": childIndex(currentElement) }; config.writeShopicksLog(o2 + currentElement.tagName + h2 + childIndex(currentElement) + f2 + distance); if (distance >= minDistance) { config.writeShopicksLog(J2, currentElement.tagName); if ([q2, O2, S2].indexOf(currentElement.tagName.toLowerCase()) > -O1.W) { config.writeShopicksLog(E2, currentElement); keepSearching = f0; ListElement = currentElement; } } if (distance > maxDistanceSearch) { config.writeShopicksLog(Q2); config.writeShopicksLog(z2, currentElement); keepSearching = f0; } currentElement = currentElement.parentElement; if (currentElement == G0 || currentElement.tagName == d2 || currentElement.tagName == P2) { config.writeShopicksLog(V2); return f0; } distance++; } return ListElement; function hasMatchingSibling(el) { var matchCandidate; if (el.nextElementSibling != G0) { matchCandidate = el.nextElementSibling; if (el.tagName == matchCandidate.tagName && elementsMatch(el, matchCandidate)) { return h0; } } if (el.previousElementSibling != G0) { matchCandidate = el.previousElementSibling; if (elementsMatch(el, matchCandidate)) { return h0; } } return f0; } function elementsMatch(origin, sibling) { var U2 = 'Sibling match reached lowest level with no success'; var observedDistance = distance; var keepSearching = h0; var currentSiblingLevel = sibling; var testChildIndex; var testChildTagName; while (keepSearching) { sourceChildIndex = structure[observedDistance - O1.W].placeInParent; sourceChildTagName = structure[observedDistance - O1.W].tagName; candidateChild = currentSiblingLevel.childNodes[sourceChildIndex]; if (!(candidateChild instanceof HTMLElement)) { return f0; } candidateChildTagName = candidateChild.tagName; if (sourceChildTagName != candidateChildTagName) { return f0; } else if (observedDistance == O1.W) { return h0; } else {} currentSiblingLevel = candidateChild; observedDistance--; if (observedDistance < O1.W) { config.writeShopicksLog(U2); return f0; } } } function childIndex(elem) { var i = K; while ((elem = elem.previousSibling) != G0) ++i; return i; } } function imgUpDetection(element) { var node = element.parentNode; if (node.nodeName.toLowerCase() == v2 || node.nodeName.toLowerCase() == k2) return; if (node.tagName.toLowerCase() == w2) { if (node.getAttribute(x2) || node.getAttribute(Z2)) return node; } if (node.tagName.toLowerCase() == R2) { var node2 = node.querySelector(w2); if (node2 != G0 && (node2.getAttribute(x2) || node2.getAttribute(Z2))) return node2; if (node.getAttribute(Z2)) return node; } return imgUpDetection(node); } function altDetection(element, itemName) { var parent = find(element, itemName); var price = {}; if (parent) { price = getPrice(parent); } if (!parent || !price.price) { parentElement = getVirtualParent(element); if (parentElement) { price = getPrice(parentElement); } } return { "name": itemName, "price": price.price, "currency": price.currency, "oldPrice": price.oldPrice }; } function removeBrandFromTitle(brand, title) { var C2 = /^-[\s]+/; return title.toLowerCase().replace(brand.toLowerCase(), N0).trim().replace(C2, N0); } function doesTitleValid(title) { var a2 = '&'; var retVal = h0; if (!!title) { var doesTitleInBlackList = titlesBlackList.indexOf(title.toLowerCase()) > -O1.W; if (doesTitleInBlackList) { retVal = f0; } else { if (window.domain && !window.domain.ignoreOneWordTitle) { var trimmedTitle = title.trim(); var doesTitleOneWord = trimmedTitle.indexOf(O0) == -O1.W && trimmedTitle.indexOf(M2) == -O1.W && trimmedTitle.indexOf(C0) == -O1.W && trimmedTitle.indexOf(a2) == -O1.W; if (doesTitleOneWord) { retVal = f0; } else { retVal = h0; } } else { retVal = h0; } } } else { retVal = f0; } return retVal; } function doesNameValid(info) { return info && !!info.name; } function getItemName(element) { var F2 = 'image of'; var B2 = 'Image of'; var s2 = 'Image Of'; var l2 = "alt"; var itemName, info = f0; if (element) { info = findInfoByTitleDiv(element); } if (!doesNameValid(info)) { itemName = element.getAttribute(x2); if (doesTitleValid(itemName)) { info = altDetection(element, itemName); info.detection = l2; } itemName = element.getAttribute(Z2); if (doesTitleValid(itemName)) { info = altDetection(element, itemName); info.detection = g2; } } if (!doesNameValid(info)) { info = findInfoByLI(element); } if (!doesNameValid(info)) { info = findInfoByH1(); } if (doesNameValid(info)) { info.name = info.name.replace(s2, N0); info.name = info.name.replace(B2, N0); info.name = info.name.replace(F2, N0); info.name = info.name.replace(/\n/g, O0).replace(/\r/g, O0).trim(); } return info; } function hasChildElements(element) { if (!element.hasChildNodes()) return f0; var childNodes = element.childNodes; for (var i = K; i < childNodes.length; i++) { if (childNodes[i] instanceof HTMLElement) { return h0; } } return f0; } function getElementsByInnerText(selector, text) { var elements = document.querySelectorAll(selector); var childElements = []; for (var i = K; i < elements.length; i++) { if (!hasChildElements(elements[i])) { childElements.push(elements[i]); } } return [].filter.call(childElements, function(element) { return RegExp(text).test(element.textContent); }); } function isValidAvailabilityMarker(element) { var c6 = 'Element is inside a comment'; var T6 = 'action'; var X6 = 'src'; var v6 = 'Element is inside an invalid marker '; var W6 = 'Element is an invalid marker '; var u6 = "A"; var K6 = "OPTION"; var invalidMarkerTypes = [K6, u6]; var result = h0; for (var i = K; i < invalidMarkerTypes.length; i++) { if (element.tagName == invalidMarkerTypes[i]) { config.writeShopicksLog(W6 + invalidMarkerTypes[i] + O0, element); result = f0; } } if (findClosestByNodeType(invalidMarkerTypes, element)) { config.writeShopicksLog(v6, element); result = f0; } var attributeBlackList = {}; attributeBlackList.attributeKeyBlackList = [k6, X6, T6, D6]; attributeBlackList.attributeValueBlackList = [m2, y6]; if (searchAtParents(element, blackListCommentClasses, G, attributeBlackList)) { config.writeShopicksLog(c6, element); result = f0; } if (getListItemParent(element)) { result = f0; } return result; } function isVisible(element) { var t6 = 'Element is invisible '; var n6 = "absolute"; var H6 = "rect(0px 0px 0px 0px)"; var r6 = 'none'; var result = h0; if (!(element.offsetWidth > K && element.offsetHeight > K && window.getComputedStyle(element).display !== r6)) { result = f0; } else if (window.getComputedStyle(element).clip == H6 && window.getComputedStyle(element).position == n6) { result = f0; } if (!result) { config.writeShopicksLog(t6, element); } return result; } function isRecommendationItem(element) { var G6 = 'checking if element is in recommendation area'; var containerBlackList = [L6, m6, i6, b6, I6, Y6, A6, p6, j6]; var recomendationsContainer = [b6, N6]; var recommendationMarkerList = containerBlackList.concat(recomendationsContainer); config.writeShopicksLog(G6); if (searchAtParents(element, recommendationMarkerList, G)) { return h0; } return f0; } function getImageByAlt(altArr) { var e6 = 'img[alt*="'; var images = []; for (var i = K; i < altArr.length; i++) { images = document.querySelectorAll(e6 + altArr[i] + o6); if (images.length == O1.W && isVisible(images[K])) { break; } } return images; } function getAvailabilityMarkers(element, removeRecommendations, indicatorTexts, blackListKeywords) { var z6 = 'Valid candidates: '; var Q6 = 'All candidates: '; var E6 = 'candidate validated: '; var S6 = 'failing candidate: '; var O6 = 'isRecommendationItem(currentCandidate): '; var q6 = 'currentCandidate: '; var J6 = 'removeRecommendations: '; var f6 = 'Inspecting Out of stock Candidates for removal: '; var h6 = 'Searching for OOS markers in: '; removeRecommendations = f0; config.writeShopicksLog(h6, element); var candidateMarkers = []; var validMarkers = []; for (var i = K; i < indicatorTexts.length; i++) { var candidates = getElementsByText(element, indicatorTexts[i], blackListKeywords); candidateMarkers = candidateMarkers.concat(candidates); } for (i = K; i < candidateMarkers.length; i++) { var currentCandidate = candidateMarkers[i]; config.writeShopicksLog(f6); config.writeShopicksLog(J6, removeRecommendations); config.writeShopicksLog(q6, currentCandidate); config.writeShopicksLog(O6, isRecommendationItem(currentCandidate)); if (!isVisible(currentCandidate) || !isValidAvailabilityMarker(currentCandidate) || removeRecommendations && isRecommendationItem(currentCandidate)) { config.writeShopicksLog(S6 + i); candidateMarkers.splice(i, O1.W); i--; } else { config.writeShopicksLog(E6 + i); validMarkers.push(currentCandidate); } } config.writeShopicksLog(Q6, candidateMarkers); config.writeShopicksLog(z6, validMarkers); return validMarkers; } function getLinkFromElement(anchorElement) { var P6 = 'javascript'; var d6 = 'shopicks_href'; var href = anchorElement.href; if (!href) { href = anchorElement.getAttribute(d6); } if (!!href) { var hrefOnly = href.split(y6)[K]; var extensionIndex = hrefOnly.lastIndexOf(J0); var extension = hrefOnly.substr(extensionIndex + O1.W); if (extensionBlackList[extension] == O1.W || href.indexOf(P6) == K) { return G0; } else { return href; } } } function hasRegularPageAnchor(element) { var Z6 = 'no anchor parent found'; var x6 = '/image/'; var w6 = 'MagicZoomPlus'; var V6 = 'A'; var parentAnchor; if (element.tagName != V6) { parentAnchor = findClosestByNodeType(U6, element); } else { parentAnchor = element; } if (!!parentAnchor) { if (parentAnchor.classList.contains(w6)) { return f0; } var href = getLinkFromElement(parentAnchor); var linkToImage = !!href && href.toLowerCase().indexOf(x6) > -O1.W; return !!href && !linkToImage; } else { config.writeShopicksLog(Z6); return f0; } }; function findInfoByTitleDiv(element) { var k8 = '__'; var v8 = '^'; var u8 = "] "; var B4 = ".view_box_right h2"; var s4 = ".headline h2"; var g4 = ".right h2"; var l4 = "#primary_block h2"; var a4 = ".view_box_right h1"; var M4 = ".headline h1"; var C4 = ".right h1"; var R4 = "#primary_block h1"; var Z4 = "#content h1"; var x4 = "detail"; var w4 = "item"; var U4 = "product"; var V4 = 'h2'; var d4 = "[itemprop=name]"; var z4 = "summary"; var Q4 = "info"; var E4 = "Desc"; var S4 = "Name"; var O4 = "Title"; var q4 = "item^summary"; var J4 = "prod^summary"; var f4 = "product^summary"; var h4 = "item^info"; var o4 = "prod^info"; var e4 = "product^info"; var G4 = "desc"; var N4 = "description"; var j4 = "name"; var p4 = "item^title"; var A4 = "item^name"; var Y4 = "prod^title"; var I4 = "prod^name"; var b4 = "product^title"; var i4 = "product^name"; var m4 = "related"; var L4 = "[class*=slug]"; var t4 = "[class*=brand]"; var n4 = "[class*=designer]"; var r4 = "flash_title"; var c4 = "thumb"; var y4 = "rate"; var D4 = "price"; var T4 = "image"; var X4 = "common-carousels-step-title"; var k4 = "designer"; var v4 = "color"; var W4 = "links-title"; var u4 = "share_title"; var K4 = "crossselltitle"; var F6 = "shadename"; var B6 = "code"; var s6 = "right"; var g6 = "left"; var a6 = "sub"; var M6 = "short-description"; var C6 = "widget-title"; var R6 = "sku"; var N = 999; var blackList = [R6, C6, M6, a6, l6, g6, s6, B6, F6, K4, u4, W4, v4, k4, X4, T4, w2, B, D4, y4, c4, b6, r4]; var blackListOfElementsIndideTitleNode = [H4, n4, t4, L4]; var containerBlackList = [L6, m6, i6, b6, I6, Y6, A6, m4, p6, j6]; var keyList = [i4, b4, I4, Y4, A4, p4, g2, j4, N4, G4, e4, o4, h4, f4, J4, q4]; var regularPageTitleKeyWords = [g2, j4, G4, O4, S4, E4, Q4, z4]; var generalTitleForRegularPageKeyList = [d4]; var mainTitleTags = [P4, V4]; var generalDPageSelectors = [j4, g2, S4, O4, U4, w4, N4, x4]; var generalTitleKeyList = [d4, Z4, R4, C4, M4, a4, l4, g4, s4, B4]; var recomendationsContainer = [b6, N6]; var xpath, xpathArr, titleNode, price = {}, title, distance = N; xpathArr = []; if (window.dPage && searchAtParents(element, recomendationsContainer, G) == G0) { for (var j = K; j < mainTitleTags.length; j++) { var tag = mainTitleTags[j]; for (var i = K; i < generalDPageSelectors.length; i++) { xpath = generalDPageSelectors[i]; xpathArr.push(tag + F4 + xpath + K8); xpathArr.push(F4 + xpath + u8 + tag); xpathArr.push(tag + W8 + xpath + K8); xpathArr.push(W8 + xpath + u8 + tag); } } titleNode = findNearestElementByArrayOfExPathWithCounter(document.body, xpathArr, distance, blackList, containerBlackList, f0); if (!titleNode) { xpathArr = []; for (var i = K; i < generalTitleKeyList.length; i++) { xpath = generalTitleKeyList[i]; xpathArr.push(xpath); } titleNode = findNearestElementByArrayOfExPathWithCounter(element, xpathArr, distance, blackList, containerBlackList, f0); } } if (!titleNode) { xpathArr = []; var generatedKeyList = []; for (var i = K; i < keyList.length; i++) { var key = keyList[i]; var splitedKey = key.split(v8); if (splitedKey.length == v) { var firstWord = splitedKey[K].toLowerCase(); var secondWord = splitedKey[O1.W].toLowerCase(); var firstWordTitleCase = toTitleCase(firstWord); var secondWordTitleCase = toTitleCase(secondWord); generatedKeyList.push(firstWord + secondWordTitleCase); generatedKeyList.push(firstWord + secondWord); generatedKeyList.push(firstWord + C0 + secondWord); generatedKeyList.push(firstWord + M2 + secondWord); generatedKeyList.push(firstWord + k8 + secondWord); generatedKeyList.push(firstWordTitleCase + secondWordTitleCase); generatedKeyList.push(firstWordTitleCase + secondWord); generatedKeyList.push(firstWordTitleCase + C0 + secondWord); generatedKeyList.push(firstWordTitleCase + M2 + secondWord); generatedKeyList.push(firstWordTitleCase + k8 + secondWord); generatedKeyList.push(firstWord.toUpperCase() + secondWord.toUpperCase()); generatedKeyList.push(firstWordTitleCase.toUpperCase() + C0 + secondWord.toUpperCase()); generatedKeyList.push(firstWordTitleCase.toUpperCase() + M2 + secondWord.toUpperCase()); generatedKeyList.push(firstWordTitleCase.toUpperCase() + k8 + secondWord.toUpperCase()); } else { generatedKeyList.push(splitedKey[K].toLowerCase()); generatedKeyList.push(toTitleCase(splitedKey[K].toLowerCase())); generatedKeyList.push(splitedKey[K].toUpperCase()); } } for (var i = K; i < generatedKeyList.length; i++) { xpath = J0 + generatedKeyList[i]; xpathArr.push(xpath); xpath = S0 + generatedKeyList[i]; xpathArr.push(xpath); } for (var i = K; i < generalTitleForRegularPageKeyList.length; i++) { xpath = generalTitleForRegularPageKeyList[i]; xpathArr.push(xpath); } for (var i = K; i < regularPageTitleKeyWords.length; i++) { xpath = W8 + regularPageTitleKeyWords[i] + K8; xpathArr.push(xpath); } for (var i = K; i < regularPageTitleKeyWords.length; i++) { xpath = F4 + regularPageTitleKeyWords[i] + K8; xpathArr.push(xpath); } titleNode = findNearestElementByArrayOfExPathWithCounter(element, xpathArr, distance, blackList, G0, h0); } if (titleNode) { title = titleNode.innerText; if (!!title) { for (var i = K; i < blackListOfElementsIndideTitleNode.length; i++) { var elemToRemoveFromTitle = titleNode.querySelector(blackListOfElementsIndideTitleNode[i]); if (elemToRemoveFromTitle != G0) { title = title.replace(elemToRemoveFromTitle.innerText, N0); title = title.trim(); } } var virtualParent = getVirtualParent(titleNode, window.dPage ? containerBlackList : G0); price = getPrice(virtualParent, G0, G0); return { "name": title, "price": price.price, "currency": price.currency, "oldPrice": price.oldPrice }; } } return; } function removeDuplicates(arr) { var i, j, cur, found; for (i = arr.length - O1.W; i >= K; i--) { cur = arr[i]; found = f0; for (j = i - O1.W; !found && j >= K; j--) { if (cur === arr[j]) { if (i !== j) { arr.splice(i, O1.W); } found = h0; } } } return arr; } function removeChildernsByClass(element, xpath) { var priceElem = element.querySelector(xpath); var counter = I; while (priceElem != G0 && counter > K) { try { priceElem.parentNode.removeChild(priceElem); } catch (ex) {} priceElem = element.querySelector(xpath); counter--; } } function findInfoByLI(element) { var r8 = "[class*=Sale]"; var c8 = "[class*=sale]"; var y8 = "[class*=Off]"; var D8 = "[class*=off]"; var T8 = "[class*=Price]"; var X8 = "[class*=rice]"; var res = findNearestLi(element); if (res) { var li = res.cloneNode(h0); price = getPrice(li); var priceElem = li.querySelector(X8); var counter = I; while (priceElem != G0 && counter > K) { try { priceElem.parentNode.removeChild(priceElem); } catch (ex) {} priceElem = li.querySelector(X8); counter--; } removeChildernsByClass(li, H4); removeChildernsByClass(li, T8); removeChildernsByClass(li, D8); removeChildernsByClass(li, y8); removeChildernsByClass(li, c8); removeChildernsByClass(li, r8); title = li.innerText; if (!!price) { title = title.trim().replace(price, N0); } if (!!title) { return { "name": title, "price": price.price, "currency": price.currency, "oldPrice": price.oldPrice }; } } return G0; } function getProductId(element) { var R8 = "scroll"; var Z8 = "sku_info"; var x8 = "item_num"; var w8 = "itemNum"; var U8 = "item-num"; var V8 = "prod_num"; var P8 = "prod-num"; var d8 = "prodNum"; var z8 = 'ref'; var Q8 = 'productKey'; var E8 = 'product_key'; var S8 = 'productkey'; var O8 = 'code'; var q8 = "Sku"; var J8 = 'sku'; var f8 = "Product #"; var e8 = "product key"; var H8 = "data-product-id"; if (!element) return; var attrKeyList = [H8]; var textKeyList = [n8, t8, L8, m8, i8, b8, I8, Y8, A8, p8, j8, N8, G8, e8, o8, h8, f8]; var keyList = [J8, q8, O8, S8, E8, Q8, z8, d8, P8, V8, U8, w8, x8]; var blackList = [Z8, R8, l6]; var pid, xpath, xpathArr = [], distance = o, pidNode; for (var i = K; i < textKeyList.length; i++) { if (document.getElementsByTagName(v2)[K].innerText.toLowerCase().indexOf(textKeyList[i]) > -O1.W) { pid = findNearestString(textKeyList[i], element).replace(textKeyList[i], T2); break; } } if (!pid || !containsNumbersRegx.test(pid)) { for (var i = K; i < attrKeyList.length; i++) { if (pid = findNearestAttribute(element, attrKeyList[i])) break; } } if (!pid || !containsNumbersRegx.test(pid)) { for (var i = K; i < keyList.length; i++) { xpath = W8 + keyList[i] + K8; xpathArr.push(xpath); } for (var i = K; i < keyList.length; i++) { xpath = F4 + keyList[i] + K8; xpathArr.push(xpath); } pidNode = findNearestElementByArrayOfExPathWithCounter(element, xpathArr, distance, blackList); if (pidNode) { pid = pidNode.textContent; pid = !!pid && containsNumbersRegx.test(pid) ? pid : N0; } } if (typeof pid != M0) { return pid; } else { return pid.trim(); } } function findNearestAttribute(element, attr) { if (element.nodeName.toLowerCase() == v2 || element.nodeName.toLowerCase() == k2) return; var node; if (node = element.querySelector(C8 + attr + K8)) { return node.getAttribute(attr); } else return findNearestAttribute(element.parentNode, attr); } function findNearestString(text, element) { var M8 = "[:\\s#]*[^\\s\\n]+"; var regexp = new RegExp(text + M8, Z0); var node = element; var nodeText = node.innerText; if (nodeText.toLowerCase().indexOf(text) > -O1.W) { if (pid = regexp.exec(nodeText)) return pid[K].trim().replace(text, N0); } else { if (node.nodeName.toLowerCase() == v2 || node.nodeName.toLowerCase() == k2) return; return findNearestString(text, node.parentNode); } } function findByTitleClass(element, className) { if (!className) return; var titleNode = findElementByClass(element, className); var price = {}; if (titleNode) { price = getPrice(titleNode.parentNode); title = titleNode.innerText; return { "name": title, "price": price.price, "currency": price.currency, "oldPrice": price.oldPrice }; } return; } function getText(node) { var text = node.innerText; if (text == E0) text = node.textContent; return text; } function findNearestElement(element, xpath, originalElement) { if (!originalElement) { originalElement = element; } if (!xpath || !element) return; var node = element, resultElm; if (resultElm = node.querySelector(xpath)) { if (window.domain && !!window.domain.itemsWithRowsImageContainer && !!window.domain.itemsWithRowsDescriptionContainer) { try { if (node.querySelectorAll(xpath).length > K) { var imageRow = document.querySelectorAll(window.domain.itemsWithRowsImageContainer); var descriptionRow = document.querySelectorAll(window.domain.itemsWithRowsDescriptionContainer); var index = -O1.W; var rowIndex = -O1.W; var result; if (imageRow.length > K) { for (var i = K; i < imageRow.length; i++) { if (imageRow[i].contains(originalElement)) { rowIndex = i; break; } } } if (rowIndex > -O1.W) { for (var i = K; i < imageRow[rowIndex].children.length; i++) { if (imageRow[rowIndex].children[i].contains(originalElement)) { index = i; result = descriptionRow[rowIndex].children[index]; break; } } } if (result) { return result; } else { return resultElm; } } else { return resultElm; } } catch (ex) { var l8 = "find nearest element"; config.writeShopicksLog(l8, ex, h0); } } else { return resultElm; } } if (node.nodeName.toLowerCase() == v2 || node.nodeName.toLowerCase() == k2) return; node = element.parentNode; return findNearestElement(node, xpath, originalElement); } function findNearestImgWithTitle(element) { var xpath = g8; var node = element, resultElm; resultElm = node.querySelector(xpath); if (resultElm != G0) { if (!!resultElm.title || !!resultElm.alt) { return resultElm; } } if (node.nodeName.toLowerCase() == v2 || node.nodeName.toLowerCase() == k2) return; node = element.parentNode; return findNearestImgWithTitle(node); } function findNearestLi(element) { var s8 = "li"; var xpath = q2; var node = element, resultElm; if (node.nodeName.toLowerCase() == s8) return node; if (node.nodeName.toLowerCase() == v2 || node.nodeName.toLowerCase() == k2) return; node = element.parentNode; return findNearestLi(node); } function findNearestElementWithCounter(element, xpath) { if (!xpath) return; counter++; var node = element, resultElm; if (resultElm = node.querySelector(xpath)) return resultElm; if (node.nodeName.toLowerCase() == v2 || node.nodeName.toLowerCase() == k2) return; node = element.parentNode; return findNearestElementWithCounter(node, xpath); } function inBlackList(foundElem, node, blackList, containerBlackList) { if (containerBlackList) { var parentElem = searchAtParents(foundElem, containerBlackList, G); if (parentElem != G0) { if (doesElemIsChildOfElem(parentElem, node)) { return h0; } } } if (blackList) { for (var j = K; j < foundElem.classList.length; j++) { for (var m = K; m < blackList.length; m++) { if (foundElem.classList[j].toLowerCase().indexOf(blackList[m]) > -O1.W) { return h0; } } } } return f0; } function findNearestElementByArrayOfExPathWithCounter(element, xpathArr, counter, blackList, containerBlackList, shouldStopOnListSelector) { var X3 = '_list'; var k3 = 'ol'; var v3 = 'dl'; var W3 = 'ul'; var u3 = 'products'; var K3 = 'Products'; var F8 = 'page'; var B8 = 'Page'; counter--; if (!xpathArr) { return; } if (counter <= K) { return; } var node = element, resultElm; for (var i = K; i < xpathArr.length; i++) { xpath = xpathArr[i]; var foundElem = G0; var foundElems = node.querySelectorAll(xpath); for (var m = K; m < foundElems.length; m++) { if (foundElems[m] != G0 && isVisible(foundElems[m]) && !inBlackList(foundElems[m], node, blackList, containerBlackList)) { foundElem = foundElems[m]; break; } } if (foundElem != G0) { if (foundElem.querySelector(P4) != G0) { return foundElem.querySelector(P4); } else { return foundElem; } } } if (node.nodeName.toLowerCase() == v2 || node.nodeName.toLowerCase() == k2 || node.classList.contains(B8) || node.classList.contains(F8) || node.classList.contains(K3) || node.classList.contains(u3) || shouldStopOnListSelector && (node.nodeName.toLowerCase() == W3 || node.nodeName.toLowerCase() == v3 || node.nodeName.toLowerCase() == k3) || !!node.id && typeof node.id == B0 && node.id.toLowerCase().indexOf(X3) > -O1.W) { return; } node = element.parentNode; return findNearestElementByArrayOfExPathWithCounter(node, xpathArr, counter, blackList, containerBlackList, shouldStopOnListSelector); } function findNearestElementInBoundary(element, xpath, boundary) { if (!xpath) return; if (element.querySelector(boundary)) return; var node = element, resultElm; if (resultElm = node.querySelector(xpath)) return resultElm; if (node.nodeName.toLowerCase() == v2 || node.nodeName.toLowerCase() == k2) return; node = element.parentNode; return findNearestElementInBoundary(node, xpath); } function findElementByClass(element, className) { if (!className) return; var xpath = J0 + className; return findNearestElement(element, xpath); } function isElementInBoundary(element, xpath) { var boundary = document.querySelector(xpath); if (!boundary) return f0; if (!boundary.contains(element)) return f0; return h0; } function type100(element, domainInfo) { var c3 = "Product Code: "; var y3 = '[class="'; var D3 = "']"; var T3 = "*='"; var info; if (!domainInfo || !domainInfo.attr || !domainInfo.el) return G0; var productId = element[domainInfo.attr]; if (domainInfo.rDelimiter && domainInfo.lDelimiter) productId = productId.split(domainInfo.lDelimiter)[O1.W].split(domainInfo.rDelimiter)[K]; var node; if (domainInfo.elId) { var els = document.querySelectorAll(C8 + domainInfo.el + T3 + productId + D3); for (var i = K; i < els.length; i++) { if (els[i].querySelector(domainInfo.elId)) { node = els[i]; break; } } } else { node = document.querySelector(C8 + domainInfo.el + T3 + productId + D3); } if (domainInfo.tl) info = findByTitleClass(node, domainInfo.tl); else info = getItemName(node); if (domainInfo.b) { var brand = node.querySelector(y3 + domainInfo.b + o6); if (domainInfo.rbft && domainInfo.rbft == O1.W && brand && info) info.name = removeBrandFromTitle(getText(brand), info.name); info.brand = getText(brand); } if (productId) info.storeItemID = c3 + productId; return info; } function type1(element) { var info; if (element == G0) return G0; if (element.tagName.toLowerCase() != w2) { if (element.querySelector(w2) != G0) { element = element.querySelector(w2); } } info = getItemName(element); if (!info) { element = imgUpDetection(element); if (element) { info = getItemName(element); } } return info; } function type0(element, domainInfo, last) { var r3 = 'true'; if (!domainInfo) return G0; var info, titleNode, priceNode, price = {}, brand, pid; if (domainInfo.rmvElmIfSlcExsSlc) { if (document.querySelector(domainInfo.rmvElmIfSlcExsSlc) != G0) { jQuery(domainInfo.rmvElmIfExs).remove(); } } if (domainInfo.be) { if (!isElementInBoundary(element, domainInfo.be)) return G0; } if (domainInfo.ep) { if (domainInfo.epbe) { if (!findNearestElementInBoundary(element, domainInfo.ep, domainInfo.epbe)) return G0; } else if (!classExists(domainInfo.ep)) return G0; } if (domainInfo.tlc) { titleNode = findElementByClass(element, domainInfo.tlc); } else if (domainInfo.tls) { titleNode = findNearestElement(element, domainInfo.tls); } else if (domainInfo.tlfs) { titleNode = document.querySelector(domainInfo.tlfs); } else if (domainInfo.tlAtr && domainInfo.tlAtrs) { var elem = findNearestElement(element, domainInfo.tlAtrs); if (elem) { var title = elem.getAttribute(domainInfo.tlAtr); if (!!title) { info = { "name": title }; titleNode = elem; } } } if (domainInfo.pc) { priceNode = findElementByClass(element, domainInfo.pc); } else if (domainInfo.ps) { priceNode = findNearestElement(element, domainInfo.ps); if (!priceNode && domainInfo.ps2) { priceNode = findNearestElement(element, domainInfo.ps2); } } else if (domainInfo.pfs) { priceNode = document.querySelector(domainInfo.pfs); } if (priceNode) { if (domainInfo.pcur) { var t = document.createElement(priceNode.tagName); t.innerHTML = domainInfo.pcurPOR && domainInfo.pcurPOR == r3 ? priceNode.innerHTML + domainInfo.pcur : domainInfo.pcur + priceNode.innerHTML; price = getPrice(t, domainInfo.piel, domainInfo.pi); } else price = getPrice(priceNode, domainInfo.piel, domainInfo.pi); } else if (titleNode) { price = getPrice(getVirtualParent(titleNode), domainInfo.piel, domainInfo.pi); if (!price || price && price.price == E0) price = getPrice(getVirtualParent(element), domainInfo.piel, domainInfo.pi); } if (titleNode && (!domainInfo.tlAtr && !domainInfo.tlAtrs)) { var tl = getText(titleNode); tl = tl.trim(); info = { "name": tl }; } if (!!price.price) { if (!info) { info = {}; } if (!info.name) { info = type1(element); } if (!info) {} if (info) { info.price = price.price; info.currency = price.currency; info.oldPrice = price.oldPrice; if (domainInfo.rpft) { info.name = info.name.replace(price.price, N0).replace(new RegExp(curReg, q), N0).trim(); if (!!price.oldPrice) { info.name = info.name.replace(price.oldPrice, N0).replace(new RegExp(curReg, q), N0).trim(); } } } } if (!info && last) { info = type1(element); } if (domainInfo.rtft && !!info.name) { info.name = info.name.replace(domainInfo.rtft, N0); } if (domainInfo.tiel && !!info.name) { var tiel = document.querySelector(domainInfo.tiel); if (tiel != G0) { var rText = tiel.textContent; if (!!rText) { info.name = info.name.replace(rText.trim(), N0); info.name = info.name.replace(rText.toLowerCase().trim(), N0); info.name = info.name.replace(rText.toUpperCase().trim(), N0); info.name = info.name.trim(); } } } if (info && (domainInfo.bc || domainInfo.bs || domainInfo.bfs)) { if (brand = b0(element, domainInfo)) { info.brand = brand; if (domainInfo.rbft && domainInfo.rbft == O1.W) info.name = removeBrandFromTitle(brand, info.name); } } if (info && (domainInfo.pidc || domainInfo.pids || domainInfo.pidfs || domainInfo.pidtxt)) { if (pid = pid0(element, domainInfo)) info.storeItemID = pid; } return info; } function b0(element, domainInfo) { if (!domainInfo) return G0; var brand, brandNode; if (domainInfo.bc) { brandNode = findElementByClass(element, domainInfo.bc); } else if (domainInfo.bs) { brandNode = findNearestElement(element, domainInfo.bs); } else if (domainInfo.bfs) { brandNode = document.querySelector(domainInfo.bfs); } if (brandNode) { brand = getText(brandNode); if (!brand) { if (brandNode.tagName == H3) { brand = brandNode.alt; } } } return brand; } function pid0(element, domainInfo) { try { if (!domainInfo) return G0; var pid, pidNode, txt; if (domainInfo.pidc) { pidNode = findElementByClass(element, domainInfo.pidc); } else if (domainInfo.pids) { pidNode = findNearestElement(element, domainInfo.pids); } else if (domainInfo.pidfs) { pidNode = document.querySelector(domainInfo.pidfs); } if (pidNode && (txt = getText(pidNode))) { if (domainInfo.pidl && txt.indexOf(domainInfo.pidl) > -O1.W) txt = txt.substr(txt.indexOf(domainInfo.pidl) + domainInfo.pidl.length, txt.length); if (domainInfo.pidr && txt.indexOf(domainInfo.pidr) > -O1.W) txt = txt.substr(K, txt.indexOf(domainInfo.pidr)); pid = txt.trim(); } else if (domainInfo.pidtxt) pid = findNearestString(domainInfo.pidtxt.toLowerCase(), element); else if (domainInfo.pidattr) pid = findNearestAttribute(element, domainInfo.pidattr); return cleanProdID(pid); } catch (ex) { return G0; } } function cleanProdID(i_pidText) { var L3 = "product key:"; var t3 = "Style:"; var n3 = "Product Sku:"; var output = i_pidText; var textKeyList = [n8, t8, n3, L8, t3, m8, i8, b8, I8, Y8, A8, p8, j8, N8, G8, L3, o8, h8]; for (var i = K; i < textKeyList.length; i++) { output = output.replace(textKeyList[i], T2); output = output.replace(textKeyList[i].toUpperCase(), T2); } return output.trim(); } function getProdUrl(element, domainInfo) { var H = 7; if (!element) return G0; if (domainInfo.be) { if (!isElementInBoundary(element, domainInfo.be)) return G0; } if (domainInfo.eid) { if (classExists(domainInfo.eid)) return G0; } var purl; if (domainInfo.purls) { if (purl = findNearestElement(element, domainInfo.purls)) return purl; } if (domainInfo.purll) { if (purl = getHref(element, domainInfo.purll)) return purl; } if (domainInfo.clk) { if (purl = getHref(element, H)) return purl; } } function overloadElement(domainInfo) { if (!domainInfo) return G0; var newElement; if (domainInfo.fnum && domainInfo.oes && window.frames[domainInfo.fnum]) { if (newElement = window.frames[domainInfo.fnum].document.querySelector(domainInfo.oes)) return type0(newElement, domainInfo); } if (domainInfo.oes) { for (var i = K; i < window.frames.length; i++) { newElement = window.frames[i].document.querySelector(domainInfo.oes); if (newElement) { return type0(newElement, domainInfo); } } } } function getHref(element, level) { var A3 = "'"; var i3 = 'onclick'; var m3 = "javascript|\\.jpg|\\.png|\\.jpeg|\\.gif|image"; var regex = new RegExp(m3, Z0); if (!element) return G0; if (element.nodeName.toLowerCase() == v2) return; if (level <= K) return; var href, a, l = level - O1.W, flag = O1.W; if (element.tagName.toLowerCase() == U6) { a = [element]; } else { a = element.querySelectorAll(R2); } if (a && a.length > K) { for (var i = K; i < a.length; i++) { if (!!a) { var href = getLinkFromElement(a[i]); if (!!href) { return href; } } try { if (window.domain.purl && window.domain.purl[K].clk && window.domain.purl[K].clkID && document.querySelector(window.domain.purl[K].clkID) != G0) { var onClickWithHref = a[i].getAttribute(i3).replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, function($0) { var Y3 = "</a>"; var I3 = "' target='_blank'>"; var b3 = "<a href='"; return b3 + $0 + I3 + $0 + Y3; }); if (!!onClickWithHref && onClickWithHref.indexOf(k6) > -O1.W) { var start = onClickWithHref.substring(onClickWithHref.indexOf(k6) + y); start = start.substring(K, start.indexOf(A3)); if (!!start && !regex.test(start.toString())) { return start; } } } } catch (ex) {} } } return getHref(element.parentNode, l); } function classExists(className) { if (document.querySelector(J0 + className)) return h0; if (document.querySelector(S0 + className)) return h0; return f0; } function callFn(type, element, domainInfo) { var A = 100; var D = 5; type = parseInt(type); switch (type) { case O1.W: return type1(element); break; case A: return type100(element, domainInfo); break; case D: var info = overloadElement(domainInfo); if (info) return info; return type0(element, domainInfo); break; default: return type0(element, domainInfo); break; } } function findInfoByH1() { var p3 = "H1"; var text, nodes, node, name, price; var info = G0; if (nodes = document.querySelectorAll(p3)) { for (var i = K; i < nodes.length; i++) { node = nodes[i]; if (text = getText(node)) break; } price = getPrice(getVirtualParent(node)); if (price && text) { name = text.replace(price.price, N0).replace(new RegExp(curReg, q), N0).trim(); info = { "name": name, "price": price.price, "currency": price.currency, "oldPrice": price.oldPrice }; } } return info; } function getColorByRules() { var selector = document.querySelector(window.domain.d.colorS); var imgElement = selector.tagName == H3 || selector.querySelector(g8) != G0; var inputElement = selector.tagName == j3 || selector.querySelector(N3) != G0; var color = N0; if (imgElement) { if (!!imgElement.alt) { color = imgElement.alt; } else if (!!imgElement.title) { color = imgElement.title; } } else if (inputElement) { if (!!inputElement.alt) { color = inputElement.alt; } } else { color = selector.textContent; } return color; } function getColorByText(element) { var V3 = 'field-color'; var P3 = 'electedColorName'; var d3 = 'swatchLabel'; var z3 = 'electedColorDisplay'; var Q3 = 'default-patterns-label'; var E3 = 'color_title'; var S3 = 'colorTitle'; var O3 = 'color-title'; var q3 = 'productColor'; var J3 = 'product_color'; var f3 = 'product-color'; var h3 = 'color-name'; var o3 = 'color_name'; var e3 = 'colorName'; var G3 = 'product-selected-color'; var keyList = [G3, e3, o3, h3, f3, J3, q3, O3, S3, E3, Q3, z3, d3, P3, V3]; var xpath, colorsNode, xpathArr = [], distance = o; var color; for (var i = K; i < keyList.length; i++) { xpath = W8 + keyList[i] + K8; xpathArr.push(xpath); } for (var i = K; i < keyList.length; i++) { xpath = F4 + keyList[i] + K8; xpathArr.push(xpath); } colorsNode = findNearestElementByArrayOfExPathWithCounter(element, xpathArr, distance); if (colorsNode) { color = colorsNode.textContent; } return color; } function getColorByImage(element) { var W9 = 'data-color-name'; var u9 = 'selected'; var K9 = 'active'; var F3 = 'current'; var B3 = 'swatchWrap'; var s3 = 'colors'; var g3 = 'color_options'; var l3 = 'colorOptions'; var a3 = 'color-options'; var M3 = 'swatch_list'; var C3 = 'swatchList'; var R3 = 'swatch-list'; var Z3 = 'swatches'; var x3 = 'colorCode'; var w3 = 'swatchContent'; var U3 = 'pColor'; var color = N0; var keyList = [U3, w3, x3, Z3, R3, C3, M3, a3, l3, g3, s3, B3]; var selectedColorKeyList = [F3, K9, u9]; var xpath, colorsNode, selectedColor, xpathArr = [], distance = o; for (var i = K; i < keyList.length; i++) { xpath = W8 + keyList[i] + K8; xpathArr.push(xpath); } for (var i = K; i < keyList.length; i++) { xpath = F4 + keyList[i] + K8; xpathArr.push(xpath); } colorsNode = findNearestElementByArrayOfExPathWithCounter(element, xpathArr, distance); if (colorsNode) { for (var i = K; i < selectedColorKeyList.length; i++) { xpath = W8 + selectedColorKeyList[i] + K8; if (selectedColor = colorsNode.querySelector(xpath)) { break; } } if (selectedColor) { var image = selectedColor.tagName == H3 ? selectedColor : selectedColor.querySelector(g8); if (image) { if (!!image.alt) { color = image.alt; } else if (!!image.title) { color = image.title; } else if (image.getAttribute(W9) != G0) { color = image.getAttribute(W9); } } if (!color) { var input = selectedColor.tagName == j3 ? selectedColor : selectedColor.querySelector(N3); if (input) { if (!!input.alt) { color = input.alt; } else if (input.getAttribute(W9) != G0) { color = input.getAttribute(W9); } } } if (!color) { var text = selectedColor.textContent; if (!!text) { color = text; } } } } return color; } function setColor(info, element) { var y9 = 'select'; var D9 = 'select :'; var T9 = 'color'; var X9 = 'color:'; var k9 = 'colour'; var v9 = 'colour:'; var color = N0; if (window.dPage && window.domain && window.domain.d && window.domain.d.colorS && document.querySelector(window.domain.d.colorS) != G0) { color = getColorByRules(); } if (!color && window.dPage) { color = getColorByText(element); } if (!color) { color = getColorByImage(element); } if (!!color) { color = color.toLowerCase(); color = color.replace(v9, N0); color = color.replace(k9, N0); color = color.replace(X9, N0); color = color.replace(T9, N0); color = color.replace(D9, N0); color = color.replace(y9, N0); color = color.trim(); info.color = color; } } function replaceAll(find, replace, str) { var c9 = 'g'; return str.replace(new RegExp(find, c9), replace); } function filterCategories(categories, info) { var j9 = ' by '; var p9 = '.com'; var A9 = '‹'; var Y9 = '\\'; var I9 = 'results'; var b9 = 'dress '; var i9 = 'new'; var m9 = 'shop now'; var L9 = 'shop all'; var t9 = 'new arrivals'; var n9 = 'return'; var H9 = 'back'; var r9 = 'home'; var Y = 40; var firstWordBlackList = [r9]; var blackList = [H9, n9, t9, L9, m9, i9]; var partOfNameBlackList = [b9, I9, Y9, A9, p9, j9]; if (window.domain && categories[K].toLowerCase() == window.domain.sn.toLowerCase()) { categories.splice(K, O1.W); } else { for (var i = K; i < firstWordBlackList.length; i++) { var word = firstWordBlackList[i]; if (categories[K].toLocaleLowerCase() == word) { categories.splice(K, O1.W); i--; break; } } } var lastIndex = categories.length - O1.W; if (categories.length > K) { if (categories[lastIndex].split(O0).length > X) { categories.splice(lastIndex, O1.W); } } if (categories.length > K) { if (categories[K].split(O0).length > X) { categories.splice(K, O1.W); } } for (var i = K; i < blackList.length; i++) { var word = blackList[i]; for (var j = K; j < categories.length; j++) { if (categories[j].toLocaleLowerCase() == word) { categories.splice(j, O1.W); break; } } } for (var i = K; i < partOfNameBlackList.length; i++) { var word = partOfNameBlackList[i]; for (var j = K; j < categories.length; j++) { if (categories[j].toLocaleLowerCase().indexOf(word) > -O1.W) { categories.splice(j, O1.W); break; } } } if (info && !!info.title) { for (var j = K; j < categories.length; j++) { if (categories[j].toLocaleLowerCase().indexOf(info.title) > -O1.W) { categories.splice(j, O1.W); break; } } } for (var j = K; j < categories.length; j++) { if (categories[j].length > Y) { categories.splice(j, O1.W); break; } } } function setAvailable(info, element) { var B9 = 'Item Available'; var s9 = 'NE'; var g9 = 'Item Not Available'; var l9 = 'OOS'; var a9 = 'Item Out Of Stock'; var M9 = 'at store'; var C9 = 'at this store'; var R9 = 'for pickup'; var Z9 = 'currently not available'; var x9 = 'longer available'; var w9 = 'currently unavailable'; var U9 = 'product isn\'t available'; var V9 = 'product not available'; var P9 = 'product unavailable'; var d9 = 'this product isn\'t available'; var z9 = 'item not available'; var Q9 = 'item unavailable'; var E9 = 'this item isn\'t available'; var S9 = 'Out Of Stock'; var O9 = 'out of stock'; var q9 = 'sale is closed'; var J9 = 'they sold out'; var f9 = 'sold out in your'; var h9 = 'Sold Out'; var o9 = 'sold out'; var e9 = 'out of this item'; var G9 = 'Cannot set availability - element cannot be defined'; var N9 = 'setting availability'; config.writeShopicksLog(N9); var available = h0; var isListItem = G0; var testElement; if (window.dPage) { isListItem = f0; testElement = document.body; } else { return; } if (testElement == undefined) { config.writeShopicksLog(G9); return f0; } var outOfStockIndicators = [e9, o9, h9, f9, J9, q9, O9, S9]; var unavailableIndicators = [E9, Q9, z9, d9, P9, V9, U9, w9, x9, Z9]; var unavailableBlackListKeywords = [R9, C9, M9]; if (getImageByAlt(outOfStockIndicators).length == O1.W || getAvailabilityMarkers(testElement, !isListItem, outOfStockIndicators, G0).length > K) { config.writeShopicksLog(a9); info.status = l9; info.price = N0; info.oldPrice = N0; available = f0; } else if (getAvailabilityMarkers(testElement, !isListItem, unavailableIndicators, unavailableBlackListKeywords).length > K) { config.writeShopicksLog(g9); info.status = s9; available = f0; } else { config.writeShopicksLog(B9); } } function setCategories(info, element) { var m1 = 'categories'; var L1 = '\t'; var n1 = '\n'; var H1 = '\r'; var r1 = '>'; var c1 = '»'; var y1 = '⁄'; var D1 = '›'; var T1 = "[class*='bread']"; var X1 = '.path'; var k1 = "[class*='brumblnk']"; var v1 = "[id *= 'brumb']"; var W1 = ".goods_top"; var u1 = "[class*='crumb']"; var K1 = "[id*='crumbs']"; var F9 = "[class*='crumbs']"; var containerArr = [F9, K1, u1, W1, v1, k1, X1, T1]; var splitChars = [D1, m2, y1, c1, r1, H1, n1, L1, P0]; var categories = []; var container = G0; if (window.domain && !!window.domain.breadcrumbSelector) { container = document.querySelector(window.domain.breadcrumbSelector); } else { for (var i = K; i < containerArr.length; i++) { container = document.querySelector(containerArr[i]); if (container != G0) { break; } } } if (container != G0) { var searchByText = h0; var elements = []; if (window.domain && !!window.domain.breadcrumbInnerSelector) { elements = container.querySelectorAll(window.domain.breadcrumbInnerSelector); } if (elements.length == K) { elements = container.querySelectorAll(q2); if (elements.length == K) { elements = container.querySelectorAll(U6); if (elements.length == K) { searchByText = h0; } else { searchByText = f0; for (var i = K; i < elements.length; i++) { var elem = elements[i]; if (typeof elem.innerText != N2) { categories.push(elem.innerText); } } } } else { searchByText = f0; for (var i = K; i < elements.length; i++) { var elem = elements[i]; if (typeof elem.innerText != N2) { categories.push(elem.innerText); } } } } else { searchByText = f0; for (var i = K; i < elements.length; i++) { var elem = elements[i]; if (typeof elem.innerText != N2) { categories.push(elem.innerText); } } } if (searchByText) { for (var i = K; i < splitChars.length; i++) { if (typeof container.innerText != N2) { categories = container.innerText.split(splitChars[i]); } if (categories.length > O1.W) { break; } } } if (categories.length > K) { for (var i = K; i < categories.length; i++) { for (var j = K; j < splitChars.length; j++) { categories[i] = replaceAll(splitChars[j], N0, categories[i]); } categories[i] = categories[i].trim(); categories[i] = toTitleCase(categories[i]); } removeDuplicates(categories); filterCategories(categories, info); } } info.categories = categories; if (categories) { config.writeShopicksLog(m1, categories); } } function setProductId(info, element) { if (info && !info.storeItemID && (!window.domain || !window.domain.pidi)) { var pid; if (window.domain && (window.domain.pidtxt || window.domain.pidc || window.domain.pids)) { if (window.domain.be) { if (isElementInBoundary(element, window.domain.be)) pid = pid0(element, window.domain); } else pid = pid0(element, window.domain); } else { pid = getProductId(element); } if (pid) { info.storeItemID = pid; } else { info.storeItemID = N0; } } } function setPageUrl(info, element, dpage, detailsPageUrl) { var L = 12; var purl; if (!!detailsPageUrl) { info.prodUrl = detailsPageUrl; } else if (!dpage && window.domain && window.domain.purl) { for (var i = K; i < window.domain.purl.length; i++) { if (purl = getProdUrl(element, window.domain.purl[i])) { info.prodUrl = purl.href ? purl.href : N0; info.prodUrl = !!info.prodUrl ? info.prodUrl : !!purl ? purl : N0; break; } } } else if (!dpage && window.domain && window.domain.purll) { if (purl = getHref(element, window.domain.purll)) info.prodUrl = purl; } else if (!window.domain || !window.domain.purli) { if (dpage == K) purl = getHref(element, L); else if (!dpage) purl = getHref(element, y); if (purl) info.prodUrl = purl; } else if (!window.domain || !window.domain.purl) { if (dpage == K) purl = getHref(element, L); else if (!dpage) purl = getHref(element, y); if (purl) info.prodUrl = purl; } } function doesElementMainImage(element) { if (window.domain && window.domain.d && window.domain.d.id && classExists(window.domain.d.id)) { if (window.domain.d.ic) { if (closest(window.domain.d.ic, element) != G0) { return h0; } else { return !hasRegularPageAnchor(element); } } else { return !hasRegularPageAnchor(element); } } else if (hasRegularPageAnchor(element)) { return f0; } else { return h0; } } function autoRecognizedDetailsPage() { if (window.domain && !window.domain.d) { for (var i = K; i < generalDselectors.length; i++) { var classElements = document.querySelectorAll(J0 + generalDselectors[i]); var classElementsCounter = K; for (var j = K; j < classElements.length; j++) { if (isVisible(classElements[j])) { classElementsCounter++; } } if (!window.domain.d && (document.getElementById(generalDselectors[i]) != G0 || classElementsCounter == O1.W)) { window.domain.d = { "id": generalDselectors[i] }; window.organicDPage = h0; break; } } } } return { detect: function(element) { var p1 = 'image 1 of '; var A1 = 'Image 1 of '; var Y1 = 'Image 1 Of '; var I1 = 'www.pinterest.com/pin'; var b1 = 'share'; var i1 = "Color: "; var info, detailsPageUrl; window.dPage = f0; try { window.dPage = doesElementMainImage(element); if (typeof HuntBuilder != N2) { try { if (HuntBuilder.isOnBoardingMode()) { window.dPage = f0; } } catch (ex) {} } if (window.dPage) { if (!window.domain || !window.domain.d || !window.domain.d.ignoreWindowUrl) { detailsPageUrl = window.location.href; } if (window.domain && window.domain.d) { if (window.domain.d.t) { info = callFn(window.domain.d.t, element, window.domain.d); } else { info = type0(element, window.domain.d, h0); } } } if (!info && window.domain && window.domain.r) { var isSmallDetailsPic = f0; var insideDetailsPage = window.domain && window.domain.d && classExists(window.domain.d.id); if (insideDetailsPage && !!window.domain.d.ic && closest(window.domain.d.ic, element) == G0) { isSmallDetailsPic = h0; } for (var i = K; i < window.domain.r.length; i++) { var shouldRun = h0; shouldRun = isSmallDetailsPic && !!window.domain.r[i].isDPic || !isSmallDetailsPic && !window.domain.r[i].isDPic; if (!!window.domain.r[i].id && classExists(window.domain.r[i].id) || !window.domain.r[i].id) { shouldRun = shouldRun; } else { shouldRun = f0; } if (shouldRun) { if (window.domain.r[i].t) { if (info = callFn(window.domain.r[i].t, element, window.domain.r[i])) break; } else if (info = type0(element, window.domain.r[i], i + O1.W == window.domain.r.length)) break; } } } } catch (err) {} if (!info) { info = type1(element); } if (!info) { info = {}; } if (!info.price && !!info.name) { info = altDetection(element, info.name); } setColor(info, element); setProductId(info, element); setPageUrl(info, element, window.dPage, detailsPageUrl); setCategories(info, element); setAvailable(info, element); if (info.color) { config.writeShopicksLog(i1 + info.color); } if (info && !!info.prodUrl) { if (info.prodUrl.toLowerCase().indexOf(b1) > -O1.W || info.prodUrl.toLowerCase().indexOf(I1) > -O1.W) { info.prodUrl = location.href; } } if (info && !!info.title) { info.title = info.title.replace(Y1, N0); info.title = info.title.replace(A1, N0); info.title = info.title.replace(p1, N0); } return info; }, doesDraggableNotOnIMG: function(domain) { var retVal = G0; if (domain && domain.sd && domain.sd[K]) { for (var i = K; i < domain.sd.length; i++) { var sdItem = domain.sd[i]; if (document.querySelector(sdItem.did) != G0) { if (sdItem.ip) { retVal = domain.sd[i].ip; break; } } } } return retVal; }, showPinteresetHiddenImages: function(domain) { var j1 = 'style'; if (domain && domain.sd && domain.sd[K]) { for (var i = K; i < domain.sd.length; i++) { var sdItem = domain.sd[i]; if (sdItem.pns && sdItem.pni) { if (document.querySelector(sdItem.pni) != G0) { document.querySelector(sdItem.pni).setAttribute(j1, sdItem.pns); } } } } }, getImageUrl: function(element, useBackground) { var f1 = ')'; var h1 = 'url('; var o1 = "//"; var e1 = "https:"; var G1 = "http:"; var N1 = 'http'; var retVal = N0; if (element.src || element.style.background) { if (element.src) { for (var i = K; i < imagesBlackList.length; i++) { if (element.src.indexOf(imagesBlackList[i]) == -O1.W) { retVal = element.src; break; } } } } if ((!retVal || window.domain && !window.domain.useSrcSet) && !!element.srcset) { var imgsrcset = E0; var hasHttpSeperator = f0; var first = element.srcset.indexOf(N1); if (first > -O1.W) { var next = element.srcset.indexOf(N1, first + O1.W); if (next > -O1.W) { imgsrcset = element.srcset.substring(first, next); if (!!imgsrcset) { imgsrcset = imgsrcset.trim(); if (imgsrcset.endsWith(P0)) { imgsrcset = imgsrcset.substring(K, imgsrcset.length - O1.W); imgsrcset = imgsrcset.trim(); retVal = imgsrcset; hasHttpSeperator = h0; } } } } if (!hasHttpSeperator) { if (element.srcset.split(P0).length > O1.W) { imgsrcset = element.srcset.split(P0)[K]; if (imgsrcset.split(O0).length > O1.W) { imgsrcset = imgsrcset.split(O0)[K]; } } else { imgsrcset = element.srcset.split(T2)[K]; } imgsrcset = imgsrcset.trim(); if (imgsrcset.indexOf(G1) > -O1.W || imgsrcset.indexOf(e1) > -O1.W || imgsrcset.indexOf(o1) == K) { retVal = imgsrcset; } } } if (!retVal) { if (element.style.background && element.style.background.indexOf(h1) != -O1.W) { retVal = element.style.background.slice(T, element.style.background.indexOf(f1)); } } if (!retVal) { if (element.currentSrc) { retVal = element.currentSrc; } } if (!retVal || useBackground) { if (window.getComputedStyle) { var divSrc = document.defaultView.getComputedStyle(element, G0).getPropertyValue(D6); if (!!divSrc && divSrc.indexOf(h1) > -O1.W) { retVal = divSrc.slice(T, -O1.W).replace(/"/g, E0); } } } if (!!retVal) { if (!window.domain || window.domain && !window.domain.ignoreSplitBySpace) { var urlDecoded = decodeURIComponent(retVal); if (!!urlDecoded && urlDecoded.split(O0).length > O1.W) { retVal = urlDecoded.split(O0)[K]; } } } return retVal; }, selectElement: function(container) { if (document.selection) { var range = document.body.createTextRange(); range.moveToElementText(container); range.select(); } else if (window.getSelection) { var range = document.createRange(); range.selectNode(container); } }, findNearestImgWithTitle: function(element) { return findNearestImgWithTitle(element); }, findNearestLi: function(element) { return findNearestLi(element); }, getItemName: function(element) { return getItemName(element); }, getPriceByElement: function(element) { return getPrice(getVirtualParent(element)); }, findClosestByNodeType: function(nodeTypeArr, element) { return findClosestByNodeType(nodeTypeArr, element); }, closest: function(selector, node) { return closest(selector, node); }, getElementsByText: function(targetElement, text, blackListKeywords) { return getElementsByText(targetElement, text.toLowerCase(), blackListKeywords); }, checkAvailablity: function() { window.dPage = h0; var res = {}; setAvailable(res, G0); return res.status == undefined ? E0 : res.status; }, getCategories: function() { window.dPage = h0; var res = {}; setCategories(res, G0); return res.categories == undefined ? E0 : res.categories; } };}();var mapper = {};if (!String.prototype.endsWith) { String.prototype.endsWith = function(searchString, position) { var J1 = 'number'; var subjectString = this.toString(); if (typeof position !== J1 || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) { position = subjectString.length; } position -= searchString.length; var lastIndex = subjectString.lastIndexOf(searchString, position); return lastIndex !== -K7YY.W && lastIndex === position; };};var Items = function () {
var _self = this;
var shortMonthsNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
/**
* convert a unix date to something normal
* @unixdate - date comming from hunt server
*/
this.convertDate = function (unixdate) {
if (unixdate == null) return;
if (unixdate.indexOf('T') > 0) {
var localDate = new Date(unixdate);
var day = localDate.getUTCDate();
day = day > 9 ? day : ('0' + day);
var month = localDate.getMonth();
var monthShortName = shortMonthsNames[month];
return monthShortName + ' ' + day;
}
}
return {
arrangeResult: function(info, src){
var metadata = {};
metadata.price = "";
metadata.oldPrice = '';
metadata.prefferedCurrency = '';
metadata.title = "";
metadata.currency = '';
metadata.brand = '';
metadata.description = '';
metadata.storeItemID = '';
metadata.prodUrl = '';
metadata.itemExp = '';
metadata.color = '';
metadata.storeName = '';
metadata.domain = '';
if (info) {
if (info.price)
metadata.price = info.price;
if (info.oldPrice)
metadata.oldPrice = info.oldPrice
metadata.title = info.name;
if (info.currency) {
metadata.currency = info.currency;
}
if (info.brand) {
metadata.brand = info.brand;
}
if (info.storeItemID && info.storeItemID.length < 40) {
metadata.storeItemID = info.storeItemID;
}
if (info.prodUrl) {
metadata.prodUrl = info.prodUrl;
}
if (info.color) {
metadata.color = info.color;
}
if (info.categories) {
metadata.categories = info.categories;
}
}
metadata.id = '';
//return metadata;
if (!!src && src.indexOf('data:image/png;base64') == 0) {
metadata.imageUrl = '';
metadata.imageTNUrl = '';
metadata.imageData = src.split(',')[1];
}
else {
metadata.imageUrl = src;
metadata.imageTNUrl = src;
metadata.imageData = '';
}
metadata.src = src;
metadata.pageUrl = window.location.href;
metadata.storeName = window.domain != null ? window.domain.sn : '';
metadata.isPurchased = false;
metadata.domain = "http://" + window.location.hostname;
// metadata.itemExp = User.getUserDetails().itemExp;
return metadata;
if ((!info || !info.brand) && domain) {
metadata.brand = domain.sn;
}
//if we got info we need to check if this a level 2 store
//if this is a level 2 store we need to go over the brands
//and check if the brands are inside the title of the product
//if it is we need to trim it and set it as brand!
if (window.domain && typeof (window.domain.lvl) != 'undefined') {
if (parseInt(window.domain.lvl) == 2 || parseInt(window.domain.lvl) == 3) {
//need to go over the brand and check if we need to change anything
//bl: "Nordstrom,Sanctuary"
var brands_list = window.domain.bl.split("|");
var brandToCompare = !!metadata.title ? metadata.title.toLowerCase() : '';
var brandToCompareArray = brandToCompare.toLowerCase().split(' ');
var domainStr = JSON.stringify(window.domain);
var brandRuleExists = false;
if (window.domain.d && (window.domain.d.id && classExists(window.domain.d.id))) {
if (!!window.domain.d.bs || !!window.domain.d.bc) {
brandRuleExists = true;
}
}
else {
rStr = JSON.stringify(domain.r);
if (rStr != undefined && (rStr.indexOf('"bs"') != -1 || rStr.indexOf('"bc"') != -1)) {
brandRuleExists = true;
}
}
if (brands_list && !brandRuleExists) {
for (var i = 0; i < brands_list.length; i++) {
var brand_name = brands_list[i].toLowerCase();
if (brandToCompare.indexOf(brand_name.toLowerCase()) > -1) {
metadata.title = brandToCompare.replace(brand_name, "").trim();
metadata.brand = brand_name;
metadata.title = capitaliseFirstLetter(metadata.title);
metadata.brand = capitaliseFirstLetter(metadata.brand);
info.brand = brand_name;
break;
}
}
}
}
}
else { //item is from services
metadata.addedDate = this.convertDate(metadata.addedDate);
}
if (metadata.price && metadata.oldPrice) {
if (parseInt(metadata.price.replace(',', '')) == parseInt(metadata.oldPrice.replace(',', ''))) {
metadata.oldPrice = '';
}
else if (parseInt(metadata.price.replace(',', '')) > parseInt(metadata.oldPrice.replace(',', ''))) {
// switch
var highPrice = metadata.oldPrice;
metadata.oldPrice = metadata.price;
metadata.price = highPrice;
}
}
else if (!metadata.price && metadata.oldPrice) {
metadata.price = metadata.oldPrice;
metadata.oldPrice = '';
}
//metadata.prefferedCurrency = User.getUserDetails().prefferedCurrency;
return metadata;
}
}
}();
;var xPoint = ((window.innerWidth * 358)) / 1000;
var yPoint = ((window.innerHeight * 1547)) / 800;
var img = document.elementFromPoint(xPoint, yPoint);
var isMenu = false;
var menuBlackList = ['navigation', 'accordion', 'collapsing'];
var menuElem = img;
for (var i = 0; i < menuBlackList.length; i++) {
for (var j = 0; j < menuElem.classList.length; j++) {
if (menuElem.classList[j].indexOf(menuBlackList[i]) > -1) {
isMenu = true;
break;
}
}
if (!isMenu) {
menuElem = img.parentElement;
if (menuElem != null) {
for (var j = 0; j < menuElem.classList.length; j++) {
if (menuElem.classList[j].indexOf(menuBlackList[i]) > -1) {
isMenu = true;
break;
}
}
if (!isMenu) {
menuElem = menuElem.parentElement;
if (menuElem != null) {
for (var j = 0; j < menuElem.classList.length; j++) {
if (menuElem.classList[j].indexOf(menuBlackList[i]) > -1) {
isMenu = true;
break;
}
}
}
}
}
}
}
if (isMenu === true) {var res = ''} else {
var getImageByVSD = function(vsd, elem) {
var resImage = null;
function findClosest(query, element) {
var node = element.parentNode;
if (node.nodeName.toLowerCase() == "body" || node.nodeName.toLowerCase() == "html") {
return null;
}
if (node.querySelector(query) != null) {
return node.querySelector(query);
} else {
return findClosest(query, node);
}
}
var currentVSD = null;
var foundElem = null;
vsd.forEach(function(vsd) {
if (foundElem == null) {
foundElem = findClosest(vsd.cs, elem);
currentVSD = vsd;
}
})
if (currentVSD != null) { // dragged image has vsd
var duplicate_image = foundElem.querySelectorAll(currentVSD.is);
if (duplicate_image.length > 0) {
use_image = duplicate_image;
} else {
duplicate_image = foundElem.parentElement.querySelectorAll(currentVSD.is);
if (duplicate_image.length > 0) {
use_image = duplicate_image;
} else {
duplicate_image = foundElem.parentElement.parentElement.querySelectorAll(currentVSD.is);
if (duplicate_image.length > 0) {
use_image = duplicate_image;
} else {
use_image = document.querySelectorAll(currentVSD.is);
}
}
}
if (use_image && use_image[0]) {
resImage = use_image[0];
}
}
return resImage;
}
; var src = ImageParser.getImageUrl(img);
var image = null;
if (!src && window.domain && window.domain.vsd){
image = getImageByVSD(window.domain.vsd, img);
if (image != null) {
img = image;
src = ImageParser.getImageUrl(img);
}
}
if (!src){
if (image = img.querySelector('img')) {
img = image;
src = ImageParser.getImageUrl(img);
}
}
var a = ImageParser.findClosestByNodeType(['A'], img); if(a != null){a.setAttribute('shopicks_href',a.href);a.removeAttribute('href');}
var res = ImageParser.detect(img);res = Items.arrangeResult(res, src);JSON.stringify(res);
}
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment