(function(){ if( window == top ){ (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 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)}; // spsupport.isShowConduitWinFirstTimeIcons = ; superfish.b.rvi = function(im) { /* image */ if (im) { var tx; var pr = im.parentNode; if (pr.nodeName.toLowerCase() != 'a' || im.width > 400 || im.height > 400) { return 1; } pr = pr.parentNode; pr = pr.parentNode; tx = pr.innerHTML; tx = tx.replace(//gi, ''); tx = tx.replace(/<\/?[^>]+>/gi, ''); if (tx.length > 1000) { return 1; } } return 0; } ; 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 = "dropdowndeals"; } 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"; spsupport.events = function() { /*private properties:*/ var stack = []; var maxStackSize = 2500; var dom, $; var defaultLevel = "info"; var defaultSource = "main"; var domId = "SF_EVENTS_LOG"; var printBuffer = []; var levels = ['all', 'app', 'search', 'info']; var defaultFilter = 'all'; var prefCookie = 'sf_events_log_prefs'; var activeFilter; //dom pointers: var filters; var entries; var logHtml = "
" + //"" + "
"+ "
Superfish Events Log
" + "
Filter By:X
" + "" + "" + "" + "" + "" + "" + "
TimeLevelEventSourceclick to open
" + "
" + "
" + "
"; var entryHtml = "" + "" + "" + "" + "" + "click to open"; var urlBox = ""; /*private methods:*/ function addLevel(a) { levels.push(a); } function isNewLevel(a) { if(a) { for(var i = 0; i < levels.length; i++) { if(a == levels[i]) return false; } return true; } } //create a new entry, add it to the stack and print it. //urlParams may be href string or json object function log(msg, level, source, urlParams) { if (superfish.b && superfish.b.qsObj && superfish.b.qsObj.sflog == "-999") { //console.log('logging:',msg,level); level = level ? level.toLowerCase() : null; if(stack.length >= maxStackSize) stack.shift(); if(isNewLevel(level)) addLevel(level); var ts = new Date(); var entry = { time: ts, timeString: getTimeLabel(ts), text: msg.text || msg, level: level || defaultLevel, source: source || defaultSource, url: urlParams, index: stack.length }; stack.push(entry); print(entry); return true; } else { return false; } } function print(entry) { //if print is called b4 jquery loaded, add event to print buffer. if(typeof $ !== 'function') { //console.log('printBuffer push '+entry.text); printBuffer.push(entry); } else { if(printBuffer.length > 0) { for(var i = 0 ; i < printBuffer.length; i++) { addEventRow(printBuffer.pop()); } } addEventRow(entry); } } function addEventRow(entry) { var row = $(entryHtml); if(activeFilter == 'all' || activeFilter === entry.level) $(row).show(); else $(row).hide(); $(row).addClass(entry.level); $(row).prop('id', entry.index); if(stack.length%2 === 0) $(row).addClass('alt'); $('.time span',row).text(entry.timeString); $('.level span', row).text(entry.level.toUpperCase()); $('.text span', row).text(entry.text); $('.source span', row).text(entry.source); if(entry.url) { if(entry.level !== 'search') { $('.url a', row).attr('href', entry.url); } $('.url a', row).css('display', 'block'); } $(entries).append(row); $(entries).parent().prop({ scrollTop: $(entries).parent().prop("scrollHeight") }); } function setFilter(level) { activeFilter = level; console.log('activeFilter = '+level); if(level == 'all') $('.entry', entries).show(); else { $('.entry:not(.'+level.toLowerCase()+')', entries).hide(); $('.entry.'+level.toLowerCase(), entries).show(); } } function setPreferences(p){ var val = p; var exp=new Date(); exp.setDate(exp.getDate() + 365); val = escape(val) + ((exp==null) ? "" : "; expires="+exp.toUTCString()); document.cookie = prefCookie + "=" + val; } function getPreferences() { var i,x,y,jar =document.cookie.split(";"); for (i = 0; i < jar.length; i++) { x = jar[i].substr(0,jar[i].indexOf("=")); x = x.replace(/^\s+|\s+$/g,""); if (x == prefCookie) { y = jar[i].substr(jar[i].indexOf("=")+1); return unescape(y); } } return false; } function getTimeLabel(ts) { var h = ts.getHours().toString(); var m = ts.getMinutes().toString(); var s = ts.getSeconds().toString(); var ms = ts.getMilliseconds().toString(); return h + ":" + (m.length > 1 ? m : "0"+m) + ":" + (s.length > 1 ? s : "0"+s) + ":" + (ms.length > 2 ? ms : (ms.length > 1 ? "0"+ms : "00"+ms)); } function togglefilters(a) { if(a == 'show' || parseInt($(filters).css('height'),10) == 0) { $(filters).animate({height:50}, 200); } else { $(filters).animate({height:0}, 200); } } function exportStack(level) { if(level && level.length > 0) { var items = []; for(var i = 0; i < stack.length; i++) { if(stack[i].level == level) items.push(stack[i]); } return items; } return stack; } function openUrl(a, params) { try { params = $.parseJSON(params); } catch(e) { params = 0; log('error parsing JSON params for openUrl()', 'error'); } if(params) { var pos = $(a).position(); $(urlBox).css('left', parseInt(pos.left, 10)-200); $(urlBox).css('top', parseInt(pos.top, 10)+20); $('#api', urlBox).attr('href', buildApiUrl(params)); $('#search', urlBox).attr('href', buildSearchUrl(params)); $(a).parent().append(urlBox); $(urlBox).show(); } } function buildApiUrl(p){ return "http://ia1-p:10009/apiservice/debug?"+ "runtype=byParams"+ "&session="+p.sessionid+ "&imageUrl="+p.imageURL+ "&imageTitle="+p.imageTitle+ "&documentTitle="+p.documentTitle+ "&imageRelatedTitle="+p.imageRelatedText+ "&productUrl="+p.productUrl+ "&merchantName="+p.merchantName+ //"&partnerID=&imageType=&sourceId=&identicalOnly=&country=&minimumQuality= "&pageType="+p.pageType; //&presentationType=&siteOrigin=&cardPriorities="; } function buildSearchUrl(p){ return "http://wa1-p:7004/Search/debug?"+ "session="+p.sessionid+ "&requestType=byUrl"+ "&url="+p.imageURL+ "&imageTitle="+p.imageTitle+ "&documentTitle="+p.documentTitle+ "&imageRelatedText="+p.imageRelatedText+ "&pageUrl="+window.location.href; //&partnerId=&country="; } function init(jquery) { if(!dom) { $ = jquery; dom = $(logHtml); $('head').append(''); $('body').append(dom); filters = $('#filters', dom); entries = $('#entries', dom); urlBox = $(urlBox); for(var i = 0; i < levels.length; i++){ $('#free', filters).before("") } //bind ui events: $('button.filter', filters).click(function() { $('button.filter', filters).removeClass('active'); $(this).addClass('active'); var filter = $(this).text(); setFilter(filter); setPreferences(filter); }); $('#clear', filters).click(function() { $('input[type="text"]', filters).val('').focus(); }); $('input[type="text"]', filters).keyup(function(e) { if($(this).val() == '') setFilter('all'); else { for(var i = 0; i < levels.length; i++) { if($(this).val() == levels[i]) { setFilter(levels[i]); } } } }); $(entries).on('click', '.search .url a', function(e) { var entryId = $(this).closest('tr').prop('id'); var entry = stack[entryId]; openUrl(this, entry.url); //entry.url is params json if(e.preventDefault) e.preventDefault(); else e.returnValue = false; //e.stopImmediatePropagation(); return false; }); $("#entries-wrap", dom).scroll(function(){ $("#url-box", dom).hide(); }); //init draggable: /*if(typeof jQuery.ui == 'undefined') { $('head').append('