forked from suellenwang/Ars327_Final_Suellen-Wang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tr.js
1 lines (1 loc) · 7.77 KB
/
tr.js
1
(function(c,b){var d={ignoredTags:{"!":1,A:1,BUTTON:1,HEAD:1,HTML:1,INPUT:1,IMG:1,META:1,H1:1,H2:1,OPTION:1,SCRIPT:1,NOSCRIPT:1,SELECT:1,STYLE:1,TEXTAREA:1,TITLE:1,XML:1,SUP:1,LINK:1,LABEL:1,IFRAME:1},keywordList:[],goodword:{a2:1,a5:1,a6:1,c4:1,aa:1,bt:1,g3:1,c6:1,s3:1,s4:1,s6:1,c5:1,ka:1,mg:1,pr:1,cv:1,pa:1,hp:1,"3g":1,o2:1,cd:1,uk:1,po:1,thermal:1,theather:1,thessaloniki:1,thai:1,thailand:1,thames:1,tassos:1,sweepstake:1,sweepstakes:1,ad:1,at:1,as:1,a:1,an:1,be:1,by:1,go:1,hi:1,"in":1,"if":1,id:1,me:1,my:1,no:1,of:1,oh:1,on:1,or:1,so:1,to:1,us:1,up:1,we:1,tv:1},nodesMap:{},keywordsStr:"",maxNodes:800,maxKeywords:2000,elements:[b.body],usedWords:{},datl:0,tlFeedID:null,testMode:null,network:null,params:null,jsdomain:null};var i=(function(){var s=-1;var p=["www\\.amazon\\.","www\\.wine\\.com","www\\.ask\\.com","\\.softonic\\.com","www\\.linkedin\\.com","www\\.weather\\.com","www\\.huffingtonpost\\.com","www\\.godaddy\\.com","www\\.adobe\\.com","www\\.zillow\\.com","^wallmart\\.com","^conduit\\.com","^stackoverflow\\.com","www\\.trulia\\.com","www\\.swagbucks\\.com","www\\.nbcolympics\\.com","www\\.ehow\\.com","\\.time\\.com","www\\.coupons\\.com","^mashable\\.com","www\\.marketwatch\\.com","www\\.examiner\\.com","www\\.nfl\\.com","www\\.alibaba\\.com","www\\.npr\\.org","www\\.lulus\\.com","www\\.partsgeek\\.com","www\\.specialtys\\.com"];var t=function(){var u=p.length;for(var v=0;v<u;v++){var w=new RegExp(p[v],"ig");if(c.location.hostname.match(w)!=null){s=v;break}}};var q=function(w,u){var v=new RegExp("(?:^| )("+w+")(?:$| )");return v.test(u)};var o=function(){return s};var r=function(u){switch(s){case 0:if(u.id==="nav-search"||u.id==="nav_browse_flyout"||u.id==="gwcswA"||u.id==="gwcswB"||u.id==="nav-search-in"||q("a-button-text",u.className)||u.id==="canvasCaption"){return true}break;case 1:if(q("ui-btn-corners",u.className)){return true}break;case 2:if(q("mod-top-navigation",u.className)){return true}break;case 3:if(q("text_container",u.className)){return true}break;case 4:if(q("rollup-update-detail-hidden",u.className)||u.id==="global-search"||u.id==="you-recently-visited"){return true}break;case 5:if(q("ctrl-btn",u.className)){return true}break;case 6:if(u.id==="top_nav"||u.id==="hp_anywhere_wnd"){return true}break;case 7:if(u.id==="pch5"){return true}break;case 8:if(u.id==="shBar"){return true}break;case 9:if(q("nav-main",u.className)){return true}break;case 10:if(q("homePageNav",u.className)){return true}break;case 11:if(q("scrollerContainer",u.className)){return true}break;case 12:if(q("new-login-form",u.className)||u.id==="desc"){return true}break;case 13:if(q("container containerResponsive line h6 typeWeightNormal mvn",u.className)){return true}break;case 14:if(q("actionBtn",u.className)){return true}break;case 15:if(u.id==="block-menu-menu-owg-secondary-navigation"){return true}break;case 16:if(u.id==="primaryNav"){return true}break;case 17:if(q("social-box",u.className)){return true}break;case 18:if(q("sprite-pod circle",u.className)){return true}break;case 19:if(q("navbar",u.className)){return true}break;case 20:if(u.id==="toplevelnav"){return true}break;case 21:if(q("region--navigation",u.className)||q("visuallyhidden",u.className)){return true}break;case 22:if(q("main-nav",u.className)){return true}break;case 23:if(q("ls-cate",u.className)||q("J-tabs tabs",u.className)){return true}break;case 24:if(q("nav-primary",u.className)){return true}break;case 25:if(q("facet-wrap",u.className)||q("facets",u.className)){return true}break;case 26:if(u.id==="header_nav"){return true}break;case 27:if(u.id==="fixedHeader"){return true}break;default:return false}};return{check:t,popularDomain:o,sort:r}}());var n=function(p){var o=p.className.toString();return((p.getAttribute("id")!==null&&(p.getAttribute("id").indexOf("PXLINK_")===0||p.getAttribute("id").indexOf("IL_")===0||p.getAttribute("id").indexOf("uninstallPromptContainer")===0))||o.indexOf("noPXIntl")!==-1||o.indexOf("iau-wrapper")!==-1)};var k=function(p){if(p.length>25){return 0}p=p.toLowerCase();if(d.goodword[p]===1){return 1}var o=p.match(/^[a-z0-9\u00A1\u00BF\u00D7\u00DF-\u00FF][a-z0-9\\-\u00A1\u00BF\u00D7\u00DF-\u00FF]+("s|[a-z0-9\u00A1\u00BF\u00D7\u00DF-\u00FF])$/g);if(!o){return 0}return 1};var g=function(o){var p=/[,.:;?!(){}]/gi;o=o.replace(p," . ");o=o.toLowerCase();p=/[0-9]{5,}/gi;o=o.replace(p," ");if(o.indexOf("'")>=0){p=/( "|" )/gi;o=o.replace(p," . ")}return o};var h=function(s,r){if(s.length<=2){return}s=g(s);var q=s.split(" ");var o="";var t="";var u;for(var v=0;v<=q.length;v++){if(v!==q.length){u=c.PMO.Util.trim(q[v])}if(v!==q.length&&k(u)===1){if(o!==""){o+=" "}o+=u;d.usedWords[u]=d.usedWords[u]?d.usedWords[u]++:1}else{if(o!==""){var p=true;if(o.length>200){o=o.substring(0,o.lastIndexOf(" ",200))}if(o.indexOf(" ")<0&&d.usedWords[o]>1){p=false}if(p){d.keywordList.push(o)}if(t!==""){t+="|"}t+=o;o=""}}if(d.maxKeywords--<1&&o===""){break}}if(t!==""&&typeof d.nodesMap[t]==="undefined"){d.nodesMap[t]=r}};var f=function(r){if(d.ignoredTags[r.tagName.toUpperCase()]===1){return}else{if(r.tagName.toUpperCase()!=="BODY"&&(typeof r.onclick==="function"||typeof r.onmouseover==="function"||!c.PMO.Util.isElementVisible(r))){return}else{if(i.popularDomain()!==-1&&i.sort(r)){return}}}var u=r.childNodes;if(d.maxNodes--===0||d.maxKeywords<1){return}for(var p=0;p<u.length;p++){var v=u[p];if(v.parentNode!==r){continue}if(v.nodeType===1){if(n(v)){continue}else{f(v)}}else{if((v.nodeType===3)&&/[\w]{2,}/.test(v.data)){var o=c.PMO.Util.trim(v.data);var t=/[\s\n\r]/gi;o=o.replace(t," ");var s=/ +/gi;o=o.replace(s," ");var q=o.split(" ");if(q.length>=1){h(o,v)}}}}};var a=function(){try{d.keywordList=[];d.keywordsStr="";d.nodesMap={};d.maxNodes=800;d.maxKeywords=2000;if(b.location.protocol==="http:"){i.check();f(b.body);for(var p=0;p<d.keywordList.length;p++){var s=0;var r=false;while((s=d.keywordsStr.indexOf(d.keywordList[p],s+1))>=0){var o=d.keywordList[p].length+s;if(s>0&&d.keywordsStr.charAt(s-1)!==" "&&d.keywordsStr.charAt(s-1)!=="|"){continue}if(o<d.keywordsStr.length&&d.keywordsStr.charAt(o)!==" "&&d.keywordsStr.charAt(o)!=="|"){continue}r=true;break}if(!r){d.keywordsStr+=d.keywordList[p]+"|"}if(d.keywordsStr.length>6000){break}}d.keywordsStr=d.keywordsStr.substring(0,d.keywordsStr.length-1)}c.PMO.Interface.notify({type:"KWDRR",token:null,info:null,data:{keywords:d.keywordsStr,nodesMap:d.nodesMap},etc:{testMode:d.testMode}})}catch(q){c.PMO.Util.log({network:d.network,params:d.params,jsdomain:d.jsdomain,data:["tl-rsrv-err"]})}};var e=function(p){if(b.location.protocol==="http:"){d.testMode=p.etc.testMode;i.check();f(b.body);for(var q=0;q<d.keywordList.length;q++){var s=0;var r=false;while((s=d.keywordsStr.indexOf(d.keywordList[q],s+1))>=0){var o=d.keywordList[q].length+s;if(s>0&&d.keywordsStr.charAt(s-1)!==" "&&d.keywordsStr.charAt(s-1)!=="|"){continue}if(o<d.keywordsStr.length&&d.keywordsStr.charAt(o)!==" "&&d.keywordsStr.charAt(o)!=="|"){continue}r=true;break}if(!r){d.keywordsStr+=d.keywordList[q]+"|"}if(d.keywordsStr.length>6000){break}}d.keywordsStr=d.keywordsStr.substring(0,d.keywordsStr.length-1)}c.PMO.Interface.notify({type:"KWD",token:null,info:null,data:{keywords:d.keywordsStr,nodesMap:d.nodesMap},etc:{testMode:d.testMode}})};var j=function(){var o=c.PMO.Interface.getPrimaryConfig();d.network=o.network;d.params=o.params;d.jsdomain=o.jsdomain};var l=function(){try{if(typeof c.PMO.Interface!=="undefined"){if(c.PMO.Interface.checkModule("TRVS")){return}else{c.PMO.Interface.register({name:"TRVS",instance:this,events:{TRAVERSE:{type:"TRAVERSE",handler:e},TRAVERSERR:{type:"TRAVERSERR",handler:a}}})}}else{c.setTimeout(l,50)}}catch(o){c.PMO.Util.log({network:d.network,params:d.params,jsdomain:d.jsdomain,data:["trvs-reg-ex",c.PMO.Util.getExceptionInfo(o)]})}};var m=function(){if(typeof c.PMO.Interface!=="undefined"){if(typeof c.PMO.TRVS==="undefined"){c.PMO.TRVS="12345abcde";j();l()}}else{c.setTimeout(m,50)}};return{init:m}}(this,document)).init();