Skip to content

Commit

Permalink
feat(samples): improve simple website sample
Browse files Browse the repository at this point in the history
If the site doesn't load properly a warning is shown.
  • Loading branch information
dwmkerr committed Apr 3, 2021
1 parent fbfb3a4 commit 47d8f69
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 7 additions & 0 deletions effective-shell-playground/websites/simple/code.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
// This function changes the header text for the webpage.
function changeHeader(newHeader) {
document.getElementById("header").innerText = newHeader;
}

// When the webpage is loaded...
window.addEventListener('DOMContentLoaded', function() {
// ...hide the warning message.
document.getElementById("warning").display = 'none';
});
6 changes: 5 additions & 1 deletion effective-shell-playground/websites/simple/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@
<h1 id="header">My New Project</h1>
</header>
<section>
<p>This is a sample webpage, with some JavaScript for logic and CSS.</p>
<p>This is a simple web page. The <code>index.html</code> file defines the content, the <code>styles.css</code> file defines the styles and the <code>code.js</code> file makes the website interactive!</p>
<button onclick="changeHeader('My Even Newer Project')">Update Title</button>
<div id="warning" style="color: red">
<h2>Warning</h2>
<p>If you see this message then the site is not loading properly - maybe you have disabled JavaScript in your browser?</p>
</div>
</section>
</body>
</html>

0 comments on commit 47d8f69

Please sign in to comment.