##// END OF EJS Templates
Fix
Fix

File last commit:

r66:84186fb0 default
r67:d0477458 default
Show More
api.ps
523 lines | 14.9 KiB | application/postscript | PostScriptLexer
100% parser, 100% macros, 50% intrinsics, 10% api, 0% misc
r1
Actually fix it
r53 (in-package txt2web.api)
100% parser, 100% macros, 50% intrinsics, 10% api, 0% misc
r1
;;; API deals with DOM manipulation and some bookkeeping for the
;;; intrinsics, namely variables
;;; API is an implementation detail and has no QSP documentation. It
;;; doesn't call intrinsics
Tutorial game works!
r6 ;;; Utils
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun make-act-html (title img)
Special variables and locations
r32 (+ "<a class='qsp-act' href='" (href-call call-act title) "' onmouseover='" (inline-call select-act title) "'>"
MENU
r30 (if img (+ "<img src='" img "'>") "")
Tutorial game works!
r6 title
"</a>"))
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun make-menu-item-html (num title img loc)
Special variables and locations
r32 (+ "<a href='" (href-call finish-menu loc) "'>"
MENU
r30 (if img (+ "<img src='" img "'>") "")
Menu, game saving
r11 title
"</a>"))
Special variables and locations
r32 (defun make-obj (title img selected)
Bugfixes, remaining font stuff
r33 (+ "<li onclick='" (inline-call select-obj title img) "'>"
"<a class='qsp-obj" (if selected " qsp-obj-selected" "") "'>"
Special variables and locations
r32 (if img (+ "<img src='" img "'>") "")
Bugfixes, remaining font stuff
r33 title
Special variables and locations
r32 "</a>"))
MENU
r30 (defun make-menu-delimiter ()
"<hr>")
Bugfixes
r41 (defun copy-obj (obj)
(chain *j-s-o-n (parse (chain *j-s-o-n (stringify obj)))))
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun report-error (text)
Finishing lib
r20 (alert text))
Working WAIT without busy-wait
r29 (defun start-sleeping ()
MENU
r30 (chain (by-id "qsp") class-list (add "disable")))
Working WAIT without busy-wait
r29
(defun finish-sleeping ()
MENU
r30 (chain (by-id "qsp") class-list (remove "disable")))
Working WAIT without busy-wait
r29
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun sleep (msec)
MENU
r30 (with-sleep (resume)
(set-timeout resume msec)))
WAIT with async
r24
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun init-dom ()
Some DOM stuff, VIEW
r18 ;; Save/load buttons
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (let ((btn (by-id "qsp-btn-save")))
(setf (@ btn onclick) savegame)
(setf (@ btn href) "#"))
(let ((btn (by-id "qsp-btn-open")))
(setf (@ btn onclick) opengame)
(setf (@ btn href) "#"))
Some DOM stuff, VIEW
r18 ;; Close image on click
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (setf (@ (by-id "qsp-image-container") onclick)
Special variables and locations
r32 show-image)
Bugfixes, remaining font stuff
r33 ;; Enter in input field
Special variables and locations
r32 (setf (@ (get-frame :input) onkeyup)
on-input-key)
Some DOM stuff, VIEW
r18 ;; Close the dropdown on any click
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (setf (@ window onclick)
Some DOM stuff, VIEW
r18 (lambda (event)
MENU
r30 (setf (@ window mouse)
(list (@ event page-x)
(@ event page-y)))
(finish-menu nil))))
Some DOM stuff, VIEW
r18
Fix two regressions
r64 (defun init-globals (game-name)
(chain *object (assign *globals (getprop *default-globals game-name))))
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun call-serv-loc (var-name &rest args)
Optimizations: JUMP-loops, FOR loops, and variable access
r37 (let ((loc-name (get-global var-name 0)))
Finishing lib
r20 (when loc-name
Fix a bug with kill-var and calling service locations
r66 (let ((loc (getprop *locs (chain loc-name (to-upper-case)))))
Finishing lib
r20 (when loc
Special variables and locations
r32 (call-loc loc-name args))))))
Menu, game saving
r11
Multiple sources, multiple games, openqst/addqst/killqst
r31 (defun filename-game (filename)
(let ((game-name (chain filename (match "(.*/)?([^.]+)(\\.[a-zA-Z]+)?") 2))))
Globals instead of ROOT object
r39 (getprop *games game-name))
Multiple sources, multiple games, openqst/addqst/killqst
r31
(defun run-game (name)
(let ((game (filename-game name)))
Globals instead of ROOT object
r39 (setf *main-game name)
Multiple sources, multiple games, openqst/addqst/killqst
r31 ;; Replace locations with the new game's
Globals instead of ROOT object
r39 (setf *locs game)
Multiple sources, multiple games, openqst/addqst/killqst
r31 (funcall (getprop game
(chain *object (keys game) 0))
(list))))
A better UI
r9 ;;; Misc
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun newline (key)
(append-id (key-to-id key) "<br>" t))
Bugfixes
r22
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun clear-id (id)
(setf (inner-html (by-id id)) ""))
Bugfixes
r22
Benchmark, bugfixes, code walker
r36 (defun escape-html (text)
(chain text
(replace (regex "/&/g") "&amp;")
(replace (regex "/</g") "&lt;")
(replace (regex "/>/g") "&gt;")
(replace (regex "/\"/g") "&quot;")
(replace (regex "/'/g") "&apos;")))
Bugfixes
r22
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun prepare-contents (s &optional force-html)
Optimizations: JUMP-loops, FOR loops, and variable access
r37 (setf s (chain s (to-string)))
(if (or force-html (get-global "USEHTML" 0))
Bugfixes
r22 s
Benchmark, bugfixes, code walker
r36 (escape-html s)))
A better UI
r9
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun get-id (id &optional force-html)
(inner-html (by-id id)))
A better UI
r9
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun set-id (id contents &optional force-html)
(setf (inner-html (by-id id)) (prepare-contents contents force-html)))
A better UI
r9
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun append-id (id contents &optional force-html)
Bugfixes
r22 (when contents
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (incf (inner-html (by-id id)) (prepare-contents contents force-html))))
A better UI
r9
Special variables and locations
r32 (defun on-input-key (ev)
(when (= 13 (@ ev key-code))
(chain ev (prevent-default))
Optimizations: JUMP-loops, FOR loops, and variable access
r37 (call-serv-loc "$USERCOM")))
Special variables and locations
r32
100% parser, 100% macros, 50% intrinsics, 10% api, 0% misc
r1 ;;; Function calls
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun init-args (args)
Fix two regressions
r64 (dotimes (i 10)
(set-global "ARGS" i 0)
(set-global "$ARGS" i "")
Fix a bug in dynamic return
r65 (when (and args (< i (length args)))
Fix two regressions
r64 (let ((arg (elt args i)))
(if (numberp arg)
(set-global "ARGS" i arg)
(set-global "$ARGS" i arg))))))
100% parser, 100% macros, 50% intrinsics, 10% api, 0% misc
r1
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun get-result ()
Optimizations: JUMP-loops, FOR loops, and variable access
r37 (or (get-global "$RESULT" 0)
(get-global "RESULT" 0)))
100% parser, 100% macros, 50% intrinsics, 10% api, 0% misc
r1
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun call-loc (name args)
MENU
r30 (setf name (chain name (to-upper-case)))
Remove cl-uglify-js
r23 (with-frame
Fix a bug in dynamic return
r65 (with-call-args args t
(funcall (getprop *locs name)))))
Remove cl-uglify-js
r23
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun call-act (title)
Bugfixes
r41 (with-frame
(funcall (getprop *acts title :act)))
(void))
The Box bugfixes
r21
100% parser, 100% macros, 50% intrinsics, 10% api, 0% misc
r1 ;;; Text windows
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun key-to-id (key)
Tutorial game works!
r6 (case key
Special variables and locations
r32 (:all "qsp")
Tutorial game works!
r6 (:main "qsp-main")
(:stat "qsp-stat")
Menu, game saving
r11 (:objs "qsp-objs")
(:acts "qsp-acts")
(:input "qsp-input")
MENU
r30 (:image "qsp-image")
Menu, game saving
r11 (:dropdown "qsp-dropdown")
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (t (report-error "Internal error!"))))
Tutorial game works!
r6
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun get-frame (key)
(by-id (key-to-id key)))
Menu, game saving
r11
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun add-text (key text)
(append-id (key-to-id key) text))
Tutorial game works!
r6
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun get-text (key)
(get-id (key-to-id key)))
Tutorial game works!
r6
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun clear-text (key)
(clear-id (key-to-id key)))
Tutorial game works!
r6
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun enable-frame (key enable)
(let ((obj (get-frame key)))
(setf (@ obj style display) (if enable "block" "none"))
Removing unnecessary returns
r27 (void)))
Menu, game saving
r11
100% parser, 100% macros, 50% intrinsics, 10% api, 0% misc
r1 ;;; Actions
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun add-act (title img act)
Globals instead of ROOT object
r39 (setf (getprop *acts title)
Special variables and locations
r32 (create :title title :img img :act act :selected nil))
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (update-acts))
Tutorial game works!
r6
Remove curact, implement selact
r45 (defun del-act (title)
(delete (getprop *acts title))
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (update-acts))
Tutorial game works!
r6
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun clear-act ()
Globals instead of ROOT object
r39 (setf *acts (create))
Special variables and locations
r32 (update-acts))
Tutorial game works!
r6
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun update-acts ()
(clear-id "qsp-acts")
(let ((elt (by-id "qsp-acts")))
Globals instead of ROOT object
r39 (for-in (title *acts)
(let ((obj (getprop *acts title)))
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (incf (inner-html elt) (make-act-html title (getprop obj :img)))))))
Special variables and locations
r32 (defun select-act (title)
Globals instead of ROOT object
r39 (loop :for (k v) :of *acts
Bugfixes, remaining font stuff
r33 :do (setf (getprop v :selected) nil))
Globals instead of ROOT object
r39 (setf (getprop *acts title :selected) t)
Optimizations: JUMP-loops, FOR loops, and variable access
r37 (call-serv-loc "$ONACTSEL"))
100% parser, 100% macros, 50% intrinsics, 10% api, 0% misc
r1
Properly handle stringly-indexed arrays
r16 ;;; Variables
Tutorial game works!
r6
Null indexes
r38 (defun new-var (slot &rest indexes)
Optimizations: JUMP-loops, FOR loops, and variable access
r37 (let ((v (list)))
Null indexes
r38 (dolist (index indexes)
Optimizations: JUMP-loops, FOR loops, and variable access
r37 (setf (elt v index) (if (eq #\$ (elt slot 0)) "" 0)))
Null indexes
r38 (setf (@ v :indexes) (create))
Optimizations: JUMP-loops, FOR loops, and variable access
r37 v))
Locals
r14
Optimizations: JUMP-loops, FOR loops, and variable access
r37 (defun set-str-element (slot index value)
Bugfixes
r41 (if (has index (getprop slot :indexes))
Fix a bug with kill-var and calling service locations
r66 (setf (elt slot (getprop slot :indexes index))
Optimizations: JUMP-loops, FOR loops, and variable access
r37 value)
(progn
(chain slot (push value))
Fix a bug with kill-var and calling service locations
r66 (setf (getprop slot :indexes index)
(1- (length slot)))))
Fix service variables
r42 (void))
Tutorial game works!
r6
Optimizations: JUMP-loops, FOR loops, and variable access
r37 (defun set-any-element (slot index value)
Fix service variables
r42 (cond ((null index)
(chain (elt slot) (push value)))
((numberp index)
(setf (elt slot index) value))
((stringp index)
(set-str-element slot index value))
(t (report-error "INTERNAL ERROR")))
(void))
(defun set-serv-var (name index value)
(let ((slot (getprop *globals name)))
(set-any-element slot index value))
(funcall (getprop serv-vars name :body) value index)
(void))
Menu, game saving
r11
Optimizations: JUMP-loops, FOR loops, and variable access
r37 (defun get-element (slot index)
(if (numberp index)
(elt slot index)
(elt slot (getprop slot :indexes index))))
Locals
r14
Fix two regressions
r64 (defun set-global (name index value)
(set-any-element (getprop *globals name) index value))
Optimizations: JUMP-loops, FOR loops, and variable access
r37 (defun get-global (name index)
Fix two regressions
r64 (get-element (getprop *globals name) index))
Optimizations: JUMP-loops, FOR loops, and variable access
r37
Fix two regressions
r64 (defun kill-var (&optional name index)
(cond (name
(setf name (chain name (to-upper-case)))
Fix a bug with kill-var and calling service locations
r66 (cond ((and index (not (= 0 index)))
(chain (getprop *globals name) (kill index)))
(t
(setf (getprop *globals name) (list))
(setf (getprop *globals name "indexes") (create)))))
Fix two regressions
r64 (t
(setf *globals (create))
(init-globals *main-game)))
Removing unnecessary returns
r27 (void))
Tutorial game works!
r6
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun array-size (name)
Special variables and locations
r32 (@ (var-ref name) :values length))
Properly handle stringly-indexed arrays
r16
;;; Locals
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun push-local-frame ()
Globals instead of ROOT object
r39 (chain *locals (push (create)))
Removing unnecessary returns
r27 (void))
Properly handle stringly-indexed arrays
r16
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun pop-local-frame ()
Globals instead of ROOT object
r39 (chain *locals (pop))
Removing unnecessary returns
r27 (void))
Properly handle stringly-indexed arrays
r16
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun current-local-frame ()
Globals instead of ROOT object
r39 (elt *locals (1- (length *locals))))
Properly handle stringly-indexed arrays
r16
Tutorial game works!
r6 ;;; Objects
Special variables and locations
r32 (defun select-obj (title img)
Globals instead of ROOT object
r39 (loop :for (k v) :of *objs
Bugfixes, remaining font stuff
r33 :do (setf (getprop v :selected) nil))
Globals instead of ROOT object
r39 (setf (getprop *objs title :selected) t)
Optimizations: JUMP-loops, FOR loops, and variable access
r37 (call-serv-loc "$ONOBJSEL" title img))
Special variables and locations
r32
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun update-objs ()
(let ((elt (by-id "qsp-objs")))
(setf (inner-html elt) "<ul>")
Globals instead of ROOT object
r39 (loop :for (name obj) :of *objs
Special variables and locations
r32 :do (incf (inner-html elt)
Bugfixes, remaining font stuff
r33 (make-obj name (@ obj :img) (@ obj :selected))))
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (incf (inner-html elt) "</ul>")))
Menu, game saving
r11
;;; Menu
MENU
r30 (defun open-menu (menu-data)
(let ((elt (get-frame :dropdown))
Menu, game saving
r11 (i 0))
(loop :for item :in menu-data
:do (incf i)
MENU
r30 :do (incf (inner-html elt)
(if (eq item :delimiter)
(make-menu-delimiter i)
(make-menu-item-html i
(@ item :text)
(@ item :icon)
(@ item :loc)))))
(let ((mouse (@ window mouse)))
(setf (@ elt style left) (+ (elt mouse 0) "px"))
(setf (@ elt style top) (+ (elt mouse 1) "px"))
;; Make sure it's inside the viewport
(when (> (@ document body inner-width)
(+ (elt mouse 0) (@ elt inner-width)))
(incf (@ elt style left) (@ elt inner-width)))
(when (> (@ document body inner-height)
(+ (elt mouse 0) (@ elt inner-height)))
(incf (@ elt style top) (@ elt inner-height))))
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (setf (@ elt style display) "block")))
Sounds, save/load UI buttons
r12
MENU
r30 (defun finish-menu (loc)
Globals instead of ROOT object
r39 (when *menu-resume
MENU
r30 (let ((elt (get-frame :dropdown)))
(setf (inner-html elt) "")
(setf (@ elt style display) "none")
Globals instead of ROOT object
r39 (funcall *menu-resume)
(setf *menu-resume nil))
MENU
r30 (when loc
(call-loc loc)))
(void))
(defun menu (menu-data)
(with-sleep (resume)
(open-menu menu-data)
Globals instead of ROOT object
r39 (setf *menu-resume resume))
MENU
r30 (void))
Sounds, save/load UI buttons
r12 ;;; Content
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun clean-audio ()
Globals instead of ROOT object
r39 (loop :for k :in (chain *object (keys *playing))
:for v := (getprop *playing k)
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 :do (when (@ v ended)
Globals instead of ROOT object
r39 (delete (@ *playing k)))))
Locals
r14
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun show-image (path)
MENU
r30 (let ((img (get-frame :image)))
Some DOM stuff, VIEW
r18 (cond (path
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (setf (@ img src) path)
(setf (@ img style display) "flex"))
Some DOM stuff, VIEW
r18 (t
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (setf (@ img src) "")
(setf (@ img style display) "hidden")))))
Some DOM stuff, VIEW
r18
Special variables and locations
r32 (defun rgb-string (rgb)
Bugfixes, remaining font stuff
r33 (let ((red (ps::>> rgb 16))
(green (logand (ps::>> rgb 8) 255))
(blue (logand rgb 255)))
Special variables and locations
r32 (flet ((rgb-to-hex (comp)
(let ((hex (chain (*number comp) (to-string 16))))
(if (< (length hex) 2)
(+ "0" hex)
hex))))
Fix service variables
r43 (+ "#" (rgb-to-hex red) (rgb-to-hex green) (rgb-to-hex blue)))))
Special variables and locations
r32
Working Linux build, some CLI improvements
r44 (defun store-obj (key obj)
(store-str key (btoa (encode-u-r-i-component (chain *j-s-o-n (stringify obj)))))
(void))
(defun store-str (key str)
(chain local-storage (set-item (+ "qsp_" key) str))
(void))
(defun load-obj (key)
(chain *j-s-o-n (parse (encode-u-r-i-component (atob (load-str key))))))
(defun load-str (key)
(chain local-storage (get-item (+ "qsp_" key))))
Some DOM stuff, VIEW
r18 ;;; Saves
Working Linux build, some CLI improvements
r44 (defun slot-savegame (slot comment)
(let ((saves (load-obj "saves")))
(setf (@ saves slot) comment)
(store-obj saves))
(store-str slot (state-to-base64))
(void))
(defun slot-loadgame (slot)
(base64-to-state (load-str slot))
(void))
(defun slot-deletegame (slot)
(let ((saves (load-obj "saves")))
(setf (@ saves slot) undefined)
(store-obj saves))
(store-str slot undefined)
(void))
(defun slot-listgames ()
(load-obj "saves"))
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun opengame ()
(let ((element (chain document (create-element :input))))
(chain element (set-attribute :type :file))
(chain element (set-attribute :id :qsp-opengame))
(chain element (set-attribute :tabindex -1))
(chain element (set-attribute "aria-hidden" t))
(setf (@ element style display) :block)
(setf (@ element style visibility) :hidden)
(setf (@ element style position) :fixed)
(setf (@ element onchange)
Some DOM stuff, VIEW
r18 (lambda (event)
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (let* ((file (@ event target files 0))
(reader (new (*file-reader))))
(setf (@ reader onload)
Some DOM stuff, VIEW
r18 (lambda (ev)
(block nil
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (let ((target (@ ev current-target)))
(unless (@ target result)
(return))
(base64-to-state (@ target result))
(unstash-state)))))
(chain reader (read-as-text file)))))
(chain document body (append-child element))
(chain element (click))
(chain document body (remove-child element))))
Some DOM stuff, VIEW
r18
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun savegame ()
(let ((element (chain document (create-element :a))))
(chain element (set-attribute :href (+ "data:text/plain;charset=utf-8," (state-to-base64))))
(chain element (set-attribute :download "savegame.sav"))
(setf (@ element style display) :none)
(chain document body (append-child element))
(chain element (click))
(chain document body (remove-child element))))
Finishing lib
r20
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun stash-state (args)
Optimizations: JUMP-loops, FOR loops, and variable access
r37 (call-serv-loc "$ONGSAVE")
Globals instead of ROOT object
r39 (setf *state-stash
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (chain *j-s-o-n (stringify
Bugfixes to optimized variables. CURACT, DELACT
r40 (create :vars *globals
Globals instead of ROOT object
r39 :objs *objs
Removing unnecessary returns
r27 :loc-args args
Globals instead of ROOT object
r39 :msecs (- (chain *date (now)) *started-at)
:timer-interval *timer-interval
Removing unnecessary returns
r27 :main-html (inner-html
MENU
r30 (get-frame :main))
Removing unnecessary returns
r27 :stat-html (inner-html
MENU
r30 (get-frame :stat))
Globals instead of ROOT object
r39 :next-location *current-location))))
Removing unnecessary returns
r27 (void))
Finishing lib
r20
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun unstash-state ()
Globals instead of ROOT object
r39 (let ((data (chain *j-s-o-n (parse *state-stash))))
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (clear-act)
Bugfixes to optimized variables. CURACT, DELACT
r40 (setf *globals (@ data :vars))
(loop :for k :in (chain *object (keys *globals))
:do (chain *object (set-prototype-of (getprop *globals k)
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (@ *var prototype))))
Globals instead of ROOT object
r39 (setf *started-at (- (chain *date (now)) (@ data :msecs)))
(setf *objs (@ data :objs))
(setf *current-location (@ data :next-location))
MENU
r30 (setf (inner-html (get-frame :main))
Removing unnecessary returns
r27 (@ data :main-html))
MENU
r30 (setf (inner-html (get-frame :stat))
Removing unnecessary returns
r27 (@ data :stat-html))
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (update-objs)
Removing unnecessary returns
r27 (set-timer (@ data :timer-interval))
Optimizations: JUMP-loops, FOR loops, and variable access
r37 (call-serv-loc "$ONGLOAD")
Globals instead of ROOT object
r39 (call-loc *current-location (@ data :loc-args))
Removing unnecessary returns
r27 (void)))
Finishing lib
r20
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun state-to-base64 ()
Globals instead of ROOT object
r39 (btoa (encode-u-r-i-component *state-stash)))
Finishing lib
r20
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun base64-to-state (data)
Globals instead of ROOT object
r39 (setf *state-stash (decode-u-r-i-component (atob data))))
Finishing lib
r20
;;; Timers
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun set-timer (interval)
Globals instead of ROOT object
r39 (setf *timer-interval interval)
(clear-interval *timer-obj)
(setf *timer-obj
Finishing lib
r20 (set-interval
(lambda ()
Optimizations: JUMP-loops, FOR loops, and variable access
r37 (call-serv-loc "$COUNTER"))
Finishing lib
r20 interval)))
Special variables and locations
r32
;;; Special variables
Bugfixes, remaining font stuff
r33 (defvar serv-vars (create))
Fix service variables
r42 (define-serv-var $backimage (path)
Special variables and locations
r32 (setf (@ (get-frame :main) style background-image) path))
Fix service variables
r42 (define-serv-var bcolor (color)
Special variables and locations
r32 (setf (@ (get-frame :all) style background-color) (rgb-string color)))
Fix service variables
r42 (define-serv-var fcolor (color)
Special variables and locations
r32 (setf (@ (get-frame :all) style color) (rgb-string color)))
Fix service variables
r42 (define-serv-var lcolor (color)
Special variables and locations
r32 (setf (@ (get-frame :style) inner-text)
(+ "a { color: " (rgb-string color) ";}")))
Bugfixes, remaining font stuff
r33
Fix service variables
r42 (define-serv-var fsize (size)
Bugfixes, remaining font stuff
r33 (setf (@ (get-frame :all) style font-size) size))
Fix service variables
r42 (define-serv-var $fname (font-name)
Bugfixes, remaining font stuff
r33 (setf (@ (get-frame :all) style font-family) (+ font-name ",serif")))