##// END OF EJS Templates
Bugfixes
Bugfixes

File last commit:

r41:097aa130 default
r41:097aa130 default
Show More
api.ps
488 lines | 14.0 KiB | application/postscript | PostScriptLexer
100% parser, 100% macros, 50% intrinsics, 10% api, 0% misc
r1
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (in-package sugar-qsp.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
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
Globals instead of ROOT object
r39 (let ((loc (getprop *locs loc-name)))
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)
100% parser, 100% macros, 50% intrinsics, 10% api, 0% misc
r1 (dotimes (i (length args))
Properly handle stringly-indexed arrays
r16 (let ((arg (elt args i)))
(if (numberp arg)
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (set-var args i :num arg)
(set-var args i :str 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
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (with-call-args args
Bugfixes
r41 (funcall (getprop *locs name))))
(void))
Remove cl-uglify-js
r23
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun call-act (title)
Bugfixes
r41 (setf *current-action title)
(with-frame
(funcall (getprop *acts title :act)))
(setf *current-action nil)
(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
Bugfixes
r41 (defun del-act (&optional title)
Bugfixes to optimized variables. CURACT, DELACT
r40 (delete (getprop *acts (or title *current-action)))
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
API call for FOR loop to make the main code less cluttered
r19 ;;; "Syntax"
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defun qspfor (name index from to step body)
(for ((i from))
((< i to))
((incf i step))
(set-var name index :num i)
Benchmark, bugfixes, code walker
r36 (unless (await (funcall body))
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (return-from qspfor))))
API call for FOR loop to make the main code less cluttered
r19
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))
Optimizations: JUMP-loops, FOR loops, and variable access
r37 (setf (elt (getprop slot)
(getprop slot :indexes index))
value)
(progn
(chain slot (push value))
(setf (elt slot index)
(length slot)))))
Tutorial game works!
r6
Optimizations: JUMP-loops, FOR loops, and variable access
r37 (defun set-any-element (slot index value)
(if (numberp index)
(setf (elt slot index) value)
(set-str-element slot index value)))
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
Optimizations: JUMP-loops, FOR loops, and variable access
r37 (defun get-global (name index)
Globals instead of ROOT object
r39 (elt (getprop *globals name) index))
Optimizations: JUMP-loops, FOR loops, and variable access
r37
(defun kill-var (store name &optional index)
MENU
r30 (setf name (chain name (to-upper-case)))
Properly handle stringly-indexed arrays
r16 (if (and index (not (= 0 index)))
Bugfixes to optimized variables. CURACT, DELACT
r40 (chain (getprop *globals name) (kill index))
(delete (getprop *globals name)))
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
IMG and *IMG
r34 (defun show-inline-images (frame-name images)
(let ((frame (get-frame frame-name))
(text ""))
(incf text "<div style='position:relative; display: inline-block'>")
(incf text (+ "<img src='" (@ images 0) "'>"))
(loop :for image :in (chain images (slice 1))
:do (incf text
(+ "<img style='position:absolute' src='" image "'>")))
(incf text "</div>")
(incf (inner-html frame) text)))
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))))
(+ "#" (rgb-to-hex red) (rgb-to-hex green) (rgb-to-hex red)))))
Some DOM stuff, VIEW
r18 ;;; 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))
Special variables and locations
r32 (define-serv-var backimage (:str path)
(setf (@ (get-frame :main) style background-image) path))
(define-serv-var bcolor (:num color)
(setf (@ (get-frame :all) style background-color) (rgb-string color)))
(define-serv-var fcolor (:num color)
(setf (@ (get-frame :all) style color) (rgb-string color)))
(define-serv-var lcolor (:num color)
(setf (@ (get-frame :style) inner-text)
(+ "a { color: " (rgb-string color) ";}")))
Bugfixes, remaining font stuff
r33
(define-serv-var fsize (:num size)
(setf (@ (get-frame :all) style font-size) size))
(define-serv-var fname (:str font-name)
(setf (@ (get-frame :all) style font-family) (+ font-name ",serif")))