-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor index.html and scripts: update title, add theme options, and…
… replace script files
- Loading branch information
1 parent
a06a79a
commit 9f53fcf
Showing
12 changed files
with
161 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
document.getElementById('deleteForm').addEventListener('submit', function(event) { | ||
event.preventDefault(); | ||
|
||
const deleteId = document.getElementById('deleteId').value; | ||
const deletePassword = document.getElementById('deletePassword').value; | ||
|
||
const data = { | ||
password: deletePassword | ||
}; | ||
|
||
fetch(`/${deleteId}`, { | ||
method: 'DELETE', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
body: JSON.stringify(data) | ||
}) | ||
.then(response => { | ||
if (!response.ok) { | ||
throw new Error('Network response was not ok: ' + response.statusText); | ||
} | ||
return response.text(); | ||
}) | ||
.then(message => { | ||
document.getElementById('responseMessage').textContent = message; | ||
}) | ||
.catch(error => { | ||
document.getElementById('responseMessage').textContent = 'Error: ' + error.message; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
document.getElementById('postForm').addEventListener('submit', function(event) { | ||
event.preventDefault(); | ||
|
||
const url = document.getElementById('url').value; | ||
const id = document.getElementById('id').value; | ||
const password = document.getElementById('password').value; | ||
|
||
const data = { | ||
url: url, | ||
id: id, | ||
password: password | ||
}; | ||
|
||
fetch('/shorten', { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
body: JSON.stringify(data) | ||
}) | ||
.then(response => { | ||
if (!response.ok) { | ||
return response.text().then(text => { | ||
throw new Error(text); | ||
}); | ||
} | ||
return response.json(); | ||
}) | ||
.then(data => { | ||
document.getElementById('responseMessage').textContent = JSON.stringify(data, null, 2); | ||
}) | ||
.catch(error => { | ||
document.getElementById('responseMessage').textContent = 'Error: ' + error.message; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
document.getElementById('theme').addEventListener('change', function() { | ||
document.body.className = this.value; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.black-theme { | ||
--background-color: #000000; | ||
--container-background: #000000; | ||
--label-color: #ffffff; | ||
--input-border: #ffffff; | ||
--input-focus-border: #00ff73; | ||
--button-background: #000000; | ||
--button-hover-background: rgb(31, 31, 31); | ||
--link-color: #ffffff; | ||
--link-hover-color: #00ff80; | ||
--button-text-color: #ffffff; | ||
--text-color: #ffffff; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.blue-theme { | ||
--background-color: #e3f2fd; | ||
--container-background: #ffffff; | ||
--label-color: #2196f3; | ||
--input-border: #2196f3; | ||
--input-focus-border: #90caf9; | ||
--button-background: #2196f3; | ||
--button-hover-background: #1976d2; | ||
--link-color: #2196f3; | ||
--link-hover-color: #1976d2; | ||
--button-text-color: #ffffff; | ||
--text-color: #000000; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.dark-blue-theme { | ||
--background-color: #0d1b2a; | ||
--container-background: #303234; | ||
--label-color: #b7d6fc; | ||
--input-border: #7c98bb; | ||
--input-focus-border: #ffffff; | ||
--button-background: #3d6ea9; | ||
--button-hover-background: rgb(30, 74, 128); | ||
--link-color: #b5d6ff; | ||
--link-hover-color: #619ce5; | ||
--button-text-color: #ffffff; | ||
--text-color: #ffffff; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.green-theme { | ||
--background-color: #e8f5e9; | ||
--container-background: #ffffff; | ||
--label-color: #4caf50; | ||
--input-border: #4caf50; | ||
--input-focus-border: #81c784; | ||
--button-background: #4caf50; | ||
--button-hover-background: #388e3c; | ||
--link-color: #4caf50; | ||
--link-hover-color: #388e3c; | ||
--button-text-color: #ffffff; | ||
--text-color: #000000; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.orange-theme { | ||
--background-color: #fff3e0; | ||
--container-background: #ffffff; | ||
--label-color: #ff9800; | ||
--input-border: #ff9800; | ||
--input-focus-border: #ffb74d; | ||
--button-background: #ff9800; | ||
--button-hover-background: #f57c00; | ||
--link-color: #ff9800; | ||
--link-hover-color: #f57c00; | ||
--button-text-color: #ffffff; | ||
--text-color: #000000; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.pink-theme { | ||
--background-color: #fce4ec; /* Light pink background */ | ||
--container-background: #ffffff; /* White container */ | ||
--label-color: #d81b60; /* Pink label color */ | ||
--input-border: #d81b60; /* Pink input border */ | ||
--input-focus-border: #f48fb1; /* Light pink focus border */ | ||
--button-background: #d81b60; /* Pink button background */ | ||
--button-hover-background: #c2185b; /* Darker pink on hover */ | ||
--link-color: #d81b60; /* Pink link color */ | ||
--link-hover-color: #c2185b; /* Darker pink on hover */ | ||
--button-text-color: #ffffff; /* White text on buttons */ | ||
--text-color: #000000; /* Black text */ | ||
} |