Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions stickyNotes_webext/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions stickyNotes_webext/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions stickyNotes_webext/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions stickyNotes_webext/.idea/stickyNotes_webext.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions stickyNotes_webext/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions stickyNotes_webext/jquery-3.5.1.min.js

Large diffs are not rendered by default.

52 changes: 38 additions & 14 deletions stickyNotes_webext/popup/getMe.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@

const notePad = document.getElementById('tslNotes');
const boldButton = document.getElementById('bold-button');
const italicButton = document.getElementById('italic-button');
const underlineButton = document.getElementById('underline-button');
const cleanPad = document.getElementById('cleanPad');
const layOver = document.getElementById('layOver');
const yes = document.getElementById('yesPlz');
const no = document.getElementById('nope');

const yes = document.getElementById('yesPlz');

const gettingItem = browser.storage.local.get('tslStickyNotes');


gettingItem.then((res) => {
try{
if(res.tslStickyNotes){
notePad.value = res.tslStickyNotes;
}
}catch(e){}
try{
if(res.tslStickyNotes){
notePad.innerHTML = res.tslStickyNotes;
}
}catch(e){}
});

notePad.addEventListener('keyup',()=>{
browser.storage.local.set({ tslStickyNotes: notePad.value });
}, false);

cleanPad.addEventListener('click',()=>{
layOver.className="";
}, false);
Expand All @@ -29,7 +26,34 @@ no.addEventListener('click',()=>{
}, false);

yes.addEventListener('click',()=>{
notePad.value = "";
notePad.innerHTML = "";
browser.storage.local.set({ tslStickyNotes: "" });
layOver.className="hidden";
}, false);

// document.getElementById('tslNotes').innerHTML = localStorage['tslNotes'] || 'type something...';
// setInterval(function() {
// localStorage['tslNotes'] = document.getElementById('tslNotes').innerHTML;
// }, 20 * 1000);

notePad.addEventListener('keyup',()=>{
browser.storage.local.set({ tslStickyNotes: notePad.innerHTML });
}, false);

boldButton.addEventListener('click', ()=>{
console.log("press");
// $('#tslNotes').css('font-weight', '700');
document.execCommand('bold', false, null);
}, false);

italicButton.addEventListener('click', ()=>{
console.log("press");
// $('#tslNotes').css('font-style', 'italic');
document.execCommand('italic', false, null);
}, false);

underlineButton.addEventListener('click', ()=>{
console.log("press");
// $('#tslNotes').css('text-Decoration', 'underline');
document.execCommand('underline', false, null);
}, false);
25 changes: 19 additions & 6 deletions stickyNotes_webext/popup/go.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<!DOCTYPE html>
<html>
<head>
<script src="../jquery-3.5.1.min.js"></script>
<style type="text/css">

#itsAFact {
text-align: center;
padding: 5px;
}
#cleanPad {
Expand All @@ -19,12 +19,13 @@
padding: 5px;
color: #fff;
}
textarea {
#tslNotes {
font-size: 16px;
width: 350px;
height: 250px;
padding: 5px;
overflow: auto;
border: 1px solid black;
}

#layOver {
Expand Down Expand Up @@ -52,14 +53,26 @@
.hidden {
display: none;
}


[contentEditable=true]:empty:not(:focus):before{
content:attr(data-ph)
}
</style>
</head>
<body>
<table>
<tr>
<th><button class="btn btn-primary" id="bold-button">Bold</button></th>
<th><button class="btn btn-primary" id="italic-button">Italic</button></th>
<th><button class="btn btn-primary" id="underline-button">Underline</button></th>
</tr>
</table>

<div id="itsAFact">
<div><textarea id="tslNotes" placeholder="Get Set Go..."></textarea>
<a id="cleanPad">Clear</a>
</div>
<div>
<div contenteditable="true" id="tslNotes" data-ph="Type anything..."></div>
<a id="cleanPad">Clear</a>
</div>
<div id="layOver" class="hidden">
<div>Are you sure to delete everything?</div>
<button id="yesPlz">Yes</button>
Expand Down