From: Fomafix Date: Tue, 29 Apr 2014 19:39:37 +0000 (+0000) Subject: Avoid theoretical division by zero X-Git-Tag: 1.31.0-rc.0~14406^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22suivi_revisions%22%29%20.%20%22?a=commitdiff_plain;h=8585af15ed8b07386f7ae1daac3bd90165600569;p=lhc%2Fweb%2Fwiklou.git Avoid theoretical division by zero Fix white spaces. Change-Id: I7f595291253fa58c30912c97a1f6c67e53d47dc0 --- diff --git a/resources/src/jquery/jquery.suggestions.js b/resources/src/jquery/jquery.suggestions.js index a20a948d82..4bab65f6a5 100644 --- a/resources/src/jquery/jquery.suggestions.js +++ b/resources/src/jquery/jquery.suggestions.js @@ -193,7 +193,7 @@ $.suggestions = { } else { regionWidth = $region.outerWidth(); docWidth = $( document ).width(); - if ( ( regionWidth / docWidth ) > 0.85 ) { + if ( regionWidth > ( 0.85 * docWidth ) ) { // If the input size takes up more than 85% of the document horizontally // expand the suggestions to the writing direction's native end. expandFrom = 'start'; @@ -201,7 +201,7 @@ $.suggestions = { // Calculate the center points of the input and document regionCenter = $region.offset().left + regionWidth / 2; docCenter = docWidth / 2; - if ( Math.abs( regionCenter - docCenter ) / docCenter < 0.10 ) { + if ( Math.abs( regionCenter - docCenter ) < ( 0.10 * docCenter ) ) { // If the input's center is within 10% of the document center // use the writing direction's native end. expandFrom = 'start';