diff options
-rw-r--r-- | plugins/CoreHome/templates/popover.js | 3 | ||||
-rw-r--r-- | plugins/Transitions/templates/transitions.js | 28 | ||||
-rw-r--r-- | themes/default/common.js | 22 |
3 files changed, 29 insertions, 24 deletions
diff --git a/plugins/CoreHome/templates/popover.js b/plugins/CoreHome/templates/popover.js index 3120230132..eb7f690f2e 100644 --- a/plugins/CoreHome/templates/popover.js +++ b/plugins/CoreHome/templates/popover.js @@ -78,9 +78,10 @@ var Piwik_Popover = (function() { var p2; if (popoverSubject) { + popoverSubject = piwikHelper.addBreakpointsToUrl(popoverSubject); p1.addClass('Piwik_Popover_Loading_NameWithSubject'); p2 = $(document.createElement('p')).addClass('Piwik_Popover_Loading_Subject'); - loading.append(p2.text(popoverSubject)); + loading.append(p2.html(popoverSubject)); } if (height) { diff --git a/plugins/Transitions/templates/transitions.js b/plugins/Transitions/templates/transitions.js index 308507787b..29fa9cb79c 100644 --- a/plugins/Transitions/templates/transitions.js +++ b/plugins/Transitions/templates/transitions.js @@ -226,7 +226,7 @@ Piwik_Transitions.prototype.preparePopover = function() { text = text.replace(/%s/, self.model.pageviews).replace(/%s/, share + '%'); text += '<br /><i>' + Piwik_Transitions_Translations.DateRange + ' ' + self.model.date + '</i>'; - var title = '<span class="tip-title">' + Piwik_Transitions_Util.addBreakpointsToUrl(self.actionName) + + var title = '<span class="tip-title">' + piwikHelper.addBreakpointsToUrl(self.actionName) + '</span><br />'; Piwik_Tooltip.show(title + text, 'Transitions_Tooltip_Small', 300); @@ -854,7 +854,7 @@ Piwik_Transitions_Canvas.prototype.truncateVisibleBoxTexts = function() { var span = container.find('span'); var text = container.data('text'); - span.html(Piwik_Transitions_Util.addBreakpointsToUrl(text)); + span.html(piwikHelper.addBreakpointsToUrl(text)); var divHeight = container.innerHeight(); if (container.data('maxLines')) { @@ -873,7 +873,7 @@ Piwik_Transitions_Canvas.prototype.truncateVisibleBoxTexts = function() { leftPart = leftPart.substring(0, leftPart.length - 2); rightPart = rightPart.substring(2, rightPart.length); text = leftPart + '...' + rightPart; - span.html(Piwik_Transitions_Util.addBreakpointsToUrl(text)); + span.html(piwikHelper.addBreakpointsToUrl(text)); } span.removeClass('Transitions_Truncate'); @@ -959,7 +959,7 @@ Piwik_Transitions_Canvas.prototype.renderBox = function(params) { // tooltip if (params.boxTextTooltip) { el.hover(function() { - var tip = Piwik_Transitions_Util.addBreakpointsToUrl(params.boxTextTooltip); + var tip = piwikHelper.addBreakpointsToUrl(params.boxTextTooltip); Piwik_Tooltip.show(tip, 'Transitions_Tooltip_Small', 300); }, function() { Piwik_Tooltip.hide(); @@ -1392,7 +1392,7 @@ Piwik_Transitions_Ajax.prototype.callApi = function(method, params, callback) { if (typeof params.actionName != 'undefined') { var url = params.actionName; - url = Piwik_Transitions_Util.addBreakpointsToUrl(url); + url = piwikHelper.addBreakpointsToUrl(url); errorTitle = errorTitle.replace(/%s/, '<span>' + url + '</span>'); } @@ -1450,24 +1450,6 @@ Piwik_Transitions_Util = { return url; }, - /** Add break points to string so that it can be displayed more compactly */ - addBreakpoints: function(text, breakpointMarkup) { - return text.replace(/([\/&=?\.%#:])/g, '$1' + - (typeof breakpointMarkup == 'undefined' ? '<wbr>' : breakpointMarkup)); - }, - - /** - * Add breakpoints to a URL - * urldecodes and encodes htmlentities to display utf8 urls without XSS vulnerabilities - */ - addBreakpointsToUrl: function(url) { - url = decodeURIComponent(url); - url = Piwik_Transitions_Util.addBreakpoints(url, '|||'); - url = $(document.createElement('p')).text(url).html(); - url = url.replace(/\|\|\|/g, '<wbr />'); - return url; - }, - /** * Replaces a %s placeholder in the HTML. * The special feature is that it can be called multiple times, replacing the already diff --git a/themes/default/common.js b/themes/default/common.js index 7fdc6c6783..18ce90f41a 100644 --- a/themes/default/common.js +++ b/themes/default/common.js @@ -20,6 +20,28 @@ var piwikHelper = { } return value; }, + + /** + * Add break points to a string so that it can be displayed more compactly + */ + addBreakpoints: function(text, breakpointMarkup) + { + return text.replace(/([\/&=?\.%#:])/g, '$1' + + (typeof breakpointMarkup == 'undefined' ? '<wbr>' : breakpointMarkup)); + }, + + /** + * Add breakpoints to a URL + * urldecodes and encodes htmlentities to display utf8 urls without XSS vulnerabilities + */ + addBreakpointsToUrl: function(url) + { + url = decodeURIComponent(url); + url = piwikHelper.addBreakpoints(url, '|||'); + url = $(document.createElement('p')).text(url).html(); + url = url.replace(/\|\|\|/g, '<wbr />'); + return url; + }, /** * Displays a Modal dialog. Text will be taken from the DOM node domSelector. |