From 24c42d67d33199eb0b7b0b78dfc5a3856670e4c0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Tue, 11 Oct 2011 20:59:53 +0200 Subject: [PATCH] Fixing addThousandsSeparators in WCF.js Integers were no longer working --- wcfsetup/install/files/js/WCF.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index abe9eed148..3251f094dc 100644 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -1888,14 +1888,18 @@ WCF.String = { */ addThousandsSeparator: function(number) { var $numberString = String(number); - var parts = $numberString.split(/[^0-9]/); + var parts = $numberString.split(/[^0-9]+/); - var $decimalPoint = $numberString.match(/[^0-9]/g); + var $decimalPoint = $numberString.match(/[^0-9]+/); $numberString = parts[0]; - delete parts[0]; - var $decimalPart = $decimalPoint.join('')+parts.join(''); - + if ($decimalPoint === null) { + var $decimalPart = ''; + } + else { + delete parts[0]; + var $decimalPart = $decimalPoint.join('')+parts.join(''); + } if (parseInt(number) >= 1000 || parseInt(number) <= -1000) { var $negative = false; if (parseInt(number) <= -1000) { @@ -2456,6 +2460,11 @@ WCF.Effect.BalloonTooltip.prototype = { * Moves tooltip to cursor position. */ _mouseMoveHandler: function(event) { + var $element = $(event.currentTarget); + if ($element.attr('title')) { + this._mouseEnterHandler(event); + } + if ($(document).width() - event.pageX < this.tooltip.getDimensions().width) { this.tooltip.css({ top: (event.pageY) + "px", -- 2.20.1