Skip to content

Commit 3159dda

Browse files
committed
Refactor tutorial HTML files to improve image presentation and add orientation message for better user experience on mobile devices.
1 parent 92ee013 commit 3159dda

File tree

6 files changed

+44
-43
lines changed

6 files changed

+44
-43
lines changed

tutorials/HeatConduction1DWall.html

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,6 @@
4040
></script>
4141
<!-- Import the run_prettify.js library for JavaScript code coloring *** Deprecated library *** -->
4242
<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>
43-
<style>
44-
#orientation-message {
45-
display: none;
46-
color: red;
47-
font-weight: bold;
48-
}
49-
</style>
5043
</head>
5144

5245
<!-- Google tag (gtag.js) -->
@@ -95,7 +88,12 @@ <h2 id="mathematicalformulation"><a name="Mathematical formulation"></a>Mathemat
9588
within common engineering components like house walls.
9689
</p>
9790

98-
<img src="../assets/HeatConduction1DWall.png" alt="1D heat conduction schematic" width="100" />
91+
<div class="center-image">
92+
<img src="../assets/HeatConduction1DWall.png" alt="1D heat conduction schematic" width="100" />
93+
<p class="image-caption">
94+
Schematic of the 1D wall showing convection at x = 0 and prescribed temperature at x = W
95+
</p>
96+
</div>
9997

10098
<p>
10199
The above schematic illustrates the problem domain and outlines the associated boundary conditions. The

tutorials/HeatConduction2DFin.html

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,6 @@
4040
></script>
4141
<!-- Import the run_prettify.js library for JavaScript code coloring *** Deprecated library *** -->
4242
<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>
43-
<style>
44-
#orientation-message {
45-
display: none;
46-
color: red;
47-
font-weight: bold;
48-
}
49-
</style>
5043
</head>
5144

5245
<!-- Google tag (gtag.js) -->
@@ -93,7 +86,16 @@ <h2 id="mathematicalformulation"><a name="Mathematical formulation"></a>Mathemat
9386
Steady heat conduction is described by the Laplace equation: \(\nabla^{2}T(x,y) = 0\), where \(T\)
9487
denotes the temperature.
9588
</p>
96-
<img src="../assets/HeatConduction2DFin.png" width="300" />
89+
90+
<div class="center-image">
91+
<img src="../assets/HeatConduction2DFin.png" alt="2D fin heat conduction schematic" width="300" />
92+
<p class="image-caption">
93+
Schematic of the 2D cooling fin: constant temperature (200&nbsp;°C) at bottom and right edges,
94+
symmetry (zero flux) at the left edge, and convection at the top edge (h/k = 1&nbsp;m⁻¹, external
95+
temperature 20&nbsp;°C)
96+
</p>
97+
</div>
98+
9799
<p>
98100
The above schematic illustrates the problem domain and outlines the associated boundary conditions. The
99101
constant temperature boundary conditions are implemented as Dirichlet-type conditions in the finite

tutorials/HeatConduction2DFinGmsh.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,10 @@ <h2 id="results"><a name="results"></a>Results</h2>
299299
applications, but may be noticeable in regions with steep temperature gradients.
300300
</p>
301301

302+
<div id="orientation-message">
303+
Cannot draw the results. Please rotate your phone to landscape orientation and refresh the page to see
304+
the results.
305+
</div>
302306
<div id="resultsCanvas"></div>
303307

304308
<ul id="menu">
@@ -324,6 +328,14 @@ <h2 id="results"><a name="results"></a>Results</h2>
324328
// } from "../../FEAScript-core/src/index.js";
325329

326330
window.addEventListener("DOMContentLoaded", async () => {
331+
if (window.innerHeight > window.innerWidth) {
332+
document.getElementById("orientation-message").style.display = "block";
333+
document.getElementById("resultsCanvas").style.display = "none";
334+
} else {
335+
document.getElementById("orientation-message").style.display = "none";
336+
document.getElementById("resultsCanvas").style.display = "block";
337+
}
338+
327339
// Enable debug logging mode
328340
//logSystem("debug");
329341

@@ -381,6 +393,16 @@ <h2 id="results"><a name="results"></a>Results</h2>
381393
"unstructured"
382394
);
383395
});
396+
397+
window.addEventListener("resize", () => {
398+
if (window.innerHeight > window.innerWidth) {
399+
document.getElementById("orientation-message").style.display = "block";
400+
document.getElementById("resultsCanvas").style.display = "none";
401+
} else {
402+
document.getElementById("orientation-message").style.display = "none";
403+
document.getElementById("resultsCanvas").style.display = "block";
404+
}
405+
});
384406
</script>
385407

386408
<footer>

tutorials/HeatConduction2DFinWorker.html

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,6 @@
4040
></script>
4141
<!-- Import the run_prettify.js library for JavaScript code coloring *** Deprecated library *** -->
4242
<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>
43-
<style>
44-
#orientation-message {
45-
display: none;
46-
color: red;
47-
font-weight: bold;
48-
}
49-
</style>
5043
</head>
5144

5245
<!-- Google tag (gtag.js) -->
@@ -94,9 +87,9 @@ <h1>Heat Conduction in a Two-Dimensional Fin Tutorial (Multi-threaded)</h1>
9487
start chrome --disable-web-security --user-data-dir="C:\tmp\chrome-cors" --disable-site-isolation-trials</pre
9588
>
9689
<p>
97-
These flags disable CORS restrictions which are normally required when working with web workers in a
98-
local environment. For production applications, proper CORS headers should be configured on your
99-
server.
90+
These flags temporarily disable CORS restrictions that normally block a web worker from loading
91+
scripts or data when running from local files. For production applications, proper CORS headers should
92+
be configured on your server.
10093
</p>
10194
</div>
10295

tutorials/SolidificationFront2D.html

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,6 @@
4040
></script>
4141
<!-- Import the run_prettify.js library for JavaScript code coloring *** Deprecated library *** -->
4242
<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>
43-
<style>
44-
#orientation-message {
45-
display: none;
46-
color: red;
47-
font-weight: bold;
48-
}
49-
</style>
5043
</head>
5144

5245
<!-- Google tag (gtag.js) -->

tutorials/SolidificationFront2DWorker.html

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,6 @@
4040
></script>
4141
<!-- Import the run_prettify.js library for JavaScript code coloring *** Deprecated library *** -->
4242
<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>
43-
<style>
44-
#orientation-message {
45-
display: none;
46-
color: red;
47-
font-weight: bold;
48-
}
49-
</style>
5043
</head>
5144

5245
<!-- Google tag (gtag.js) -->
@@ -94,9 +87,9 @@ <h1>Solidification Front Propagation in a Two-Dimensional Domain (Multi-threaded
9487
start chrome --disable-web-security --user-data-dir="C:\tmp\chrome-cors" --disable-site-isolation-trials</pre
9588
>
9689
<p>
97-
These flags disable CORS restrictions which are normally required when working with web workers in a
98-
local environment. For production applications, proper CORS headers should be configured on your
99-
server.
90+
These flags temporarily disable CORS restrictions that normally block a web worker from loading
91+
scripts or data when running from local files. For production applications, proper CORS headers should
92+
be configured on your server.
10093
</p>
10194
</div>
10295

0 commit comments

Comments
 (0)