From fed95e8555c7c3b8825a5e7be4d161c8fc9a840b Mon Sep 17 00:00:00 2001 From: Alex Klinkhamer Date: Mon, 23 Jun 2008 10:49:39 -0400 Subject: [PATCH] -Unneeded javascript. --- src/webui/psfiles/calcupage.lisp | 142 +++++++++------------------------------ 1 file changed, 31 insertions(+), 111 deletions(-) rewrite src/webui/psfiles/calcupage.lisp (74%) diff --git a/src/webui/psfiles/calcupage.lisp b/src/webui/psfiles/calcupage.lisp dissimilarity index 74% index 2cc1948..8847c81 100644 --- a/src/webui/psfiles/calcupage.lisp +++ b/src/webui/psfiles/calcupage.lisp @@ -1,111 +1,31 @@ - -(defvar calc-in) - -(defun add-break (elem) - (.append-child elem (.create-element document "br"))) - -;V Insert text into /calc-in/ at cursor and give it focus.V -(defun uinput (str) - (defvar curpos (+ calc-in.selection-start str.length)) - (setf - calc-in.value - (+ (.substring calc-in.value 0 calc-in.selection-start) - str (.substring calc-in.value calc-in.selection-end))) - (setf calc-in.selection-start curpos - calc-in.selection-end curpos) - (.focus calc-in)) - -;V Called when the "clear" button is pressed.V -(defun cleartext () - (setf calc-in.value "") - (.focus calc-in)) - -;V Called when the "OK" button is pressed.V -(defun send-calc () - (post-params - process-loc - (+ "text=" (.replace calc-in.value (regex "/\\+/g") "%2B")) - (lambda (response) - (setf (slot-value (.get-element-by-id document "resultPre") - 'inner-h-t-m-l) - response) - (.focus calc-in)))) - -(defun show-a-button (name elem onclick width fcolor bcolor) - (unless width (setf width 25)) - (unless fcolor (setf fcolor "#000000")) - (unless bcolor (setf bcolor "#D3D3D3")) - (let ((b (.create-element document "button"))) - (setf b.inner-h-t-m-l name) - (.set-attribute - b "style" - (+ "color: " fcolor "; background-color: " bcolor - "; height: 25px; width: " width "px")) - (.set-attribute b "onclick" onclick) - (.append-child elem b))) - -;-- BEGIN SPECIAL BUTTON CREATORS -- -(defun show-input-button (name elem tosend width fcolor bcolor) - (show-a-button name elem (+ "uinput(\"" tosend "\")") - width fcolor bcolor)) - -(defun show-num (name elem) - (show-input-button - name elem name 25 "white" "black")) - -;V Use the button operation as a name.V -(defun char-button (name elem width fcolor bcolor) - (show-input-button - name elem name width fcolor bcolor)) - -(defun clear-button (elem) - (show-a-button "clear" elem "cleartext()" 45 "white" "darkred")) - -(defun ok-button (elem) - (show-a-button "ok" elem "sendCalc()" 25 "white" "green")) - -;-- END SPECIAL BUTTON CREATORS -- - -;V Show the calculator-layout thing. V -(defun show-standops (elem) - (sqrt-button elem) - (expt-button elem) - (char-button "(" elem) - (char-button ")" elem) - (add-break elem) - (show-num "7" elem) (show-num "8" elem) (show-num "9" elem) - (show-binop "/" elem) - (add-break elem) - (show-num "4" elem) (show-num "5" elem) (show-num "6" elem) - (times-button elem) - (add-break elem) - (show-num "1" elem) (show-num "2" elem) (show-num "3" elem) - (show-binop "-" elem) - (add-break elem) - (show-input-button "0" elem "0" 50 "white" "black") - (show-num "." elem) - (show-binop "+" elem) - (add-break elem) - (memory-buttons elem)) - -;V Show linear algebra functions/operations.V -;V (not linear operators :) V -(defun show-linops (elem) - (show-func "rref" elem 40) - (show-func "ref" elem 40) - (show-func "det" elem 35) - (add-break elem) - (show-func "transpose" elem 80) - (show-func "inverse" elem 60) - (add-break elem) - (show-multi-func "dot" elem 35) - (show-multi-func "cross" elem 45) - (show-multi-func "proj" elem 40) - (show-multi-func "orth" elem 40) - (add-break elem) - (show-multi-func "cat" elem 35) - (show-multi-func "vcat" elem 40) - (show-multi-func "crop" elem 40) - (show-multi-func "vcrop" elem 45)) - - + +(defvar calc-in) + +;V Insert text into /calc-in/ at cursor and give it focus.V +(defun uinput (str) + (defvar curpos (+ calc-in.selection-start str.length)) + (setf + calc-in.value + (+ (.substring calc-in.value 0 calc-in.selection-start) + str (.substring calc-in.value calc-in.selection-end))) + (setf calc-in.selection-start curpos + calc-in.selection-end curpos) + (.focus calc-in)) + +;V Called when the "clear" button is pressed.V +(defun cleartext () + (setf calc-in.value "") + (.focus calc-in)) + +;V Called when the "OK" button is pressed.V +(defun send-calc () + (post-params + process-loc + (+ "text=" (.replace calc-in.value (regex "/\\+/g") "%2B")) + (lambda (response) + (setf (slot-value (.get-element-by-id document "resultPre") + 'inner-h-t-m-l) + response) + (.focus calc-in)))) + + -- 2.11.4.GIT