From: Tim Düsterhus Date: Tue, 11 Oct 2011 18:59:53 +0000 (+0200) Subject: Fixing addThousandsSeparators in WCF.js X-Git-Tag: 2.0.0_Beta_1~1709^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=24c42d67d33199eb0b7b0b78dfc5a3856670e4c0;p=GitHub%2FWoltLab%2FWCF.git Fixing addThousandsSeparators in WCF.js Integers were no longer working --- 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",