Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
CP-pract-3
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Лотуга Данила Сергеевич
CP-pract-3
Commits
083c80b5
Commit
083c80b5
authored
Jun 12, 2023
by
Лотуга Данила Сергеевич
🏳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update public/script.js, public/index.html files
parent
2e0dd521
Pipeline
#8610
failed with stage
in 17 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
19 deletions
+39
-19
index.html
public/index.html
+11
-19
script.js
public/script.js
+28
-0
No files found.
public/index.html
View file @
083c80b5
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"generator"
content=
"GitLab Pages"
>
<title>
Plain HTML site using GitLab Pages
</title>
<link
rel=
"stylesheet"
href=
"style.css"
>
</head>
<body>
<div
class=
"navbar"
>
<a
href=
"https://pages.gitlab.io/plain-html/"
>
Plain HTML Example
</a>
<a
href=
"https://gitlab.com/pages/plain-html/"
>
Repository
</a>
<a
href=
"https://gitlab.com/pages/"
>
Other Examples
</a>
</div>
<head>
<title>
Image Upload
</title>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"style.css"
>
</head>
<body>
<h1>
Image Upload
</h1>
<input
type=
"file"
id=
"image-input"
>
<button
id=
"upload-button"
>
Upload
</button>
<div
id=
"result"
></div>
<h1>
Hello World!
</h1>
<p>
This is a simple plain-HTML website on GitLab Pages, without any fancy static site generator.
</p>
</body>
<script
src=
"script.js"
></script>
</body>
</html>
public/script.js
0 → 100644
View file @
083c80b5
document
.
getElementById
(
'upload-button'
).
addEventListener
(
'click'
,
async
function
()
{
const
imageInput
=
document
.
getElementById
(
'image-input'
);
const
file
=
imageInput
.
files
[
0
];
if
(
file
)
{
const
reader
=
new
FileReader
();
reader
.
onloadend
=
async
function
()
{
const
imageBase64
=
reader
.
result
.
split
(
','
)[
1
];
const
response
=
await
fetch
(
'https://functions.yandexcloud.net/d4e48qrvft4m7jei77hr'
,
{
method
:
'POST'
,
headers
:
{
'Content-Type'
:
'application/json'
},
body
:
JSON
.
stringify
({
image_file
:
file
.
name
,
image_data
:
imageBase64
,
image_invert
:
true
// Change this value as needed
})
});
const
result
=
await
response
.
json
();
document
.
getElementById
(
'result'
).
textContent
=
JSON
.
stringify
(
result
,
null
,
2
);
};
reader
.
readAsDataURL
(
file
);
}
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment