Skip to content

Commit 6133c44

Browse files
authored
Update sitemaplinks.html
1 parent 7043fa3 commit 6133c44

File tree

1 file changed

+149
-2
lines changed

1 file changed

+149
-2
lines changed

Wiki/sitemaplinks.html

Lines changed: 149 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,160 @@
4949
</nav>
5050
</head>
5151
<body>
52-
<h1><center><b>Wiki | FAQ | More Links</b></center></h1><a href="https://github.com/Scratch-Coding-Hut/Scratch-Coding-Hut.github.io/edit/main/Wiki/sitemaplinks.html"><img src="images.png" width="50"
53-
height="50"></a></img><a href="https://github.com/Scratch-Coding-Hut/Scratch-Coding-Hut.github.io/new/main/Wiki"><img src="new-wiki-page.png" width="50"
52+
<h1><center><b>Wiki | FAQ | More Links</b></center></h1><button onclick=createWikiPage()><img src="images.png" width="50"
53+
height="50"></button></img><a href="https://github.com/Scratch-Coding-Hut/Scratch-Coding-Hut.github.io/new/main/Wiki"><img src="new-wiki-page.png" width="50"
5454
height="50"></a></img> <a href="https://github.com/Scratch-Coding-Hut/Scratch-Coding-Hut.github.io/delete/main/Wiki/sitemaplinks.html"><img src="delete-page.png" width="50"
5555
height="50"></a></img><a href="https://github.com/Scratch-Coding-Hut/Scratch-Coding-Hut.github.io/commits/main/Wiki/sitemaplinks.html"><img src="history-icon.png" width="50"
5656
height="50"></a></img><a href="https://github.com/Scratch-Coding-Hut/Scratch-Coding-Hut.github.io/issues/new?title=Wiki-Homepage"><img src="discuss-icon.png" width="50"
5757
height="50"></a></img><a href="https://github.com/Scratch-Coding-Hut/Scratch-Coding-Hut.github.io/blob/main/Wiki/sitemaplinks.html"><img src="plain-text.png" width="50"
5858
height="50"></a></img>
59+
60+
<style>
61+
body {
62+
font-family: Arial, sans-serif;
63+
display: flex;
64+
flex-direction: column;
65+
align-items: center;
66+
}
67+
68+
#wikiForm {
69+
width: 80%;
70+
max-width: 800px;
71+
margin-bottom: 20px;
72+
}
73+
74+
input[type="text"] {
75+
width: 100%;
76+
padding: 10px;
77+
font-size: 18px;
78+
margin-bottom: 10px;
79+
border: 1px solid #ccc;
80+
border-radius: 5px;
81+
}
82+
83+
textarea {
84+
width: 100%;
85+
height: 200px;
86+
padding: 10px;
87+
font-size: 16px;
88+
border: 1px solid #ccc;
89+
border-radius: 5px;
90+
}
91+
92+
button {
93+
padding: 10px 20px;
94+
font-size: 16px;
95+
background-color: #4CAF50;
96+
color: white;
97+
border: none;
98+
border-radius: 5px;
99+
cursor: pointer;
100+
}
101+
102+
button:hover {
103+
background-color: #45a049;
104+
}
105+
106+
ul {
107+
list-style: none;
108+
padding: 0;
109+
}
110+
111+
li a {
112+
color: #007BFF;
113+
text-decoration: none;
114+
cursor: pointer;
115+
}
116+
117+
li a:hover {
118+
text-decoration: underline;
119+
}
120+
121+
#wikiPageView {
122+
width: 80%;
123+
max-width: 800px;
124+
margin-top: 20px;
125+
padding: 20px;
126+
border: 1px solid #ccc;
127+
border-radius: 5px;
128+
background: #f9f9f9;
129+
}
130+
</style>
131+
<h1>Advanced Wiki Creator</h1>
132+
133+
<div id="wikiForm">
134+
<input type="text" id="pageTitle" placeholder="Enter page title">
135+
<textarea id="pageContent" placeholder="Write your HTML, CSS, and JS here"></textarea>
136+
</div>
137+
138+
<h2>Saved Pages:</h2>
139+
<ul id="wikiPages"></ul>
140+
141+
<div id="wikiPageView" style="display: none;">
142+
<h2 id="viewTitle"></h2>
143+
<iframe id="viewContent" style="width: 100%; height: 300px; border: none;"></iframe>
144+
<button onclick="closePageView()">Close Page</button>
145+
</div>
146+
147+
<script>
148+
function createWikiPage() {
149+
const title = document.getElementById('pageTitle').value;
150+
const content = document.getElementById('pageContent').value;
151+
152+
if (!title || !content) {
153+
alert('Please enter both a title and content.');
154+
return;
155+
}
156+
157+
const page = { title, content };
158+
localStorage.setItem(title, JSON.stringify(page));
159+
160+
displayWikiPages();
161+
alert(`Page "${title}" created!`);
162+
163+
// Clear inputs
164+
document.getElementById('pageTitle').value = '';
165+
document.getElementById('pageContent').value = '';
166+
}
167+
168+
function displayWikiPages() {
169+
const wikiPages = document.getElementById('wikiPages');
170+
wikiPages.innerHTML = '';
171+
172+
for (let i = 0; i < localStorage.length; i++) {
173+
const key = localStorage.key(i);
174+
const page = JSON.parse(localStorage.getItem(key));
175+
176+
const listItem = document.createElement('li');
177+
listItem.innerHTML = `<a href="#" onclick="viewWikiPage('${page.title}')">${page.title}</a>`;
178+
wikiPages.appendChild(listItem);
179+
}
180+
}
181+
182+
function viewWikiPage(title) {
183+
const page = JSON.parse(localStorage.getItem(title));
184+
185+
if (page) {
186+
document.getElementById('viewTitle').textContent = page.title;
187+
188+
const iframe = document.getElementById('viewContent');
189+
const doc = iframe.contentDocument || iframe.contentWindow.document;
190+
191+
doc.open();
192+
doc.write(page.content); // This lets you write HTML, CSS, and JS directly
193+
doc.close();
194+
195+
document.getElementById('wikiPageView').style.display = 'block';
196+
}
197+
}
198+
199+
function closePageView() {
200+
document.getElementById('wikiPageView').style.display = 'none';
201+
}
202+
203+
// Display saved pages on load
204+
window.onload = displayWikiPages;
205+
</script>
59206
<h2>Wiki Homepage</h2>
60207

61208
Welcome to the wiki! The wiki is a place where we share Coding Hut knowledge and link to pages not shown in the header. It's also a useful source.

0 commit comments

Comments
 (0)