From 7f1a57d1a6a42485b5baeb4af8630baa2de8623c Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Sun, 22 Jan 2023 14:41:39 -0500 Subject: finish --- public/404.html | 4 +- public/css/console.css | 60 +++++++++++++++++++++ public/css/home.css | 5 ++ public/css/main.css | 10 ++++ public/css/people.css | 41 ++++++++++++++ public/css/profile.css | 118 ++++++++++++++++++++++++++++++++++++++++ public/home.html | 2 + public/js/api.js | 57 ++++++++++++++++++++ public/js/header.js | 2 +- public/js/home.js | 144 ++++++++++++++++++++++++------------------------- public/js/login.js | 29 ++++++++++ public/js/people.js | 48 ++++++++++++++++- public/js/profile.js | 88 ++++++++++++++++++++++++++++++ public/login.html | 38 +++++++------ public/people.html | 3 +- public/profile.html | 26 +++------ 16 files changed, 560 insertions(+), 115 deletions(-) create mode 100644 public/css/console.css create mode 100644 public/js/api.js create mode 100644 public/js/login.js create mode 100644 public/js/profile.js (limited to 'public') diff --git a/public/404.html b/public/404.html index 7aedb82..49f0d5d 100644 --- a/public/404.html +++ b/public/404.html @@ -5,11 +5,11 @@ - XSSBook - Home + XSSBook - Not Found
diff --git a/public/css/console.css b/public/css/console.css new file mode 100644 index 0000000..bc07969 --- /dev/null +++ b/public/css/console.css @@ -0,0 +1,60 @@ +body { + margin: 0; + padding: 0; + background-color: #181818; + display: flex; + flex-direction: column-reverse; +} + +@font-face { + font-family: sfpro; + src: url("../fonts/sfpro.otf") format("opentype"); +} + +div { + background-color: #282828; + font-family: sfpro; + margin: 15px; + margin-bottom: 0px; + border-radius: 5px; + padding: 10px; + width: calc(100% - 50px) +} + +span { + display: inline-block; + padding: 0; + margin: 0; + color: #ffffff; + font-family: sfpro; + margin-right: 10px; +} + +.json span { + display: inline; + margin: 0; +} + +.key { + color: white; +} + +.value { + color: white; +} + +.boolean { + color: aqua; +} + +.null { + color: blue; +} + +.number { + color: yellow; +} + +.string { + color: #4ae04a +} \ No newline at end of file diff --git a/public/css/home.css b/public/css/home.css index de0c2d0..33d72c0 100644 --- a/public/css/home.css +++ b/public/css/home.css @@ -148,6 +148,11 @@ body { margin-bottom: 10px; } +.comment p, .post p { + word-break: break-all; + white-space: normal; +} + .comment>span { display: flex; flex-direction: column; diff --git a/public/css/main.css b/public/css/main.css index 9d2fe1d..a75a941 100644 --- a/public/css/main.css +++ b/public/css/main.css @@ -42,6 +42,14 @@ body { color: #1778f2 } +.error { + font-family: sfpro; + color: #f02849; + padding-top: 10px; + margin-bottom: -10px; + font-size: 15px; +} + .gtext { font-family: sfpro; color: #606770 @@ -77,6 +85,7 @@ body { } a { + color: inherit; text-decoration: none; cursor: pointer; } @@ -263,6 +272,7 @@ footer { .hidden { visibility: hidden; pointer-events: none; + display: none !important; } .pfp, .pfp img { diff --git a/public/css/people.css b/public/css/people.css index 70db81f..b8cf025 100644 --- a/public/css/people.css +++ b/public/css/people.css @@ -1,3 +1,44 @@ body { background-color: #f0f2f5; +} + +#users { + display: flex; + flex-direction: column; + align-items: center; +} + +.person { + width: 30em; + height: fit-content; + background-color: white; + border-radius: 10px; + box-shadow: 0 2px 4px rgba(0, 0, 0, .05); + margin-bottom: 1.5em; + display: flex; + flex-direction: row; +} + +.profile, .profile img { + border-radius: 10px 0px 0px 10px; + width: 10em; + height: 10em; + padding: 0; + display: block; + background-color: #e4e6e8; + flex-shrink: 0; +} + +.info { + margin: 20px; + display: flex; + flex-direction: column; +} + +.info span { + width: 280px; + margin-bottom: 5px; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; } \ No newline at end of file diff --git a/public/css/profile.css b/public/css/profile.css index 70db81f..4c5ae10 100644 --- a/public/css/profile.css +++ b/public/css/profile.css @@ -1,3 +1,121 @@ body { background-color: #f0f2f5; +} + +.spacer { + margin-bottom: 3.5em; +} + +#top { + background-color: white; + display: flex; + flex-direction: column; + align-items: center; + width: 100%; + box-shadow: 0 2px 4px rgba(0, 0, 0, .05); +} + +#banner { + background-image: linear-gradient(#949494, white, white); + height: 30em; + width: 100%; + display: flex; + justify-content: center; +} + +#banner div, #banner img { + width: 80em; + height: inherit; + background-color: #e4e6e8; + border-radius: 0px 0px 20px 20px; +} + +#info { + width: 80em; + display: flex; + flex-direction: row; +} + +.face { + background-color: #e4e6e8; + height: 12em; + width: 12em; + border-radius: 7em; + border: solid 5px white; + margin-top: -2em; + margin-left: 2em; + margin-right: 2em; +} + +.infodata { + margin-top: 2em; + display: flex; + flex-direction: column; +} + +.infodata span { + margin-bottom: .5em; +} + +.profilebuttons { + width: 80em; + height: 3em; + display: flex; + align-items: center; +} + +.profilebuttons button { + all: unset; + font-family: sfprobold; + padding: 0px 50px; + height: 100%; + display: flex; + align-items: center; + justify-content: center; + color: #606770; + cursor: pointer; +} + +.profilebuttons button:hover { + background-color: #dddfe2; +} + +.selected { + color: #1778f2 !important; + border-bottom: 3px solid #1778f2 !important; +} + +#about { + margin-top: 2em; + align-self: center; + padding: 0; + display: flex; + flex-direction: row; +} + +#posts { + margin-top: 2em; +} + +#about .ltext { + border-right: 2px solid #dadde1; + padding: 10px; + padding-right: 3em; +} + +#about .data { + display: flex; + flex-direction: column; + padding: 10px; + padding-left: 20px; + padding-top: 15px; +} + +#about .data span { + margin-bottom: 10px; + width: 28em; + margin-bottom: 5px; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; } \ No newline at end of file diff --git a/public/home.html b/public/home.html index 6035fc4..cc780ac 100644 --- a/public/home.html +++ b/public/home.html @@ -10,6 +10,8 @@ + + \ No newline at end of file diff --git a/public/js/api.js b/public/js/api.js new file mode 100644 index 0000000..371ecf3 --- /dev/null +++ b/public/js/api.js @@ -0,0 +1,57 @@ +const endpoint = 'https://xssbook.com/api' + +const request = async (url, body, method) => { + if (method === undefined) method = 'POST' + const response = await fetch(endpoint + url, { + method, + body: JSON.stringify(body), + headers: { + 'Content-Type': 'application/json' + } + }); + if (response.status == 401) { + location.href = 'login' + } + const json = await response.json() + return { status: response.status, msg: json.msg, json } +} + +const login = async (email, password) => { + return await request('/auth/login', {email, password}) +} + +const register = async (first, last, email, password, gender, month, day, year) => { + return await request('/auth/register', {first, last, email, password, gender, month, day, year}) +} + +const loadposts = async (page) => { + return await request('/posts/load', {page}) +} + +const loadusersposts = async (id) => { + return await request('/posts/user', {id}) +} + +const loadusers = async (ids) => { + return await request('/users/load', {ids}) +} + +const loadallusers = async () => { + return await request('/users/all', {}) +} + +const loadself = async () => { + return await request("/auth/self", {}) +} + +const postcomment = async (id, content) => { + return await request('/posts/comment', {id, content}, 'PUT') +} + +const postlike = async (id, state) => { + return await request('/posts/like', {id, state}, 'PUT') +} + +const createpost = async (content) => { + return await request('/posts/create', {content}) +} \ No newline at end of file diff --git a/public/js/header.js b/public/js/header.js index 24643d6..8fe03e5 100644 --- a/public/js/header.js +++ b/public/js/header.js @@ -1,7 +1,7 @@ function header(home, people) { const html = `
diff --git a/public/people.html b/public/people.html index a46487d..f0aa514 100644 --- a/public/people.html +++ b/public/people.html @@ -3,12 +3,13 @@ - + XSSBook - People + \ No newline at end of file diff --git a/public/profile.html b/public/profile.html index 5f7a902..0274327 100644 --- a/public/profile.html +++ b/public/profile.html @@ -3,27 +3,15 @@ - + + XSSBook - Profile - + + + + + \ No newline at end of file -- cgit v1.2.3-freya