diff options
author | Anthon Pang <apang@softwaredevelopment.ca> | 2013-03-24 01:56:05 +0400 |
---|---|---|
committer | Anthon Pang <apang@softwaredevelopment.ca> | 2013-03-24 08:53:48 +0400 |
commit | e233ebaa002ccc20590e7f1ea4247189a873a665 (patch) | |
tree | e9b15d171e9ae9ebf5da8a6ba11fa3b4feec04a6 | |
parent | 84168836dad6877dafe3ab3693d212b5cd04ea09 (diff) |
remove tabs and fix jslint error
-rw-r--r-- | js/piwik.js | 67 | ||||
-rw-r--r-- | piwik.js | 2 |
2 files changed, 35 insertions, 34 deletions
diff --git a/js/piwik.js b/js/piwik.js index 42a493363e..6472f9d1fb 100644 --- a/js/piwik.js +++ b/js/piwik.js @@ -408,7 +408,7 @@ if (!this.JSON2) { setCustomVariable, getCustomVariable, deleteCustomVariable, setDownloadExtensions, addDownloadExtensions, setDomains, setIgnoreClasses, setRequestMethod, - setReferrerUrl, setCustomUrl, setDocumentTitle, + setReferrerUrl, setCustomUrl, setAPIUrl, setDocumentTitle, setDownloadClasses, setLinkClasses, setCampaignNameKey, setCampaignKeywordKey, discardHashTag, @@ -955,13 +955,14 @@ var ************************************************************/ function getPiwikUrlForOverlay(trackerUrl, apiUrl) { - if (apiUrl) { - return apiUrl; - } - + if (apiUrl) { + return apiUrl; + } + if (trackerUrl.slice(-9) === 'piwik.php') { trackerUrl = trackerUrl.slice(0, trackerUrl.length - 9); } + return trackerUrl; } @@ -975,26 +976,26 @@ var function isOverlaySession(configTrackerSiteId) { var windowName = 'Piwik_Overlay'; - // check whether we were redirected from the piwik overlay plugin + // check whether we were redirected from the piwik overlay plugin var referrerRegExp = new RegExp('index\\.php\\?module=Overlay&action=startOverlaySession' - + '&idsite=([0-9]+)&period=([^&]+)&date=([^&]+)$'); + + '&idsite=([0-9]+)&period=([^&]+)&date=([^&]+)$'); - var match = referrerRegExp.exec(documentAlias.referrer); - - if (match) { - // check idsite - var idsite = match[1]; + var match = referrerRegExp.exec(documentAlias.referrer); - if (idsite !== String(configTrackerSiteId)) { - return false; - } + if (match) { + // check idsite + var idsite = match[1]; - // store overlay session info in window name - var period = match[2], - date = match[3]; + if (idsite !== String(configTrackerSiteId)) { + return false; + } + + // store overlay session info in window name + var period = match[2], + date = match[3]; - windowAlias.name = windowName + '###' + period + '###' + date; - } + windowAlias.name = windowName + '###' + period + '###' + date; + } // retrieve and check data from window name var windowNameParts = windowAlias.name.split('###'); @@ -1012,7 +1013,7 @@ var piwikUrl = getPiwikUrlForOverlay(configTrackerUrl, configApiUrl); loadScript( - piwikUrl + 'plugins/Overlay/client/client.js?v=1', + piwikUrl + 'plugins/Overlay/client/client.js?v=1', function () { Piwik_Overlay_Client.initialize(piwikUrl, configTrackerSiteId, period, date); } @@ -1055,9 +1056,9 @@ var // Tracker URL configTrackerUrl = trackerUrl || '', - - // API URL (only set if it differs from the Tracker URL) - configApiUrl = '', + + // API URL (only set if it differs from the Tracker URL) + configApiUrl = '', // This string is appended to the Tracker URL Request (eg. to send data that is not handled by the existin setters/getters) configAppendToTrackingUrl = '', @@ -2491,15 +2492,15 @@ var configTitle = title; }, - /** - * Set the URL of the Piwik API. It is used for Page Overlay. - * This method should only be called when the API URL differs from the tracker URL. - * - * @param string apiUrl - */ - setAPIUrl: function (apiUrl) { - configApiUrl = apiUrl; - }, + /** + * Set the URL of the Piwik API. It is used for Page Overlay. + * This method should only be called when the API URL differs from the tracker URL. + * + * @param string apiUrl + */ + setAPIUrl: function (apiUrl) { + configApiUrl = apiUrl; + }, /** * Set array of classes to be treated as downloads @@ -27,4 +27,4 @@ aa=bj}else{aD=aa=null}}else{if(bh.type==="mouseup"){if(bi===aD&&bj===aa){aS(bj)} }else{if(bj==="visit"||bj===2){O();bh=S[bi]}}if(!q(bh)||(bh&&bh[0]==="")){return false}return bh},deleteCustomVariable:function(bh,bi){if(this.getCustomVariable(bh,bi)){this.setCustomVariable(bh,"","",bi)}},setLinkTrackingTimer:function(bh){aH=bh},setDownloadExtensions:function(bh){ap=bh},addDownloadExtensions:function(bh){ap+="|"+bh},setDomains:function(bh){aJ=j(bh)?[bh]:bh;aJ.push(a0)},setIgnoreClasses:function(bh){T=j(bh)?[bh]:bh},setRequestMethod:function(bh){aL=bh||"GET"},setReferrerUrl:function(bh){aN=bh},setCustomUrl:function(bh){ax=aZ(be,bh)},setDocumentTitle:function(bh){an=bh},setAPIUrl:function(bh){ae=bh},setDownloadClasses:function(bh){aB=j(bh)?[bh]:bh},setLinkClasses:function(bh){ag=j(bh)?[bh]:bh},setCampaignNameKey:function(bh){ar=j(bh)?[bh]:bh},setCampaignKeywordKey:function(bh){am=j(bh)?[bh]:bh},discardHashTag:function(bh){V=bh},setCookieNamePrefix:function(bh){bc=bh;S=ab()},setCookieDomain:function(bh){Z=s(bh);aE()},setCookiePath:function(bh){bd=bh;aE()},setVisitorCookieTimeout:function(bh){ad=bh*1000 },setSessionCookieTimeout:function(bh){af=bh*1000},setReferralCookieTimeout:function(bh){ay=bh*1000},setConversionAttributionFirstReferrer:function(bh){aw=bh},disableCookies:function(){X=true;a5.cookie="0"},setDoNotTrack:function(bi){var bh=c.doNotTrack||c.msDoNotTrack;a7=bi&&(bh==="yes"||bh==="1");if(a7){this.disableCookies()}},addListener:function(bi,bh){aR(bi,bh)},enableLinkTracking:function(bh){if(l){az(bh)}else{w.push(function(){az(bh)})}},setHeartBeatTimer:function(bj,bi){var bh=new Date();U=bh.getTime()+bj*1000;ai=bi*1000},killFrame:function(){if(y.location!==y.top.location){y.top.location=y.location}},redirectFile:function(bh){if(y.location.protocol==="file:"){y.location=bh}},setCountPreRendered:function(bh){au=bh},trackGoal:function(bh,bj,bi){ak(function(){aF(bh,bj,bi)})},trackLink:function(bi,bh,bj){ak(function(){a2(bi,bh,bj)})},trackPageView:function(bh,bi){if(t(a4)){ak(function(){D(P,ae,a4)})}else{ak(function(){aA(bh,bi)})}},trackSiteSearch:function(bh,bj,bi){ak(function(){al(bh,bj,bi) })},setEcommerceView:function(bk,bh,bj,bi){if(!q(bj)||!bj.length){bj=""}else{if(bj instanceof Array){bj=JSON2.stringify(bj)}}aC[5]=["_pkc",bj];if(q(bi)&&String(bi).length){aC[2]=["_pkp",bi]}if((!q(bk)||!bk.length)&&(!q(bh)||!bh.length)){return}if(q(bk)&&bk.length){aC[3]=["_pks",bk]}if(!q(bh)||!bh.length){bh=""}aC[4]=["_pkn",bh]},addEcommerceItem:function(bl,bh,bj,bi,bk){if(bl.length){aT[bl]=[bl,bh,bj,bi,bk]}},trackEcommerceOrder:function(bh,bl,bk,bj,bi,bm){aX(bh,bl,bk,bj,bi,bm)},trackEcommerceCartUpdate:function(bh){bb(bh)}}}function p(){return{push:I}}L(y,"beforeunload",J,false);k();Date.prototype.getTimeAlias=Date.prototype.getTime;C=new v();for(F=0;F<_paq.length;F++){if(_paq[F][0]==="setTrackerUrl"||_paq[F][0]==="setSiteId"){I(_paq[F]);delete _paq[F]}}for(F=0;F<_paq.length;F++){if(_paq[F]){I(_paq[F])}}_paq=new p();return{addPlugin:function(i,N){a[i]=N},getTracker:function(i,N){return new v(i,N)},getAsyncTracker:function(){return C}}}()),piwik_track,piwik_log=function(b,f,d,g){function a(h){try{return eval("piwik_"+h) -}catch(i){}return}var c,e=Piwik.getTracker(d,f);e.setDocumentTitle(b);e.setCustomData(g);c=a("tracker_pause");if(c){e.setLinkTrackingTimer(c)}c=a("download_extensions");if(c){e.setDownloadExtensions(c)}c=a("hosts_alias");if(c){e.setDomains(c)}c=a("ignore_classes");if(c){e.setIgnoreClasses(c)}e.trackPageView();if(a("install_tracker")){piwik_track=function(i,k,j,h){e.setSiteId(k);e.setTrackerUrl(j);e.trackLink(i,h)};e.enableLinkTracking()}};
\ No newline at end of file +}catch(i){}return}var c,e=Piwik.getTracker(d,f);e.setDocumentTitle(b);e.setCustomData(g);c=a("tracker_pause");if(c){e.setLinkTrackingTimer(c)}c=a("download_extensions");if(c){e.setDownloadExtensions(c)}c=a("hosts_alias");if(c){e.setDomains(c)}c=a("ignore_classes");if(c){e.setIgnoreClasses(c)}e.trackPageView();if(a("install_tracker")){piwik_track=function(i,k,j,h){e.setSiteId(k);e.setTrackerUrl(j);e.trackLink(i,h)};e.enableLinkTracking()}}; |