Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
WebProgramming
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
Maxime Oliva
WebProgramming
Commits
872fe527
Commit
872fe527
authored
2 years ago
by
MaximeOLIVA
Browse files
Options
Downloads
Patches
Plain Diff
modif client
parent
0481ddc8
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Twidder (Lab3)/database.db
+0
-0
0 additions, 0 deletions
Twidder (Lab3)/database.db
Twidder (Lab3)/static/client.js
+22
-30
22 additions, 30 deletions
Twidder (Lab3)/static/client.js
with
22 additions
and
30 deletions
Twidder (Lab3)/database.db
+
0
−
0
View file @
872fe527
No preview for this file type
This diff is collapsed.
Click to expand it.
Twidder (Lab3)/static/client.js
+
22
−
30
View file @
872fe527
...
...
@@ -82,7 +82,7 @@ function changePassword(formData) {
document
.
getElementById
(
"
pwderror
"
).
innerHTML
=
"
Password too short. Must be 6 characters at leats.
"
}
else
if
(
req
.
status
==
400
){
document
.
getElementById
(
"
pwderror
"
).
innerHTML
=
"
Missing information
"
}
}
}
}
}
...
...
@@ -184,7 +184,7 @@ function signOut() {
let
messageDiv
=
document
.
getElementById
(
"
error
"
);
let
req
=
new
XMLHttpRequest
();
req
.
open
(
"
P
OS
T
"
,
"
/users/sign_out
"
,
true
);
req
.
open
(
"
P
U
T
"
,
"
/users/sign_out
"
,
true
);
req
.
setRequestHeader
(
"
Content-type
"
,
"
application/json;charset=UTF-8
"
);
req
.
setRequestHeader
(
"
token
"
,
localStorage
.
getItem
(
"
token
"
));
req
.
send
(
null
);
...
...
@@ -268,16 +268,6 @@ function openTab(tabName) {
var
i
,
tabcontent
,
tablinks
;
localStorage
.
setItem
(
"
tab
"
,
tabName
);
if
(
tabName
!=
"
browsePage
"
)
{
var
xhttp
=
new
XMLHttpRequest
();
xhttp
.
open
(
"
GET
"
,
"
/account/get/message/
"
+
localStorage
.
getItem
(
"
browsed_email
"
),
true
);
xhttp
.
setRequestHeader
(
"
token
"
,
localStorage
.
getItem
(
"
token
"
));
xhttp
.
send
();
if
(
xhttp
.
readyState
==
4
&&
xhttp
.
status
!=
204
){
localStorage
.
removeItem
(
"
browsed_email
"
);
}
}
// Get all elements with class="tabcontent" and hide them
tabcontent
=
document
.
getElementsByClassName
(
"
tabcontent
"
);
for
(
i
=
0
;
i
<
tabcontent
.
length
;
i
++
)
{
...
...
@@ -292,7 +282,7 @@ function openTab(tabName) {
if
(
tabName
==
"
homePage
"
)
{
display_wall_info
(
localStorage
.
getItem
(
"
email_username
"
),
"
HP
"
);
}
else
if
(
tabName
==
"
browsePage
"
)
{
}
else
if
(
tabName
==
"
browsePage
"
&&
localStorage
.
getItem
(
"
browsed_email
"
)
!=
null
)
{
display_wall_info
(
localStorage
.
getItem
(
"
browsed_email
"
),
"
BP
"
);
}
...
...
@@ -308,26 +298,27 @@ function display_wall_info(email, tab) {
let
data_user
;
get_user_info
(
email
,
tab
,
function
(
data
){
data_user
=
data
;
if
(
data_user
.
success
)
{
if
(
tab
==
"
BP
"
)
{
if
(
data_user
!=
null
)
{
if
(
data_user
.
success
)
{
if
(
tab
==
"
BP
"
)
{
browsecontent
=
document
.
getElementsByClassName
(
"
browsecontent
"
);
for
(
i
=
0
;
i
<
browsecontent
.
length
;
i
++
)
{
document
.
getElementById
(
"
browse_error
"
).
style
.
display
=
"
none
"
;
browsecontent
[
i
].
style
.
display
=
"
block
"
;
}
}
fills_data
(
tab
,
data_user
);
display_wall
(
email
,
tab
);
}
else
{
browsecontent
=
document
.
getElementsByClassName
(
"
browsecontent
"
);
for
(
i
=
0
;
i
<
browsecontent
.
length
;
i
++
)
{
document
.
getElementById
(
"
browse_error
"
).
style
.
display
=
"
none
"
;
browsecontent
[
i
].
style
.
display
=
"
block
"
;
browsecontent
[
i
].
style
.
display
=
"
none
"
;
}
if
(
localStorage
.
getItem
(
"
browsed_email
"
)
!=
null
){
document
.
getElementById
(
"
browse_error
"
).
style
.
display
=
"
block
"
;
document
.
getElementById
(
"
browse_error
"
).
innerHTML
=
data_user
.
message
;
}
}
fills_data
(
tab
,
data_user
);
display_wall
(
email
,
tab
);
}
else
{
browsecontent
=
document
.
getElementsByClassName
(
"
browsecontent
"
);
for
(
i
=
0
;
i
<
browsecontent
.
length
;
i
++
)
{
browsecontent
[
i
].
style
.
display
=
"
none
"
;
}
if
(
localStorage
.
getItem
(
"
browsed_email
"
)
!=
null
){
document
.
getElementById
(
"
browse_error
"
).
style
.
display
=
"
block
"
;
document
.
getElementById
(
"
browse_error
"
).
innerHTML
=
data_user
.
message
;
}
}
});
}
...
...
@@ -335,7 +326,8 @@ function display_wall_info(email, tab) {
function
get_user_info
(
email
,
tab
,
callback
)
{
//call the server if data aren't already stored
if
((
tab
==
"
BP
"
)
&&
(
localStorage
.
getItem
(
"
browsed_email
"
)
!=
email
||
data_user_browse
==
null
))
{
if
((
tab
==
"
BP
"
)
&&
(
localStorage
.
getItem
(
"
browsed_email
"
)
!=
email
||
data_user_browse
==
null
)
&&
(
localStorage
.
getItem
(
"
browsed_email
"
)
!=
null
))
{
let
req
=
new
XMLHttpRequest
();
req
.
open
(
"
GET
"
,
"
/account/get/data/
"
+
email
,
true
);
req
.
setRequestHeader
(
"
token
"
,
localStorage
.
getItem
(
"
token
"
));
...
...
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