x-scittle

This commit is contained in:
Michiel Borkent 2021-05-26 13:01:43 +02:00
parent 25bc58e0ee
commit 2bb0552abd
4 changed files with 12 additions and 12 deletions

View file

@ -3,7 +3,7 @@
<head> <head>
<link rel="stylesheet" href="css/style.css"> <link rel="stylesheet" href="css/style.css">
<script src="js/scittle.js" type="application/javascript"></script> <script src="js/scittle.js" type="application/javascript"></script>
<script type="application/x-sci"> <script type="application/x-scittle">
(defn my-alert [] (defn my-alert []
(js/alert "You clicked!")) (js/alert "You clicked!"))
@ -18,7 +18,7 @@
&lt;head&gt; &lt;head&gt;
&lt;script src=&quot;https://borkdude.github.io/scittle/js/scittle.js&quot; type=&quot;application/javascript&quot;&gt;&lt;/script&gt; &lt;script src=&quot;https://borkdude.github.io/scittle/js/scittle.js&quot; type=&quot;application/javascript&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;application/x-sci&quot;&gt; &lt;script type=&quot;application/x-scittle&quot;&gt;
(defn my-alert [] (defn my-alert []
(js/alert &quot;You clicked!&quot;)) (js/alert &quot;You clicked!&quot;))

View file

@ -6,7 +6,7 @@
<script crossorigin src="https://unpkg.com/react@17/umd/react.production.min.js"></script> <script crossorigin src="https://unpkg.com/react@17/umd/react.production.min.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js"></script> <script crossorigin src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js"></script>
<script src="js/scittle.reagent.js" type="application/javascript"></script> <script src="js/scittle.reagent.js" type="application/javascript"></script>
<script type="application/x-sci"> <script type="application/x-scittle">
(defn my-alert [] (defn my-alert []
(js/alert "You clicked!")) (js/alert "You clicked!"))
@ -26,7 +26,7 @@
(rdom/render [my-component] (.getElementById js/document "app")) (rdom/render [my-component] (.getElementById js/document "app"))
</script> </script>
<script src="cljs/script.cljs" type="application/x-sci"></script> <script src="cljs/script.cljs" type="application/x-scittle"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.7.2/highlight.min.js" type="text/javascript"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.7.2/highlight.min.js" type="text/javascript"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.7.2/styles/zenburn.min.css" integrity="sha512-JPxjD2t82edI35nXydY/erE9jVPpqxEJ++6nYEoZEpX2TRsmp2FpZuQqZa+wBCen5U16QZOkMadGXHCfp+tUdg==" crossorigin="anonymous" referrerpolicy="no-referrer" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.7.2/styles/zenburn.min.css" integrity="sha512-JPxjD2t82edI35nXydY/erE9jVPpqxEJ++6nYEoZEpX2TRsmp2FpZuQqZa+wBCen5U16QZOkMadGXHCfp+tUdg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
@ -52,13 +52,13 @@
Include <tt>scittle.js</tt> and write a <tt>script</tt> tag Include <tt>scittle.js</tt> and write a <tt>script</tt> tag
where <tt>type</tt> is set where <tt>type</tt> is set
to <tt>application/x-sci</tt>. to <tt>application/x-scittle</tt>.
<pre> <pre>
<code class="html">&lt;head&gt; <code class="html">&lt;head&gt;
&lt;script src=&quot;https://borkdude.github.io/scittle/js/scittle.js&quot; type=&quot;application/javascript&quot;&gt;&lt;/script&gt; &lt;script src=&quot;https://borkdude.github.io/scittle/js/scittle.js&quot; type=&quot;application/javascript&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;application/x-sci&quot;&gt; &lt;script type=&quot;application/x-scittle&quot;&gt;
(defn my-alert [] (defn my-alert []
(js/alert &quot;You clicked!&quot;)) (js/alert &quot;You clicked!&quot;))
@ -84,7 +84,7 @@
When you have a file on your server, say <tt>cljs/script.cljs</tt>, you can load it using the <tt>src</tt> attribute: When you have a file on your server, say <tt>cljs/script.cljs</tt>, you can load it using the <tt>src</tt> attribute:
<pre><code class="html"> <pre><code class="html">
&lt;script src=&quot;cljs/script.cljs&quot; type=&quot;application/x-sci&quot;&gt;&lt;/script&gt; &lt;script src=&quot;cljs/script.cljs&quot; type=&quot;application/x-scittle&quot;&gt;&lt;/script&gt;
</code></pre> </code></pre>
<a name="reagent"></a> <a name="reagent"></a>
@ -99,7 +99,7 @@
&lt;script crossorigin src=&quot;https://unpkg.com/react-dom@17/umd/react-dom.production.min.js&quot;&gt;&lt;/script&gt; &lt;script crossorigin src=&quot;https://unpkg.com/react-dom@17/umd/react-dom.production.min.js&quot;&gt;&lt;/script&gt;
&lt;script src=&quot;https://borkdude.github.io/scittle/js/scittle.reagent.js&quot; type=&quot;application/javascript&quot;&gt;&lt;/script&gt; &lt;script src=&quot;https://borkdude.github.io/scittle/js/scittle.reagent.js&quot; type=&quot;application/javascript&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;application/x-sci&quot;&gt; &lt;script type=&quot;application/x-scittle&quot;&gt;
(require '[reagent.core :as r] (require '[reagent.core :as r]
'[reagent.dom :as rdom]) '[reagent.dom :as rdom])

View file

@ -8,7 +8,7 @@
<script crossorigin src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js"></script> <script crossorigin src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js"></script>
<script src="js/scittle.reagent.js" type="application/javascript"></script> <script src="js/scittle.reagent.js" type="application/javascript"></script>
<script type="application/x-sci" src="cljs/tictactoe.cljs"></script> <script type="application/x-scittle" src="cljs/tictactoe.cljs"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.7.2/highlight.min.js" type="text/javascript"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.7.2/highlight.min.js" type="text/javascript"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.7.2/languages/clojure.min.js" type="text/javascript"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.7.2/languages/clojure.min.js" type="text/javascript"></script>
@ -25,12 +25,12 @@
from <a href="cljs/tictactoe.cljs"><tt>cljs/tictactoe.cljs</tt></a> using the from <a href="cljs/tictactoe.cljs"><tt>cljs/tictactoe.cljs</tt></a> using the
script tag: script tag:
<pre><code class="html"> <pre><code class="html">
&lt;script type=&quot;application/x-sci&quot; src=&quot;cljs/tictactoe.cljs&quot;&gt;&lt;/script&gt; &lt;script type=&quot;application/x-scittle&quot; src=&quot;cljs/tictactoe.cljs&quot;&gt;&lt;/script&gt;
</code></pre> </code></pre>
</p> </p>
<pre><code class="language-clojure" id="cljs"></code></pre> <pre><code class="language-clojure" id="cljs"></code></pre>
<script type="application/x-sci"> <script type="application/x-scittle">
(defn set-text [progress-event] (defn set-text [progress-event]
(let [elt (.getElementById js/document "cljs")] (let [elt (.getElementById js/document "cljs")]
(set! (.-innerHTML elt) (.. progress-event -srcElement -responseText)) (set! (.-innerHTML elt) (.. progress-event -srcElement -responseText))

View file

@ -58,5 +58,5 @@
(js/document.addEventListener (js/document.addEventListener
"DOMContentLoaded" "DOMContentLoaded"
(fn [] (fn []
(let [script-tags (js/document.querySelectorAll "script[type='application/x-sci']")] (let [script-tags (js/document.querySelectorAll "script[type='application/x-scittle']")]
(load-contents script-tags))), false) (load-contents script-tags))), false)