From 3f0781dacb0d6f1add1fbbc412f53de367a2f520 Mon Sep 17 00:00:00 2001 From: rkayastha98 Date: Tue, 15 Sep 2020 00:36:10 -0400 Subject: [PATCH 1/6] First commit --- public/css/style.css | 60 ++++++++++++++++- public/index.html | 151 +++++++++++++++++++++++++++++++++++++++++-- public/js/scripts.js | 29 ++++++++- server.improved.js | 53 +++++++-------- 4 files changed, 256 insertions(+), 37 deletions(-) diff --git a/public/css/style.css b/public/css/style.css index d5f842ab..52a1a3ae 100755 --- a/public/css/style.css +++ b/public/css/style.css @@ -1 +1,59 @@ -/*Style your own assignment! This is fun! */ \ No newline at end of file +/*Style your own assignment! This is fun! */ +body{ + background-color:aliceblue; +} + +#addBox{ + padding: 10px; + box-shadow: 2px 5px 5px saddlebrown; + border: solid darksalmon; + background-color: darksalmon; +} + +header{ + color: white; + font-family: "Aclonica"; + font-size: 100px; + text-align: center; + +} + +.tg {border-collapse:collapse;border-spacing:0;} +.tg td{border-color: lightskyblue;border-style:solid;border-width:5px;font-family:Arial, sans-serif;font-size:14px; + overflow:hidden;padding:20px 10px;word-break:normal;} +.tg th{border-color: lightskyblue;border-style:solid;border-width:5px;font-family:Arial, sans-serif;font-size:14px; + font-weight:normal;overflow:hidden;padding:20px 10px;word-break:normal;} +.tg .tg-cly1{text-align:left;vertical-align:middle} +.tg .tg-0lax{text-align:left;vertical-align:top} + +.tabs{ + padding: 2px; + background-color: darksalmon; + color: white; +} + +/* width */ +::-webkit-scrollbar { + width: 20px; +} + +/* Track */ +::-webkit-scrollbar-track { + box-shadow: inset 0 0 5px grey; + border-radius: 5px; +} + +/* Handle */ +::-webkit-scrollbar-thumb { + background: darksalmon; + border-radius: 5px; +} + +/* Handle on hover */ +::-webkit-scrollbar-thumb:hover { + background: #b30000; +} + +#add_box:hover{ + color: #b30000; +} \ No newline at end of file diff --git a/public/index.html b/public/index.html index c56d620e..e15a814c 100755 --- a/public/index.html +++ b/public/index.html @@ -3,12 +3,145 @@ CS4241 Assignment 2 + + + + +
Work-Play Balance
+ + + + + + +
+
- - +
+
+
+
+ + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
00:00
01:00
02:00
03:00
04:00
05:00
06:00
07:00
08:00
09:00
10:00
11:00
12:00
13:00
14:00
15:00
16:00
17:00
18:00
19:00
20:00
21:00
22:00
23:00
+ + +
+ + + diff --git a/public/js/scripts.js b/public/js/scripts.js index de052eae..1baa0ae8 100755 --- a/public/js/scripts.js +++ b/public/js/scripts.js @@ -1,3 +1,30 @@ // Add some Javascript code here, to run on the front end. -console.log("Welcome to assignment 2!") \ No newline at end of file +console.log("Welcome to assignment 2!") + +var addBox=document.getElementById("addBox") +var cal=document.getElementById("cal") +var hist=document.getElementById("hist") +var today=document.getElementById("today") + +document.getElementById("addBtn").addEventListener("click",function () { + if (addBox.style.visibility === 'hidden') { + addBox.style.visibility = 'visible'; + const button = document.querySelector( '#submit' ) + button.onclick = submit + } else { + addBox.style.visibility = 'hidden'; + } + +}) + +document.getElementById("history").addEventListener("click",function () { + hist.style.display = 'inline'; + cal.style.display="none"; + +}) + +document.getElementById("today").addEventListener("click", function () { + cal.style.display='inline' + hist.style.display='none' +}) \ No newline at end of file diff --git a/server.improved.js b/server.improved.js index 26673fc0..586f3f78 100644 --- a/server.improved.js +++ b/server.improved.js @@ -1,27 +1,22 @@ const http = require( 'http' ), - fs = require( 'fs' ), - // IMPORTANT: you must run `npm install` in the directory for this assignment - // to install the mime library used in the following line of code - mime = require( 'mime' ), - dir = 'public/', - port = 3000 - -const appdata = [ - { 'model': 'toyota', 'year': 1999, 'mpg': 23 }, - { 'model': 'honda', 'year': 2004, 'mpg': 30 }, - { 'model': 'ford', 'year': 1987, 'mpg': 14} -] + fs = require( 'fs' ), + // IMPORTANT: you must run `npm install` in the directory for this assignment + // to install the mime library used in the following line of code + mime = require( 'mime' ), + dir = 'public/', + port = 3000 + const server = http.createServer( function( request,response ) { if( request.method === 'GET' ) { - handleGet( request, response ) + handleGet( request, response ) }else if( request.method === 'POST' ){ - handlePost( request, response ) + handlePost( request, response ) } }) const handleGet = function( request, response ) { - const filename = dir + request.url.slice( 1 ) + const filename = dir + request.url.slice( 1 ) if( request.url === '/' ) { sendFile( response, 'public/index.html' ) @@ -34,7 +29,7 @@ const handlePost = function( request, response ) { let dataString = '' request.on( 'data', function( data ) { - dataString += data + dataString += data }) request.on( 'end', function() { @@ -48,25 +43,25 @@ const handlePost = function( request, response ) { } const sendFile = function( response, filename ) { - const type = mime.getType( filename ) + const type = mime.getType( filename ) - fs.readFile( filename, function( err, content ) { + fs.readFile( filename, function( err, content ) { - // if the error = null, then we've loaded the file successfully - if( err === null ) { + // if the error = null, then we've loaded the file successfully + if( err === null ) { - // status code: https://httpstatuses.com - response.writeHeader( 200, { 'Content-Type': type }) - response.end( content ) + // status code: https://httpstatuses.com + response.writeHeader( 200, { 'Content-Type': type }) + response.end( content ) - }else{ + }else{ - // file not found, error code 404 - response.writeHeader( 404 ) - response.end( '404 Error: File Not Found' ) + // file not found, error code 404 + response.writeHeader( 404 ) + response.end( '404 Error: File Not Found' ) - } - }) + } + }) } server.listen( process.env.PORT || port ) From 62a92cfdf0e3d0457f5fb9d5abd221c0d1dc3787 Mon Sep 17 00:00:00 2001 From: "Glitch (a2-rkayastha98)" Date: Wed, 16 Sep 2020 06:19:03 +0000 Subject: [PATCH 2/6] =?UTF-8?q?=F0=9F=93=A1=F0=9F=8E=AB=20Updated=20with?= =?UTF-8?q?=20Glitch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 120 +++++++++++++++++++++++++++++++++++++------ public/js/scripts.js | 2 +- server.improved.js | 14 +++-- shrinkwrap.yaml | 15 ++++++ 4 files changed, 131 insertions(+), 20 deletions(-) create mode 100644 shrinkwrap.yaml diff --git a/public/index.html b/public/index.html index e15a814c..a67afbd2 100755 --- a/public/index.html +++ b/public/index.html @@ -19,12 +19,12 @@
-
+
-
-
- - +
+
+
    * +
@@ -37,11 +37,15 @@ - 00:00 - + Time + Event + + 00:00 + + 01:00 @@ -137,37 +141,123 @@ - + diff --git a/public/js/scripts.js b/public/js/scripts.js index 1dc59140..4baffe64 100755 --- a/public/js/scripts.js +++ b/public/js/scripts.js @@ -21,14 +21,17 @@ document.getElementById("history").addEventListener("click",function () { hist.style.display = 'inline'; cal.style.display="none"; prog.style.display='none' + document.getElementById("mainContainer").style.overflowY="hidden" }) document.getElementById("today").addEventListener("click", function () { cal.style.display='inline' hist.style.display='none' prog.style.display='none' + document.getElementById("mainContainer").style.overflowY="scroll" }) document.getElementById("progress").addEventListener("click", function () { playProg() + document.getElementById("mainContainer").style.overflowY="hidden" }) diff --git a/server.improved.js b/server.improved.js index 4affc785..a23d3e0b 100644 --- a/server.improved.js +++ b/server.improved.js @@ -3,6 +3,7 @@ const http = require( 'http' ), // IMPORTANT: you must run `npm install` in the directory for this assignment // to install the mime library used in the following line of code mime = require( 'mime' ), + url = require('url'), dir = 'public/', port = 3000 @@ -28,26 +29,47 @@ const handleGet = function( request, response ) { const handlePost = function( request, response ) { let dataString = '' - - request.on( 'data', function( data ) { - dataString += data - }) - - request.on( 'end', function() { - var obj=JSON.parse( dataString ) + + switch(request.url){ + case '/submit': + request.on( 'data', function( data ) { + dataString += data + }) + + request.on( 'end', function() { + var obj=JSON.parse( dataString ) - var hh=(parseInt(obj["eventETime"].substring(0,2))-parseInt((obj["eventSTime"]).substring(0,2)))*60 - var mm=parseInt((obj["eventETime"]).substring(3,5))-parseInt((obj["eventSTime"]).substring(3,5)) + var hh=(parseInt(obj["eventETime"].substring(0,2))-parseInt((obj["eventSTime"]).substring(0,2)))*60 + var mm=parseInt((obj["eventETime"]).substring(3,5))-parseInt((obj["eventSTime"]).substring(3,5)) + + obj["duration"]= (hh+mm).toString() - obj["duration"]= (hh+mm).toString() + calArray.push(obj) + + response.writeHead( 200, "OK", {'Content-Type': 'text/plain' }) + response.end(JSON.stringify(calArray[calArray.length-1])) + }) - calArray.push(obj) - response.writeHead( 200, "OK", {'Content-Type': 'text/plain' }) - response.end(JSON.stringify(calArray[calArray.length-1])) - }) + break; + case '/delete': + request.on( 'data', function( data ) { + dataString += data + }) + + request.on( 'end', function() { + // var obj=JSON.parse( dataString ) + + response.writeHead( 200, "OK", {'Content-Type': 'text/plain' }) + response.end() + }) + + delete calArray[parseInt(dataString)] + break; + } } + const sendFile = function( response, filename ) { const type = mime.getType( filename ) @@ -70,4 +92,4 @@ const sendFile = function( response, filename ) { }) } -server.listen( process.env.PORT || port ) +server.listen( process.env.PORT || port ) \ No newline at end of file From 8f4c7ed899813f7aa949871c6bdc1994bd7b6c8a Mon Sep 17 00:00:00 2001 From: "Glitch (a2-rimshakayastha)" Date: Thu, 17 Sep 2020 03:54:08 +0000 Subject: [PATCH 5/6] =?UTF-8?q?=F0=9F=90=9E=E2=9A=A1=EF=B8=8F=20Updated=20?= =?UTF-8?q?with=20Glitch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 988f135f..5005a35a 100755 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { - "name": "", - "version": "", - "description": "", - "author": "", + "name": "Work-Play Balance", + "version": "1.0", + "description": "Application to keep track of tasks", + "author": "Rimsha Kayastha", "scripts": { "start": "node server.improved.js" }, From 45909cb0f69b9a8d1b9eb26f35829109f57c3361 Mon Sep 17 00:00:00 2001 From: rkayastha98 Date: Wed, 21 Oct 2020 23:28:20 -0400 Subject: [PATCH 6/6] Index.html moved --- public/index.html => index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename public/index.html => index.html (98%) mode change 100755 => 100644 diff --git a/public/index.html b/index.html old mode 100755 new mode 100644 similarity index 98% rename from public/index.html rename to index.html index bfce0f85..0bb7e544 --- a/public/index.html +++ b/index.html @@ -3,7 +3,7 @@ CS4241 Assignment 2 - + @@ -303,5 +303,5 @@ - +