scittle/resources/public/tictactoe.html
2021-05-26 11:48:38 +02:00

46 lines
2.3 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="css/style.css">
<script src="js/sci-script-tag.js" type="application/javascript"></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 src="js/sci-script-tag-plugin-reagent.js" type="application/javascript"></script>
<script type="application/x-sci" 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/languages/clojure.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" />
</head>
<body>
<h1>SCI script tag: Reagent tic-tac-toe</h1>
<h2>What is SCI script tag?</h2>
<p>Read <a href="index.html">the main page</a> for more details.</p>
<h2>Reagent tic tac toe</h2>
<div id="app"></div>
<p>The following source was loaded and interpreted
from <a href="cljs/tictactoe.cljs"><tt>cljs/tictactoe.cljs</tt></a> using the
script tag:
<pre><code class="html">
&lt;script type=&quot;application/x-sci&quot; src=&quot;cljs/tictactoe.cljs&quot;&gt;&lt;/script&gt;
&lt;script crossorigin src=&quot;https://unpkg.com/react@17/umd/react.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;
</code></pre>
</p>
<pre><code class="language-clojure" id="cljs"></code></pre>
<script type="application/x-sci">
(defn set-text [progress-event]
(let [elt (.getElementById js/document "cljs")]
(set! (.-innerHTML elt) (.. progress-event -srcElement -responseText))
(.highlightAll js/hljs)))
(def oreq (js/XMLHttpRequest.))
(.addEventListener oreq "load" set-text)
(.open oreq "GET" "cljs/tictactoe.cljs")
(.send oreq)
</script>
</body>
</html>