slitaz-dev-tools rev 203
tazwikiss: some math functions for the Calc plugin
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Nov 19 16:46:39 2013 +0000 (2013-11-19) |
parents | c07b80d1e89b |
children | e3b40fe05c1d |
files | tazwikiss/rootfs/var/www/wiki/pages/AideCalc.txt tazwikiss/rootfs/var/www/wiki/pages/HelpCalc.txt tazwikiss/rootfs/var/www/wiki/plugins/wkp_Calc.sh |
line diff
1.1 --- a/tazwikiss/rootfs/var/www/wiki/pages/AideCalc.txt Sun Nov 17 17:33:50 2013 +0000 1.2 +++ b/tazwikiss/rootfs/var/www/wiki/pages/AideCalc.txt Tue Nov 19 16:46:39 2013 +0000 1.3 @@ -21,6 +21,6 @@ 1.4 Poires;7;=parseInt((100*B2)/B3)+"%"; 1.5 Total :;=B1+B2;; 1.6 {{Un nombre;sa racine carré; 1.7 -2;=(A2<0)?alert('A2 < 0 !'):Math.sqrt(A2);}} 1.8 +2;=(A2<0)?alert('A2 < 0 !'):sqrt(A2);}} 1.9 Un nombre;sa racine carré; 1.10 -2;=(A2<0)?alert('A2 < 0 !'):Math.sqrt(A2); 1.11 +2;=(A2<0)?alert('A2 < 0 !'):sqrt(A2);
2.1 --- a/tazwikiss/rootfs/var/www/wiki/pages/HelpCalc.txt Sun Nov 17 17:33:50 2013 +0000 2.2 +++ b/tazwikiss/rootfs/var/www/wiki/pages/HelpCalc.txt Tue Nov 19 16:46:39 2013 +0000 2.3 @@ -21,6 +21,6 @@ 2.4 Pears;7;=parseInt((100*B2)/B3)+"%"; 2.5 Total :;=B1+B2;; 2.6 {{A number;its square root; 2.7 -2;=(A2<0)?alert('A2 < 0 !'):Math.sqrt(A2);}} 2.8 +2;=(A2<0)?alert('A2 < 0 !'):sqrt(A2);}} 2.9 A number;its square root; 2.10 -2;=(A2<0)?alert('A2 < 0 !'):Math.sqrt(A2); 2.11 +2;=(A2<0)?alert('A2 < 0 !'):sqrt(A2);
3.1 --- a/tazwikiss/rootfs/var/www/wiki/plugins/wkp_Calc.sh Sun Nov 17 17:33:50 2013 +0000 3.2 +++ b/tazwikiss/rootfs/var/www/wiki/plugins/wkp_Calc.sh Tue Nov 19 16:46:39 2013 +0000 3.3 @@ -1,5 +1,5 @@ 3.4 plugin="Calc" 3.5 -description_fr="Tableur format CSV" 3.6 +description_fr="Feuille de calcul au format CSV" 3.7 description="CSV format spreadsheet" 3.8 help_fr="AideCalc" 3.9 help="HelpCalc" 3.10 @@ -24,6 +24,19 @@ 3.11 var DATA={}; 3.12 function buildCalc(id, rows, cols) { 3.13 DATA[id] = {}; 3.14 + var maths = [ "abs", "acos", "asin", "atan", "atan2", "ceil", "cos", "exp", 3.15 + "floor", "log", "max", "min", "pow", "random", "round", "sin", 3.16 + "tan", "sqrt", "PI", "E" ]; 3.17 + for (var i=0; v = maths[i]; i++) 3.18 + eval("DATA[id]."+v+" = DATA[id]."+v.toUpperCase()+" = Math."+v); 3.19 + DATA[id].rand = DATA[id].RAND = Math.random; 3.20 + DATA[id].ln = DATA[id].LN = Math.log; 3.21 + DATA[id].log10= DATA[id].LOG10= function(n){return Math.log(n)/Math.LN10;}; 3.22 + DATA[id].log2 = DATA[id].LOG2 = function(n){return Math.log(n)/Math.LN2;}; 3.23 + DATA[id].fact = DATA[id].FACT = 3.24 + function(n){var x=1;while(n>0)x*=n--;return x;}; 3.25 + DATA[id].fib = DATA[id].FIB = 3.26 + function(n){var c=0,p=1;while(n-->0){var x=c;c+=p;p=x};return c;}; 3.27 for (var i=0; i<=rows; i++) { 3.28 var row = document.getElementById(id).insertRow(-1); 3.29 for (var j=0; j<=cols && j<=26; j++) { 3.30 @@ -102,7 +115,7 @@ 3.31 { 3.32 if (lines > 1 && rows > 1) { 3.33 id="C" (100+cnt++) 3.34 - print "<noscript><u>Enable javascript to see the spreadsheet " id "</u></noscript>" 3.35 + print "<noscript><a href=\"http://www.enable-javascript.com/\" target=\"_blank\">Enable javascript to see the spreadsheet " id "</a></noscript>" 3.36 print "<table id=\"" id "\" class=\"tablecalc\"></table>" 3.37 print "<script type=\"text/javascript\">" 3.38 print "<!--" 3.39 @@ -130,7 +143,6 @@ 3.40 headdone = 1 3.41 showtail = 1 3.42 system("/bin/sh " prg " showhead") 3.43 - #print "system(" prg " showhead)" 3.44 } 3.45 line[++lines] = $0 3.46 gsub("<","<",$0)