|
46 | 46 | :initform nil |
47 | 47 | :accessor truth))) |
48 | 48 |
|
| 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 | + |
49 | 68 | (defun truth-table (exp) |
50 | 69 | (with-output-to-string (s) |
51 | 70 | (let ((inference:*output-stream* s)) |
|
74 | 93 | (update-table table prop))) |
75 | 94 | (:input :type "text" |
76 | 95 | :id "prop-input" |
| 96 | + :style "text-align:center;" |
77 | 97 | :name "prop" |
78 | 98 | :placeholder (prop table)) |
79 | 99 | (:input :type "submit" |
80 | 100 | :value "Eval") |
81 | 101 | (:input :type "button" |
82 | 102 | :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))) |
99 | 104 | (: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)) |
101 | 106 | (:pre (format nil "Operators: ~a" inference:*valid-operators*))) |
102 | 107 | (:p "Some notes: " |
103 | 108 | (:ul |
|
0 commit comments