[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 10/18: Improve calc
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 10/18: Improve calc |
Date: |
Sun, 22 Apr 2018 09:30:30 -0400 (EDT) |
sparkyx pushed a commit to annotated tag rel6919-syn-180310
in repository noalyss.
commit fc0bb8cf4a882b349246d20d4605e80d1e27a4eb
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] 08/18: set version 6919.7, (continued)
- [Noalyss-commit] [noalyss] 08/18: set version 6919.7, Dany De Bontridder, 2018/04/22
- [Noalyss-commit] [noalyss] 03/18: Protect queryString with encodeURI, Dany De Bontridder, 2018/04/22
- [Noalyss-commit] [noalyss] 09/18: Task #0001507: Click sur détail opérations apparaît trop haut Use the function window.pageYOffset instead of window.scrollY, Dany De Bontridder, 2018/04/22
- [Noalyss-commit] [noalyss] 16/18: sorttable.js : alternate properly the color of the table rows, Dany De Bontridder, 2018/04/22
- [Noalyss-commit] [noalyss] 11/18: Calc : set 4 decimals, Dany De Bontridder, 2018/04/22
- [Noalyss-commit] [noalyss] 13/18: Merge from rel6919.7 Merge branch 'dev-6919.2' of ns3:/srv/git/noalyss into dev-6919.2, Dany De Bontridder, 2018/04/22
- [Noalyss-commit] [noalyss] 17/18: sorttable.js : Add an icon if the column is already sorted, Dany De Bontridder, 2018/04/22
- [Noalyss-commit] [noalyss] 05/18: Set version 6919.6, Dany De Bontridder, 2018/04/22
- [Noalyss-commit] [noalyss] 12/18: Upgrade the branch with the stable release 6919.7 Merge tag 'rel6919.7' into dev-6919.2, Dany De Bontridder, 2018/04/22
- [Noalyss-commit] [noalyss] 15/18: Merge tag 'rel6919.8' into dev-6919.2, Dany De Bontridder, 2018/04/22
- [Noalyss-commit] [noalyss] 10/18: Improve calc,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 14/18: Merge tag 'rel6919.8' into dev-6919.2, Dany De Bontridder, 2018/04/22
- [Noalyss-commit] [noalyss] 18/18: Manage_Table : add sort, Dany De Bontridder, 2018/04/22