Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d0816f7

Browse files
version 2.0 released
1 parent ae8c4c0 commit d0816f7

File tree

6 files changed

+182
-43
lines changed

6 files changed

+182
-43
lines changed

‎all_note.html

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,13 @@
99
<!-- Bootstrap CSS -->
1010
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
1111
<script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/2.0.2/anime.min.js"></script>
12-
<style>
13-
.modal-open[style] {
14-
padding-right: 0px !important;
15-
}
16-
</style>
12+
<link rel="stylesheet" href="css/style.css">
1713
<title>NoteFizz</title>
1814
</head>
1915
<body style="padding-right: 0px !important;">
2016

2117
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
22-
<a class="navbar-brand" href="#">NoteFizz</a>
18+
<a class="navbar-brand" href="index.html">NoteFizz</a>
2319
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
2420
<span class="navbar-toggler-icon"></span>
2521
</button>
@@ -52,15 +48,15 @@ <h2 class=" ml3 mt-5 mb-2"><span class="letters">Welcome to NoteFizz App</span><
5248

5349

5450
<div class="custom-control custom-switch my-3">
55-
<input type="checkbox" class="custom-control-input" id="fetchnote" onclick="switch_state()">
51+
<input type="checkbox" class="custom-control-input" id="fetchnote2" onclick="switch_state2()">
5652
<label class="custom-control-label" for="fetchnote">Fetch Saved Notes on Startup</label>
5753
</div>
58-
<button type="button" class="btn btn-dark" onclick="saved_notes_display()">Fetch Saved Notes</button>
54+
<button type="button" class="btn btn-dark" onclick="saved_notes_display2()">Fetch Saved Notes</button>
5955
<button type="button" class="btn btn-dark" data-toggle="modal" data-target="#exampleModal" >Clear Local Storage</button>
6056
</form>
6157
<div class="note_container my-5" style="min-width: 100%; box-sizing: border-box;" id="nc">
6258
<h4>Your Notes</h4>
63-
<div class="notes d-flex flex-wrap justify-content-between" style="width: 100%;box-sizing: border-box;"id="nt">
59+
<div class="notes d-flex flex-wrap justify-content-start" style="width: 100%;box-sizing: border-box;"id="nt">
6460

6561
</div>
6662
</div>
@@ -89,6 +85,28 @@ <h5 class="modal-title" id="exampleModalLabel">Warning</h5>
8985
</div>
9086
</div>
9187
</div>
88+
<!-- //////////////////////////view note//////////////////////////// -->
89+
90+
<!-- Modal -->
91+
<div class="modal fade" id="viewmodal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
92+
<div class="modal-dialog">
93+
<div class="modal-content">
94+
<div class="modal-header">
95+
<h5 class="modal-title" id="modaltitle">Modal title</h5>
96+
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
97+
<span aria-hidden="true">&times;</span>
98+
</button>
99+
</div>
100+
<div class="modal-body">
101+
<p id="modalbody"></p>
102+
</div>
103+
<div class="modal-footer">
104+
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
105+
</div>
106+
</div>
107+
</div>
108+
</div>
109+
<script src="js/view.js"></script>
92110
<script src="js/script.js"></script>
93111
<!-- Optional JavaScript; choose one of the two! -->
94112

‎changelog_v1.0.txt

Lines changed: 0 additions & 22 deletions
This file was deleted.

‎changelog_v2.0.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---------------------NoteFizz v2.0 full --------------------------------
2+
3+
Added:
4+
Edit Note functionality added.
5+
Note will be saved to local storage by default.
6+
search functionality added.
7+
note view functionality added.
8+
9+
Removed:
10+
user can't toggle (save notes to localstorage ) option.
11+
12+
Depricated:
13+
none
14+
15+
Bugs Fixes:
16+
All known bugs fixed.
17+
18+
Security:
19+
none
20+
21+
Author/Developer:
22+
Navdeep Mishra

‎css/style.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ button
5757
{
5858
margin-left: 8.5rem;
5959
}
60+
.fa-eye
61+
{
62+
margin-left: 8.5rem;
63+
}
6064
@media screen and (max-width: 900px)
6165
{
6266
.main-container

‎js/script.js

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,26 @@
22
main_container = document.querySelector(".note_container");
33

44
////////////////making storenote as a default and unchangeble option/////////////////
5-
document.getElementById("storenote").checked=true;
6-
document.getElementById("storenote").disabled=true;
5+
if(document.getElementById("storenote"))
6+
{
7+
document.getElementById("storenote").checked=true;
8+
document.getElementById("storenote").disabled=true;
9+
}
10+
711
///////////////////////fetching the value on startup////////////////
812
fetchnote_value = localStorage.getItem("fetchnote");
913

10-
if (fetchnote_value == "true") {
11-
document.getElementById("fetchnote").checked = true;
12-
13-
saved_notes_display();
14-
} else {
15-
document.getElementById("fetchnote").checked = false;
14+
if(document.getElementById("fetchnote"))
15+
{
16+
if (fetchnote_value == "true") {
17+
document.getElementById("fetchnote").checked = true;
18+
19+
saved_notes_display();
20+
} else {
21+
document.getElementById("fetchnote").checked = false;
22+
}
1623
}
24+
1725
function switch_state() {
1826
if (!document.getElementById("fetchnote").checked) {
1927
localStorage.setItem("fetchnote", false);
@@ -23,6 +31,8 @@ function switch_state() {
2331
}
2432
function save_to_local(checker, title, data) {
2533
//this function will save data to local storage
34+
document.getElementById("note_title").value="";
35+
document.getElementById("note_data").value="";
2636
if (checker) {
2737
let dict = {};
2838
dict[title] = data;
@@ -86,7 +96,7 @@ function error_message_shower(title ="", data ="") {
8696
t_el = document
8797
.getElementById("note_title")
8898
.setAttribute("style", "border: 1px solid green;");
89-
99+
90100
derror.innerHTML = ""
91101
d_el = document
92102
.getElementById("note_data")
@@ -310,15 +320,37 @@ function note_search(e) {
310320

311321
function edit_note(id)
312322
{
313-
title = document.getElementById("note_title");
323+
ntitle = document.getElementById("note_title");
314324

315325
data = document.getElementById("note_data");
316326

317327
note = document.getElementById(id).children[0].children[1];
318328

319-
title.value=note.children[0].innerText;
320-
data.value = note.children[1].innerText;
329+
ntitle.value=note.children[0].innerText;
330+
let notesObj = JSON.parse(localStorage.getItem("notes"));
331+
try
332+
{
333+
notesObj.forEach(function note_data_extractor(note, ind) {
334+
for (var title in note) {
335+
336+
if (ntitle.value==title) {
337+
ndata = note[title];
338+
console.log(ndata)
339+
throw "found";
340+
341+
}
342+
}
343+
});
344+
}
345+
catch(err)
346+
{
347+
data.value = ndata;
348+
}
349+
350+
351+
321352
msg="Note is in edit mode now. Don't left without saving this note otherwise it will be lost."
353+
322354
notedelete(id,note.children[0].innerText,msg);
323355

324356
}

‎js/view.js

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
document.getElementById("fetchnote2").checked=true;
2+
document.getElementById("fetchnote2").disabled=true;
3+
saved_notes_display2()
4+
5+
6+
function display_note(id)
7+
{ obj = document.getElementById(id);
8+
note_title = obj.children[0].children[1].children[0].innerHTML;
9+
let notesObj = JSON.parse(localStorage.getItem("notes"));
10+
notesObj.forEach(function note_data_extractor(note, ind) {
11+
for (var title in note) {
12+
13+
if (note_title==title) {
14+
data = note[title];
15+
16+
}
17+
}
18+
});
19+
document.getElementById("modaltitle").innerHTML=note_title;
20+
document.getElementById("modalbody").innerHTML=data;
21+
}
22+
function add_note2(title_el, data_el) {
23+
notes_count = document.querySelectorAll(".note").length; // returns total created notes
24+
25+
note_card = document.createElement("div");
26+
note_card.className = "note";
27+
note_card.id = `${notes_count + 1}`; //for giving unique id to every note
28+
29+
main_container = document.getElementById("nt");
30+
main_container.appendChild(note_card);
31+
html = `
32+
<div class="card text-white bg-dark mx-1 mb-3" id="${
33+
notes_count + 1
34+
}" style=" max-width: 18rem; min-width: 18rem;">
35+
<div class="card-header row container-fluid justify-content-between" style="margin: 0px !important">
36+
Note: ${notes_count + 1}
37+
<i class="fa fa-eye" data-toggle="modal" data-target="#viewmodal" onclick="display_note(${notes_count + 1})" aria-hidden="true"></i>
38+
<i" onclick="notedelete(${
39+
notes_count + 1
40+
},'${title_el}')"class="fa fa-trash" aria-hidden="true"></i>
41+
42+
</div>
43+
<div class="card-body">
44+
<h5 class="card-title">${title_el}</h5>
45+
<p class="card-text">${data_el.slice(0, 30)}...</p>
46+
</div>
47+
</div>`;
48+
49+
document.getElementById(`${notes_count + 1}`).innerHTML = html; //adding the html for the proper view
50+
51+
}
52+
function saved_notes_display2() {
53+
let noteselm = JSON.parse(localStorage.getItem("notes"));
54+
all_notes_in_dom = document.getElementsByClassName("card-title");
55+
56+
all_note_in_dom = Array.from(all_notes_in_dom);
57+
all_dom_notes_title = [];
58+
all_note_in_dom.forEach(function (note, ind) {
59+
all_dom_notes_title.push(note.innerHTML);
60+
});
61+
62+
if(all_notes_in_dom.length > 0)
63+
{
64+
alert_shower("success", "Notes Already Added");
65+
return;
66+
67+
}
68+
if (!noteselm.length) {
69+
70+
alert_shower("danger", "No Notes Found");
71+
} else {
72+
notesObj = noteselm;
73+
74+
notesObj.forEach(function note_data_extractor(note, ind) {
75+
for (var title in note) {
76+
77+
if (!all_dom_notes_title.length) {
78+
data = note[title];
79+
add_note2(title, data);
80+
}
81+
}
82+
});
83+
}
84+
alert_shower("success", "Note Added Succesfully");
85+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /