Skip to content

Commit 1fb4ebf

Browse files
AllenDowneyclaude
andcommitted
Restore embed/ pages for WordPress iframes (dropped by the 2026-08-24 rebuild).
collatz-conjecture.html and fruit-charat-repl.html, copied from quarto/embed/ on master. Used by allendowney.com/blog Think Java post. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 7b54b99 commit 1fb4ebf

2 files changed

Lines changed: 126 additions & 0 deletions

File tree

‎embed/collatz-conjecture.html‎

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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+
/* Light console to match the editor (embed-only override). */
10+
:root {
11+
--jr-console-bg: #ffffff;
12+
--jr-console-text: #1a1a1a;
13+
--jr-console-input: #005a9e;
14+
--jr-console-error: #c62828;
15+
--jr-console-separator: #e0e0e0;
16+
--jr-input-bg: #f8f9fa;
17+
--jr-input-border: #d0d0d0;
18+
}
19+
.jr-repl, .jr-console { color-scheme: light; }
20+
.jr-repl-input-line {
21+
background: var(--jr-console-bg);
22+
border-top: 1px solid var(--jr-console-separator);
23+
}
24+
.jr-repl-input, .jr-console-input-field {
25+
background-color: var(--jr-input-bg) !important;
26+
color: var(--jr-console-text) !important;
27+
caret-color: var(--jr-console-text);
28+
-webkit-text-fill-color: var(--jr-console-text);
29+
}
30+
.jr-repl-echo { color: var(--jr-console-text); }
31+
.jr-editor .cm-activeLine { background-color: rgba(204, 238, 255, 0.27) !important; }
32+
.jr-editor .cm-activeLineGutter { background-color: #e2f2ff !important; }
33+
.jr-pending-code {
34+
background-color: #f8f9fa;
35+
padding: 0.5em 0.75em;
36+
border-radius: 3px;
37+
border: 1px solid #e0e0e0;
38+
font-size: 0.95em;
39+
overflow-x: auto;
40+
margin: 0 0 0.5em 0;
41+
}
42+
.jr-pending:has(.jr-widget) > .jr-pending-code { display: none; }
43+
.jr-btn-test { display: none !important; }
44+
</style>
45+
</head>
46+
<body>
47+
<div class="jr-pending">
48+
<pre class="jr-pending-code"><code>int n = 3;
49+
while (n != 1) {
50+
System.out.println(n);
51+
if (n % 2 == 0) { // n is even
52+
n = n / 2;
53+
} else { // n is odd
54+
n = 3 * n + 1;
55+
}
56+
}</code></pre>
57+
<script type="text/x-java">
58+
int n = 3;
59+
while (n != 1) {
60+
System.out.println(n);
61+
if (n % 2 == 0) { // n is even
62+
n = n / 2;
63+
} else { // n is odd
64+
n = 3 * n + 1;
65+
}
66+
}
67+
</script>
68+
</div>
69+
<script defer src="https://chrismayfield.github.io/ThinkJava2/assets/javarunner/javarunner.js"></script>
70+
</body>
71+
</html>

‎embed/fruit-charat-repl.html‎

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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+
/* Light console/REPL to match the editor (embed-only override). */
10+
:root {
11+
--jr-console-bg: #ffffff;
12+
--jr-console-text: #1a1a1a;
13+
--jr-console-input: #005a9e;
14+
--jr-console-error: #c62828;
15+
--jr-console-separator: #e0e0e0;
16+
--jr-input-bg: #f8f9fa;
17+
--jr-input-border: #d0d0d0;
18+
}
19+
.jr-repl, .jr-console { color-scheme: light; }
20+
.jr-repl-input-line {
21+
background: var(--jr-console-bg);
22+
border-top: 1px solid var(--jr-console-separator);
23+
}
24+
.jr-repl-input, .jr-console-input-field {
25+
background-color: var(--jr-input-bg) !important;
26+
color: var(--jr-console-text) !important;
27+
caret-color: var(--jr-console-text);
28+
-webkit-text-fill-color: var(--jr-console-text);
29+
}
30+
.jr-repl-echo { color: var(--jr-console-text); }
31+
.jr-pending-code {
32+
background-color: #f8f9fa;
33+
padding: 0.5em 0.75em;
34+
border-radius: 3px;
35+
border: 1px solid #e0e0e0;
36+
font-size: 0.95em;
37+
overflow-x: auto;
38+
margin: 0 0 0.5em 0;
39+
}
40+
.jr-pending:has(.jr-widget) > .jr-pending-code { display: none; }
41+
.jr-btn-test { display: none !important; }
42+
</style>
43+
</head>
44+
<body>
45+
<div class="jr-pending">
46+
<pre class="jr-pending-code"><code>String fruit = "banana";
47+
char letter = fruit.charAt(0);</code></pre>
48+
<script type="text/x-java-repl">
49+
String fruit = "banana";
50+
char letter = fruit.charAt(0);
51+
</script>
52+
</div>
53+
<script defer src="https://chrismayfield.github.io/ThinkJava2/assets/javarunner/javarunner.js"></script>
54+
</body>
55+
</html>

0 commit comments

Comments
 (0)