diff options
author | Thomas Steur <thomas.steur@gmail.com> | 2015-12-04 06:15:03 +0300 |
---|---|---|
committer | Thomas Steur <thomas.steur@gmail.com> | 2015-12-04 06:15:03 +0300 |
commit | 4d45f92a5e99ba207c5f241bf129693844150088 (patch) | |
tree | 4be3274e45e46a1ddfffa7d34fc1581cf075095f | |
parent | 66a15fd6457df333fa3e8bdd0a5c80674ca99dc4 (diff) |
fix jslint
-rw-r--r-- | js/piwik.js | 9 | ||||
-rw-r--r-- | piwik.js | 4 | ||||
-rw-r--r-- | tests/javascript/index.php | 2 |
3 files changed, 8 insertions, 7 deletions
diff --git a/js/piwik.js b/js/piwik.js index a2fc4c0595..fa05e5e58d 100644 --- a/js/piwik.js +++ b/js/piwik.js @@ -1021,7 +1021,7 @@ if (typeof JSON2 !== 'object' && typeof window.JSON === 'object' && window.JSON. trackVisibleContentImpressions, isTrackOnlyVisibleContentEnabled, port, isUrlToCurrentDomain, isNodeAuthorizedToTriggerInteraction, replaceHrefIfInternalLink, getConfigDownloadExtensions, disableLinkTracking, substr, setAnyAttribute, wasContentTargetAttrReplaced, max, abs, childNodes, compareDocumentPosition, body, - getConfigVisitorCookieTimeout, getRemainingVisitorCookieTimeout, getDomains, + getConfigVisitorCookieTimeout, getRemainingVisitorCookieTimeout, getDomains, getConfigCookiePath, newVisitor, uuid, createTs, visitCount, currentVisitTs, lastVisitTs, lastEcommerceOrderTs, "", "\b", "\t", "\n", "\f", "\r", "\"", "\\", apply, call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, lastIndex, length, parse, prototype, push, replace, @@ -4927,7 +4927,8 @@ if (typeof Piwik !== 'object') { // also a config alias allowing "apache.piwik/foo". In this case we're not allowed to set // the cookie for "/foo/bar" but "/foo" var pathAliasParts = aliasPath.split('/'); - for (var i = 2; i < pathAliasParts.length; i++) { + var i; + for (i = 2; i < pathAliasParts.length; i++) { var lessRestrctivePath = pathAliasParts.slice(0, i).join('/'); if (isSiteHostPath(aliasDomain, lessRestrctivePath)) { aliasPath = lessRestrctivePath; @@ -5528,10 +5529,8 @@ if (typeof Piwik !== 'object') { var hasDomainAliasAlready = false, i; for (i in configHostsAlias) { - var configHostAliasDomain = domainFixup(String(configHostsAlias[i])); - if (Object.prototype.hasOwnProperty.call(configHostsAlias, i) - && isSameHost(domainAlias, configHostAliasDomain)) { + && isSameHost(domainAlias, domainFixup(String(configHostsAlias[i])))) { hasDomainAliasAlready = true; if (!configCookiePath) { @@ -52,10 +52,10 @@ if(!ax(cB)&&cz.wasContentTargetAttrReplaced){S.setAnyAttribute(cz,n.CONTENT_TARG for(cz=0;cz<cA.length;cz++){if(!n.isNodeVisible(cA[cz])){cA.splice(cz,1);cz--}}if(!cA||!cA.length){return[]}return bZ(cA)}function ak(cB,cz,cA){var cC=n.buildImpressionRequestParams(cB,cz,cA);return bU(cC,null,"contentImpression")}function cu(cC,cA){if(!cC){return}var cz=n.findParentContentNode(cC);var cB=n.buildContentBlock(cz);if(!cB){return}if(!cA){cA="Unknown"}return ar(cA,cB.name,cB.piece,cB.target)}function ca(cA,cC,cz,cB){return"e_c="+m(cA)+"&e_a="+m(cC)+(y(cz)?"&e_n="+m(cz):"")+(y(cB)?"&e_v="+m(cB):"")}function ad(cB,cD,cz,cC,cE){if(String(cB).length===0||String(cD).length===0){return false}var cA=bU(ca(cB,cD,cz,cC),cE,"event");ba(cA,bd)}function bC(cz,cC,cA,cD){var cB=bU("search="+m(cz)+(cC?"&search_cat="+m(cC):"")+(y(cA)?"&search_count="+cA:""),cD,"sitesearch");ba(cB,bd)}function ce(cz,cC,cB){var cA=bU("idgoal="+cz+(cC?"&revenue="+cC:""),cB,"goal");ba(cA,bd)}function cl(cC,cz,cG,cF,cB){var cE=cz+"="+m(bv(cC));var cA=bW(cB,"click",cC);if(cA){cE+="&"+cA}var cD=bU(cE,cG,"link");ba(cD,(cF?0:bd),cF) }function bm(cA,cz){if(cA!==""){return cA+cz.charAt(0).toUpperCase()+cz.slice(1)}return cz}function bK(cE){var cD,cz,cC=["","webkit","ms","moz"],cB;if(!aQ){for(cz=0;cz<cC.length;cz++){cB=cC[cz];if(Object.prototype.hasOwnProperty.call(w,bm(cB,"hidden"))){if(w[bm(cB,"visibilityState")]==="prerender"){cD=true}break}}}if(cD){X(w,cB+"visibilitychange",function cA(){w.removeEventListener(cB+"visibilitychange",cA,false);cE()});return}cE()}function an(cz){if(w.readyState==="complete"){cz()}else{if(I.addEventListener){I.addEventListener("load",cz)}else{if(I.attachEvent){I.attachEvent("onLoad",cz)}}}}function aO(cA){var cz=false;if(w.attachEvent){cz=w.readyState==="complete"}else{cz=w.readyState!=="loading"}if(cz){cA()}else{if(w.addEventListener){w.addEventListener("DOMContentLoaded",cA)}else{if(w.attachEvent){w.attachEvent("onreadystatechange",cA)}}}}function b5(cz){var cA=ct(cz);if(cA&&cA.type){cA.href=j(cA.href);cl(cA.href,cA.type,undefined,null,cz)}}function bY(){return w.all&&!w.addEventListener }function cg(cz){var cB=cz.which;var cA=(typeof cz.button);if(!cB&&cA!=="undefined"){if(bY()){if(cz.button&1){cB=1}else{if(cz.button&2){cB=3}else{if(cz.button&4){cB=2}}}}else{if(cz.button===0||cz.button==="0"){cB=1}else{if(cz.button&1){cB=2}else{if(cz.button&2){cB=3}}}}}return cB}function bn(cz){switch(cg(cz)){case 1:return"left";case 2:return"middle";case 3:return"right"}}function aD(cz){return cz.target||cz.srcElement}function ag(cz){return function(cC){cC=cC||I.event;var cB=bn(cC);var cD=aD(cC);if(cC.type==="click"){var cA=false;if(cz&&cB==="middle"){cA=true}if(cD&&!cA){b5(cD)}}else{if(cC.type==="mousedown"){if(cB==="middle"&&cD){au=cB;a7=cD}else{au=a7=null}}else{if(cC.type==="mouseup"){if(cB===au&&cD===a7){b5(cD)}au=a7=null}else{if(cC.type==="contextmenu"){b5(cD)}}}}}}function aa(cA,cz){X(cA,"click",ag(cz),false);if(cz){X(cA,"mouseup",ag(cz),false);X(cA,"mousedown",ag(cz),false);X(cA,"contextmenu",ag(cz),false)}}function a8(cA){if(!Z){Z=true;var cB,cz=aC(a6,"ignore"),cC=w.links;if(cC){for(cB=0; -cB<cC.length;cB++){if(!cz.test(cC[cB].className)){aa(cC[cB],cA)}}}}}function av(cB,cD,cE){if(bI){return true}bI=true;var cF=false;var cC,cA;function cz(){cF=true}an(function(){function cG(cI){setTimeout(function(){if(!bI){return}cF=false;cE.trackVisibleContentImpressions();cG(cI)},cI)}function cH(cI){setTimeout(function(){if(!bI){return}if(cF){cF=false;cE.trackVisibleContentImpressions()}cH(cI)},cI)}if(cB){cC=["scroll","resize"];for(cA=0;cA<cC.length;cA++){if(w.addEventListener){w.addEventListener(cC[cA],cz)}else{I.attachEvent("on"+cC[cA],cz)}}cH(100)}if(cD&&cD>0){cD=parseInt(cD,10);cG(cD)}})}function aK(cD,cF){var cE=bN(cD);var cC=bN(cF);if(!cE||cE==="/"||!cC||cC==="/"){return}var cB=A(cD);if(ab(cB,"/")){return}if(cm(cE,"/")){cE=aP(cE,1)}var cG=cE.split("/");for(var cA=2;cA<cG.length;cA++){var cz=cG.slice(0,cA).join("/");if(ab(cB,cz)){cE=cz;break}}if(!aF(cC,cE)){return}return cE}function b3(){var cA,cB,cC={pdf:"application/pdf",qt:"video/quicktime",realp:"audio/x-pn-realaudio-plugin",wma:"application/x-mplayer2",dir:"application/x-director",fla:"application/x-shockwave-flash",java:"application/x-java-vm",gears:"application/x-googlegears",ag:"application/x-silverlight"},cz=I.devicePixelRatio||1; +cB<cC.length;cB++){if(!cz.test(cC[cB].className)){aa(cC[cB],cA)}}}}}function av(cB,cD,cE){if(bI){return true}bI=true;var cF=false;var cC,cA;function cz(){cF=true}an(function(){function cG(cI){setTimeout(function(){if(!bI){return}cF=false;cE.trackVisibleContentImpressions();cG(cI)},cI)}function cH(cI){setTimeout(function(){if(!bI){return}if(cF){cF=false;cE.trackVisibleContentImpressions()}cH(cI)},cI)}if(cB){cC=["scroll","resize"];for(cA=0;cA<cC.length;cA++){if(w.addEventListener){w.addEventListener(cC[cA],cz)}else{I.attachEvent("on"+cC[cA],cz)}}cH(100)}if(cD&&cD>0){cD=parseInt(cD,10);cG(cD)}})}function aK(cD,cF){var cE=bN(cD);var cC=bN(cF);if(!cE||cE==="/"||!cC||cC==="/"){return}var cB=A(cD);if(ab(cB,"/")){return}if(cm(cE,"/")){cE=aP(cE,1)}var cG=cE.split("/");var cA;for(cA=2;cA<cG.length;cA++){var cz=cG.slice(0,cA).join("/");if(ab(cB,cz)){cE=cz;break}}if(!aF(cC,cE)){return}return cE}function b3(){var cA,cB,cC={pdf:"application/pdf",qt:"video/quicktime",realp:"audio/x-pn-realaudio-plugin",wma:"application/x-mplayer2",dir:"application/x-director",fla:"application/x-shockwave-flash",java:"application/x-java-vm",gears:"application/x-googlegears",ag:"application/x-silverlight"},cz=I.devicePixelRatio||1; if(!((new RegExp("MSIE")).test(e.userAgent))){if(e.mimeTypes&&e.mimeTypes.length){for(cA in cC){if(Object.prototype.hasOwnProperty.call(cC,cA)){cB=e.mimeTypes[cC[cA]];cq[cA]=(cB&&cB.enabledPlugin)?"1":"0"}}}if(typeof navigator.javaEnabled!=="unknown"&&y(e.javaEnabled)&&e.javaEnabled()){cq.java="1"}if(r(I.GearsFactory)){cq.gears="1"}cq.cookie=by()}cq.res=M.width*cz+"x"+M.height*cz}b3();aR();ao();return{getVisitorId:function(){return aA().uuid},getVisitorInfo:function(){return b9()},getAttributionInfo:function(){return bg()},getAttributionCampaignName:function(){return bg()[0]},getAttributionCampaignKeyword:function(){return bg()[1]},getAttributionReferrerTimestamp:function(){return bg()[2]},getAttributionReferrerUrl:function(){return bg()[3]},setTrackerUrl:function(cz){ai=cz},getTrackerUrl:function(){return ai},getSiteId:function(){return bz},setSiteId:function(cz){bw(cz)},setUserId:function(cz){if(!y(cz)||!cz.length){return}a5=cz;bi=bA(a5).substr(0,16)},getUserId:function(){return a5},setCustomData:function(cz,cA){if(L(cz)){Y=cz }else{if(!Y){Y={}}Y[cz]=cA}},getCustomData:function(){return Y},setCustomRequestProcessing:function(cz){bE=cz},appendToTrackingUrl:function(cz){cj=cz},getRequest:function(cz){return bU(cz)},addPlugin:function(cz,cA){a[cz]=cA},setCustomDimension:function(cz,cA){cz=parseInt(cz,10);if(cz>0){if(!y(cA)){cA=""}if(!o(cA)){cA=String(cA)}aV[cz]=cA}},getCustomDimension:function(cz){cz=parseInt(cz,10);if(cz>0&&Object.prototype.hasOwnProperty.call(aV,cz)){return aV[cz]}},deleteCustomDimension:function(cz){cz=parseInt(cz,10);if(cz>0){delete aV[cz]}},setCustomVariable:function(cA,cz,cD,cB){var cC;if(!y(cB)){cB="visit"}if(!y(cz)){return}if(!y(cD)){cD=""}if(cA>0){cz=!o(cz)?String(cz):cz;cD=!o(cD)?String(cD):cD;cC=[cz.slice(0,a1),cD.slice(0,a1)];if(cB==="visit"||cB===2){b2();at[cA]=cC}else{if(cB==="page"||cB===3){bp[cA]=cC}else{if(cB==="event"){bO[cA]=cC}}}}},getCustomVariable:function(cA,cB){var cz;if(!y(cB)){cB="visit"}if(cB==="page"||cB===3){cz=bp[cA]}else{if(cB==="event"){cz=bO[cA]}else{if(cB==="visit"||cB===2){b2(); -cz=at[cA]}}}if(!y(cz)||(cz&&cz[0]==="")){return false}return cz},deleteCustomVariable:function(cz,cA){if(this.getCustomVariable(cz,cA)){this.setCustomVariable(cz,"","",cA)}},storeCustomVariablesInCookie:function(){bk=true},setLinkTrackingTimer:function(cz){bd=cz},setDownloadExtensions:function(cz){if(o(cz)){cz=cz.split("|")}cp=cz},addDownloadExtensions:function(cA){var cz;if(o(cA)){cA=cA.split("|")}for(cz=0;cz<cA.length;cz++){cp.push(cA[cz])}},removeDownloadExtensions:function(cB){var cA,cz=[];if(o(cB)){cB=cB.split("|")}for(cA=0;cA<cp.length;cA++){if(B(cB,cp[cA])===-1){cz.push(cp[cA])}}cp=cz},setDomains:function(cz){ae=o(cz)?[cz]:cz;var cC=false,cA;for(cA in ae){var cB=A(String(ae[cA]));if(Object.prototype.hasOwnProperty.call(ae,cA)&&b4(cf,cB)){cC=true;if(!aY){var cD=aK(ae[cA],bh);if(cD){this.setCookiePath(cD)}break}}}if(!cC){ae.push(cf)}},setIgnoreClasses:function(cz){a6=o(cz)?[cz]:cz},setRequestMethod:function(cz){cs=cz||bL},setRequestContentType:function(cz){bX=cz||am},setReferrerUrl:function(cz){aW=cz +cz=at[cA]}}}if(!y(cz)||(cz&&cz[0]==="")){return false}return cz},deleteCustomVariable:function(cz,cA){if(this.getCustomVariable(cz,cA)){this.setCustomVariable(cz,"","",cA)}},storeCustomVariablesInCookie:function(){bk=true},setLinkTrackingTimer:function(cz){bd=cz},setDownloadExtensions:function(cz){if(o(cz)){cz=cz.split("|")}cp=cz},addDownloadExtensions:function(cA){var cz;if(o(cA)){cA=cA.split("|")}for(cz=0;cz<cA.length;cz++){cp.push(cA[cz])}},removeDownloadExtensions:function(cB){var cA,cz=[];if(o(cB)){cB=cB.split("|")}for(cA=0;cA<cp.length;cA++){if(B(cB,cp[cA])===-1){cz.push(cp[cA])}}cp=cz},setDomains:function(cz){ae=o(cz)?[cz]:cz;var cB=false,cA;for(cA in ae){if(Object.prototype.hasOwnProperty.call(ae,cA)&&b4(cf,A(String(ae[cA])))){cB=true;if(!aY){var cC=aK(ae[cA],bh);if(cC){this.setCookiePath(cC)}break}}}if(!cB){ae.push(cf)}},setIgnoreClasses:function(cz){a6=o(cz)?[cz]:cz},setRequestMethod:function(cz){cs=cz||bL},setRequestContentType:function(cz){bX=cz||am},setReferrerUrl:function(cz){aW=cz },setCustomUrl:function(cz){aG=bo(bh,cz)},setDocumentTitle:function(cz){aS=cz},setAPIUrl:function(cz){bc=cz},setDownloadClasses:function(cz){bf=o(cz)?[cz]:cz},setLinkClasses:function(cz){aJ=o(cz)?[cz]:cz},setCampaignNameKey:function(cz){bT=o(cz)?[cz]:cz},setCampaignKeywordKey:function(cz){bb=o(cz)?[cz]:cz},discardHashTag:function(cz){bj=cz},setCookieNamePrefix:function(cz){aT=cz;at=bq()},setCookieDomain:function(cz){var cA=A(cz);if(a3(cA)){ch=cA;aR()}},setCookiePath:function(cz){aY=cz;aR()},setVisitorCookieTimeout:function(cz){b7=cz*1000},setSessionCookieTimeout:function(cz){bR=cz*1000},setReferralCookieTimeout:function(cz){co=cz*1000},setConversionAttributionFirstReferrer:function(cz){a2=cz},disableCookies:function(){aU=true;cq.cookie="0";if(bz){aj()}},deleteCookies:function(){aj()},setDoNotTrack:function(cA){var cz=e.doNotTrack||e.msDoNotTrack;cb=cA&&(cz==="yes"||cz==="1");if(cb){this.disableCookies()}},addListener:function(cA,cz){aa(cA,cz)},enableLinkTracking:function(cz){cr=true;if(q){a8(cz) }else{G.push(function(){a8(cz)})}},enableJSErrorTracking:function(){if(cd){return}cd=true;var cz=I.onerror;I.onerror=function(cE,cC,cB,cD,cA){bK(function(){var cF="JavaScript Errors";var cG=cC+":"+cB;if(cD){cG+=":"+cD}ad(cF,cG,cE)});if(cz){return cz(cE,cC,cB,cD,cA)}return false}},disablePerformanceTracking:function(){aE=false},setGenerationTimeMs:function(cz){bP=parseInt(cz,10)},enableHeartBeatTimer:function(cz){cz=Math.max(cz,1);aH=(cz||15)*1000;if(ci!==null){cx()}},killFrame:function(){if(I.location!==I.top.location){I.top.location=I.location}},redirectFile:function(cz){if(I.location.protocol==="file:"){I.location=cz}},setCountPreRendered:function(cz){aQ=cz},trackGoal:function(cz,cB,cA){bK(function(){ce(cz,cB,cA)})},trackLink:function(cA,cz,cC,cB){bK(function(){cl(cA,cz,cC,cB)})},trackPageView:function(cz,cA){bD=[];if(C(bz)){bK(function(){O(ai,bc,bz)})}else{bK(function(){bt(cz,cA)})}},trackAllContentImpressions:function(){if(C(bz)){return}bK(function(){aO(function(){var cz=n.findContentNodes(); var cA=bZ(cz);cw(cA,bd)})})},trackVisibleContentImpressions:function(cz,cA){if(C(bz)){return}if(!y(cz)){cz=true}if(!y(cA)){cA=750}av(cz,cA,this);bK(function(){an(function(){var cB=n.findContentNodes();var cC=aL(cB);cw(cC,bd)})})},trackContentImpression:function(cB,cz,cA){if(C(bz)){return}if(!cB){return}cz=cz||"Unknown";bK(function(){var cC=ak(cB,cz,cA);ba(cC,bd)})},trackContentImpressionsWithinNode:function(cz){if(C(bz)||!cz){return}bK(function(){if(bI){an(function(){var cA=n.findContentNodesWithinNode(cz);var cB=aL(cA);cw(cB,bd)})}else{aO(function(){var cA=n.findContentNodesWithinNode(cz);var cB=bZ(cA);cw(cB,bd)})}})},trackContentInteraction:function(cB,cC,cz,cA){if(C(bz)){return}if(!cB||!cC){return}cz=cz||"Unknown";bK(function(){var cD=ar(cB,cC,cz,cA);ba(cD,bd)})},trackContentInteractionNode:function(cA,cz){if(C(bz)||!cA){return}bK(function(){var cB=cu(cA,cz);ba(cB,bd)})},logAllContentBlocksOnPage:function(){var cA=n.findContentNodes();var cz=n.collectContent(cA);if(console!==undefined&&console&&console.log){console.log(cz) diff --git a/tests/javascript/index.php b/tests/javascript/index.php index 0cb1d002b1..60d7f11558 100644 --- a/tests/javascript/index.php +++ b/tests/javascript/index.php @@ -2454,6 +2454,8 @@ function PiwikTest() { tracker.setCookiePath(null); tracker.setDomains( ['.' + domainAlias + '/another/one', '.example.org/tests/javascript', '.example.com/tests'] ); equal(null, tracker.getConfigCookiePath()), 'should not set a path when no domain and no path matches'; + + tracker.setCookiePath(null); }); test("Tracker getClassesRegExp()", function() { |