[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 05/06: Improve calc
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 05/06: Improve calc |
Date: |
Wed, 20 Dec 2017 04:42:48 -0500 (EST) |
sparkyx pushed a commit to annotated tag rel6919.7
in repository noalyss.
commit 518119e9c837160d48a0919a2be4c31471a7113b
Author: Dany De Bontridder <address@hidden>
Date: Tue Nov 28 19:17:40 2017 +0100
Improve calc
---
html/js/calc.js | 11 ++++++++---
html/js/scripts.js | 2 +-
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/html/js/calc.js b/html/js/calc.js
index 37477c5..4789efc 100644
--- a/html/js/calc.js
+++ b/html/js/calc.js
@@ -38,6 +38,12 @@ function cal()
try
{
Compute();
+ p_variable=p_variable.replace(/[a-z]/,'');
+ p_variable=p_variable.replace(/[A-Z]/,'');
+ p_variable=p_variable.replace(/</,'');
+ p_variable=p_variable.replace(/%/,'');
+ p_variable=p_variable.replace(/;/,'');
+ p_variable=p_variable.replace(/>/,'');
p_variable=p_variable.replace(/ /g,"");
p_variable=p_variable.replace(/\+/g,"+ ");
p_variable=p_variable.replace(/-/g,"- ");
@@ -52,9 +58,8 @@ function cal()
alert_box("Mauvaise formule\n"+p_variable);
return false;
}
- p_history=p_history+'<hr>'+p_variable;
- p_history+="="+result.toString();
- var str_sub="<hr><p> Total :"+p_variable+" = "+result.toString()+"</p>";
+ p_history=p_variable+"="+result.toString()+'<br>'+p_history;
+ var str_sub="Total :"+p_variable+" = "+result.toString();
this.document.getElementById("sub_total").innerHTML=str_sub;
this.document.getElementById("listing").innerHTML=p_history;
this.document.getElementById('inp').value="";
diff --git a/html/js/scripts.js b/html/js/scripts.js
index 87e9b90..5a42995 100644
--- a/html/js/scripts.js
+++ b/html/js/scripts.js
@@ -1062,7 +1062,7 @@ function show_calc()
shtml += '<div
style="float:right;height:10px;display:block;margin-top:2px;margin-right:2px">
<a onclick="removeDiv(\'calc1\');" href="javascript:void(0)"
id="close_div">Fermer</a></div>';
shtml += '<div> <h2 class="info">Calculatrice</h2></div>';
shtml += '<form name="calc_line" method="GET" onSubmit="cal();return
false;" >Calculatrice simplifiée: écrivez simplement les opérations que vous
voulez puis la touche retour. exemple : 1+2+3*(1/5) <input class="input_text"
type="text" size="30" id="inp" name="calculator"> <input type="button"
value="Efface tout" class="button" onClick="Clean();return false;" > <input
type="button" class="button" value="Fermer" onClick="removeDiv(\'calc1\')" >';
- shtml += '</form><span id="result"> </span><br><span id="sub_total">
Taper une formule (ex 20*5.1) puis enter </span><br><span id="listing">
</span>';
+ shtml += '</form><span class="highligth" style="display:block"
id="sub_total"> Taper une formule (ex 20*5.1) puis enter </span><span
style="display:block" id="listing"> </span>';
var obj = {id: sid, html: shtml,
drag: true, style: ''
- [Noalyss-commit] [noalyss] annotated tag rel6919.7 created (now 9e96201), Dany De Bontridder, 2017/12/20
- [Noalyss-commit] [noalyss] 02/06: Accounting : error message if accounting is too large, Dany De Bontridder, 2017/12/20
- [Noalyss-commit] [noalyss] 01/06: Accounting : error message if accounting is too large, Dany De Bontridder, 2017/12/20
- [Noalyss-commit] [noalyss] 03/06: set version 6919.7, Dany De Bontridder, 2017/12/20
- [Noalyss-commit] [noalyss] 06/06: Calc : set 4 decimals, Dany De Bontridder, 2017/12/20
- [Noalyss-commit] [noalyss] 05/06: Improve calc,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 04/06: Task #0001507: Click sur détail opérations apparaît trop haut Use the function window.pageYOffset instead of window.scrollY, Dany De Bontridder, 2017/12/20