Skip to content
This repository has been archived by the owner on Mar 16, 2023. It is now read-only.

Commit

Permalink
Added duplicate function and cleaned up some code!
Browse files Browse the repository at this point in the history
  • Loading branch information
octalmage committed Aug 25, 2014
1 parent 5d7583f commit c7466e9
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 24 deletions.
58 changes: 37 additions & 21 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,9 @@ var gui = require('nw.gui');
var win = gui.Window.get();

var mb = new gui.Menu({type:"menubar"});
mb.createMacBuiltin("Chimera");
mb.createMacBuiltin("Marknote");
win.menu = mb;

//Show Chrome debug console.
win.showDevTools();



var marked = require('marked');
var highlight = require('highlight.js');
var editor;
Expand All @@ -32,7 +27,6 @@ function render(markdown)

renderer.link = function (href, title, text)
{
console.log(href + " | " + title + " | " + text);
if (href.indexOf("://")!=-1)
{
output="<a target=\"_blank\" href=\"" + href + "\">" + text + "</a>";
Expand Down Expand Up @@ -138,29 +132,40 @@ $(document).on("mousemove", function(e)

$(document).on("ready",function()
{
//Temporary access to devtools using CMD+ALT+I.
$(document).on("keypress", function(e)
{
if (e.altKey && e.metaKey && e.keyCode==94)
{
win.showDevTools();
}

});


store = new Lawnchair(
{
adapter: "dom"
}, function ()
{})

store.exists("notes", function (s)
{
if (s===false)
{
store.save({key:'notes', notes: defaultnote});
notes=defaultnote;
}
else
store.exists("notes", function (s)
{

store.get("notes", function (n)
if (s===false)
{
store.save({key:'notes', notes: defaultnote});
notes=defaultnote;
}
else
{
notes=n.notes;

store.get("notes", function (n)
{
notes=n.notes;

});
}
});
});
}
});



Expand All @@ -175,6 +180,10 @@ store.exists("notes", function (s)
{
deleteNote(current);
});
$("paper-icon-button[icon='content-copy']").on("click", function()
{
duplicateNote(current);
});

$("#note").on("dblclick", function()
{
Expand Down Expand Up @@ -239,6 +248,13 @@ function updateList()
}
}

function duplicateNote(id)
{
notes.push(notes[current]);
saveNotes();
updateList();
}

function deleteNote(id)
{
notes.splice(current, 1);
Expand Down
13 changes: 10 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,14 @@

ul
{
padding: 0px;
padding-left:32px;
}

.task-list-item-checkbox
{
float: left;
margin-left: -20px;
margin-top: 4px;
}

#display
Expand Down Expand Up @@ -172,13 +179,13 @@
<script src="js/ace-builds/src-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>
<script>
editor = ace.edit("edit");
editor.setTheme("ace/theme/monokai");
editor.setTheme("ace/theme/github");
editor.getSession().setMode("ace/mode/markdown");
editor.setShowPrintMargin(false);
</script>

<div id="actions">
<paper-icon-button icon="close"></paper-icon-button>
<paper-icon-button icon="content-copy"></paper-icon-button><paper-icon-button icon="close"></paper-icon-button>
</div>
</body>
</html>

0 comments on commit c7466e9

Please sign in to comment.