Skip to content

Commit 860bc4b

Browse files
committed
fix: reduce font size, center input and move js func to macro
1 parent 8460885 commit 860bc4b

File tree

2 files changed

+26
-22
lines changed

2 files changed

+26
-22
lines changed

roswell/inference-server.ros

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,17 @@ exec ros -Q -- $0 "$@"
55
|#
66

77
#+quicklisp
8-
(defun ensure-dist-installed-and-updated (dist nick)
8+
(defun ensure-dist-installed (dist nick)
99
(let ((d (ql-dist:find-dist nick)))
10-
(if (not (and d (ql-dist:installedp d)))
10+
(when (not (and d (ql-dist:installedp d)))
1111
(ql-dist:install-dist dist
12-
:prompt nil))
13-
(ql:update-dist nick :prompt nil)))
12+
:prompt nil))))
1413

1514
(progn ;;init forms
1615
(ros:ensure-asdf)
1716
#+quicklisp
1817
(progn
19-
(ensure-dist-installed-and-updated "http://dist.ultralisp.org" "ultralisp")
18+
(ensure-dist-installed "http://dist.ultralisp.org" "ultralisp")
2019
(ql:quickload '(lisp-inference/web)))
2120
)
2221

web/webapp.lisp

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,25 @@
4646
:initform nil
4747
:accessor truth)))
4848

49+
(defmacro js-share-button-function ()
50+
"
51+
var prop = document.getElementById('prop-input').value || document.getElementById('prop-input').placeholder;
52+
var url = window.location.origin + window.location.pathname + '?prop=' + encodeURIComponent(prop);
53+
var shareUrlInput = document.getElementById('share-url');
54+
shareUrlInput.value = url;
55+
shareUrlInput.style.display = 'block';
56+
try {
57+
navigator.clipboard.writeText(url).then(function() {
58+
/* clipboard successfully set */
59+
}, function() {
60+
/* clipboard write failed */
61+
});
62+
} catch (e) {
63+
// ignore
64+
}
65+
")
66+
67+
4968
(defun truth-table (exp)
5069
(with-output-to-string (s)
5170
(let ((inference:*output-stream* s))
@@ -74,30 +93,16 @@
7493
(update-table table prop)))
7594
(:input :type "text"
7695
:id "prop-input"
96+
:style "text-align:center;"
7797
:name "prop"
7898
:placeholder (prop table))
7999
(:input :type "submit"
80100
:value "Eval")
81101
(:input :type "button"
82102
:value "Share"
83-
:onclick "
84-
var prop = document.getElementById('prop-input').value || document.getElementById('prop-input').placeholder;
85-
var url = window.location.origin + window.location.pathname + '?prop=' + encodeURIComponent(prop);
86-
var shareUrlInput = document.getElementById('share-url');
87-
shareUrlInput.value = url;
88-
shareUrlInput.style.display = 'block';
89-
try {
90-
navigator.clipboard.writeText(url).then(function() {
91-
/* clipboard successfully set */
92-
}, function() {
93-
/* clipboard write failed */
94-
});
95-
} catch (e) {
96-
// ignore
97-
}
98-
"))
103+
:onclick (js-share-button-function)))
99104
(:input :type "text" :id "share-url" :style "display: none; width: 100%; margin-top: 10px;" :readonly "readonly")
100-
(:pre :style "font-size: 25px" (truth table))
105+
(:pre :style "font-size: 20px" (truth table))
101106
(:pre (format nil "Operators: ~a" inference:*valid-operators*)))
102107
(:p "Some notes: "
103108
(:ul

0 commit comments

Comments
 (0)