From 83aecffc751b5c2c175d890bc375e24a6bcf9d67 Mon Sep 17 00:00:00 2001 From: ltnguy16 Date: Thu, 26 Apr 2018 14:49:51 -0700 Subject: [PATCH 1/8] Add getTime() and CSS getTime() locate at line 58 update writedocument parameter to include array timestamp and time the CSS for when it showing newNote as well as list of notes are off --- Webpage/index.html | 142 ++++++++++++++++++++++----------------------- Webpage/style.css | 10 +++- 2 files changed, 78 insertions(+), 74 deletions(-) diff --git a/Webpage/index.html b/Webpage/index.html index 6e49b6c..37d775d 100644 --- a/Webpage/index.html +++ b/Webpage/index.html @@ -16,7 +16,6 @@ } function localSet(key, val){ - localStorage.setItem(key, JSON.stringify(val)); } @@ -31,11 +30,13 @@ // Array#includes seems to be compatible with mobile device browsers } - function writeDocument(id, name, paths, undone){ + function writeDocument(id, name, paths, undone, timeStamp, time){ var obj = { name: name, paths: paths, - undone: undone + undone: undone, + timeStamp: timeStamp, + time: time }; localSet(id, obj); @@ -50,10 +51,18 @@ function newNote(){ var id = Math.floor(Math.random()*1000000000).toString(); addToManifest(id); - writeDocument(id, 'New Note', [], []); + writeDocument(id, 'New Note', [], [], [], getTime()); window.location.href = window.location.origin + "/?" + id; } + function getTime(){ + var currentTime = new Date(); + var hour = 1 + currentTime.getHours(); + var time = currentTime.toLocaleDateString() + "\t" + currentTime.toLocaleTimeString(); + console.log(time); + return time; + } + -
SAVE IT v.2.1325
+
SAVE IT v.2.3
-
Testing
diff --git a/Webpage/style.css b/Webpage/style.css index f9db0c9..6fae53c 100644 --- a/Webpage/style.css +++ b/Webpage/style.css @@ -1,4 +1,12 @@ button { height: 50px; - width: 100px; + width: 20%; + float:left; + margin-bottom:10px; } + +.toolbar { + width:100%; + background-color:red; + padding:10px; +} \ No newline at end of file From d2fb68037a16fc031fb6ce9a023aa8c1d3f87125 Mon Sep 17 00:00:00 2001 From: ltnguy16 Date: Thu, 26 Apr 2018 15:43:07 -0700 Subject: [PATCH 2/8] Update CSS --- Webpage/index.html | 25 ++++++++++++------------- Webpage/style.css | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 13 deletions(-) diff --git a/Webpage/index.html b/Webpage/index.html index 37d775d..c231d96 100644 --- a/Webpage/index.html +++ b/Webpage/index.html @@ -57,12 +57,14 @@ function getTime(){ var currentTime = new Date(); - var hour = 1 + currentTime.getHours(); var time = currentTime.toLocaleDateString() + "\t" + currentTime.toLocaleTimeString(); - console.log(time); return time; } + function goBack(){ + window.location.href = window.location.origin; + } + -
SAVE IT v.2.3
- + diff --git a/Webpage/style.css b/Webpage/style.css index 6fae53c..10e425a 100644 --- a/Webpage/style.css +++ b/Webpage/style.css @@ -9,4 +9,37 @@ button { width:100%; background-color:red; padding:10px; +} +ul { + list-style-type: none; + margin: 0; + padding: 0; + overflow: hidden; + background-color: #333; +} + +li { + float: left; +} +li b { + display: block; + color: white; + text-align: center; + padding: 14px 16px; + text-decoration: none; +} +li a { + display: block; + color: white; + text-align: center; + padding: 14px 16px; + text-decoration: none; +} + +a:hover:not(.active) { + background-color: #111; +} + +.active { +background-color:#4CAF50; } \ No newline at end of file From e95191269d2313cf8ca20996b48f32f15224fdd9 Mon Sep 17 00:00:00 2001 From: ltnguy16 Date: Thu, 26 Apr 2018 15:51:56 -0700 Subject: [PATCH 3/8] Add Spacer --- Webpage/index.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Webpage/index.html b/Webpage/index.html index c231d96..4da3186 100644 --- a/Webpage/index.html +++ b/Webpage/index.html @@ -285,6 +285,9 @@
  • Home
  • New note
  • + +
    + From f9e0a1d5f7d61ea57fc67f09143d80485ea0fb36 Mon Sep 17 00:00:00 2001 From: ltnguy16 Date: Thu, 26 Apr 2018 22:31:28 -0700 Subject: [PATCH 4/8] Update UI --- Webpage/index.html | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/Webpage/index.html b/Webpage/index.html index 4da3186..da07df1 100644 --- a/Webpage/index.html +++ b/Webpage/index.html @@ -27,16 +27,14 @@ function documentExists(id){ var docsList = localGet("DOCUMENTS_MANIFEST"); return docsList.includes(id); - // Array#includes seems to be compatible with mobile device browsers } - function writeDocument(id, name, paths, undone, timeStamp, time){ + function writeDocument(id, name, paths, undone){ var obj = { name: name, paths: paths, undone: undone, - timeStamp: timeStamp, - time: time + time: (new Date()).toLocaleString() }; localSet(id, obj); @@ -51,16 +49,10 @@ function newNote(){ var id = Math.floor(Math.random()*1000000000).toString(); addToManifest(id); - writeDocument(id, 'New Note', [], [], [], getTime()); + writeDocument(id, 'New Note', [], []); window.location.href = window.location.origin + "/?" + id; } - function getTime(){ - var currentTime = new Date(); - var time = currentTime.toLocaleDateString() + "\t" + currentTime.toLocaleTimeString(); - return time; - } - function goBack(){ window.location.href = window.location.origin; } @@ -72,7 +64,6 @@ var paths = []; var ctx; var undone = []; - var timeStamp = []; var THUMBNAIL_HEIGHT_RATIO = 200/500; var THUMBNAIL_WIDTH_RATIO = 400/1500; var SCALE = 0.25; @@ -102,7 +93,7 @@ $("#undone").toggle(); } /*========================================================================*/ - function draw(context, path, color='black', lineWidth=10){ + function draw(context, path, color='black', lineWidth=5){ console.log("drawing path:"); console.log(path); context.strokeStyle = color; @@ -157,8 +148,14 @@ function addToUndone(path){ if(typeof path === 'undefined') return; + var firstEl = false; + var i = 0; + while(!firstEl){ + firstEl = path.pts[i]; + i++; + } undone.push(transformSize(path)); - $("#undone").append("
    "); + $("#undone").append("
    " + firstEl[2] + "
    "); draw($("#undone").children().last().children().first()[0].getContext('2d'), path, 'red', 5); } /*========================================================================*/ @@ -307,7 +304,8 @@
    -
    +
    +
    From f2f1c1dd55e0de2d035aaabba61cad87982a5097 Mon Sep 17 00:00:00 2001 From: ltnguy16 Date: Thu, 26 Apr 2018 22:43:42 -0700 Subject: [PATCH 5/8] Fix timestamp undefine --- Webpage/index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Webpage/index.html b/Webpage/index.html index da07df1..edd45ac 100644 --- a/Webpage/index.html +++ b/Webpage/index.html @@ -199,7 +199,7 @@ } function saveNotes(){ - writeDocument(sessionId, getSessionName(), paths, undone, timeStamp, getTime()); + writeDocument(sessionId, getSessionName(), paths, undone); } /*========================================================================*/ @@ -211,7 +211,7 @@ var docsList = localGet("DOCUMENTS_MANIFEST"); for(var i = 0; i < docsList.length; i++){ var id = docsList[i]; - $("#menu").append("" + localGet(id).name + "\t" + localGet(id).time + "
    "); + $("#menu").append("" + localGet(id).name + "
    Last edited:" + localGet(id).time + "

    "); } } else { $("#home").show(); @@ -227,7 +227,7 @@ this.lineCap = 'round'; this.lineJoin = 'round'; this.fillStyle = this.strokeStyle = "BLACK"; - this.lineWidth = 10; + this.lineWidth = 5; touch = this.touches[0]; if(typeof touch === 'undefined'){ if(inPath && inStroke){ @@ -262,7 +262,7 @@ var oy = touch.oy; this.moveTo( ox, oy ); this.lineTo( touch.x, touch.y ); - paths[paths.length - 1].pts.push([touch.x, touch.y]) + paths[paths.length - 1].pts.push([touch.x, touch.y, (new Date()).toLocaleString()]) this.stroke(); } }); From 3415e8bc16e9bb246d8cf08d8fa881a087a75c6e Mon Sep 17 00:00:00 2001 From: Isaac Moldofsky Date: Thu, 26 Apr 2018 23:29:24 -0700 Subject: [PATCH 6/8] undone retreieval --- Webpage/index.html | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Webpage/index.html b/Webpage/index.html index edd45ac..3fa717a 100644 --- a/Webpage/index.html +++ b/Webpage/index.html @@ -145,7 +145,7 @@ return pathChanged; } /*========================================================================*/ - function addToUndone(path){ + function addToUndone(path, keepsize=false){ if(typeof path === 'undefined') return; var firstEl = false; @@ -154,7 +154,10 @@ firstEl = path.pts[i]; i++; } - undone.push(transformSize(path)); + if(keepsize) + undone.push(path); + else + undone.push(transformSize(path)); $("#undone").append("
    " + firstEl[2] + "
    "); draw($("#undone").children().last().children().first()[0].getContext('2d'), path, 'red', 5); } @@ -270,6 +273,10 @@ for(var i = 0; i < paths.length; i++){ draw(ctx, paths[i]); } + undone = localGet(sessionId).undone; + for(var i = 0; i < undone.length; i++){ + addToUndone(paths[i], true); + } $('canvas').first().height(CANVAS_HEIGHT).width(CANVAS_WIDTH); $('canvas').first().css('border-style', 'dashed'); } From 3188e87fcb869f87307bddca4cd653f2f188b57f Mon Sep 17 00:00:00 2001 From: Isaac Moldofsky Date: Thu, 26 Apr 2018 23:41:31 -0700 Subject: [PATCH 7/8] fix infinite loop --- Webpage/index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Webpage/index.html b/Webpage/index.html index 3fa717a..4fe367c 100644 --- a/Webpage/index.html +++ b/Webpage/index.html @@ -273,9 +273,9 @@ for(var i = 0; i < paths.length; i++){ draw(ctx, paths[i]); } - undone = localGet(sessionId).undone; - for(var i = 0; i < undone.length; i++){ - addToUndone(paths[i], true); + var _undone = localGet(sessionId).undone; + for(var i = 0; i < _undone.length; i++){ + addToUndone(_undone[i], true); } $('canvas').first().height(CANVAS_HEIGHT).width(CANVAS_WIDTH); $('canvas').first().css('border-style', 'dashed'); From d51952ba84674eb401b15a1af3bd9763d1540099 Mon Sep 17 00:00:00 2001 From: Isaac Moldofsky Date: Thu, 26 Apr 2018 23:55:03 -0700 Subject: [PATCH 8/8] change canvas ref --- Webpage/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Webpage/index.html b/Webpage/index.html index 4fe367c..19f8ec6 100644 --- a/Webpage/index.html +++ b/Webpage/index.html @@ -277,8 +277,8 @@ for(var i = 0; i < _undone.length; i++){ addToUndone(_undone[i], true); } - $('canvas').first().height(CANVAS_HEIGHT).width(CANVAS_WIDTH); - $('canvas').first().css('border-style', 'dashed'); + $('canvas').last().height(CANVAS_HEIGHT).width(CANVAS_WIDTH); + $('canvas').last().css('border-style', 'dashed'); } };