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:
authormattab <matthieu.aubry@gmail.com>2016-10-04 00:57:00 +0300
committermattab <matthieu.aubry@gmail.com>2016-10-04 00:57:00 +0300
commitc8ec06e1989da61090af348ae33d12f7e290610e (patch)
treecb8b528f0f30e9ee550b9c463226dcf669c5d794 /plugins
parent609457da84a3a0301159952d1e36a8865934ef34 (diff)
Fix the JS error without breaking existing logic
Diffstat (limited to 'plugins')
-rw-r--r--plugins/SegmentEditor/javascripts/Segmentation.js20
1 files changed, 15 insertions, 5 deletions
diff --git a/plugins/SegmentEditor/javascripts/Segmentation.js b/plugins/SegmentEditor/javascripts/Segmentation.js
index 12470675be..28280a1a5d 100644
--- a/plugins/SegmentEditor/javascripts/Segmentation.js
+++ b/plugins/SegmentEditor/javascripts/Segmentation.js
@@ -86,14 +86,24 @@ Segmentation = (function($) {
var title;
if( current != "")
{
- var currentDecoded = piwikHelper.htmlDecode(current);
- var selector = 'div.segmentList ul li[data-definition="'+currentDecoded+'"]';
+ // this code is mad, and may drive you mad.
+ // the whole segmentation editor needs to be rewritten in AngularJS with clean code
+ var selector = 'div.segmentList ul li[data-definition="'+current+'"]';
var foundItems = $(selector, this.target);
if (foundItems.length === 0) {
- currentDecoded = piwikHelper.htmlDecode(decodeURIComponent(current));
- selector = 'div.segmentList ul li[data-definition="'+currentDecoded+'"]';
- foundItems = $(selector, this.target);
+ try {
+ currentDecoded = piwikHelper.htmlDecode(current);
+ selector = 'div.segmentList ul li[data-definition="'+currentDecoded+'"]';
+ foundItems = $(selector, this.target);
+ } catch(e) {}
+ }
+ if (foundItems.length === 0) {
+ try {
+ currentDecoded = piwikHelper.htmlDecode(decodeURIComponent(current));
+ selector = 'div.segmentList ul li[data-definition="'+currentDecoded+'"]';
+ foundItems = $(selector, this.target);
+ } catch(e) {}
}
if (foundItems.length > 0) {