commit 172da8fc136251ed42cfede5c23d04cd0de44b14
parent 8f58633dcb7d6cfc19f03fcbafa3e642a19ef2e1
Author: Hunter
Date:   Mon,  7 Jul 2025 23:20:06 -0400

save load

Diffstat:
Rresources/images/Coffeeclipart.webp -> images/Coffeeclipart.webp | 0
Rresources/images/clippy.jpg -> images/clippy.jpg | 0
Rresources/images/clock.jpg -> images/clock.jpg | 0
Rresources/images/297434.png -> images/mac.png | 0
Rresources/images/scared_mouse.gif -> images/scared_mouse.gif | 0
Rresources/images/sun.png -> images/sun.png | 0
Rresources/images/under-construction-pikachu.gif -> images/under-construction-pikachu.gif | 0
Rresources/images/underconstruction.gif -> images/underconstruction.gif | 0
Rresources/images/welcome.gif -> images/welcome.gif | 0
Rresources/images/windows.gif -> images/windows.gif | 0
Mindex.html | 44+++++++++++++++++++++++++++++++-------------
Apages/my_homepage.html | 39+++++++++++++++++++++++++++++++++++++++
12 files changed, 70 insertions(+), 13 deletions(-)

diff --git a/resources/images/Coffeeclipart.webp b/images/Coffeeclipart.webp Binary files differ. diff --git a/resources/images/clippy.jpg b/images/clippy.jpg Binary files differ. diff --git a/resources/images/clock.jpg b/images/clock.jpg Binary files differ. diff --git a/resources/images/297434.png b/images/mac.png Binary files differ. diff --git a/resources/images/scared_mouse.gif b/images/scared_mouse.gif Binary files differ. diff --git a/resources/images/sun.png b/images/sun.png Binary files differ. diff --git a/resources/images/under-construction-pikachu.gif b/images/under-construction-pikachu.gif Binary files differ. diff --git a/resources/images/underconstruction.gif b/images/underconstruction.gif Binary files differ. diff --git a/resources/images/welcome.gif b/images/welcome.gif Binary files differ. diff --git a/resources/images/windows.gif b/images/windows.gif Binary files differ. diff --git a/index.html b/index.html @@ -4,6 +4,7 @@ <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>HTML Laboratory</title> + <link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🛼</text></svg>"> <script type="module"> import {EditorView, keymap} from "https://esm.sh/@codemirror/view@6" import {EditorState} from "https://esm.sh/@codemirror/state@6" @@ -195,26 +196,38 @@ return ''; } - // Save functionality with Cmd+S - document.addEventListener('keydown', function(e) { - if ((e.metaKey || e.ctrlKey) && e.key === 's') { - e.preventDefault(); - saveFile(); - } - }); - - function saveFile() { + // Simple file operations + window.saveFile = function() { const code = editorView.state.doc.toString(); const blob = new Blob([code], { type: 'text/html' }); const url = URL.createObjectURL(blob); - const a = document.createElement('a'); a.href = url; a.download = 'index.html'; a.click(); - URL.revokeObjectURL(url); - } + }; + + window.loadFile = function() { + const input = document.createElement('input'); + input.type = 'file'; + input.accept = '.html,.htm'; + input.onchange = function(event) { + const file = event.target.files[0]; + if (!file) return; + + const reader = new FileReader(); + reader.onload = function(e) { + editorView.dispatch({ + changes: { from: 0, to: editorView.state.doc.length, insert: e.target.result } + }); + saveToStorage(); + updatePreview(); + }; + reader.readAsText(file); + }; + input.click(); + }; // Wait for CodeMirror to be available function initializeCodeMirror() { @@ -233,7 +246,12 @@ state: EditorState.create({ doc: savedContent, extensions: [ - keymap.of([indentWithTab, ...defaultKeymap]), + keymap.of([ + {key: "Mod-o", run: () => { window.loadFile(); return true; }}, + {key: "Mod-s", run: () => { window.saveFile(); return true; }}, + indentWithTab, + ...defaultKeymap + ]), html(), githubDark, indentUnit.of("\t"), diff --git a/pages/my_homepage.html b/pages/my_homepage.html @@ -0,0 +1,38 @@ +<html> + <head> + <style> + body { + color: white; + background-color:mediumslateblue; + text-shadow: 2px 2px 2px black; + } + .heading { + font-size: 40px; + background-color: teal; + padding:8px; + box-shadow: 4px 4px black; + border: 1px solid black; + } + p { + font-size: 35px; + } + h3 { + font-size: 35px; + } + </style> + </head> + <body> + <h1 class="heading"> + Welcome to my World Wide Web Site 🌞 + </h1> + <center> + <img src="images/welcome.gif" width=400px> + <p> + brace yourself. you are in for a wild ride!! + </p> + <a href="https://hunterirving.com"><img src="images/windows.gif"></a> + <h3>enter by "clicking" on the window above....<br>if you <i><span style="color:red">dare</span></i>.....!</h3> + <img src="images/scared_mouse.gif" style="transform: scaleX(-1); margin-bottom:25px"><img src="images/mac.png" width=200px> + </center> + </body> +</html> +\ No newline at end of file