slitaz-dev-tools rev 204

tazwikiss: add wkp_FullScreen.sh
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Nov 27 11:03:01 2013 +0000 (2013-11-27)
parents d80619cb46db
children 2d939b459507
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 tazwikiss/rootfs/var/www/wiki/plugins/wkp_FullScreen.sh
line diff
     1.1 --- a/tazwikiss/rootfs/var/www/wiki/pages/AideCalc.txt	Tue Nov 19 16:46:39 2013 +0000
     1.2 +++ b/tazwikiss/rootfs/var/www/wiki/pages/AideCalc.txt	Wed Nov 27 11:03:01 2013 +0000
     1.3 @@ -14,12 +14,12 @@
     1.4  ** Cliquer en dehors de la case pour tout recalculer
     1.5  * Cliquer sur une case grise pour voir le CSV à jour
     1.6  !!Exemples
     1.7 -{{Pommes;12;=parseInt((100*B1)/B3)+'%'; 
     1.8 -Poires;7;=parseInt((100*B2)/B3)+"%"; 
     1.9 -Total :;=B1+B2;;}}
    1.10 -Pommes;12;=parseInt((100*B1)/B3)+'%';
    1.11 -Poires;7;=parseInt((100*B2)/B3)+"%";
    1.12 -Total :;=B1+B2;;
    1.13 +{{Pommes;12;=round((100*B1)/B3)+'%'; 
    1.14 +Poires;7;=round((100*B2)/B3)+"%"; 
    1.15 +Total :;=B1+B2;=parseInt(C1)+parseInt(C2)+'%';}}
    1.16 +Pommes;12;=round((100*B1)/B3)+'%';
    1.17 +Poires;7;=round((100*B2)/B3)+"%";
    1.18 +Total :;=B1+B2;=parseInt(C1)+parseInt(C2)+'%';
    1.19  {{Un nombre;sa racine carré; 
    1.20  2;=(A2&lt;0)?alert('A2 &lt; 0 !'):sqrt(A2);}}
    1.21  Un nombre;sa racine carré;
     2.1 --- a/tazwikiss/rootfs/var/www/wiki/pages/HelpCalc.txt	Tue Nov 19 16:46:39 2013 +0000
     2.2 +++ b/tazwikiss/rootfs/var/www/wiki/pages/HelpCalc.txt	Wed Nov 27 11:03:01 2013 +0000
     2.3 @@ -14,12 +14,12 @@
     2.4  ** click anywhere outside the cell to recompute everything
     2.5  * click to a gray cell to see the CSV update
     2.6  !!Examples
     2.7 -{{Apples;12;=parseInt((100*B1)/B3)+'%'; 
     2.8 -Pears;7;=parseInt((100*B2)/B3)+"%"; 
     2.9 -Total :;=B1+B2;;}}
    2.10 -Apples;12;=parseInt((100*B1)/B3)+'%';
    2.11 -Pears;7;=parseInt((100*B2)/B3)+"%";
    2.12 -Total :;=B1+B2;;
    2.13 +{{Apples;12;=round((100*B1)/B3)+'%'; 
    2.14 +Pears;7;=round((100*B2)/B3)+"%"; 
    2.15 +Total :;=B1+B2;=parseInt(C1)+parseInt(C2)+'%';}}
    2.16 +Apples;12;=round((100*B1)/B3)+'%';
    2.17 +Pears;7;=round((100*B2)/B3)+"%";
    2.18 +Total :;=B1+B2;=parseInt(C1)+parseInt(C2)+'%';
    2.19  {{A number;its square root; 
    2.20  2;=(A2&lt;0)?alert('A2 &lt; 0 !'):sqrt(A2);}}
    2.21  A number;its square root;
     3.1 --- a/tazwikiss/rootfs/var/www/wiki/plugins/wkp_Calc.sh	Tue Nov 19 16:46:39 2013 +0000
     3.2 +++ b/tazwikiss/rootfs/var/www/wiki/plugins/wkp_Calc.sh	Wed Nov 27 11:03:01 2013 +0000
     3.3 @@ -34,7 +34,7 @@
     3.4      DATA[id].log10= DATA[id].LOG10= function(n){return Math.log(n)/Math.LN10;};
     3.5      DATA[id].log2 = DATA[id].LOG2 = function(n){return Math.log(n)/Math.LN2;};
     3.6      DATA[id].fact = DATA[id].FACT = 
     3.7 -	function(n){var x=1;while(n>0)x*=n--;return x;};
     3.8 +	function(n){var x=1;while(n>1)x*=n--;return x;};
     3.9      DATA[id].fib  = DATA[id].FIB  = 
    3.10  	function(n){var c=0,p=1;while(n-->0){var x=c;c+=p;p=x};return c;};
    3.11      for (var i=0; i<=rows; i++) {
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/tazwikiss/rootfs/var/www/wiki/plugins/wkp_FullScreen.sh	Wed Nov 27 11:03:01 2013 +0000
     4.3 @@ -0,0 +1,52 @@
     4.4 +plugin="FullScreen"
     4.5 +description="Full screen support"
     4.6 + 
     4.7 +FULLSCREEN="Fullscreen"
     4.8 +
     4.9 +case "$1" in
    4.10 +showjs) cat <<EOT
    4.11 +<script type="text/javascript">
    4.12 +<!--
    4.13 +function isInFullScreen() {
    4.14 +	return (document.fullScreenElement &&
    4.15 +	        document.fullScreenElement !== null) ||
    4.16 +	       (document.mozFullScreen || document.webkitIsFullScreen);
    4.17 +}
    4.18 +
    4.19 +var changeHandler = function() {
    4.20 +	var t = document.getElementById("mainTable");
    4.21 +	t.rows[0].style.display = t.rows[1].style.display = 
    4.22 +	t.rows[3].style.display = (isInFullScreen()) ? "none" : "";
    4.23 +}
    4.24 +
    4.25 +function doFullScreen() {
    4.26 +	var e = document.body;
    4.27 +	var r = e.requestFullScreen || e.webkitRequestFullScreen ||
    4.28 +		  e.mozRequestFullScreen || e.msRequestFullScreen;
    4.29 +	if (r) r.call(e);
    4.30 +	document.addEventListener("fullscreenchange", changeHandler, false);
    4.31 +	document.addEventListener("webkitfullscreenchange", changeHandler, false);
    4.32 +	document.addEventListener("mozfullscreenchange", changeHandler, false);
    4.33 +}
    4.34 +//-->
    4.35 +</script>
    4.36 +EOT
    4.37 +esac
    4.38 +
    4.39 +template()
    4.40 +{
    4.41 +	[ -n "$(GET page)" -a -z "$(GET action)" ] || return 1
    4.42 +	FULLSCREEN="<a href='#' onClick='doFullScreen()'>$FULLSCREEN</a>"
    4.43 +	html="$(sed "s|EDIT|& / $FULLSCREEN|" <<EOT | \
    4.44 +		awk -v prg=$plugins_dir/wkp_$plugin.sh '
    4.45 +{
    4.46 +	if (/<\/head>/) {
    4.47 +		system("/bin/sh " prg " showjs")
    4.48 +	}
    4.49 +	print
    4.50 +}'
    4.51 +$html
    4.52 +EOT
    4.53 +)"
    4.54 +	return 0
    4.55 +}