New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #1 --add default message #2
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,80 @@ | ||
<!doctype html> | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>My Web Note</title> | ||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" | ||
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"> | ||
<link rel="stylesheet" href="https://fonts.google.com/specimen/Josefin+Sans"> | ||
<link | ||
rel="stylesheet" | ||
href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" | ||
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" | ||
crossorigin="anonymous" | ||
/> | ||
<link | ||
rel="stylesheet" | ||
href="https://fonts.google.com/specimen/Josefin+Sans" | ||
/> | ||
<style> | ||
body { | ||
background-image: url("https://ak0.picdn.net/shutterstock/videos/935170/thumb/1.jpg"); | ||
} | ||
body { | ||
background-image: url("https://ak0.picdn.net/shutterstock/videos/935170/thumb/1.jpg"); | ||
} | ||
</style> | ||
</head> | ||
</head> | ||
|
||
<body> | ||
<body> | ||
<div class=" container"> | ||
<div class="raw" style="font-family: Josefin Sans, serif"> | ||
<h1 class="font-weight-bold text-center mt-5 mb-4">Take Notes Here!!!</h1> | ||
<div class="border rounded" id="note" style="overflow-y: scroll; height: 200px; background-color: white" contenteditable></div> | ||
</div> | ||
<div class="raw"> | ||
<div class="text-right my-3"> | ||
<button id="clear" class="btn btn-primary px-4">Clear</button> | ||
<button id="save" class="btn btn-primary px-4">Save</button> | ||
</div> | ||
<div class="raw" style="font-family: Josefin Sans, serif"> | ||
<h1 class="font-weight-bold text-center mt-5 mb-4"> | ||
Take Notes Here!!! | ||
</h1> | ||
<div | ||
class="border rounded" | ||
id="note" | ||
style="overflow-y: scroll; height: 200px; background-color: white" | ||
contenteditable | ||
></div> | ||
</div> | ||
<div class="raw"> | ||
<div class="text-right my-3"> | ||
<button id="clear" class="btn btn-primary px-4">Clear</button> | ||
<button id="save" class="btn btn-primary px-4">Save</button> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<script src="https://unpkg.com/filer/dist/filer.min.js"></script> | ||
<script> | ||
const fs = new Filer.FileSystem(); | ||
var note = document.querySelector('#note'); | ||
const fs = new Filer.FileSystem(); | ||
var note = document.querySelector("#note"); | ||
|
||
window.addEventListener('DOMContentLoaded', (event) => { | ||
note.focus(); | ||
fs.readFile('/note', 'utf8', function (err, data) { | ||
if (err) { | ||
console.log("Welcome to my notepad!"); | ||
throw err; | ||
} | ||
if (data) note.innerHTML = data; | ||
}); | ||
|
||
document.querySelector('#clear').addEventListener("click", clearContent); | ||
document.querySelector('#save').addEventListener("click", saveContent); | ||
window.addEventListener("DOMContentLoaded", event => { | ||
fs.readFile("/note", "utf8", function(err, data) { | ||
if (err) { | ||
throw err; | ||
} | ||
if (data) note.innerHTML = data; | ||
else note.innerHTML = "Welcome to my notepad!"; | ||
}); | ||
|
||
function saveContent() { | ||
fs.writeFile('/note', note.innerHTML, function (err) { | ||
if (err) throw err; | ||
document | ||
.querySelector("#clear") | ||
.addEventListener("click", clearContent); | ||
document.querySelector("#save").addEventListener("click", saveContent); | ||
}); | ||
|
||
if (note.innerHTML) | ||
alert("Contents saved!"); | ||
}); | ||
} | ||
function saveContent() { | ||
fs.writeFile("/note", note.innerHTML, function(err) { | ||
if (err) throw err; | ||
|
||
function clearContent() { | ||
fs.writeFile('/note', "", function (err) { | ||
if (err) throw err; | ||
note.innerHTML = ""; | ||
}); | ||
} | ||
</script> | ||
</body> | ||
if (note.innerHTML) alert("Contents saved!"); | ||
}); | ||
} | ||
|
||
</html> | ||
function clearContent() { | ||
fs.writeFile("/note", "", function(err) { | ||
if (err) throw err; | ||
note.innerHTML = ""; | ||
}); | ||
} | ||
</script> | ||
</body> | ||
</html> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! Very simple way to display a default message if there is no data.