Skip to content

Commit 8c52313

Browse files
committed
feat: added dummy 'index.html' at root for client-side redirecting purposes.
1 parent bb7f406 commit 8c52313

1 file changed

Lines changed: 20 additions & 150 deletions

File tree

index.html

Lines changed: 20 additions & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -1,153 +1,23 @@
11
<!DOCTYPE html>
22
<html lang="en">
3-
<!-- Semantic tags: 'https://www.semrush.com/blog/semantic-html5-guide/', 'https://developer.mozilla.org/en-US/docs/Glossary/Semantics#semantic_elements'. -->
4-
<head>
5-
<meta charset="UTF-8">
6-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7-
<!-- Window title. -->
8-
<title>PyScript Exercises</title>
9-
<!-- Window logo. -->
10-
<link rel="icon" type="image/png" href="rsrcs/media/icon-favicon.png" />
11-
<!--
12-
External CSS stylesheet: 'https://www.w3schools.com/html/html_css.asp', 'https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/link'.
13-
- In this case, PyScript CSS.
14-
-->
15-
<link rel="stylesheet" href="https://pyscript.net/releases/2025.8.1/core.css" />
16-
<!-- External (local) CSS stylesheet, with multiple external CSS links. ORDER MATTERS! 'https://www.programminghead.com/how-to-link-multiple-css-style-sheets-in-html'. -->
17-
<link rel="stylesheet" href="rsrcs/io_inputs/app/config/web_pages/index-loading_splashscreen_(style).css">
18-
<link rel="stylesheet" href="rsrcs/io_inputs/app/config/web_pages/index_(style).css">
19-
<!--
20-
Script call; e.g. this js script tag bootstraps PyScript.
21-
- NOTE: threated as deferred script. Ref. 'https://stackoverflow.com/questions/436411/where-should-i-put-script-tags-in-html-markup/24070373#24070373'.
22-
-->
23-
<script type="module" src="https://pyscript.net/releases/2025.8.1/core.js"></script>
24-
<!--
25-
JS script call: (module) loading splashscreen.
26-
- If 'type' not defined, defaults to 'text/javascript': 'https://www.w3schools.com/tags/att_script_type.asp'.
27-
- For HTML 5, if default, discouraged to be explicit, since it's redundant: 'https://stackoverflow.com/questions/4195427/is-the-type-attribute-necessary-for-script-tags/4195504#4195504'.
28-
- 'type' module: 'https://forum.freecodecamp.org/t/the-type-module-in-html-file-whats-for/488865', 'https://stackoverflow.com/questions/39652618/classic-scripts-vs-module-scripts-in-javascript/53821485#53821485'.
29-
- 'module' scripts: 'https://neerajdana.medium.com/understanding-type-module-in-javascript-a-comprehensive-guide-ebb13926da7a'.
30-
- 'module' vs. 'non-module' scripts: 'https://neerajdana.medium.com/understanding-type-module-in-javascript-a-comprehensive-guide-ebb13926da7a'.
31-
-->
32-
<script type="module" src="rsrcs/io_inputs/app/config/web_pages/index-loading_splashscreen_(app).js"></script>
33-
</head>
34-
<body>
35-
<!-- Main dialog (as 'modal', defined in js module '_app-loading_splashscreen.js'), what appears 1st as soon as web page is loaded. -->
36-
<dialog id="dialog_loading">
37-
<h1>Loading...</h1>
38-
</dialog>
39-
<header class="header">
40-
<nav class="header-nav">
41-
<div class="header-nav-left_aligned">
42-
<img class="header-nav-left_aligned-logo" src="rsrcs/media/img-logo.png" />
43-
<div class="header-nav-left_aligned-links_container">
44-
<a class="header-nav-left_aligned-links_container-link" href="index.html"><b>HOME</b></a>
45-
<!-- <a class="header-nav-left_aligned-links_container-link" href="rsrcs/io_inputs/app/config/web_pages/hello_world.html">Hello World</a>
46-
<a class="header-nav-left_aligned-links_container-link" href="rsrcs/io_inputs/app/config/web_pages/antigravity.html">Antigravity</a> -->
47-
</div>
48-
</div>
49-
<div class="header-nav-links_container">
50-
<!-- '/' in 'href' redirects to ROOT vs. '#' that redirects to TOP of CURRENT PAGE (causing scrolling): 'https://stackoverflow.com/questions/17772692/what-does-it-means-when-there-is-fowards-slash-after-a-href/17772747#17772747', 'https://www.w3schools.com/tags/att_a_href.asp'. -->
51-
<a class="header-nav-links_container-link" href="/">[GOTO ROOT]</a>
52-
<!-- Blank 'href' REFRESH CURRENT PAGE; i.e. act as hyperlink to CURRENT PAGE: 'https://stackoverflow.com/questions/4855168/what-is-href-and-why-is-it-used/21397285#21397285'. -->
53-
<a class="header-nav-links_container-link" href="">[Refresh Current Page]</a>
54-
<a class="header-nav-links_container-link" href="#">[GOTO TOP]</a>
55-
</div>
56-
</nav>
57-
</header>
58-
<main>
59-
<section class="main-pyscript">
60-
<h1>Hello world!</h1>
61-
<br>
62-
<hr>
63-
<!-- Display content: 'https://docs.pyscript.net/2024.5.2/user-guide/builtins/#pyscriptdisplay'. -->
64-
<h2>Using 'pyscript.display': default (i.e. 'append=True') vs. 'append=False'.</h2>
65-
<ul>
66-
<li><b>Default</b>: encapsulates the result from 'pyscript.display' between a 'div' tag. Then the 'div' gets ADDED to the inner content of the target DOM element.</li>
67-
<li><b>'append=False'</b>: RE-WRITES WHATEVER previous inner content of the target DOM, with the result from 'pyscript.display'.</li>
68-
</ul>
69-
<br>
70-
<p><b>IMPORTANT</b>: whenever as possible, create an html element (and include an id) to populate with the result of 'pyscript.display' by using the 'target=' parameter / property. Otherwise, <b>un-expected behaviours</b> can happen, as the one described <i>in the comments of this html</i>.</p>
71-
<br>
72-
<p>Use the 'target=' specification inside the pyscript as a <b>parameter</b> of the 'pyscript.display' function: '<code>from pyscript import display display("PyScript running...", target="pyscript_output")</code>'.</p>
73-
<br>
74-
<p><b>CASE 01: default, default.</b></p>
75-
<p><i>Default:</i></p>
76-
<!--
77-
If running ALONE: 'pyscript.display' adds new html element '<script-py>'', right after <script>...</script>: '<script-py id="py-0"><div>...<result_from_pyscript01>...</div></script-py>'.
78-
- IMPORTANT: 'div' is added to ATTACH result, to ANY PREVIOUS inner content of the target DOM element; in this case '<script-py>', since target DOM wasn't specified in the 'pyscript.display' function.
79-
-->
80-
<script type="py" defer>
81-
from pyscript import display
82-
display("This is PyScript running... Default.", target="pyscript_tests_case01a")
83-
</script>
84-
<p id="pyscript_tests_case01a"></p>
85-
<p><i>Default:</i></p>
86-
<!--
87-
When both 'script's run sequentially, it adds new html elements, but both results get placed at the end, RIGHT AFTER the LAST <script>...</script> EXECUTED (in case, target DOMs were NOT specified in the 'pyscript.display' functions):
88-
- For 1st script, html element '<script-py id="py-0"></script-py>', still gets created in-place as regular (i.e. after the corresponding '<script>' element), but EMPTY; i.e. '<script-py id="py-0"></script-py>'.
89-
- Outputs are ALL created and assigned to LAST html element '<script-py>' (in case, target DOMs were NOT specified in the 'pyscript.display' functions): '<script-py id="py-1"><div>...<result_from_pyscript01>...</div><div>...<result_from_pyscript02>...</div></script-py>'; id="py-0" to "py-1", in this case for x2 pyscripts executions.
90-
-->
91-
<script type="py" defer>
92-
from pyscript import display
93-
display("This is PyScript running... Default.", target="pyscript_tests_case01b")
94-
</script>
95-
<p id="pyscript_tests_case01b"></p>
96-
<br>
97-
<p><b>CASE 02: default, 'append=False'.</b></p>
98-
<p><i>Default:</i></p>
99-
<!-- [As first example.] -->
100-
<script type="py" defer>
101-
from pyscript import display
102-
display("This is PyScript running... Default.", target="pyscript_tests_case02a")
103-
</script>
104-
<p id="pyscript_tests_case02a"></p>
105-
</p><i>'append=False':</i></p>
106-
<!--
107-
If running ALONE: 'pyscript.display' adds new html element '<script-py>'', right after <script>...</script> (without <div>): '<script-py id="py-0">...<result_from_display>...</script-py>'.
108-
- IMPORTANT: this time, there are no '<div>', since ANY PREVIOUS inner content of the target DOM element is OVERWRITTEN.
109-
-->
110-
<!--
111-
When both 'script's run sequentially, it adds new html elements, but both results get placed at the end, RIGHT AFTER the LAST <script>...</script> EXECUTED (in case, target DOMs were NOT specified in the 'pyscript.display' functions):
112-
- For 1st script, html element '<script-py id="py-0"></script-py>', still gets created in-place as regular (i.e. after the corresponding '<script>' element), but EMPTY; i.e. '<script-py id="py-0"></script-py>'.
113-
- Created outputs depend on which pyscripts were run with 'append=False'. Any pyscript as such, WILL OVERWRITE ANY PREVIOUS inner content of the target DOM (in case, target DOMs were NOT specified in the 'pyscript.display' functions); in this case, 1st pyscript is overwritten and only results from 2nd pyscript are showed: '<script-py id="py-1">...<result_from_pyscript02>...</script-py>'; id="py-0" to "py-1", in this case for x2 scripts executions.
114-
-->
115-
<script type="py" defer>
116-
from pyscript import display
117-
display("This is PyScript running... 'append=False'.", append=False, target="pyscript_tests_case02b")
118-
</script>
119-
<p id="pyscript_tests_case02b"></p>
120-
<br>
121-
<h2>Example with 'pyscript.display': review 'pyscript.config' parameters.</h2>
122-
<script type="py" defer>
123-
from pyscript import display, config
124-
display(config.get("files"), target="pyscript_output_config_files")
125-
display(config.get("packages"), target="pyscript_output_config_packages")
126-
</script>
127-
<p id="pyscript_output_config_files"><b>Config. files</b>: </p>
128-
<p id="pyscript_output_config_packages"><b>Config packages</b>: </p>
129-
<br>
130-
<h2>Example with 'pyscript.display': display date and time. DOESN'T USE 'target=' specification.</h2>
131-
<p>This is the current date and time, as computed by Python:</p>
132-
<script type="py" defer>
133-
from pyscript import display
134-
from datetime import datetime
135-
now = datetime.now()
136-
display(now.strftime("%m/%d/%Y, %H:%M:%S"))
137-
</script>
138-
<br>
139-
<hr>
140-
</section>
141-
<section class="main-pyscript">
142-
<b>Based on xkcd: antigravity <a href="https://xkcd.com/353/" target="_blank">https://xkcd.com/353/</a>.</b>
143-
<script type="py" src="rsrcs/io_inputs/app/config/imports/main.py" config="rsrcs/io_inputs/app/config/imports/main-pyscript.json" defer></script>
144-
<!--
145-
TODO: investigate how to redirect output to an html element.
146-
- So far, un-successful; e.g. use 'svg' element.
147-
- For now, it renders output in a 'svg' tag, but OUT of 'main', but inside of 'body'. Check with developer tools (F12), in a regular web-browser.
148-
-->
149-
<!-- <svg id="pyscript_output"></svg> -->
150-
</section>
151-
</main>
152-
</body>
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<!--
7+
Using a dummy 'index.html' at ROOT to redirect: 'https://stackoverflow.com/questions/25320356/can-i-have-my-github-pages-index-html-in-a-subfolder-of-the-repository/25327759#25327759'.
8+
- GitHub pages 'index/html' file: 'https://docs.github.com/en/pages/getting-started-with-github-pages/troubleshooting-404-errors-for-github-pages-sites#indexhtml-file'.
9+
- GitHub example: 'https://gist.github.com/jaredchu/c4e9575f65feaab8c7c100b2ee618906'.
10+
- HubsPot guideline: 'https://blog.hubspot.com/website/html-redirect'.
11+
- W3Org example: 'https://www.w3.org/TR/WCAG20-TECHS/H76.html'.
12+
-->
13+
<title>Redirect...</title>
14+
<meta http-equiv="Refresh" content="1; URL='./rsrcs/io_inputs/app/config/web_pages/home.html'" />
15+
</head>
16+
<body style="background-color: #0D1117; color: #F6F6F6;">
17+
<!--
18+
Add a fallback method for old browsers that might generate conflict with 'meta' element.
19+
- Example: 'https://stackoverflow.com/questions/5411538/how-to-redirect-one-html-page-to-another-on-load/5411567#5411567'.
20+
-->
21+
<p>This page has been moved. If you are not re-directed within 1 second(s), click <a href="./rsrcs/io_inputs/app/config/web_pages/home.html">here</a>.</p>
22+
</body>
15323
</html>

0 commit comments

Comments
 (0)