| Paste number 6108: | javascript lisp compiler example |
| Pasted by: | manuel |
| 3 years, 9 months ago | |
| None | |
| Paste contents: |
| (start :port 8000) (publish :path "/hello" :content-type "text/html" :function #'(lambda (req ent) (with-http-response (req ent) (with-http-body (req ent) (js-test))))) (publish-file :path "/photo1.jpg" :file "/Users/manuel/Pictures/lain/lain2.jpg") (publish-file :path "/photo2.jpg" :file "/Users/manuel/Pictures/lain/lain4.jpg") (publish-file :path "/photo3.jpg" :file "/Users/manuel/Pictures/lain/lain16.jpg") (defun js-test () (html (:html (:head (:title "foobar") (js-script (defvar photos (make-array)) (defvar photoslink (make-array)) (defvar which 0) (setf (aref photos 0) "photo1.jpg" (aref photos 1) "photo2.jpg" (aref photos 2) "photo3.jpg") (defvar linkornot 0) (setf (aref photoslink 0) "" (aref photoslink 1) "" (aref photoslink 2) "") (defvar preloadedimages (make-array)) (dotimes (i photos.length) (setf (aref preloadedimages i) (new *Image) (.src (aref preloadedimages i)) (aref photos i))) (function apply-effect () (when (and document.all photoslider.filters) (let ((trans photoslider.filters.reveal-trans)) (setf (.*Transition trans) (*Math.floor (* (*Math.random) 23))) (.stop trans) (.apply trans)))) (function play-effect () (when (and document.all photoslider.filters) (.play photoslider.filters.reveal-trans))) (function keep-track () (setf window.status (+ "Image " (1+ which) " of " photos.length))) (function backward () (when (> which 0) (decf which) (apply-effect) (setf document.images.photoslider.src (aref photos which)) (play-effect) (keep-track))) (function forward () (when (< which (1- photos.length)) (incf which) (apply-effect) (setf document.images.photoslider.src (aref photos which)) (play-effect) (keep-track))) (function transport () (setf window.location (aref photoslink which))) )) (:body (:h2 "Hello") ((:table :border 0 :cellspacing 0 :cellpadding 0) (:tr ((:td :width "100%" :colspan 2 :height 22) (:center (js-script (when (= linkornot 1) (document.write "<a href=\"javascript:transport()\"?")) (document.write (+ "<img src=\"" (aref photos 0) "\" " "name=\"photoslider\" " "style=\"filter:revealTrans(duration=2,transition=23)\" " "border=0/>")) (when (= linkornot 1) (document.write "</a>")))))) (:tr ((:td :width "50%" :height "21") ((:p :align "left") ((:a :href "#" :onClick (js (backward) (return false))) "Previous Slide"))) ((:td :width "50%" :height "21") ((:p :align "right") ((:a :href "#" :onClick (js (forward) (return false))) "Next Slide"))))))))) |
Annotations for this paste:
| Annotation number 1: | gusto ko maarte kc bunso ako |
| Pasted by: | joseph |
| 2 years, 8 months ago | |
| Paste contents: |
| xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
| Annotation number 2: | gusto ko maarte kc bunso ako |
| Pasted by: | joseph |
| 2 years, 8 months ago | |
| Paste contents: |
| wwwwwwwwwwwwww |
| Annotation number 3: | gusto ko maarte kc bunso ako |
| Pasted by: | joseph |
| 2 years, 8 months ago | |
| Paste contents: |
| wwwwwwwwwwwwww |