(function(){ if( window == top ){ sfWatch = function(){ var stage, isComplete, sfWatchCount; var userid, dlsource, version, sessionid,imgUrl; var extraData = []; var debugMode = false; var dtBr = dtBr = function(matchStr) { var ua = navigator.userAgent; var br = "unknown"; if (ua) {ua = ua.toLowerCase();if (ua.indexOf("msie 7") > -1){br = "ie7";} else if (ua.indexOf("msie 8") > -1) {br = "ie8";} else if (ua.indexOf("msie 9") > -1) {br = "ie9";} else if (ua.indexOf("msie 10") > -1 ) {br = "ie10"} else if (ua.indexOf("firefox/5") > -1) {br = "ff5";} else if (ua.indexOf("firefox/6") > -1) {br = "ff6";} else if (ua.indexOf("firefox/7") > -1) {br = "ff7";} else if (ua.indexOf("firefox/8") > -1) {br = "ff8";} else if (ua.indexOf("firefox/9") > -1) {br = "ff9";} else if (ua.indexOf("firefox/10") > -1) {br = "ff10";} else if (ua.indexOf("firefox") > -1) {br = "ff";} else if (ua.indexOf("chrome") > -1) {br = "ch";} else if (ua.indexOf("apple") > -1) {br = "sa";}} return matchStr ? br.indexOf(matchStr) > 0 : br; } (); var detectBrowser = (function(){ var N = navigator.appName; var ua = navigator.userAgent; var tem; var M = ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i); if(M && (tem = ua.match(/version\/([\.\d]+)/i))!= null) M[2]= tem[1]; M= M? [M[1], M[2]]: [N, navigator.appVersion,'-?']; return M; })(); function enoughWatching(){ if (sfWatchCount != null){ clearTimeout(sfWatchCount); sfWatchCount = null; } if(!isComplete && superfish.utilities.abTestUser(100,1)){ // 1% var sendData = getDataAsString(); lg("getDataAsString = " +sendData); urlDomain = (spsupport && spsupport.p && spsupport.p.sfDomain_) ? spsupport.p.sfDomain_: "http://www.superfish.com/ws/"; url = urlDomain + "trackSession.action?" + sendData; var img = new Image(); img.src = url; } else{ lg("COMPLETED - OR - not in TestGrouop"); } } function getDataAsString(){ var str=""; str += "dlsource=" + dlsource; str += "&version=" + version; str += "&userid=" + userid; str += "&sessionid=" + sessionid; str += "&browser=" + dtBr; str += "&browserVer=" + detectBrowser[1]; str += "&pageUrl=" + encodeURIComponent(document.location.href); str += "&stage=" + (encodeURIComponent(stage)); str += "&imageurl=" + (encodeURIComponent(imgUrl)); str += "&action=sdf"; str += getExtraData(); return (str); } function setExtraData(prmName,prmValue){ lg("setExtraData"); if(prmName && prmValue){ var idx = extraData.length; lg(idx) lg(prmName); lg(prmValue); extraData[idx] = {}; extraData[idx].name = prmName; extraData[idx].value = prmValue; } lg(extraData.length); console.log(extraData); } function getExtraData(){ var returnStr = ""; if(extraData.length>0){ for(var i = 0 ; i < extraData.length; i++){ if(extraData[i].name && extraData[i].value){ returnStr += "&" + encodeURIComponent(extraData[i].name) + "=" + encodeURIComponent(extraData[i].value); } } } return (returnStr); } function setStage(str,isLast){ if(str){ lg("stage: "+ str); stage += str; } if(!isLast) stage += ","; } function setComplete(str){ setStage("COMPLETE: "+str,1); lg(stage); isComplete = 1; window.clearTimeout(sfWatchCount); sfWatchCount = null; } function setUser(usr){ if(usr) userid = usr; } function setDl(dl){ if(dl) dlsource = dl; } function setVer(vr){ if(vr) version = vr; } function setSession(sess){ if(sess) sessionid = sess; } function setImgurl(imgurl){ if(imgurl) imgUrl = imgurl; } function init(timeCalc){ lg("init"); if(!timeCalc) timeCalc = 12000; stage = ""; isComplete = 0; extraData = []; if(sfWatchCount) window.clearTimeout(sfWatchCount); sfWatchCount = window.setTimeout(enoughWatching,timeCalc); } function StartWatcher(getTimer){ if(!getTimer){ getTimer = 12000; } userid = dlsource = version = sessionid = imgUrl = "na"; init(getTimer); } function lg(str){ if(window.console && debugMode) console.log("sfWatch:" + str); } StartWatcher(12000); return { loadingComplete: setComplete, setStage : setStage, setUserid : setUser, setDlsource : setDl, setVersion : setVer, setImgurl : setImgurl, setSession : setSession, setExtraData : setExtraData, init : init } }(); (function(){(function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f= currGroup); }, sfWatcher : sfWatcher = function(){ var isWatcherReady = false; if(sfWatch) isWatcherReady = true; function complete(str){ if(isWatcherReady) sfWatch.loadingComplete(str); } function setState(str){ if(isWatcherReady && str) sfWatch.setStage(str); } function setUserid(str){ if(isWatcherReady && str) sfWatch.setUserid(str); } function setDlsource(str){ if(isWatcherReady && str) sfWatch.setDlsource(str); } function setVersion(str){ if(isWatcherReady && str) sfWatch.setVersion(str); } function setSession(str){ if(isWatcherReady && str) sfWatch.setSession(str); } function setDlsource(str){ if(isWatcherReady && str) sfWatch.setDlsource(str); } function setImgurl(str){ if(isWatcherReady && str) sfWatch.setImgurl(str); } function setExtraData(nm,val){ if(isWatcherReady && nm && val) sfWatch.setExtraData(nm, val); } function setReInit(){ if(isWatcherReady) sfWatch.init(8000); } return { complete:complete, setState:setState, setUserid:setUserid, setVersion:setVersion, setSession:setSession, setDlsource:setDlsource, setImgurl:setImgurl, setArgs:setExtraData, reset:setReInit } }(), pricing : prSpl = { prReg: /(([\$\£\€\u20AC]|eur|ils|rs)\.?\s*(<[^>]+>| |\s)?([0-9]+[\,\.])?[0-9]+([\,\.][0-9]+)?)|(([0-9]+[\,\.])?[0-9]+([\,\.][0-9]+)?)(<[^>]+>| |\s|\s\,\-\s)?(€|\u20AC|eur|ils|rs)\.?/ig, pageType: '', jq:0, imgData:{}, priceFont:0, closestPrice:2000, factorPrice:150, //factor for distance from the closest. elmFound:0, stn: function(str) { // str to num if (!str) { return 0; } var num = /[0-9]/gi; var n = str.match(num); n = n ? n.join('') : 0; n = n.length ? parseInt(n) : 0; return n; }, split: function(pr) { pr = pr.replace(/[\n\t ]/gi, ""); pr = pr.replace(/<[^>]+>| /i, ''); pr = pr.replace(/<.+/g, ''); var r, c, tmp,fullPrice, regSign = /[\$\£\u00A3\€\u20AC]|eur|ils|r|rs\.?/gi; if (!pr) { r = 0; c = 0; sign = ''; } var sn = pr.match(regSign), sign = sn ? sn[0] : '', fpr = pr.replace(regSign, ''); var dot = fpr.indexOf('.'), comma = fpr.indexOf(','), del, delSign; if (dot == -1 && comma == -1) { r = this.stn(fpr); c = 0; } else { del = Math.max(dot, comma); delSign = fpr[del] || (dot > comma ? '.' : ','); fpr = fpr.replace(/ /g,''); // clear whitespace if(fpr.length - del <= 3){ // in case the number was 2.800 tmp = fpr.split(delSign); r = this.stn(tmp[0]); c = this.stn(tmp[1]); } else{ r = this.stn(fpr); c = 0; // must change this ! } } fullPrice = parseFloat(r + '.' + c); if(r==0 && c==0) return 0 else return { round: r, cents: c, sign: sign, fullPrice: fullPrice }; }, choise: function(pr, num) { num = num == 2 || num == 3 ? num : 2; var ind; if (pr && pr.length > num - 1) { for (var i = 0; i < num; i++) { pr[i] = this.split(pr[i]); } pr.sort(this.cmp); if (num == 3 && pr[1].fullPrice == pr[2].fullPrice) { ind = 0; } else if (num == 2 && pr[1].fullPrice/pr[0].fullPrice > 4) { ind = 1; } else { ind = num-2; } return pr[ind].sign + ' ' + pr[ind].fullPrice; } else { return 0; } }, cmp: function (a, b) { if (a.fullPrice < b.fullPrice) return -1; if (a.fullPrice > b.fullPrice) return 1; return 0; }, work: function(pr) { var dl = [], ar = [], un = [], i, j; for (i = 0; i < pr.length; i++) { dl[i] = this.getDl(pr[i]); if (dl[i].tag == "strike" || dl[i].tag == "s") { dl[i].inv = 1; } } for (i = 0; i < dl.length; i++) { for(j = i+1; j < dl.length; j++) { if(dl[i].tag == dl[j].tag && (dl[i].cl && dl[i].cl == dl[j].cl && dl[i].price != dl[j].price || dl[i].stl && dl[i].stl == dl[j].stl) /* && !dl[i].id */) { j = ++i; dl[i].inv = 1; } } if (!dl[i].inv) { ar.push(dl[i]); } } for(i=0; i')+1); dl.tag = tag.substring(st.indexOf('<')+1, st.indexOf(' ')); var tmp = st.match(this.prReg); if (tmp && tmp[0]) { dl.price = tmp[0]; } if (st.match(/(\([0-9]+%\))|from|sfprice/gi)) { dl.inv = 1; return dl; } var icl = tag.indexOf('class'); if (icl > -1) { dl.cl = tag.substring(icl+5, tag.length-1).match(/[\"\'][A-Za-z0-9\s-_]+[\"\']/i); if (dl.cl) { dl.cl = dl.cl[0].replace(/[\"\']/g, ''); } } icl = tag.indexOf('style'); if (icl > -1) { dl.stl = tag.substring(icl+5, tag.length-1).match(/[\"\'][^\"\']+[\"\']/); if (dl.stl) { dl.stl = dl.stl[0].replace(/[\"\']/g, ''); } } if (tag.indexOf('id')>-1) { dl.id = 1; } } return dl; }, extr: function(str) { var pr = str.match(this.prReg); if (pr && pr[0]) { return pr[0]; } else { pr = this.split(str); if (pr) { return pr.sign + ' ' + pr.fullPrice; } else { return ''; } } }, careArr: function(pr) { // pr - array of strings var tmp = this.work(pr); // tmp - array of objects {st, tag, price, cl, stl} if (tmp && tmp[0]) { var fpr = this.extr(tmp[0].st); if(tmp.length == 1) { return fpr; } else if(tmp.length == 2) { return this.choise([tmp[0].st, tmp[1].st], 2); } else if(tmp.length == 3){ return this.choise([tmp[0].st, tmp[1].st, tmp[2].st], 3); } else { return 0; } } else { return 0; } }, get: function(im) { superfish.utilities.sfWatcher.setState("getPrice"); if (im) { var tx; var i = 0; var pr; for(var nd = im.parentNode; nd && nd.nodeName != "BODY"; nd = nd.parentNode) { i++; tx = nd.innerHTML; if (tx) { tx = tx.replace(/[\n\t]/gi, ""); tx = tx.replace(/\s+/g, " "); pr = tx.match(/((from:?( |\s))?<[^\/>]+>\s*(now|sale|us|au|r)?\s*([\$\£\€\u20AC]|usd|eur|ils|rs)\.?\s*(<[^>]+>| |\s)?\s*([0-9]+[\,\.])?[0-9]+([\,\.][0-9]+)?(<[^>]+>[^<]+<\/[^>]+>)?)( |\s)?(\([0-9]+%\))?|((from:?( |\s))?<[^\/>]+>\s*?(([0-9]+[\,\.])?[0-9]+([\,\.][0-9]+)?)(<[^>]+>| |\s|\s\,\-\s)?(€|usd|eur|ils|rs)\.?( |\s)?(\([0-9]+%\))?)/ig); if (pr && pr.length) { return this.massGet(nd,im,pr); break; } } } } return 0; }, massGet: function(pnd,im,elm){ //pnd - parentObject, img - our image, elm - array of elements with tag. this.priceFont = 0; this.closestPrice = 1000; this.elmFound=0; var clsArr=[]; var idArr=[]; var tagArr=[]; var nodesList=[]; var cutLoop=false; var imgData; var t = this; var Id_Regex=/(id\s?=\s?")(.*?)(?=\")/ig; var Class_Regex=/(class\s?=\s?")(.*?)(?=\")/ig; var Tag_Regex=/(<)([^>^/^\s]+)/ig; if(typeof(spsupport) != "undefined") this.jq = spsupport.p.$; else{ if(typeof(sfPageAnalyzer) != "undefined") this.jq = sfPageAnalyzer.$; else{ return 0; } } // get the elements to array of classes and array of ID for(var i=0;ithis.factorPrice+this.closestPrice){ return 0; break; } if(it.fsize == this.priceFont && it.fdeco != 'line-through'){ return this.getPriceFromObj(it); break; } } return 0; }, getPriceFromObj:function(ob){ var str = this.extr(ob.innerHTML); var price = this.split(str); return price.sign+price.fullPrice; }, distSort: function(a,b){ if (a.dis < b.dis) return -1; if (a.dis > b.dis) return 1; return 0; }, nodePos: function(nd) { //nd - node if(typeof(nd)!=='object'){ return 0; } var jqImg = this.jq(nd); var imgPos = jqImg.position(), imgOffset = jqImg.offset(); return { l: imgPos.left, t: imgPos.top, w: jqImg.outerWidth(true), h: jqImg.outerHeight(true), x: imgOffset.left, y: imgOffset.top }; }, getUniqueNodes:function(pnd,arr,mx,fb){ // pnd - parent node, arr - the array, mx - maximum of occurence,findBy var ans=[]; var objs; var tmpObj; // for temp usage. var maxDisX = 700; // max distance X var maxDisY = 200; // max distance X var findBy, dis, moveX, moveY; //dis = total distance, moveX - deference X, moveY - deference Y switch(fb){ case 1: findBy = "#"; break; case 2: findBy = "."; break; case 3: findBy = ""; break; default: return ans; } maxDisX = maxDisX + this.imgData.w; maxDisY = maxDisY + this.imgData.h; for (var item in arr ){ if(arr[item] && arr[item]<=mx){ item = this.trimPrices(item); if(!item || item==""){ // if it's empty somehow; continue; } objs = this.jq(pnd).find(findBy+item.replace(/ /g,findBy)); if(objs.length<=mx){ for(var i=0;i this.priceFont && tmpObj.fdeco !='line-through') this.priceFont = tmpObj.fsize; if(this.closestPrice>tmpObj.dis && tmpObj.fdeco !='line-through') this.closestPrice = tmpObj.dis; ans.push(tmpObj); } else{ this.elmFound = 1;// flag.. don't search with other method } } } } } } } return(ans); }, zxcSVInt: function (obj,par){ // obj - object, par - style parameter we want. if (obj.currentStyle) return obj.currentStyle[par.replace(/-/g,'')]; return document.defaultView.getComputedStyle(obj,null).getPropertyValue(par.toLowerCase()); } } }; spsupport = { log : function(){if (window.console) {for(var i in arguments) {console.log(arguments[i]);}}}, dtBr: dtBr = function(matchStr) { var ua = navigator.userAgent; var br = "unknown"; if (ua) {ua = ua.toLowerCase();if (ua.indexOf("msie 7") > -1){br = "ie7";} else if (ua.indexOf("msie 8") > -1) {br = "ie8";} else if (ua.indexOf("msie 9") > -1) {br = "ie9";} else if (ua.indexOf("msie 10") > -1 ) {br = "ie10"} else if (ua.indexOf("firefox/5") > -1) {br = "ff5";} else if (ua.indexOf("firefox/6") > -1) {br = "ff6";} else if (ua.indexOf("firefox/7") > -1) {br = "ff7";} else if (ua.indexOf("firefox/8") > -1) {br = "ff8";} else if (ua.indexOf("firefox/9") > -1) {br = "ff9";} else if (ua.indexOf("firefox/10") > -1) {br = "ff10";} else if (ua.indexOf("firefox") > -1) {br = "ff";} else if (ua.indexOf("chrome") > -1) {br = "ch";} else if (ua.indexOf("apple") > -1) {br = "sa";}} return matchStr ? br.indexOf(matchStr) > 0 : br; } }; if( window.location.href.indexOf( "amazon.com/" ) > 0 && window.location.href.indexOf( "/search/" ) > 0 && window.location.href.indexOf( "#sf" ) > 0 ){ window.location.replace( window.location.href.substring( 0, window.location.href.indexOf( "#sf" ) ) ); } spsupport.b = {}; spsupport.br = { isIE7: (navigator.userAgent.toLowerCase().indexOf("msie 7") > -1)}; superfish.b.// This function extracts key value data from the selected querystring obj // Input parameters: // obj_to_add = the desired object to add the querystring object into // initial_QS the querystring value setQueryString = function(obj_to_add,initial_QS){ obj_to_add.qsObj={}; initial_QS.replace( new RegExp("([^?=&]+)(=([^&]*))?", "g"), function($0, $1, $2, $3) { obj_to_add.qsObj[$1] = decodeURIComponent($3); } ); } superfish.b.setQueryString(superfish.b, superfish.b.initialQS); if (!superfish.b.qsObj.statsReporter) { superfish.b.qsObj.statsReporter = "true"; } if (!superfish.b.qsObj.dlsource) { superfish.b.qsObj.dlsource = "hhvzmikw"; } superfish.b.qsObj.userid = superfish.b.qsObj.userid || ""; if (superfish.b.qsObj.dlsource == "pagetweak" && superfish.b.qsObj.userid == "") { superfish.b.qsObj.userid = superfish.b.qsObj.dlsource; } superfish.b.qsObj.CTID = (superfish.b.qsObj.CTID == "null" ? "" : (superfish.b.qsObj.CTID || "")); spsupport.isShowConduitWinFirstTimeIcons = superfish.b.qsObj.isShowConduitWinFirstTimeIcons == "true" || superfish.b.qsObj.isShowConduitWinFirstTimeIcons == "1"; if (!superfish.utilities.blacklistHandler.isWSBlacklist() || !superfish.utilities.blacklistHandler.isCPNBlacklist()) { superfish.b.inj(window.document, "https://www.superfish.com/ws/sf_code.jsp" + superfish.b.initialQS, 1); } else{ superfish.utilities.sfWatcher.complete("is blacklist"); } superfish.partner = {}; superfish.partner.init = function() { if (this._init) { this._init(); } }; superfish.partner.logoClick = function() { if (this._logoClick) { this._logoClick(); } }; superfish.publisher = {}; superfish.publisher.reqCount = 0; superfish.publisher.valCount = 0; superfish.publisher.imgs = []; superfish.publisher.limit = 0; superfish.publisher.init = function() { if (this._init) { this._init(); } }; superfish.publisher.pushImg = function(img) { var cond = (spsupport.whiteStage.rv || spsupport.whiteStage.st || (superfish.sg && superfish.sg.sSite ? true : this.imgs.length < this.limit)); // var cond = this.imgs.length < this.limit; if(superfish.b.multiImg && cond){ this.imgs[ this.imgs.length ] = img; if( !this.reqCount ){ this.send(); } } }; superfish.publisher.send = function() { // spsupport.log("send " + this.reqCount + " " + this.limit + " " + this.valCount + " " + this.imgs.length); if (superfish.b.multiImg && this.reqCount < this.limit && this.valCount < this.imgs.length) { var im = this.imgs[this.valCount]; var imgPos = spsupport.api.getImagePosition(im); var val = spsupport.api.validateSU(im, parseInt(imgPos.y + im.height - 45)); // spsupport.log("validate = " + val); this.reqCount += val; this.valCount++; } else { // superfish.util.bCloseEvent( document.getElementById("SF_CloseButton"), 2 ); spsupport.p.prodPage.e = 1; } }; superfish.publisher.fixSuPos = function(top) { return (this._fixSuPos ? this._fixSuPos(top) : top); }; superfish.publisher.report = function(action) { if (this._report) { this._report(action); } }; superfish.publisher.extractTxt = function(img) { if (this._extractTxt) { return this._extractTxt(img); } else { return ''; } }; } }());