Enhance rate limiting and mobile UI improvements for full mobile support!

Added new rate limiter policies "OneRequest" and "OneRequestPerIP" in `Program.cs`. Updated routing middleware and user authentication logic. Enhanced mobile navigation with a hamburger menu in multiple HTML files (`admin.html`, `user.html`, `archives.html`, `banned.html`, `error.html`, `login.html`, `paste.html`, `privatepaste.html`, `recent_pastes.html`). Introduced a notification system in `admin.html` and `login.html`. Updated CSS and JavaScript for better mobile responsiveness and user experience.
This commit is contained in:
whoswhip
2024-09-10 19:29:21 -04:00
parent 878cebacb6
commit 2889921f12
13 changed files with 1779 additions and 360 deletions
+21 -4
View File
@@ -40,6 +40,13 @@ class Program
builder.Services.AddResponseCompression(); builder.Services.AddResponseCompression();
builder.Services.AddRateLimiter(_ => _
.AddFixedWindowLimiter(policyName: "OneRequest", options =>
{
options.PermitLimit = 1;
options.QueueProcessingOrder = QueueProcessingOrder.OldestFirst;
options.QueueLimit = 2;
}));
builder.Services.AddRateLimiter(_ => _ builder.Services.AddRateLimiter(_ => _
.AddFixedWindowLimiter(policyName: "fixed", options => .AddFixedWindowLimiter(policyName: "fixed", options =>
{ {
@@ -56,6 +63,16 @@ class Program
options.QueueProcessingOrder = QueueProcessingOrder.OldestFirst; options.QueueProcessingOrder = QueueProcessingOrder.OldestFirst;
options.QueueLimit = 4; options.QueueLimit = 4;
})); }));
builder.Services.AddRateLimiter(options =>
{
options.AddPolicy("OneRequestPerIP", context =>
RateLimitPartition.GetConcurrencyLimiter(context.Request.Headers["X-Forwarded-For"].ToString() ?? context.Connection.RemoteIpAddress?.ToString() ?? "unknown", key => new ConcurrencyLimiterOptions
{
PermitLimit = 1,
QueueProcessingOrder = QueueProcessingOrder.OldestFirst,
QueueLimit = 1
}));
});
var app = builder.Build(); var app = builder.Build();
@@ -69,7 +86,7 @@ class Program
//app.UseHttpsRedirection(); //app.UseHttpsRedirection();
app.UseStaticFiles(); app.UseStaticFiles();
app.UseRouting(); app.UseRouting();
app.UseRateLimiter(); app.UseRateLimiter();
@@ -1477,7 +1494,7 @@ class Program
string ip = context.Request.Headers["X-Forwarded-For"].ToString() ?? context.Connection.RemoteIpAddress.ToString(); string ip = context.Request.Headers["X-Forwarded-For"].ToString() ?? context.Connection.RemoteIpAddress.ToString();
string uploaderUUID = string.Empty; string uploaderUUID = string.Empty;
string token = context.Request.Cookies["token"] ?? context.Request.Headers["Authorization"]; string token = context.Request.Cookies["token"] ?? context.Request.Headers["Authorization"];
var user = await GetLoggedInUserAsync(token);
if (string.IsNullOrEmpty(requestBody)) if (string.IsNullOrEmpty(requestBody))
{ {
@@ -1486,7 +1503,7 @@ class Program
await context.Response.WriteAsJsonAsync(new JObject { ["error"] = "No content uploaded" }.ToString()); await context.Response.WriteAsJsonAsync(new JObject { ["error"] = "No content uploaded" }.ToString());
return; return;
} }
if (await IsLoggedInAsync(token)) if (string.IsNullOrEmpty(user.UUID))
{ {
using (var connection = new SqliteConnection("Data Source=pastes.sqlite")) using (var connection = new SqliteConnection("Data Source=pastes.sqlite"))
{ {
@@ -1497,7 +1514,7 @@ class Program
var reader = await command.ExecuteReaderAsync(); var reader = await command.ExecuteReaderAsync();
await reader.ReadAsync(); await reader.ReadAsync();
uploaderUUID = reader.GetString(0); uploaderUUID = reader.GetString(0);
var user = await GetLoggedInUserAsync(token);
if (user.State != 0) if (user.State != 0)
{ {
context.Response.StatusCode = 401; context.Response.StatusCode = 401;
+164 -7
View File
@@ -15,6 +15,19 @@
<a href="/archive">archive</a> <a href="/archive">archive</a>
{html} {html}
</div> </div>
<div class="nav-hamburger-menu">
<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" fill="currentColor" class="bi bi-list"
viewBox="0 0 16 16" id="hamburger-button" style="cursor: pointer;">
<path fill-rule="evenodd"
d="M2.5 12a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5" />
</svg>
<div class="nav-buttons">
<a href="/">home</a>
<a href="/pastes">recent pastes</a>
<a href="/archive">archive</a>
{html}
</div>
</div>
<div class="container-wrapper"> <div class="container-wrapper">
<div class="dash-container"> <div class="dash-container">
<div class="wrapper"> <div class="wrapper">
@@ -36,7 +49,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="idek-wrapper"> <div class="idek-wrapper accounts">
<div class="accounts-wrapper"> <div class="accounts-wrapper">
<h3>Accounts</h3> <h3>Accounts</h3>
<input type="text" placeholder="search" class="text-input" oninput="waitSearch()"> <input type="text" placeholder="search" class="text-input" oninput="waitSearch()">
@@ -49,7 +62,8 @@
</div> </div>
</div> </div>
</div> </div>
<div class="notifcations-wrapper" id="notifications"></div>
</div>
</body> </body>
<script> <script>
let searchTimeout; let searchTimeout;
@@ -67,7 +81,51 @@
creationdateElement.innerText = "Creation Date: " + localizeDateTime(parseInt(creationdateText)); creationdateElement.innerText = "Creation Date: " + localizeDateTime(parseInt(creationdateText));
lastlogindateElement.innerText = "Last Login Date: " + localizeDateTime(parseInt(lastlogindateText)); lastlogindateElement.innerText = "Last Login Date: " + localizeDateTime(parseInt(lastlogindateText));
var mobile = window.mobileCheck();
if (mobile) {
document.querySelector('.nav-div').style.display = 'none';
document.querySelector('.nav-hamburger-menu').style.display = 'flex';
}
}); });
document.getElementById("hamburger-button").addEventListener("click", function () {
const nav = document.querySelector('.nav-buttons');
if (nav.style.display == 'none' || nav.style.display == '') {
nav.style.display = 'flex';
} else {
nav.style.display = 'none';
}
});
window.mobileCheck = function () {
let check = false;
(function (a) { if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true; })(navigator.userAgent || navigator.vendor || window.opera);
return check;
};
function createNotification(message) {
const notificationWrapper = document.getElementById('notifications');
const notificationDiv = document.createElement('div');
notificationDiv.classList.add('notification-div');
notificationDiv.id = 'notification';
const notificationText = document.createElement('h2');
notificationText.id = 'notification-text';
notificationText.innerText = message;
notificationDiv.appendChild(notificationText);
notificationWrapper.appendChild(notificationDiv);
notificationDiv.style.animation = 'none';
notificationDiv.style.display = 'none';
notificationDiv.style.display = 'flex';
notificationDiv.style.animation = 'hoverup 1s';
setTimeout(() => {
notificationDiv.style.animation = 'hoverdown 1s';
}, 4000);
setTimeout(() => {
notificationDiv.remove();
}, 4900);
}
function waitSearch() { function waitSearch() {
clearTimeout(searchTimeout); clearTimeout(searchTimeout);
searchTimeout = setTimeout(search, 200); searchTimeout = setTimeout(search, 200);
@@ -115,7 +173,7 @@
const lastAccount = accounts[accounts.length - 1]; const lastAccount = accounts[accounts.length - 1];
const lastAccountUsername = lastAccount.querySelector('.list-item').innerText; const lastAccountUsername = lastAccount.querySelector('.list-item').innerText;
const lastAccountUUID = lastAccount.querySelector('.list-item').getAttribute('data-uuid'); const lastAccountUUID = lastAccount.querySelector('.list-item').getAttribute('data-uuid');
var isScrolledDown = listContainer.scrollTop + listContainer.clientHeight >= listContainer.scrollHeight; var isScrolledDown = listContainer.scrollTop + listContainer.clientHeight >= listContainer.scrollHeight - 100;
if (!isScrolledDown) { if (!isScrolledDown) {
return; return;
} }
@@ -133,9 +191,9 @@
if (data === '') { if (data === '') {
return; return;
} }
console.log(listContainer.innerHTML); if (listContainer.innerHTML.includes(data)) {
console.log(data); return;
}
listContainer.innerHTML += data; listContainer.innerHTML += data;
} }
@@ -186,7 +244,7 @@
color: white; color: white;
border-radius: 5px; border-radius: 5px;
width: 80%; width: 80%;
max-height: 80vh; max-height: 100%;
min-height: 20%; min-height: 20%;
height: fit-content; height: fit-content;
border: #222222 2px solid; border: #222222 2px solid;
@@ -310,6 +368,50 @@
border: #222222 2px solid; border: #222222 2px solid;
} }
.nav-hamburger-menu {
top: 0;
position: absolute;
display: none;
flex-direction: column;
justify-content: center;
align-items: center;
width: 99vw;
overflow-x: hidden;
background-color: #181818;
color: white;
height: fit-content;
overflow-y: auto;
border: #222222 2px solid;
}
.nav-buttons {
display: none;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
}
.nav-buttons a {
text-decoration: none;
color: white;
padding: 10px;
margin: 2px;
border-radius: 5px;
background-color: #222222;
transition: 300ms;
border: #2a2a2a00 2px solid;
width: 100%;
text-align: center;
font-size: 1.4rem;
}
.nav-buttons a:hover {
transition: 300ms;
background-color: #333333;
border: #3a3a3a 2px solid;
}
.nav-div a { .nav-div a {
text-decoration: none; text-decoration: none;
color: white; color: white;
@@ -326,6 +428,61 @@
background-color: #333333; background-color: #333333;
border: #3a3a3a 2px solid; border: #3a3a3a 2px solid;
} }
@media screen and (max-width: 800px) {
.nav-div {
display: none;
}
.nav-hamburger-menu {
display: flex;
}
.nav-buttons {
display: none;
}
.nav-buttons a {
display: block;
}
.dash-container{
height: 80%;
margin-top: 6rem;
}
.container-wrapper {
height: 90%;
}.wrapper {
height: 70%;
max-height: 70%;
}
.idek-wrapper {
flex-direction: column;
}
.accounts{
max-height: 20%;
}
.account-info {
width: 90%;
margin: 0;
}
.pastes-wrapper {
width: 90%;
margin: 0;
margin-top: 20px;
}
.accounts-wrapper {
width: 90%;
margin: 0;
margin-top: 20px;
}
.list-container {
max-height: 100%;
overflow-y: scroll;
display: flex;
flex-direction: column;
width: 100%;
align-items: center;
}
}
</style> </style>
</html> </html>
+145 -6
View File
@@ -15,6 +15,18 @@
<a href="/archive">archive</a> <a href="/archive">archive</a>
{html} {html}
</div> </div>
<div class="nav-hamburger-menu">
<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" fill="currentColor" class="bi bi-list" viewBox="0 0 16 16" id="hamburger-button" style="cursor: pointer;">
<path fill-rule="evenodd"
d="M2.5 12a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5" />
</svg>
<div class="nav-buttons">
<a href="/">home</a>
<a href="/pastes">recent pastes</a>
<a href="/archive">archive</a>
{html}
</div>
</div>
<div class="container-wrapper"> <div class="container-wrapper">
<div class="account-container"> <div class="account-container">
<div class="account-info"> <div class="account-info">
@@ -74,7 +86,25 @@
if ('{typeban}' == 'unban') { if ('{typeban}' == 'unban') {
document.getElementById('ban-date').style.display = 'none'; document.getElementById('ban-date').style.display = 'none';
} }
var mobile = window.mobileCheck();
if (mobile) {
document.querySelector('.nav-div').style.display = 'none';
document.querySelector('.nav-hamburger-menu').style.display = 'flex';
}
}); });
document.getElementById("hamburger-button").addEventListener("click", function () {
const nav = document.querySelector('.nav-buttons');
if (nav.style.display == 'none' || nav.style.display == '') {
nav.style.display = 'flex';
} else {
nav.style.display = 'none';
}
});
window.mobileCheck = function () {
let check = false;
(function (a) { if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true; })(navigator.userAgent || navigator.vendor || window.opera);
return check;
};
function banorunban() { function banorunban() {
const banDiv = document.getElementById('ban-div'); const banDiv = document.getElementById('ban-div');
console.log(banDiv.style.display); console.log(banDiv.style.display);
@@ -396,13 +426,13 @@
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
width: fit-content; width: fit-content;
width: 85%; width: calc(100% - 40px);
max-width: 100%; max-width: 100%;
background-color: #222222; background-color: #222222;
border-radius: 5px; border-radius: 5px;
padding: 20px; padding: 20px;
height: fit-content; height: fit-content;
margin-top: 26px; margin-top: 10px;
height: 77.1%; height: 77.1%;
max-height: 77.1%; max-height: 77.1%;
} }
@@ -428,6 +458,7 @@
align-items: center; align-items: center;
background-color: #0d0d0d; background-color: #0d0d0d;
position: relative; position: relative;
height: calc(100vh - 20px);
} }
.container-wrapper { .container-wrapper {
@@ -436,7 +467,7 @@
justify-content: center; justify-content: center;
align-items: center; align-items: center;
width: 100%; width: 100%;
height: 98.7vh; height: 100%;
} }
.account-container { .account-container {
@@ -449,8 +480,8 @@
color: white; color: white;
border-radius: 5px; border-radius: 5px;
height: fit-content; height: fit-content;
max-height: 80vh; margin-top: 6rem;
overflow-y: auto; max-height: 100%;
border: #222222 2px solid; border: #222222 2px solid;
} }
@@ -464,6 +495,7 @@
width: 48%; width: 48%;
max-width: 48%; max-width: 48%;
margin-right: 10px; margin-right: 10px;
word-break: break-all;
} }
.action-wrapper { .action-wrapper {
@@ -472,7 +504,7 @@
justify-content: center; justify-content: center;
align-items: center; align-items: center;
width: fit-content; width: fit-content;
width: 85%; width: calc(100% - 40px);
max-width: 100%; max-width: 100%;
background-color: #222222; background-color: #222222;
border-radius: 5px; border-radius: 5px;
@@ -508,6 +540,7 @@
border: 2px solid #3a3a3a; border: 2px solid #3a3a3a;
} }
.nav-div { .nav-div {
top: 0; top: 0;
margin-top: 10px; margin-top: 10px;
@@ -527,6 +560,49 @@
border: #222222 2px solid; border: #222222 2px solid;
} }
.nav-hamburger-menu {
top: 0;
position: absolute;
display: none;
flex-direction: column;
justify-content: center;
align-items: center;
width: 99vw;
overflow-x: hidden;
background-color: #181818;
color: white;
overflow-y: auto;
border: #222222 2px solid;
}
.nav-buttons {
display: none;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
}
.nav-buttons a {
text-decoration: none;
color: white;
padding: 10px;
margin: 2px;
border-radius: 5px;
background-color: #222222;
transition: 300ms;
border: #2a2a2a00 2px solid;
width: 100%;
text-align: center;
font-size: 1.4rem;
}
.nav-buttons a:hover {
transition: 300ms;
background-color: #333333;
border: #3a3a3a 2px solid;
}
.nav-div a { .nav-div a {
text-decoration: none; text-decoration: none;
color: white; color: white;
@@ -543,6 +619,69 @@
background-color: #333333; background-color: #333333;
border: #3a3a3a 2px solid; border: #3a3a3a 2px solid;
} }
@media screen and (max-width: 800px) {
.nav-div {
display: none;
}
.nav-hamburger-menu {
display: flex;
}
.nav-buttons {
display: none;
}
.nav-buttons a {
display: block;
}
.container-wrapper{
height: 90%;
}
.account-container {
flex-direction: column;
align-items: center;
justify-content: center;
max-height: 100%;
}
.account-info {
margin-right: 0px;
width: 90%;
max-width: 100%;
font-size: smaller !important;
}
.collumn-2 {
margin-top: 10px;
width: 90%;
max-width: 100%;
max-height: 48%;
}
.action-wrapper {
width: 100%;
max-width: 100%;
max-height: 40%;
}
.button {
width: 90%;
max-width: 100%;
margin: 0;
margin-top: 10px;
}
.pastes-wrapper {
margin-top: 10px;
width: 100%;
max-width: 100%;
max-height: calc(500px * 1.5);
}
.pastes-container {
width: 100%;
max-width: 100%;
max-height: 20%;
overflow-x: hidden;
text-align: start;
}
}
</style> </style>
</html> </html>
+97
View File
@@ -15,6 +15,18 @@
<a href="/archive">archive</a> <a href="/archive">archive</a>
{html} {html}
</div> </div>
<div class="nav-hamburger-menu">
<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" fill="currentColor" class="bi bi-list" viewBox="0 0 16 16" id="hamburger-button" style="cursor: pointer;">
<path fill-rule="evenodd"
d="M2.5 12a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5" />
</svg>
<div class="nav-buttons">
<a href="/">home</a>
<a href="/pastes">recent pastes</a>
<a href="/archive">archive</a>
{html}
</div>
</div>
<div class="container-wrapper"> <div class="container-wrapper">
<div class="pastes-container"> <div class="pastes-container">
<h1>paste archive</h1> <h1>paste archive</h1>
@@ -33,6 +45,28 @@
<script> <script>
let searchTimeout; let searchTimeout;
document.addEventListener('DOMContentLoaded', () => {
var mobile = window.mobileCheck();
if (mobile) {
document.querySelector('.nav-div').style.display = 'none';
document.querySelector('.nav-hamburger-menu').style.display = 'flex';
}
});
document.getElementById("hamburger-button").addEventListener("click", function () {
const nav = document.querySelector('.nav-buttons');
if (nav.style.display == 'none' || nav.style.display == '') {
nav.style.display = 'flex';
} else {
nav.style.display = 'none';
}
});
window.mobileCheck = function () {
let check = false;
(function (a) { if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true; })(navigator.userAgent || navigator.vendor || window.opera);
return check;
};
function search() { function search() {
clearTimeout(searchTimeout); clearTimeout(searchTimeout);
searchTimeout = setTimeout(searchPastes, 200); searchTimeout = setTimeout(searchPastes, 200);
@@ -233,6 +267,7 @@
border: #3a3a3a 2px solid; border: #3a3a3a 2px solid;
} }
.nav-div { .nav-div {
top: 0; top: 0;
margin-top: 10px; margin-top: 10px;
@@ -252,6 +287,50 @@
border: #222222 2px solid; border: #222222 2px solid;
} }
.nav-hamburger-menu {
top: 0;
position: absolute;
display: none;
flex-direction: column;
justify-content: center;
align-items: center;
width: 99vw;
overflow-x: hidden;
background-color: #181818;
color: white;
height: fit-content;
overflow-y: auto;
border: #222222 2px solid;
}
.nav-buttons {
display: none;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
}
.nav-buttons a {
text-decoration: none;
color: white;
padding: 10px;
margin: 2px;
border-radius: 5px;
background-color: #222222;
transition: 300ms;
border: #2a2a2a00 2px solid;
width: 100%;
text-align: center;
font-size: 1.4rem;
}
.nav-buttons a:hover {
transition: 300ms;
background-color: #333333;
border: #3a3a3a 2px solid;
}
.nav-div a { .nav-div a {
text-decoration: none; text-decoration: none;
color: white; color: white;
@@ -268,6 +347,24 @@
background-color: #333333; background-color: #333333;
border: #3a3a3a 2px solid; border: #3a3a3a 2px solid;
} }
@media screen and (max-width: 800px) {
.nav-div {
display: none;
}
.nav-hamburger-menu {
display: flex;
}
.nav-buttons {
display: none;
}
.nav-buttons a {
display: block;
}
}
.arrow-button { .arrow-button {
min-width: fit-content !important; min-width: fit-content !important;
+128 -33
View File
@@ -13,6 +13,19 @@
<a href="/archive">archive</a> <a href="/archive">archive</a>
{html} {html}
</div> </div>
<div class="nav-hamburger-menu">
<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" fill="currentColor" class="bi bi-list"
viewBox="0 0 16 16" id="hamburger-button" style="cursor: pointer;">
<path fill-rule="evenodd"
d="M2.5 12a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5" />
</svg>
<div class="nav-buttons">
<a href="/">home</a>
<a href="/pastes">recent pastes</a>
<a href="/archive">archive</a>
{html}
</div>
</div>
<div class="container-wrapper"> <div class="container-wrapper">
<div class="error-container"> <div class="error-container">
<h1>Error {code}</h1> <h1>Error {code}</h1>
@@ -31,7 +44,25 @@
const dateElement = document.getElementById('unix-date'); const dateElement = document.getElementById('unix-date');
const time = localizeDateTime(parseInt(dateElement.innerText.trim())); const time = localizeDateTime(parseInt(dateElement.innerText.trim()));
dateElement.innerText = time; dateElement.innerText = time;
var mobile = window.mobileCheck();
if (mobile) {
document.querySelector('.nav-div').style.display = 'none';
document.querySelector('.nav-hamburger-menu').style.display = 'flex';
}
}); });
document.getElementById("hamburger-button").addEventListener("click", function () {
const nav = document.querySelector('.nav-buttons');
if (nav.style.display == 'none' || nav.style.display == '') {
nav.style.display = 'flex';
} else {
nav.style.display = 'none';
}
});
window.mobileCheck = function () {
let check = false;
(function (a) { if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true; })(navigator.userAgent || navigator.vendor || window.opera);
return check;
};
</script> </script>
<style> <style>
body{ body{
@@ -85,38 +116,102 @@ body{
background-color: #333333; background-color: #333333;
border: 2px solid #3a3a3a; border: 2px solid #3a3a3a;
} }
.nav-div{ .nav-div {
top: 0; top: 0;
margin-top: 10px; margin-top: 10px;
position: absolute; position: absolute;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
width: fit-content; width: fit-content;
background-color: #181818; background-color: #181818;
padding-left: 10px; padding-left: 10px;
padding-right: 10px; padding-right: 10px;
color: white; color: white;
border-radius: 5px; border-radius: 5px;
height: fit-content; height: fit-content;
overflow-y: auto; overflow-y: auto;
border: #222222 2px solid; border: #222222 2px solid;
} }
.nav-div a{
text-decoration: none; .nav-hamburger-menu {
color: white; top: 0;
padding: 10px; position: absolute;
margin: 10px; display: none;
border-radius: 5px; flex-direction: column;
background-color: #222222; justify-content: center;
transition: 300ms; align-items: center;
border: #2a2a2a00 2px solid; width: 99vw;
} overflow-x: hidden;
.nav-div a:hover{ background-color: #181818;
transition: 300ms; color: white;
background-color: #333333; height: fit-content;
border: #3a3a3a 2px solid; overflow-y: auto;
} border: #222222 2px solid;
}
.nav-buttons {
display: none;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
}
.nav-buttons a {
text-decoration: none;
color: white;
padding: 10px;
margin: 2px;
border-radius: 5px;
background-color: #222222;
transition: 300ms;
border: #2a2a2a00 2px solid;
width: 100%;
text-align: center;
font-size: 1.4rem;
}
.nav-buttons a:hover {
transition: 300ms;
background-color: #333333;
border: #3a3a3a 2px solid;
}
.nav-div a {
text-decoration: none;
color: white;
padding: 10px;
margin: 10px;
border-radius: 5px;
background-color: #222222;
transition: 300ms;
border: #2a2a2a00 2px solid;
}
.nav-div a:hover {
transition: 300ms;
background-color: #333333;
border: #3a3a3a 2px solid;
}
@media screen and (max-width: 800px) {
.nav-div {
display: none;
}
.nav-hamburger-menu {
display: flex;
}
.nav-buttons {
display: none;
}
.nav-buttons a {
display: block;
}
}
</style> </style>
</html> </html>
+294 -125
View File
@@ -1,11 +1,13 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100..900&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100..900&display=swap" rel="stylesheet">
<title>create paste</title> <title>create paste</title>
</head> </head>
<body> <body>
<div class="nav-div"> <div class="nav-div">
<a href="/">home</a> <a href="/">home</a>
@@ -13,7 +15,20 @@
<a href="/archive">archive</a> <a href="/archive">archive</a>
{html} {html}
</div> </div>
<div class="container-wrapper"> <div class="nav-hamburger-menu">
<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" fill="currentColor" class="bi bi-list"
viewBox="0 0 16 16" id="hamburger-button" style="cursor: pointer;">
<path fill-rule="evenodd"
d="M2.5 12a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5" />
</svg>
<div class="nav-buttons">
<a href="/">home</a>
<a href="/pastes">recent pastes</a>
<a href="/archive">archive</a>
{html}
</div>
</div>
<div class="container-wrapper">
<div class="dash-container"> <div class="dash-container">
<div class="wrapper"> <div class="wrapper">
<div class="idek-wrapper"> <div class="idek-wrapper">
@@ -36,6 +51,8 @@
</div> </div>
</div> </div>
</div> </div>
<div class="notifcations-wrapper" id="notifications">
</div>
</body> </body>
<script> <script>
function localizeDateTime(unixTimestamp) { function localizeDateTime(unixTimestamp) {
@@ -43,138 +60,290 @@
return date.toLocaleString(); return date.toLocaleString();
} }
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function () {
const creationdateElement = document.getElementById('creationdate'); const creationdateElement = document.getElementById('creationdate');
const lastlogindateElement = document.getElementById('lastlogindate'); const lastlogindateElement = document.getElementById('lastlogindate');
const creationdateText = creationdateElement.innerText.trim(); const creationdateText = creationdateElement.innerText.trim();
const lastlogindateText = lastlogindateElement.innerText.trim(); const lastlogindateText = lastlogindateElement.innerText.trim();
creationdateElement.innerText = "Creation Date: " + localizeDateTime(parseInt(creationdateText)); creationdateElement.innerText = "Creation Date: " + localizeDateTime(parseInt(creationdateText));
lastlogindateElement.innerText = "Last Login Date: " + localizeDateTime(parseInt(lastlogindateText)); lastlogindateElement.innerText = "Last Login Date: " + localizeDateTime(parseInt(lastlogindateText));
var mobile = window.mobileCheck();
if (mobile) {
document.querySelector('.nav-div').style.display = 'none';
document.querySelector('.nav-hamburger-menu').style.display = 'flex';
}
}); });
document.getElementById("hamburger-button").addEventListener("click", function () {
const nav = document.querySelector('.nav-buttons');
if (nav.style.display == 'none' || nav.style.display == '') {
nav.style.display = 'flex';
} else {
nav.style.display = 'none';
}
});
window.mobileCheck = function () {
let check = false;
(function (a) { if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true; })(navigator.userAgent || navigator.vendor || window.opera);
return check;
};
function createNotification(message) {
const notificationWrapper = document.getElementById('notifications');
const notificationDiv = document.createElement('div');
notificationDiv.classList.add('notification-div');
notificationDiv.id = 'notification';
const notificationText = document.createElement('h2');
notificationText.id = 'notification-text';
notificationText.innerText = message;
notificationDiv.appendChild(notificationText);
notificationWrapper.appendChild(notificationDiv);
notificationDiv.style.animation = 'none';
notificationDiv.style.display = 'none';
notificationDiv.style.display = 'flex';
notificationDiv.style.animation = 'hoverup 1s';
setTimeout(() => {
notificationDiv.style.animation = 'hoverdown 1s';
}, 4000);
setTimeout(() => {
notificationDiv.remove();
}, 4900);
}
</script> </script>
<style> <style>
body{ body {
font-family: "Noto Sans Mono", "Consolas", "SF Mono", monospace; font-family: "Noto Sans Mono", "Consolas", "SF Mono", monospace;
font-weight: bold; font-weight: bold;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
background-color: #0d0d0d; background-color: #0d0d0d;
} }
.container-wrapper{
display: flex; .container-wrapper {
flex-direction: column; display: flex;
justify-content: center; flex-direction: column;
align-items: center; justify-content: center;
width: 100%; align-items: center;
height: 98.7vh; width: 100%;
} height: 98.7vh;
.dash-container { }
display: flex;
padding: 20px; .dash-container {
background-color: #181818; display: flex;
color: white; padding: 20px;
border-radius: 5px; background-color: #181818;
width: 80%; color: white;
max-height: 80vh; border-radius: 5px;
height: 50%; width: 80%;
border: #222222 2px solid; max-height: 80vh;
} height: 50%;
.idek-wrapper{ border: #222222 2px solid;
display: flex; }
flex-direction: row;
width: 100%; .idek-wrapper {
height: 100%; display: flex;
} flex-direction: row;
.account-info{ width: 100%;
display: flex; height: 100%;
flex-direction: column; }
background-color: #222222;
width: 48%; .account-info {
height: calc(100% - 40px); display: flex;
padding: 20px; flex-direction: column;
margin-right: 5px; background-color: #222222;
border-radius: 5px; width: 48%;
overflow-x: hidden; height: calc(100% - 40px);
overflow-y: auto; padding: 20px;
} margin-right: 5px;
.pastes-wrapper{ border-radius: 5px;
display: flex; overflow-x: hidden;
flex-direction: column; overflow-y: auto;
align-items: center; }
width: 48%;
height: calc(100% - 40px); .pastes-wrapper {
margin-left: 5px; display: flex;
border-radius: 5px; flex-direction: column;
padding: 20px; align-items: center;
overflow-x: hidden; width: 48%;
overflow-y: auto; height: calc(100% - 40px);
background-color: #222222; margin-left: 5px;
max-height: 70vh; border-radius: 5px;
} padding: 20px;
.wrapper{ overflow-x: hidden;
display: flex; overflow-y: auto;
flex-direction: column; background-color: #222222;
width: 100%; max-height: 70vh;
} }
.list-a{
transition: background-color 300ms; .wrapper {
text-decoration: none; display: flex;
color: white; flex-direction: column;
width: 100%; width: 100%;
display: flex; }
justify-content: center;
align-items: center; .list-a {
padding: 10px; transition: background-color 300ms;
border-radius: 5px; text-decoration: none;
background-color: #2a2a2a; color: white;
margin-top: 5px; width: 100%;
margin-bottom: 5px; display: flex;
border: #3a3a3a00 2px solid; justify-content: center;
} align-items: center;
.list-a:hover{ padding: 10px;
transition: background-color 300ms; border-radius: 5px;
background-color: #333333; background-color: #2a2a2a;
border: #3a3a3a 2px solid; margin-top: 5px;
} margin-bottom: 5px;
.list-item{ border: #3a3a3a00 2px solid;
list-style: none; }
}
.nav-div{ .list-a:hover {
top: 0; transition: background-color 300ms;
margin-top: 10px; background-color: #333333;
position: absolute; border: #3a3a3a 2px solid;
display: flex; }
flex-direction: row;
justify-content: center; .list-item {
align-items: center; list-style: none;
width: fit-content; }
background-color: #181818;
padding-left: 10px; .nav-div {
padding-right: 10px; top: 0;
color: white; margin-top: 10px;
border-radius: 5px; position: absolute;
height: fit-content; display: flex;
overflow-y: auto; flex-direction: row;
border: #222222 2px solid; justify-content: center;
} align-items: center;
.nav-div a{ width: fit-content;
text-decoration: none; background-color: #181818;
color: white; padding-left: 10px;
padding: 10px; padding-right: 10px;
margin: 10px; color: white;
border-radius: 5px; border-radius: 5px;
background-color: #222222; height: fit-content;
transition: 300ms; overflow-y: auto;
border: #2a2a2a00 2px solid; border: #222222 2px solid;
} }
.nav-div a:hover{
transition: 300ms; .nav-hamburger-menu {
background-color: #333333; top: 0;
border: #3a3a3a 2px solid; position: absolute;
} display: none;
flex-direction: column;
justify-content: center;
align-items: center;
width: 99vw;
overflow-x: hidden;
background-color: #181818;
color: white;
height: fit-content;
overflow-y: auto;
border: #222222 2px solid;
}
.nav-buttons {
display: none;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
}
.nav-buttons a {
text-decoration: none;
color: white;
padding: 10px;
margin: 2px;
border-radius: 5px;
background-color: #222222;
transition: 300ms;
border: #2a2a2a00 2px solid;
width: 100%;
text-align: center;
font-size: 1.4rem;
}
.nav-buttons a:hover {
transition: 300ms;
background-color: #333333;
border: #3a3a3a 2px solid;
}
.nav-div a {
text-decoration: none;
color: white;
padding: 10px;
margin: 10px;
border-radius: 5px;
background-color: #222222;
transition: 300ms;
border: #2a2a2a00 2px solid;
}
.nav-div a:hover {
transition: 300ms;
background-color: #333333;
border: #3a3a3a 2px solid;
}
@media screen and (max-width: 800px) {
.nav-div {
display: none;
}
.nav-hamburger-menu {
display: flex;
}
.nav-buttons {
display: none;
}
.nav-buttons a {
display: block;
}
.dash-container{
height: 80%;
margin-top: 6rem;
}
.container-wrapper {
height: 90%;
}.wrapper {
height: 70%;
max-height: 70%;
}
.idek-wrapper {
flex-direction: column;
}
.accounts{
max-height: 20%;
}
.account-info {
width: 90%;
margin: 0;
}
.pastes-wrapper {
width: 90%;
margin: 0;
margin-top: 20px;
}
.list-container {
max-height: 100%;
overflow-y: scroll;
display: flex;
flex-direction: column;
width: 100%;
align-items: center;
}
}
</style> </style>
</html> </html>
+132 -33
View File
@@ -13,6 +13,19 @@
<a href="/archive">archive</a> <a href="/archive">archive</a>
{html} {html}
</div> </div>
<div class="nav-hamburger-menu">
<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" fill="currentColor" class="bi bi-list"
viewBox="0 0 16 16" id="hamburger-button" style="cursor: pointer;">
<path fill-rule="evenodd"
d="M2.5 12a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5" />
</svg>
<div class="nav-buttons">
<a href="/">home</a>
<a href="/pastes">recent pastes</a>
<a href="/archive">archive</a>
{html}
</div>
</div>
<div class="container-wrapper"> <div class="container-wrapper">
<div class="error-container"> <div class="error-container">
<h1>Error {code}</h1> <h1>Error {code}</h1>
@@ -21,6 +34,28 @@
</div> </div>
</div> </div>
</body> </body>
<script>
document.addEventListener("DOMContentLoaded", function () {
var mobile = window.mobileCheck();
if (mobile) {
document.querySelector('.nav-div').style.display = 'none';
document.querySelector('.nav-hamburger-menu').style.display = 'flex';
}
});
document.getElementById("hamburger-button").addEventListener("click", function () {
const nav = document.querySelector('.nav-buttons');
if (nav.style.display == 'none' || nav.style.display == '') {
nav.style.display = 'flex';
} else {
nav.style.display = 'none';
}
});
window.mobileCheck = function () {
let check = false;
(function (a) { if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true; })(navigator.userAgent || navigator.vendor || window.opera);
return check;
};
</script>
<style> <style>
body{ body{
font-family: "Noto Sans Mono", "Consolas", "SF Mono", monospace; font-family: "Noto Sans Mono", "Consolas", "SF Mono", monospace;
@@ -73,38 +108,102 @@ body{
background-color: #333333; background-color: #333333;
border: 2px solid #3a3a3a; border: 2px solid #3a3a3a;
} }
.nav-div{ .nav-div {
top: 0; top: 0;
margin-top: 10px; margin-top: 10px;
position: absolute; position: absolute;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
width: fit-content; width: fit-content;
background-color: #181818; background-color: #181818;
padding-left: 10px; padding-left: 10px;
padding-right: 10px; padding-right: 10px;
color: white; color: white;
border-radius: 5px; border-radius: 5px;
height: fit-content; height: fit-content;
overflow-y: auto; overflow-y: auto;
border: #222222 2px solid; border: #222222 2px solid;
} }
.nav-div a{
text-decoration: none; .nav-hamburger-menu {
color: white; top: 0;
padding: 10px; position: absolute;
margin: 10px; display: none;
border-radius: 5px; flex-direction: column;
background-color: #222222; justify-content: center;
transition: 300ms; align-items: center;
border: #2a2a2a00 2px solid; width: 99vw;
} overflow-x: hidden;
.nav-div a:hover{ background-color: #181818;
transition: 300ms; color: white;
background-color: #333333; height: fit-content;
border: #3a3a3a 2px solid; overflow-y: auto;
} border: #222222 2px solid;
}
.nav-buttons {
display: none;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
}
.nav-buttons a {
text-decoration: none;
color: white;
padding: 10px;
margin: 2px;
border-radius: 5px;
background-color: #222222;
transition: 300ms;
border: #2a2a2a00 2px solid;
width: 100%;
text-align: center;
font-size: 1.4rem;
}
.nav-buttons a:hover {
transition: 300ms;
background-color: #333333;
border: #3a3a3a 2px solid;
}
.nav-div a {
text-decoration: none;
color: white;
padding: 10px;
margin: 10px;
border-radius: 5px;
background-color: #222222;
transition: 300ms;
border: #2a2a2a00 2px solid;
}
.nav-div a:hover {
transition: 300ms;
background-color: #333333;
border: #3a3a3a 2px solid;
}
@media screen and (max-width: 800px) {
.nav-div {
display: none;
}
.nav-hamburger-menu {
display: flex;
}
.nav-buttons {
display: none;
}
.nav-buttons a {
display: block;
}
}
</style> </style>
</html> </html>
+103
View File
@@ -26,14 +26,23 @@
<h3 id="error-message"></h3> <h3 id="error-message"></h3>
</div> </div>
</div> </div>
<div class="notifcations-wrapper" id="notifications">
</div>
</body> </body>
<script> <script>
let isLoggingIn = false;
document.getElementById("loginForm").addEventListener("submit", function (event) { document.getElementById("loginForm").addEventListener("submit", function (event) {
event.preventDefault(); event.preventDefault();
var usernameContent = document.getElementById("usernameInput").value; var usernameContent = document.getElementById("usernameInput").value;
var passwordContent = document.getElementById("passwordInput").value; var passwordContent = document.getElementById("passwordInput").value;
if (isLoggingIn) {
createNotification("Please wait for the login to finish.");
return;
}
isLoggingIn = true;
console.log(isLoggingIn);
var requestUrl = "/api/accounts/login"; var requestUrl = "/api/accounts/login";
fetch(requestUrl, { fetch(requestUrl, {
method: "POST", method: "POST",
@@ -45,11 +54,14 @@
password: passwordContent password: passwordContent
}) })
}) })
.then(response => response.json()) .then(response => response.json())
.then(obj => { .then(obj => {
const result = JSON.parse(obj); const result = JSON.parse(obj);
isLoggingIn = true;
if (result.message != null) { if (result.message != null) {
window.location.href = "/"; window.location.href = "/";
isLoggingIn = false;
} }
else if (result.error != null) { else if (result.error != null) {
const errorElement = document.getElementById("error-message"); const errorElement = document.getElementById("error-message");
@@ -59,9 +71,36 @@
setTimeout(() => { setTimeout(() => {
errorElement.style.opacity = 0; errorElement.style.opacity = 0;
}, 3000); }, 3000);
isLoggingIn = false;
} }
}) })
}); });
function createNotification(message) {
const notificationWrapper = document.getElementById('notifications');
const notificationDiv = document.createElement('div');
notificationDiv.classList.add('notification-div');
notificationDiv.id = 'notification';
const notificationText = document.createElement('h2');
notificationText.id = 'notification-text';
notificationText.innerText = message;
notificationDiv.appendChild(notificationText);
notificationWrapper.appendChild(notificationDiv);
notificationDiv.style.animation = 'none';
notificationDiv.style.display = 'none';
notificationDiv.style.display = 'flex';
notificationDiv.style.animation = 'hoverup 1s';
setTimeout(() => {
notificationDiv.style.animation = 'hoverdown 1s';
}, 4000);
setTimeout(() => {
notificationDiv.remove();
}, 4900);
}
</script> </script>
<style> <style>
@@ -215,5 +254,69 @@ body{
background-color: #333333; background-color: #333333;
border: #3a3a3a 2px solid; border: #3a3a3a 2px solid;
} }
@keyframes hoverup {
0% {
opacity: 0;
transform: translateY(100%);
}
25% {
opacity: 1;
}
50% {
transform: translateY(-10px);
}
100% {
opacity: 1;
transform: translateY(0);
}
}
@keyframes hoverdown {
0% {
transform: translateY(0);
}
50% {
transform: translateY(-10px);
}
100% {
transform: translateY(200%);
}
}
.notification-div {
display: flex;
right: 0;
bottom: 0;
width: fit-content;
height: fit-content;
color: white;
background-color: #181818;
border-radius: 5px;
border: #222222 2px solid;
padding-left: 10px;
padding-right: 10px;
margin-right: 10px;
margin-bottom: 10px;
justify-content: center;
align-items: center;
}
.notifcations-wrapper {
display: flex;
flex-direction: column;
align-items: flex-end;
justify-content: flex-end;
width: 100%;
height: 100%;
position: absolute;
pointer-events: none;
}
</style> </style>
</html> </html>
+112 -17
View File
@@ -14,6 +14,19 @@
<a href="/archive">archive</a> <a href="/archive">archive</a>
{html} {html}
</div> </div>
<div class="nav-hamburger-menu">
<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" fill="currentColor" class="bi bi-list"
viewBox="0 0 16 16" id="hamburger-button" style="cursor: pointer;">
<path fill-rule="evenodd"
d="M2.5 12a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5" />
</svg>
<div class="nav-buttons">
<a href="/">home</a>
<a href="/pastes">recent pastes</a>
<a href="/archive">archive</a>
{html}
</div>
</div>
<div class="container-wrapper"> <div class="container-wrapper">
<div class="paste-container"> <div class="paste-container">
<h1 id="paste-title" title="{pastetitleattribute}">{pastetitle}</h1> <h1 id="paste-title" title="{pastetitleattribute}">{pastetitle}</h1>
@@ -38,33 +51,51 @@
return date.toLocaleString(); return date.toLocaleString();
} }
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function () {
const creationdateElement = document.getElementById('creationdate'); const creationdateElement = document.getElementById('creationdate');
const creationdateText = creationdateElement.innerText.trim(); const creationdateText = creationdateElement.innerText.trim();
const textElement = document.getElementById('text'); const textElement = document.getElementById('text');
creationdateElement.innerText = localizeDateTime(parseInt(creationdateText)); creationdateElement.innerText = localizeDateTime(parseInt(creationdateText));
textElement.innerText = "Loading..."; textElement.innerText = "Loading...";
fetch(`/raw/{pasteid}`) fetch(`/raw/{pasteid}`)
.then(response => response.body) .then(response => response.body)
.then(stream => { .then(stream => {
const reader = stream.getReader(); const reader = stream.getReader();
let text = ''; let text = '';
const read = () => {
return reader.read().then(({ done, value }) => {
if (done) {
textElement.innerText = text;
return;
}
text += new TextDecoder().decode(value);
return read();
});
};
const read = () => {
return reader.read().then(({ done, value }) => {
if (done) {
textElement.innerText = text;
return;
}
text += new TextDecoder().decode(value);
return read(); return read();
});
};
return read();
}); });
var mobile = window.mobileCheck();
if (mobile) {
document.querySelector('.nav-div').style.display = 'none';
document.querySelector('.nav-hamburger-menu').style.display = 'flex';
}
}); });
document.getElementById("hamburger-button").addEventListener("click", function () {
const nav = document.querySelector('.nav-buttons');
if (nav.style.display == 'none' || nav.style.display == '') {
nav.style.display = 'flex';
} else {
nav.style.display = 'none';
}
});
window.mobileCheck = function () {
let check = false;
(function (a) { if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true; })(navigator.userAgent || navigator.vendor || window.opera);
return check;
};
document.getElementById("copy-button").addEventListener("click", function () { document.getElementById("copy-button").addEventListener("click", function () {
navigator.clipboard.writeText(document.querySelector(".paste-wrapper").innerText); navigator.clipboard.writeText(document.querySelector(".paste-wrapper").innerText);
@@ -78,14 +109,15 @@
element.click(); element.click();
document.body.removeChild(element); document.body.removeChild(element);
}); });
{deletescript} { deletescript }
</script> </script>
</html> </html>
<style> <style>
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100..900&display=swap'); @import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100..900&display=swap');
body { body {
font-family: "Noto Sans Mono", "Consolas", "SF Mono", monospace; font-family: "Noto Sans Mono", "Consolas", "SF Mono", monospace;
font-weight: bold; font-weight: bold;
@@ -203,6 +235,50 @@
border: #222222 2px solid; border: #222222 2px solid;
} }
.nav-hamburger-menu {
top: 0;
position: absolute;
display: none;
flex-direction: column;
justify-content: center;
align-items: center;
width: 99vw;
overflow-x: hidden;
background-color: #181818;
color: white;
height: fit-content;
overflow-y: auto;
border: #222222 2px solid;
}
.nav-buttons {
display: none;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
}
.nav-buttons a {
text-decoration: none;
color: white;
padding: 10px;
margin: 2px;
border-radius: 5px;
background-color: #222222;
transition: 300ms;
border: #2a2a2a00 2px solid;
width: 100%;
text-align: center;
font-size: 1.4rem;
}
.nav-buttons a:hover {
transition: 300ms;
background-color: #333333;
border: #3a3a3a 2px solid;
}
.nav-div a { .nav-div a {
text-decoration: none; text-decoration: none;
color: white; color: white;
@@ -219,4 +295,23 @@
background-color: #333333; background-color: #333333;
border: #3a3a3a 2px solid; border: #3a3a3a 2px solid;
} }
@media screen and (max-width: 800px) {
.nav-div {
display: none;
}
.nav-hamburger-menu {
display: flex;
}
.nav-buttons {
display: none;
}
.nav-buttons a {
display: block;
}
}
</style> </style>
+93 -2
View File
@@ -14,6 +14,18 @@
<a href="/archive">archive</a> <a href="/archive">archive</a>
{html} {html}
</div> </div>
<div class="nav-hamburger-menu">
<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" fill="currentColor" class="bi bi-list" viewBox="0 0 16 16" id="hamburger-button" style="cursor: pointer;">
<path fill-rule="evenodd"
d="M2.5 12a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5" />
</svg>
<div class="nav-buttons">
<a href="/">home</a>
<a href="/pastes">recent pastes</a>
<a href="/archive">archive</a>
{html}
</div>
</div>
<div class="container-wrapper"> <div class="container-wrapper">
<div class="paste-container"> <div class="paste-container">
<h1 id="paste-title" title="{pastetitleattribute}">{pastetitle}</h1> <h1 id="paste-title" title="{pastetitleattribute}">{pastetitle}</h1>
@@ -79,8 +91,25 @@
const creationdateText = creationdateElement.innerText.trim(); const creationdateText = creationdateElement.innerText.trim();
creationdateElement.innerText = localizeDateTime(parseInt(creationdateText)); creationdateElement.innerText = localizeDateTime(parseInt(creationdateText));
var mobile = window.mobileCheck();
if (mobile) {
document.querySelector('.nav-div').style.display = 'none';
document.querySelector('.nav-hamburger-menu').style.display = 'flex';
}
}); });
document.getElementById("hamburger-button").addEventListener("click", function () {
const nav = document.querySelector('.nav-buttons');
if (nav.style.display == 'none' || nav.style.display == '') {
nav.style.display = 'flex';
} else {
nav.style.display = 'none';
}
});
window.mobileCheck = function () {
let check = false;
(function (a) { if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true; })(navigator.userAgent || navigator.vendor || window.opera);
return check;
};
document.getElementById("copy-button").addEventListener("click", function () { document.getElementById("copy-button").addEventListener("click", function () {
navigator.clipboard.writeText(document.querySelector(".paste-wrapper").innerText); navigator.clipboard.writeText(document.querySelector(".paste-wrapper").innerText);
}); });
@@ -274,6 +303,7 @@
text-decoration: underline; text-decoration: underline;
} }
.nav-div { .nav-div {
top: 0; top: 0;
margin-top: 10px; margin-top: 10px;
@@ -291,7 +321,50 @@
height: fit-content; height: fit-content;
overflow-y: auto; overflow-y: auto;
border: #222222 2px solid; border: #222222 2px solid;
z-index: 102; }
.nav-hamburger-menu {
top: 0;
position: absolute;
display: none;
flex-direction: column;
justify-content: center;
align-items: center;
width: 99vw;
overflow-x: hidden;
background-color: #181818;
color: white;
height: fit-content;
overflow-y: auto;
border: #222222 2px solid;
}
.nav-buttons {
display: none;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
}
.nav-buttons a {
text-decoration: none;
color: white;
padding: 10px;
margin: 2px;
border-radius: 5px;
background-color: #222222;
transition: 300ms;
border: #2a2a2a00 2px solid;
width: 100%;
text-align: center;
font-size: 1.4rem;
}
.nav-buttons a:hover {
transition: 300ms;
background-color: #333333;
border: #3a3a3a 2px solid;
} }
.nav-div a { .nav-div a {
@@ -310,6 +383,24 @@
background-color: #333333; background-color: #333333;
border: #3a3a3a 2px solid; border: #3a3a3a 2px solid;
} }
@media screen and (max-width: 800px) {
.nav-div {
display: none;
}
.nav-hamburger-menu {
display: flex;
}
.nav-buttons {
display: none;
}
.nav-buttons a {
display: block;
}
}
@keyframes hoverup { @keyframes hoverup {
0% { 0% {
opacity: 0; opacity: 0;
+243 -130
View File
@@ -1,11 +1,13 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100..900&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100..900&display=swap" rel="stylesheet">
<title>recent pastes</title> <title>recent pastes</title>
</head> </head>
<body> <body>
<div class="nav-div"> <div class="nav-div">
<a href="/">home</a> <a href="/">home</a>
@@ -13,7 +15,20 @@
<a href="/archive">archive</a> <a href="/archive">archive</a>
{html} {html}
</div> </div>
<div class="container-wrapper"> <div class="nav-hamburger-menu">
<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" fill="currentColor" class="bi bi-list"
viewBox="0 0 16 16" id="hamburger-button" style="cursor: pointer;">
<path fill-rule="evenodd"
d="M2.5 12a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5" />
</svg>
<div class="nav-buttons">
<a href="/">home</a>
<a href="/pastes">recent pastes</a>
<a href="/archive">archive</a>
{html}
</div>
</div>
<div class="container-wrapper">
<div class="pastes-container"> <div class="pastes-container">
<h1>recent pastes</h1> <h1>recent pastes</h1>
<div class="pastes-wrapper"> <div class="pastes-wrapper">
@@ -26,135 +41,233 @@
</div> </div>
</div> </div>
</body> </body>
<script>
document.addEventListener("DOMContentLoaded", function () {
var mobile = window.mobileCheck();
if (mobile) {
document.querySelector('.nav-div').style.display = 'none';
document.querySelector('.nav-hamburger-menu').style.display = 'flex';
}
});
document.getElementById("hamburger-button").addEventListener("click", function () {
const nav = document.querySelector('.nav-buttons');
if (nav.style.display == 'none' || nav.style.display == '') {
nav.style.display = 'flex';
} else {
nav.style.display = 'none';
}
});
window.mobileCheck = function () {
let check = false;
(function (a) { if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true; })(navigator.userAgent || navigator.vendor || window.opera);
return check;
};
</script>
<style> <style>
body{ body {
font-family: "Noto Sans Mono", "Consolas", "SF Mono", monospace; font-family: "Noto Sans Mono", "Consolas", "SF Mono", monospace;
font-weight: bold; font-weight: bold;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
background-color: #0d0d0d; background-color: #0d0d0d;
overflow-y: hidden; overflow-y: hidden;
} }
.container-wrapper{
display: flex; .container-wrapper {
flex-direction: column; display: flex;
justify-content: center; flex-direction: column;
align-items: center; justify-content: center;
width: 100%; align-items: center;
height: 98.7vh; width: 100%;
} height: 98.7vh;
.pastes-container{ }
display: flex;
flex-direction: column; .pastes-container {
align-items: center; display: flex;
width: 80%; flex-direction: column;
padding: 20px; align-items: center;
background-color: #181818; width: 80%;
color: white; padding: 20px;
border-radius: 5px; background-color: #181818;
height: fit-content; color: white;
max-height: 80vh; border-radius: 5px;
min-height: 20%; height: fit-content;
border: #222222 2px solid; max-height: 80vh;
} min-height: 20%;
.pastes-wrapper{ border: #222222 2px solid;
display: flex; }
flex-direction: column;
align-items: center; .pastes-wrapper {
width: 95%; display: flex;
padding: 20px; flex-direction: column;
overflow-x: hidden; align-items: center;
overflow-y: auto; width: 95%;
max-height: 70vh; padding: 20px;
} overflow-x: hidden;
.pastes-wrapper a{ overflow-y: auto;
text-decoration: none; max-height: 70vh;
color: white; }
width: 100%;
display: flex; .pastes-wrapper a {
justify-content: center; text-decoration: none;
align-items: center; color: white;
} width: 100%;
li{ display: flex;
transition: 300ms; justify-content: center;
list-style: none; align-items: center;
padding: 10px; }
margin: 10px;
background-color: #222222; li {
border-radius: 5px; transition: 300ms;
width: 90%; list-style: none;
text-align: center; padding: 10px;
cursor: pointer; margin: 10px;
border: #22222200 2px solid; background-color: #222222;
} border-radius: 5px;
li:hover{ width: 90%;
transition: 300ms; text-align: center;
background-color: #333333; cursor: pointer;
border: #3a3a3a 2px solid; border: #22222200 2px solid;
} }
.buttons-wrapper{
display: flex; li:hover {
flex-direction: row; transition: 300ms;
justify-content: center; background-color: #333333;
align-items: center; border: #3a3a3a 2px solid;
width: 100%; }
padding: 20px;
} .buttons-wrapper {
.buttons-wrapper a{ display: flex;
transition: 300ms; flex-direction: row;
text-decoration: none; justify-content: center;
color: white; align-items: center;
width: fit-content; width: 100%;
margin-left: 10px; padding: 20px;
margin-right: 10px; }
min-width: 20%;
display: flex; .buttons-wrapper a {
justify-content: center; transition: 300ms;
align-items: center; text-decoration: none;
background-color: #222222; color: white;
border-radius: 5px; width: fit-content;
padding: 10px; margin-left: 10px;
border: #22222200 2px solid; margin-right: 10px;
} min-width: 20%;
.buttons-wrapper a:hover{ display: flex;
transition: 300ms; justify-content: center;
background-color: #333333; align-items: center;
border: 2px solid #3a3a3a; background-color: #222222;
} border-radius: 5px;
.nav-div{ padding: 10px;
top: 0; border: #22222200 2px solid;
margin-top: 10px; }
position: absolute;
display: flex; .buttons-wrapper a:hover {
flex-direction: row; transition: 300ms;
justify-content: center; background-color: #333333;
align-items: center; border: 2px solid #3a3a3a;
width: fit-content; }
background-color: #181818;
padding-left: 10px; .nav-div {
padding-right: 10px; top: 0;
color: white; margin-top: 10px;
border-radius: 5px; position: absolute;
height: fit-content; display: flex;
overflow-y: auto; flex-direction: row;
border: #222222 2px solid; justify-content: center;
} align-items: center;
.nav-div a{ width: fit-content;
text-decoration: none; background-color: #181818;
color: white; padding-left: 10px;
padding: 10px; padding-right: 10px;
margin: 10px; color: white;
border-radius: 5px; border-radius: 5px;
background-color: #222222; height: fit-content;
transition: 300ms; overflow-y: auto;
border: #2a2a2a00 2px solid; border: #222222 2px solid;
} }
.nav-div a:hover{
transition: 300ms; .nav-hamburger-menu {
background-color: #333333; top: 0;
border: #3a3a3a 2px solid; position: absolute;
} display: none;
flex-direction: column;
justify-content: center;
align-items: center;
width: 99vw;
overflow-x: hidden;
background-color: #181818;
color: white;
height: fit-content;
overflow-y: auto;
border: #222222 2px solid;
}
.nav-buttons {
display: none;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
}
.nav-buttons a {
text-decoration: none;
color: white;
padding: 10px;
margin: 2px;
border-radius: 5px;
background-color: #222222;
transition: 300ms;
border: #2a2a2a00 2px solid;
width: 100%;
text-align: center;
font-size: 1.4rem;
}
.nav-buttons a:hover {
transition: 300ms;
background-color: #333333;
border: #3a3a3a 2px solid;
}
.nav-div a {
text-decoration: none;
color: white;
padding: 10px;
margin: 10px;
border-radius: 5px;
background-color: #222222;
transition: 300ms;
border: #2a2a2a00 2px solid;
}
.nav-div a:hover {
transition: 300ms;
background-color: #333333;
border: #3a3a3a 2px solid;
}
@media screen and (max-width: 800px) {
.nav-div {
display: none;
}
.nav-hamburger-menu {
display: flex;
}
.nav-buttons {
display: none;
}
.nav-buttons a {
display: block;
}
}
</style> </style>
</html> </html>
+101
View File
@@ -30,14 +30,24 @@
<h3 id="error-message"></h3> <h3 id="error-message"></h3>
</div> </div>
</div> </div>
<div class="notifcations-wrapper" id="notifications">
</div>
</body> </body>
<script> <script>
let isLoggingIn = false;
document.getElementById("signupForm").addEventListener("submit", function (event) { document.getElementById("signupForm").addEventListener("submit", function (event) {
event.preventDefault(); event.preventDefault();
var usernameContent = document.getElementById("usernameInput").value; var usernameContent = document.getElementById("usernameInput").value;
var passwordContent = document.getElementById("passwordInput").value; var passwordContent = document.getElementById("passwordInput").value;
if (isLoggingIn) {
createNotification("Please wait for the login to finish.");
return;
}
isLoggingIn = true;
var requestUrl = "/api/accounts/create"; var requestUrl = "/api/accounts/create";
fetch(requestUrl, { fetch(requestUrl, {
method: "POST", method: "POST",
@@ -54,6 +64,7 @@
const result = JSON.parse(obj); const result = JSON.parse(obj);
if (result.message != null) { if (result.message != null) {
window.location.href = "/"; window.location.href = "/";
isLoggingIn = false;
} }
else if (result.error != null) { else if (result.error != null) {
const errorElement = document.getElementById("error-message"); const errorElement = document.getElementById("error-message");
@@ -63,6 +74,7 @@
setTimeout(() => { setTimeout(() => {
errorElement.style.opacity = 0; errorElement.style.opacity = 0;
}, 3000); }, 3000);
isLoggingIn = false;
} }
}) })
}); });
@@ -76,6 +88,32 @@
var characterCount = passwordContent.length; var characterCount = passwordContent.length;
document.getElementById("passcharacterCount").innerText = `${characterCount}/50`; document.getElementById("passcharacterCount").innerText = `${characterCount}/50`;
}); });
function createNotification(message) {
const notificationWrapper = document.getElementById('notifications');
const notificationDiv = document.createElement('div');
notificationDiv.classList.add('notification-div');
notificationDiv.id = 'notification';
const notificationText = document.createElement('h2');
notificationText.id = 'notification-text';
notificationText.innerText = message;
notificationDiv.appendChild(notificationText);
notificationWrapper.appendChild(notificationDiv);
notificationDiv.style.animation = 'none';
notificationDiv.style.display = 'none';
notificationDiv.style.display = 'flex';
notificationDiv.style.animation = 'hoverup 1s';
setTimeout(() => {
notificationDiv.style.animation = 'hoverdown 1s';
}, 4000);
setTimeout(() => {
notificationDiv.remove();
}, 4900);
}
</script> </script>
<style> <style>
body { body {
@@ -255,6 +293,69 @@
#button-margin-top { #button-margin-top {
margin-top: 30px; margin-top: 30px;
} }
@keyframes hoverup {
0% {
opacity: 0;
transform: translateY(100%);
}
25% {
opacity: 1;
}
50% {
transform: translateY(-10px);
}
100% {
opacity: 1;
transform: translateY(0);
}
}
@keyframes hoverdown {
0% {
transform: translateY(0);
}
50% {
transform: translateY(-10px);
}
100% {
transform: translateY(200%);
}
}
.notification-div {
display: flex;
right: 0;
bottom: 0;
width: fit-content;
height: fit-content;
color: white;
background-color: #181818;
border-radius: 5px;
border: #222222 2px solid;
padding-left: 10px;
padding-right: 10px;
margin-right: 10px;
margin-bottom: 10px;
justify-content: center;
align-items: center;
}
.notifcations-wrapper {
display: flex;
flex-direction: column;
align-items: flex-end;
justify-content: flex-end;
width: 100%;
height: 100%;
position: absolute;
pointer-events: none;
}
</style> </style>
</html> </html>
+146 -3
View File
@@ -15,6 +15,18 @@
<a href="/archive">archive</a> <a href="/archive">archive</a>
{html} {html}
</div> </div>
<div class="nav-hamburger-menu">
<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" fill="currentColor" class="bi bi-list" viewBox="0 0 16 16" id="hamburger-button" style="cursor: pointer;">
<path fill-rule="evenodd"
d="M2.5 12a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5" />
</svg>
<div class="nav-buttons">
<a href="/">home</a>
<a href="/pastes">recent pastes</a>
<a href="/archive">archive</a>
{html}
</div>
</div>
<div class="container-wrapper"> <div class="container-wrapper">
<div class="account-container"> <div class="account-container">
<div class="account-info"> <div class="account-info">
@@ -50,7 +62,25 @@
const creationdateText = creationdateElement.innerText.trim(); const creationdateText = creationdateElement.innerText.trim();
creationdateElement.innerText = "Creation Date: " + localizeDateTime(parseInt(creationdateText)); creationdateElement.innerText = "Creation Date: " + localizeDateTime(parseInt(creationdateText));
var mobile = window.mobileCheck();
if (mobile) {
document.querySelector('.nav-div').style.display = 'none';
document.querySelector('.nav-hamburger-menu').style.display = 'flex';
}
}); });
document.getElementById("hamburger-button").addEventListener("click", function () {
const nav = document.querySelector('.nav-buttons');
if (nav.style.display == 'none' || nav.style.display == '') {
nav.style.display = 'flex';
} else {
nav.style.display = 'none';
}
});
window.mobileCheck = function () {
let check = false;
(function (a) { if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true; })(navigator.userAgent || navigator.vendor || window.opera);
return check;
};
</script> </script>
<style> <style>
body { body {
@@ -61,6 +91,7 @@
justify-content: center; justify-content: center;
align-items: center; align-items: center;
background-color: #0d0d0d; background-color: #0d0d0d;
height: calc(100vh - 20px);
} }
.container-wrapper { .container-wrapper {
@@ -69,7 +100,7 @@
justify-content: center; justify-content: center;
align-items: center; align-items: center;
width: 100%; width: 100%;
height: 98.7vh; height: 100%;
} }
.account-container { .account-container {
@@ -82,8 +113,7 @@
color: white; color: white;
border-radius: 5px; border-radius: 5px;
height: fit-content; height: fit-content;
max-height: 80vh; max-height: 100%;
overflow-y: auto;
border: #222222 2px solid; border: #222222 2px solid;
} }
@@ -97,6 +127,7 @@
width: 48%; width: 48%;
max-width: 48%; max-width: 48%;
margin-right: 10px; margin-right: 10px;
word-break: break-all;
} }
h3 { h3 {
@@ -184,6 +215,50 @@
border: #222222 2px solid; border: #222222 2px solid;
} }
.nav-hamburger-menu {
top: 0;
position: absolute;
display: none;
flex-direction: column;
justify-content: center;
align-items: center;
width: 99vw;
overflow-x: hidden;
background-color: #181818;
color: white;
height: fit-content;
overflow-y: auto;
border: #222222 2px solid;
}
.nav-buttons {
display: none;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
}
.nav-buttons a {
text-decoration: none;
color: white;
padding: 10px;
margin: 2px;
border-radius: 5px;
background-color: #222222;
transition: 300ms;
border: #2a2a2a00 2px solid;
width: 100%;
text-align: center;
font-size: 1.4rem;
}
.nav-buttons a:hover {
transition: 300ms;
background-color: #333333;
border: #3a3a3a 2px solid;
}
.nav-div a { .nav-div a {
text-decoration: none; text-decoration: none;
color: white; color: white;
@@ -200,6 +275,74 @@
background-color: #333333; background-color: #333333;
border: #3a3a3a 2px solid; border: #3a3a3a 2px solid;
} }
@media screen and (max-width: 800px) {
.nav-div {
display: none;
}
.nav-hamburger-menu {
display: flex;
}
.nav-buttons {
display: none;
}
.nav-buttons a {
display: block;
}
.container-wrapper{
margin-top: calc(90% - 180px);
padding-bottom: 50px;
height: 90%;
}
.account-container {
flex-direction: column;
align-items: center;
justify-content: center;
max-height: 100%;
}
.account-info {
margin-right: 0px;
width: 100%;
box-sizing: border-box;
max-width: 100%;
font-size: smaller !important;
}
.collumn-2 {
margin-top: 10px;
width: 100%;
max-width: 100%;
max-height: 48%;
}
.action-wrapper {
width: 100%;
max-width: 100%;
max-height: 40%;
}
.button {
width: 90%;
max-width: 100%;
margin: 0;
margin-top: 10px;
}
.pastes-wrapper {
margin-top: 10px;
width: 100%;
box-sizing: border-box;
height: 97%;
max-width: 100%;
max-height: calc(500px * 1.5 - 260px);
}
.pastes-container {
width: 100%;
max-width: 100%;
max-height: 90%;
overflow-x: hidden;
text-align: start;
}
}
</style> </style>
</html> </html>