Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TDDD97-Webprog
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Oliver Green
TDDD97-Webprog
Commits
fe445d3a
Commit
fe445d3a
authored
2 years ago
by
OliverGreen27
Browse files
Options
Downloads
Patches
Plain Diff
homepage and browserpage, lab1 done, not very stylish
parent
6baac46c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
client.css
+18
-0
18 additions, 0 deletions
client.css
client.html
+43
-5
43 additions, 5 deletions
client.html
client.js
+110
-1
110 additions, 1 deletion
client.js
with
171 additions
and
6 deletions
client.css
+
18
−
0
View file @
fe445d3a
...
...
@@ -61,7 +61,25 @@ input[type=text]:focus {
/* Style the tab content */
.tabcontent
{
display
:
none
;
max-height
:
100vh
;
padding
:
6px
12px
;
border
:
1px
solid
#ccc
;
border-top
:
none
;
}
.user-data-elements
{
display
:
flex
;
flex-direction
:
column
;
justify-content
:
space-between
;
margin-left
:
10px
;
}
.data-field
{
display
:
flex
;
justify-content
:
left
;
}
textarea
{
overflow
:
hidden
;
resize
:
none
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
client.html
+
43
−
5
View file @
fe445d3a
...
...
@@ -83,25 +83,63 @@
<
div
class
=
"
user-data-elements
"
>
<
div
class
=
"
data-field
"
>
<
label
for
=
"
home-gender
"
><
/label
>
<
p
id
=
home
-
gender
><
/p
>
<
/div
>
<
div
class
=
"
data-field
"
>
<
label
for
=
"
home-location
"
><
/label
>
<
p
id
=
home
-
location
><
/p
>
<
/div
>
<
div
class
=
"
data-field
"
>
<
label
for
=
"
home-email
"
><
/label
>
<
p
id
=
home
-
email
><
/p
>
<
/div
>
<
/div
>
<
form
id
=
board
-
text
-
form
>
<
textarea
rows
=
"
5
"
max
-
rows
=
"
5
"
cols
=
"
50
"
maxlength
=
"
250
"
name
=
"
comment
"
form
=
"
board-text-form
"
><
/textarea
>
<
input
type
=
"
submit
"
value
=
"
Post message
"
>
<
/form
>
<
div
id
=
"
message3
"
><
/div
>
<
button
id
=
"
reloadbutton
"
>
Reload
board
<
/button
>
<
div
id
=
"
home-message-board
"
>
<
/div
>
<
/div
>
<
div
id
=
"
Browse
"
class
=
"
tabcontent
"
>
<
h3
>
Browse
<
/h3
>
<
p
>
Here
you
can
browse
very
cool
stuff
.
<
/p
>
<
form
id
=
"
browse-search
"
>
<
input
type
=
"
text
"
id
=
"
search-value
"
>
<
/form
>
<
div
id
=
"
message5
"
><
/div
>
<
div
id
=
"
browse-window
"
style
=
"
display:none
"
>
<
h3
id
=
browse
-
username
>
Home
<
/h3
>
<
div
class
=
"
user-data-elements
"
>
<
div
class
=
"
data-field
"
>
<
p
id
=
browse
-
gender
><
/p
>
<
/div
>
<
div
class
=
"
data-field
"
>
<
p
id
=
browse
-
location
><
/p
>
<
/div
>
<
div
class
=
"
data-field
"
>
<
p
id
=
browse
-
email
><
/p
>
<
/div
>
<
/div
>
<
form
id
=
browse
-
board
-
text
-
form
>
<
textarea
rows
=
"
5
"
max
-
rows
=
"
5
"
cols
=
"
50
"
maxlength
=
"
250
"
name
=
"
comment
"
form
=
"
browse-board-text-form
"
><
/textarea
>
<
input
type
=
"
submit
"
value
=
"
Post message
"
>
<
/form
>
<
div
id
=
"
message4
"
><
/div
>
<
button
id
=
"
browse-reloadbutton
"
>
Reload
board
<
/button
>
<
div
id
=
"
browse-message-board
"
>
<
/div
>
<
/div
>
<
/div
>
<
div
id
=
"
Account
"
class
=
"
tabcontent
"
>
...
...
This diff is collapsed.
Click to expand it.
client.js
+
110
−
1
View file @
fe445d3a
...
...
@@ -82,8 +82,9 @@ loadProfileView = function() {
document
.
getElementById
(
"
pagecontent
"
).
innerHTML
=
document
.
getElementById
(
"
profileview
"
).
innerText
;
document
.
getElementById
(
"
defaultOpen
"
).
click
();
reloadBoard
(
document
.
getElementById
(
"
home-message-board
"
));
// Account page
var
changepassform
=
document
.
forms
[
"
changepassform
"
];
changepassform
.
addEventListener
(
"
submit
"
,
function
(
event
)
{
event
.
preventDefault
();
...
...
@@ -119,6 +120,114 @@ loadProfileView = function() {
document
.
getElementById
(
'
home-gender
'
).
innerText
=
userData
.
gender
;
document
.
getElementById
(
'
home-location
'
).
innerText
=
userData
.
city
+
'
,
'
+
userData
.
country
;
document
.
getElementById
(
'
home-email
'
).
innerText
=
userData
.
email
;
var
postmessageform
=
document
.
forms
[
"
board-text-form
"
];
postmessageform
.
addEventListener
(
"
submit
"
,
function
(
event
)
{
event
.
preventDefault
();
postmessageform
[
"
comment
"
].
value
var
message
=
serverstub
.
postMessage
(
localStorage
.
getItem
(
"
logintoken
"
),
postmessageform
[
"
comment
"
].
value
);
var
messageBox
=
document
.
getElementById
(
"
message3
"
);
if
(
!
message
.
success
)
{
messageBox
.
innerText
=
"
There was an error with sending your message.
"
;
messageBox
.
style
.
color
=
"
red
"
;
}
else
{
messageBox
.
innerText
=
message
.
message
;
messageBox
.
style
.
color
=
"
green
"
;
}
})
document
.
getElementById
(
"
reloadbutton
"
).
addEventListener
(
"
click
"
,
function
(
event
)
{
reloadBoard
(
document
.
getElementById
(
"
home-message-board
"
));
})
// Browse page
var
searchform
=
document
.
forms
[
"
browse-search
"
];
searchform
.
addEventListener
(
"
submit
"
,
function
(
event
)
{
event
.
preventDefault
();
loadBrowseProfile
();
})
var
searchinput
=
searchform
[
"
search-value
"
];
console
.
log
(
searchinput
);
searchinput
.
addEventListener
(
"
input
"
,
function
(
event
)
{
document
.
getElementById
(
"
message5
"
).
innerText
=
""
;
console
.
log
(
"
JDIFJAIOSDJPIJ
"
);
})
}
loadBrowseProfile
=
function
()
{
var
searchEmail
=
document
.
forms
[
"
browse-search
"
][
"
search-value
"
].
value
;
var
message
=
serverstub
.
getUserDataByEmail
(
localStorage
.
getItem
(
"
logintoken
"
),
searchEmail
)
if
(
!
message
.
success
)
{
document
.
getElementById
(
"
message5
"
).
innerText
=
message
.
message
;
document
.
getElementById
(
"
message5
"
).
style
.
color
=
"
red
"
;
return
;
}
document
.
getElementById
(
"
message5
"
).
innerText
=
""
;
document
.
getElementById
(
"
browse-window
"
).
style
.
display
=
"
block
"
;
var
userData
=
message
.
data
;
// Change the information displayed on the browsepage to the user credentials
document
.
getElementById
(
'
browse-username
'
).
innerText
=
userData
.
firstname
+
'
'
+
userData
.
familyname
;
document
.
getElementById
(
'
browse-gender
'
).
innerText
=
userData
.
gender
;
document
.
getElementById
(
'
browse-location
'
).
innerText
=
userData
.
city
+
'
,
'
+
userData
.
country
;
document
.
getElementById
(
'
browse-email
'
).
innerText
=
userData
.
email
;
var
postmessageform
=
document
.
forms
[
"
browse-board-text-form
"
];
postmessageform
.
addEventListener
(
"
submit
"
,
function
(
event
)
{
event
.
preventDefault
();
postmessageform
[
"
comment
"
].
value
var
message
=
serverstub
.
postMessage
(
localStorage
.
getItem
(
"
logintoken
"
),
postmessageform
[
"
comment
"
].
value
,
searchEmail
);
var
messageBox
=
document
.
getElementById
(
"
message4
"
);
if
(
!
message
.
success
)
{
messageBox
.
innerText
=
"
There was an error with sending your message.
"
;
messageBox
.
style
.
color
=
"
red
"
;
}
else
{
messageBox
.
innerText
=
message
.
message
;
messageBox
.
style
.
color
=
"
green
"
;
}
})
document
.
getElementById
(
"
browse-reloadbutton
"
).
addEventListener
(
"
click
"
,
function
(
event
)
{
reloadBoard
(
document
.
getElementById
(
"
browse-message-board
"
),
searchEmail
);
})
}
reloadBoard
=
function
(
board
,
email
=
null
)
{
var
boardBox
=
board
;
boardBox
.
innerHTML
=
""
;
boardBox
.
innerText
=
""
;
var
messageBoardData
;
if
(
email
!=
null
)
{
messageBoardData
=
serverstub
.
getUserMessagesByEmail
(
localStorage
.
getItem
(
"
logintoken
"
),
email
);
}
else
{
messageBoardData
=
serverstub
.
getUserMessagesByToken
(
localStorage
.
getItem
(
"
logintoken
"
));
}
console
.
log
(
messageBoardData
.
data
);
console
.
log
(
boardBox
);
for
(
var
i
=
0
;
i
<
messageBoardData
.
data
.
length
;
i
++
)
{
var
messageHTML
=
document
.
createElement
(
'
div
'
);
var
title
=
document
.
createElement
(
'
h2
'
)
title
.
innerText
=
messageBoardData
.
data
[
i
][
"
writer
"
];
messageHTML
.
appendChild
(
title
);
var
contentHTML
=
document
.
createElement
(
'
textarea
'
);
contentHTML
.
setAttribute
(
"
readonly
"
,
""
);
contentHTML
.
setAttribute
(
"
rows
"
,
"
5
"
);
contentHTML
.
setAttribute
(
"
max-rows
"
,
"
5
"
);
contentHTML
.
setAttribute
(
"
cols
"
,
"
50
"
);
contentHTML
.
innerText
=
messageBoardData
.
data
[
i
][
"
content
"
];
messageHTML
.
appendChild
(
contentHTML
);
messageHTML
.
appendChild
(
document
.
createElement
(
'
br
'
));
boardBox
.
appendChild
(
messageHTML
);
boardBox
.
style
.
backgroundColor
=
"
white
"
;
boardBox
.
style
.
overflowY
=
"
scroll
"
;
boardBox
.
style
.
maxHeight
=
"
45vh
"
;
}
}
inputValidation
=
function
(
formID
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment