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:
authorStefan Giehl <stefan@piwik.org>2017-02-20 19:38:38 +0300
committerGitHub <noreply@github.com>2017-02-20 19:38:38 +0300
commit6789c01482a548218393501f3f4a9bdef3223458 (patch)
tree48cc5e18e93d3e9c7690cf63e40526cef69f99bd /plugins/SegmentEditor
parent30b1590974c1ee48ee49a6ffb596414175483b74 (diff)
Avoid segment encoding issues (#11372)
* avoids segment encoding issues * fixes highlight for current segment in segment chooser * update screenshots
Diffstat (limited to 'plugins/SegmentEditor')
-rw-r--r--plugins/SegmentEditor/javascripts/Segmentation.js47
1 files changed, 14 insertions, 33 deletions
diff --git a/plugins/SegmentEditor/javascripts/Segmentation.js b/plugins/SegmentEditor/javascripts/Segmentation.js
index 5dc1cf1f80..90fc6cc7f5 100644
--- a/plugins/SegmentEditor/javascripts/Segmentation.js
+++ b/plugins/SegmentEditor/javascripts/Segmentation.js
@@ -7,16 +7,15 @@
Segmentation = (function($) {
- Mousetrap.bind('s', function(event) {
- if (event.preventDefault) {
- event.preventDefault();
- } else {
- event.returnValue = false; // IE
- }
- $('.segmentListContainer .segmentationContainer .title').trigger('click').focus();
+ Mousetrap.bind('s', function (event) {
+ if (event.preventDefault) {
+ event.preventDefault();
+ } else {
+ event.returnValue = false; // IE
+ }
+ $('.segmentListContainer .segmentationContainer .title').trigger('click').focus();
});
-
function preselectFirstMetricMatch(rowNode)
{
var matchValue = $(rowNode).find('.metricMatchBlock option:first').attr('value');
@@ -68,16 +67,10 @@ Segmentation = (function($) {
segmentation.prototype.getSegment = function(){
var self = this;
- if($.browser.mozilla) {
- return self.currentSegmentStr;
- }
- return decodeURIComponent(self.currentSegmentStr);
+ return self.currentSegmentStr;
};
segmentation.prototype.setSegment = function(segmentStr){
- if(!$.browser.mozilla) {
- segmentStr = encodeURIComponent(segmentStr);
- }
this.currentSegmentStr = segmentStr;
};
@@ -87,7 +80,7 @@ Segmentation = (function($) {
title += ' '+ _pk_translate('SegmentEditor_CurrentlySelectedSegment', [segmentDescription]);
$(this.content).attr('title', title);
- }
+ };
segmentation.prototype.markCurrentSegment = function(){
var current = this.getSegment();
@@ -155,8 +148,7 @@ Segmentation = (function($) {
};
var getMockedInputRowHtml = function(){
- var mockedInputRow = '<div class="segment-row"><a class="segment-close" href="#"></a><div class="segment-row-inputs">'+getMockedInputSet().html()+'</div></div>';
- return mockedInputRow;
+ return '<div class="segment-row"><a class="segment-close" href="#"></a><div class="segment-row-inputs">'+getMockedInputSet().html()+'</div></div>';
};
var getMockedFormRow = function(){
@@ -275,13 +267,9 @@ Segmentation = (function($) {
injClass = "";
var checkSelected = segment.definition;
- if(!$.browser.mozilla) {
- checkSelected = encodeURIComponent(checkSelected);
- }
- if( checkSelected == self.currentSegmentStr
- || checkSelected == decodeURIComponent(self.currentSegmentStr)
- || checkSelected == unescape(decodeURIComponent(self.currentSegmentStr))
+ if( checkSelected == self.currentSegmentStr ||
+ checkSelected == decodeURIComponent(self.currentSegmentStr)
) {
injClass = 'class="segmentSelected"';
}
@@ -352,7 +340,7 @@ Segmentation = (function($) {
var sanitiseSegmentName = function(segment) {
segment = piwikHelper.escape(segment);
return segment;
- }
+ };
var getFormHtml = function() {
var html = self.editorTemplate.find("> .segment-element").clone();
@@ -1245,8 +1233,6 @@ Segmentation = (function($) {
segment = $search.segment
}
- segment = decodeURIComponent(segment);
-
if (self.getSegment() != segment) {
self.setSegment(segment);
self.initHtml();
@@ -1294,8 +1280,6 @@ $(document).ready(function() {
this.changeSegment = function(segmentDefinition) {
if (piwikHelper.isAngularRenderingThePage()) {
- segmentDefinition = this.uriEncodeSegmentDefinition(segmentDefinition);
-
angular.element(document).injector().invoke(function ($location, $rootScope) {
var $search = $location.search();
@@ -1310,7 +1294,6 @@ $(document).ready(function() {
} catch (e) {}
}, 1);
}
-
});
return false;
} else {
@@ -1454,9 +1437,7 @@ $(document).ready(function() {
|| broadcast.getValueFromUrl('segment');
}
- if ($.browser.mozilla) {
- segmentFromRequest = decodeURIComponent(segmentFromRequest);
- }
+ segmentFromRequest = decodeURIComponent(segmentFromRequest);
return segmentFromRequest;
}