Skip to content

Commit 59d2fe0

Browse files
committed
Add Collatz java-runner embed for WordPress iframes.
1 parent 9b2d228 commit 59d2fe0

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

‎embed/collatz-conjecture.html‎

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<link rel="stylesheet" href="https://chrismayfield.github.io/ThinkJava2/assets/javarunner/javarunner.css">
7+
<style>
8+
html, body { margin: 0; padding: 8px; }
9+
.jr-pending-code {
10+
background-color: #f8f9fa;
11+
padding: 0.5em 0.75em;
12+
border-radius: 3px;
13+
border: 1px solid #e0e0e0;
14+
font-size: 0.95em;
15+
overflow-x: auto;
16+
margin: 0 0 0.5em 0;
17+
}
18+
.jr-pending:has(.jr-widget) > .jr-pending-code { display: none; }
19+
.jr-btn-test { display: none !important; }
20+
</style>
21+
</head>
22+
<body>
23+
<div class="jr-pending">
24+
<pre class="jr-pending-code"><code>int n = 3;
25+
while (n != 1) {
26+
System.out.println(n);
27+
if (n % 2 == 0) { // n is even
28+
n = n / 2;
29+
} else { // n is odd
30+
n = 3 * n + 1;
31+
}
32+
}</code></pre>
33+
<script type="text/x-java">
34+
int n = 3;
35+
while (n != 1) {
36+
System.out.println(n);
37+
if (n % 2 == 0) { // n is even
38+
n = n / 2;
39+
} else { // n is odd
40+
n = 3 * n + 1;
41+
}
42+
}
43+
</script>
44+
</div>
45+
<script defer src="https://chrismayfield.github.io/ThinkJava2/assets/javarunner/javarunner.js"></script>
46+
</body>
47+
</html>

0 commit comments

Comments
 (0)