Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <thomas.steur@googlemail.com>2014-09-14 19:05:25 +0400
committerThomas Steur <thomas.steur@googlemail.com>2014-09-14 19:05:25 +0400
commite127384e57c076a96462da2f984919abadbcb85e (patch)
tree6b4847bdff5a7c1d4d0c9f14d5da0f2e81f6ce7b /piwik.js
parent78f9254cc62af38e7fdb2725bb32f71c2f766168 (diff)
refs #4996 we have to add build a fully qualified URL of the content piece in case we detect the URL of an image, video or audio, pdf, ... automatically. Otherwise we cannot display a preview in the UI and one would not know which URL was actually meant. Thinking about using //domain/path instead of http://domain/path as it would track different content pieces for http and https otherwise
Diffstat (limited to 'piwik.js')
-rw-r--r--piwik.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/piwik.js b/piwik.js
index d575e34af2..842d4ada10 100644
--- a/piwik.js
+++ b/piwik.js
@@ -22,7 +22,7 @@ break;case 3:ap=am.charCodeAt(X-3)<<24|am.charCodeAt(X-2)<<16|am.charCodeAt(X-1)
}if(this.hasNodeAttribute(Y,X)){return Y}var W=this.findNodesHavingAttribute(Y,X);if(W&&W.length){return W[0]}},findFirstNodeHavingAttributeWithValue:function(Z,Y){if(!Z||!Y){return}if(this.hasNodeAttributeWithValue(Z,Y)){return Z}var W=this.findNodesHavingAttribute(Z,Y);if(!W||!W.length){return}var X;for(X=0;X<W.length;X++){if(this.getAttributeValueFromNode(W[X],Y)){return W[X]}}},findNodesHavingCssClass:function(aa,Z,W){if(!W){W=[]}if(!aa||!Z){return W}if(aa.getElementsByClassName){var ab=aa.getElementsByClassName(Z);return this.htmlCollectionToArray(ab)}var Y=C(aa);if(!Y||!Y.length){return[]}var X,ac;for(X=0;X<Y.length;X++){ac=Y[X];if(this.hasNodeCssClass(ac,Z)){W.push(ac)}W=this.findNodesHavingCssClass(ac,Z,W)}return W},findFirstNodeHavingClass:function(Y,X){if(!Y||!X){return}if(this.hasNodeCssClass(Y,X)){return Y}var W=this.findNodesHavingCssClass(Y,X);if(W&&W.length){return W[0]}},isLinkElement:function(X){if(!X){return false}var W=String(X.nodeName).toLowerCase();var Z=["a","area"];
var Y=z(Z,W);return Y!==-1},setAnyAttribute:function(X,W,Y){if(!X||!W){return}if(X.setAttribute){X.setAttribute(W,Y)}else{X[W]=Y}}};var m={CONTENT_ATTR:"data-track-content",CONTENT_CLASS:"piwikTrackContent",CONTENT_NAME_ATTR:"data-content-name",CONTENT_PIECE_ATTR:"data-content-piece",CONTENT_PIECE_CLASS:"piwikContentPiece",CONTENT_TARGET_ATTR:"data-content-target",CONTENT_TARGET_CLASS:"piwikContentTarget",CONTENT_IGNOREINTERACTION_ATTR:"data-content-ignoreinteraction",CONTENT_IGNOREINTERACTION_CLASS:"piwikContentIgnoreInteraction",location:undefined,findContentNodes:function(){var X="."+this.CONTENT_CLASS;var W="["+this.CONTENT_ATTR+"]";var Y=Q.findMultiple([X,W]);return Y},findContentNodesWithinNode:function(Z){if(!Z){return[]}var X=Q.findNodesHavingCssClass(Z,this.CONTENT_CLASS);var W=Q.findNodesHavingAttribute(Z,this.CONTENT_ATTR);if(W&&W.length){var Y;for(Y=0;Y<W.length;Y++){X.push(W[Y])}}if(Q.hasNodeAttribute(Z,this.CONTENT_ATTR)){X.push(Z)}else{if(Q.hasNodeCssClass(Z,this.CONTENT_CLASS)){X.push(Z)
}}X=Q.makeNodesUnique(X);return X},findParentContentNode:function(X){if(!X){return}var Y=X;var W=0;while(Y&&Y!==u&&Y.parentNode){if(Q.hasNodeAttribute(Y,this.CONTENT_ATTR)){return Y}if(Q.hasNodeCssClass(Y,this.CONTENT_CLASS)){return Y}Y=Y.parentNode;if(W>1000){break}W++}},findPieceNode:function(X){var W;W=Q.findFirstNodeHavingAttribute(X,this.CONTENT_PIECE_ATTR);if(!W){W=Q.findFirstNodeHavingClass(X,this.CONTENT_PIECE_CLASS)}if(W){return W}return X},findTargetNodeNoDefault:function(W){if(!W){return}var X=Q.findFirstNodeHavingAttributeWithValue(W,this.CONTENT_TARGET_ATTR);if(X){return X}X=Q.findFirstNodeHavingAttribute(W,this.CONTENT_TARGET_ATTR);if(X){return X}X=Q.findFirstNodeHavingClass(W,this.CONTENT_TARGET_CLASS);if(X){return X}},findTargetNode:function(W){var X=this.findTargetNodeNoDefault(W);if(X){return X}return W},findContentName:function(X){if(!X){return}var aa=Q.findFirstNodeHavingAttributeWithValue(X,this.CONTENT_NAME_ATTR);if(aa){return Q.getAttributeValueFromNode(aa,this.CONTENT_NAME_ATTR)
-}var W=this.findContentPiece(X);if(W){return this.removeDomainIfIsInLink(W)}if(Q.hasNodeAttributeWithValue(X,"title")){return Q.getAttributeValueFromNode(X,"title")}var Y=this.findPieceNode(X);if(Q.hasNodeAttributeWithValue(Y,"title")){return Q.getAttributeValueFromNode(Y,"title")}var Z=this.findTargetNode(X);if(Q.hasNodeAttributeWithValue(Z,"title")){return Q.getAttributeValueFromNode(Z,"title")}},findContentPiece:function(X){if(!X){return}var Z=Q.findFirstNodeHavingAttributeWithValue(X,this.CONTENT_PIECE_ATTR);if(Z){return Q.getAttributeValueFromNode(Z,this.CONTENT_PIECE_ATTR)}var W=this.findPieceNode(X);var Y=this.findMediaUrlInNode(W);if(Y){return Y}},findContentTarget:function(Y){if(!Y){return}var Z=this.findTargetNode(Y);if(Q.hasNodeAttributeWithValue(Z,this.CONTENT_TARGET_ATTR)){return Q.getAttributeValueFromNode(Z,this.CONTENT_TARGET_ATTR)}var X;if(Q.hasNodeAttributeWithValue(Z,"href")){X=Q.getAttributeValueFromNode(Z,"href");return this.toAbsoluteUrl(X)}var W=this.findPieceNode(Y);
+}var W=this.findContentPiece(X);if(W){return this.removeDomainIfIsInLink(W)}if(Q.hasNodeAttributeWithValue(X,"title")){return Q.getAttributeValueFromNode(X,"title")}var Y=this.findPieceNode(X);if(Q.hasNodeAttributeWithValue(Y,"title")){return Q.getAttributeValueFromNode(Y,"title")}var Z=this.findTargetNode(X);if(Q.hasNodeAttributeWithValue(Z,"title")){return Q.getAttributeValueFromNode(Z,"title")}},findContentPiece:function(X){if(!X){return}var Z=Q.findFirstNodeHavingAttributeWithValue(X,this.CONTENT_PIECE_ATTR);if(Z){return Q.getAttributeValueFromNode(Z,this.CONTENT_PIECE_ATTR)}var W=this.findPieceNode(X);var Y=this.findMediaUrlInNode(W);if(Y){return this.toAbsoluteUrl(Y)}},findContentTarget:function(Y){if(!Y){return}var Z=this.findTargetNode(Y);if(Q.hasNodeAttributeWithValue(Z,this.CONTENT_TARGET_ATTR)){return Q.getAttributeValueFromNode(Z,this.CONTENT_TARGET_ATTR)}var X;if(Q.hasNodeAttributeWithValue(Z,"href")){X=Q.getAttributeValueFromNode(Z,"href");return this.toAbsoluteUrl(X)}var W=this.findPieceNode(Y);
if(Q.hasNodeAttributeWithValue(W,"href")){X=Q.getAttributeValueFromNode(W,"href");return this.toAbsoluteUrl(X)}},isSameDomain:function(W){if(!W||!W.indexOf){return false}if(0===W.indexOf(this.getLocation().origin)){return true}var X=W.indexOf(this.getLocation().host);if(8>=X&&0<=X){return true}return false},removeDomainIfIsInLink:function(Y){var X="^https?://[^/]+";var W="^.*//[^/]+";if(Y&&Y.search&&-1!==Y.search(new RegExp(X))&&this.isSameDomain(Y)){Y=Y.replace(new RegExp(W),"");if(!Y){Y="/"}}return Y},findMediaUrlInNode:function(aa){if(!aa){return}var Y=["img","embed","video","audio"];var W=aa.nodeName.toLowerCase();if(-1!==z(Y,W)&&Q.findFirstNodeHavingAttributeWithValue(aa,"src")){var Z=Q.findFirstNodeHavingAttributeWithValue(aa,"src");return Q.getAttributeValueFromNode(Z,"src")}if(W==="object"&&Q.hasNodeAttributeWithValue(aa,"data")){return Q.getAttributeValueFromNode(aa,"data")}if(W==="object"){var ab=Q.findNodesByTagName(aa,"param");if(ab&&ab.length){var X;for(X=0;X<ab.length;X++){if("movie"===Q.getAttributeValueFromNode(ab[X],"name")&&Q.hasNodeAttributeWithValue(ab[X],"value")){return Q.getAttributeValueFromNode(ab[X],"value")
}}}var ac=Q.findNodesByTagName(aa,"embed");if(ac&&ac.length){return this.findMediaUrlInNode(ac[0])}}},trim:function(W){if(W&&String(W)===W){return W.replace(/^\s+|\s+$/g,"")}return W},isOrWasNodeInViewport:function(ab){if(!ab||!ab.getBoundingClientRect||ab.nodeType!==1){return true}var aa=ab.getBoundingClientRect();var Z=u.documentElement||{};var Y=aa.top<0;if(Y&&ab.offsetTop){Y=(ab.offsetTop+aa.height)>0}var X=Z.clientWidth;if(G.innerWidth&&X>G.innerWidth){X=G.innerWidth}var W=Z.clientHeight;if(G.innerHeight&&W>G.innerHeight){W=G.innerHeight}return((aa.bottom>0||Y)&&aa.right>0&&aa.left<X&&((aa.top<W)||Y))},isNodeVisible:function(X){var W=g(X);var Y=this.isOrWasNodeInViewport(X);return W&&Y},buildInteractionRequestParams:function(W,X,Y,Z){var aa="";if(W){aa+="c_i="+l(W)}if(X){if(aa){aa+="&"}aa+="c_n="+l(X)}if(Y){if(aa){aa+="&"}aa+="c_p="+l(Y)}if(Z){if(aa){aa+="&"}aa+="c_t="+l(Z)}return aa},buildImpressionRequestParams:function(W,X,Y){var Z="c_n="+l(W)+"&c_p="+l(X);if(Y){Z+="&c_t="+l(Y)}return Z
},buildContentBlock:function(Y){if(!Y){return}var W=this.findContentName(Y);var X=this.findContentPiece(Y);var Z=this.findContentTarget(Y);W=this.trim(W);X=this.trim(X);Z=this.trim(Z);return{name:W||"Unknown",piece:X||"Unknown",target:Z||""}},collectContent:function(Z){if(!Z||!Z.length){return[]}var Y=[];var W,X;for(W=0;W<Z.length;W++){X=this.buildContentBlock(Z[W]);if(w(X)){Y.push(X)}}return Y},setLocation:function(W){this.location=W},getLocation:function(){var W=this.location||G.location;if(!W.origin){W.origin=W.protocol+"//"+W.hostname+(W.port?":"+W.port:"")}return W},toAbsoluteUrl:function(X){if((!X||String(X)!==X)&&X!==""){return X}if(""===X){return this.getLocation().href}if(X.search(/^\/\//)!==-1){return this.getLocation().protocol+X}if(X.search(/:\/\//)!==-1){return X}if(0===X.indexOf("#")){return this.getLocation().origin+this.getLocation().pathname+X}if(0===X.indexOf("?")){return this.getLocation().origin+this.getLocation().pathname+X}if(0===X.search("^[a-zA-Z]{2,11}:")){return X