remotes/1693045480750635534/spooky-22
Aevann1 2021-09-26 11:06:17 +02:00
parent adcac95850
commit 8eac76d881
14 changed files with 77 additions and 77 deletions

View File

@ -11,8 +11,8 @@
xhr.onload = function() {
if (xhr.status==204) {}
else if (xhr.status >= 200 && xhr.status < 300) {
$('#toast-post-success').toast('dispose');
$('#toast-post-success').toast('show');
document.getElementById('toast-post-success').toast('dispose');
document.getElementById('toast-post-success').toast('show');
document.getElementById('toast-post-success-text').innerText = JSON.parse(xhr.response)["message"];
callback(xhr)
return true
@ -22,8 +22,8 @@
} else {
data=JSON.parse(xhr.response);
$('#toast-post-error').toast('dispose');
$('#toast-post-error').toast('show');
document.getElementById('toast-post-error').toast('dispose');
document.getElementById('toast-post-error').toast('show');
document.getElementById('toast-post-error-text').innerText = data["error"];
return false

View File

@ -14,8 +14,8 @@
xhr.withCredentials = true;
xhr.onload = function(){
$('#toast-post-success').toast('dispose');
$('#toast-post-success').toast('show');
document.getElementById('toast-post-success').toast('dispose');
document.getElementById('toast-post-success').toast('show');
document.getElementById('toast-post-success-text').innerHTML = `@${name} banned`;
}

View File

@ -20,8 +20,8 @@
xhr.onload = function() {
if (xhr.status >= 200 && xhr.status < 300) {
$('#toast-post-success').toast('dispose');
$('#toast-post-success').toast('show');
document.getElementById('toast-post-success').toast('dispose');
document.getElementById('toast-post-success').toast('show');
try {
document.getElementById('toast-post-success-text').innerText = JSON.parse(xhr.response)["message"];
} catch(e) {
@ -35,14 +35,14 @@
try {
data=JSON.parse(xhr.response);
$('#toast-post-error').toast('dispose');
$('#toast-post-error').toast('show');
document.getElementById('toast-post-error').toast('dispose');
document.getElementById('toast-post-error').toast('show');
document.getElementById('toast-post-error-text').innerText = data["error"];
return false
} catch(e) {
$('#toast-post-success').toast('dispose');
$('#toast-post-error').toast('dispose');
$('#toast-post-error').toast('show');
document.getElementById('toast-post-success').toast('dispose');
document.getElementById('toast-post-error').toast('dispose');
document.getElementById('toast-post-error').toast('show');
document.getElementById('toast-post-error-text').innerText = "Error. Try again later.";
return false
}
@ -87,7 +87,7 @@
};
$('#reportCommentModal').on('hidden.bs.modal', function () {
document.getElementById('reportCommentModal').on('hidden.bs.modal', function () {
var button = document.getElementById("reportCommentButton");
@ -200,15 +200,15 @@
if (xhr.status==200) {
commentForm=document.getElementById('comment-form-space-'+fullname);
commentForm.innerHTML=JSON.parse(xhr.response)["html"];
$('#toast-comment-success').toast('dispose');
$('#toast-comment-error').toast('dispose');
$('#toast-comment-success').toast('show');
document.getElementById('toast-comment-success').toast('dispose');
document.getElementById('toast-comment-error').toast('dispose');
document.getElementById('toast-comment-success').toast('show');
}
else {
var commentError = document.getElementById("comment-error-text");
$('#toast-comment-success').toast('dispose');
$('#toast-comment-error').toast('dispose');
$('#toast-comment-error').toast('show');
document.getElementById('toast-comment-success').toast('dispose');
document.getElementById('toast-comment-error').toast('dispose');
document.getElementById('toast-comment-error').toast('show');
commentError.textContent = JSON.parse(xhr.response)["error"];
}
}
@ -232,15 +232,15 @@
if (xhr.status==200) {
commentForm=document.getElementById('comment-form-space-'+id);
commentForm.innerHTML=JSON.parse(xhr.response)["html"];
$('#toast-comment-success').toast('dispose');
$('#toast-comment-error').toast('dispose');
$('#toast-comment-success').toast('show');
document.getElementById('toast-comment-success').toast('dispose');
document.getElementById('toast-comment-error').toast('dispose');
document.getElementById('toast-comment-success').toast('show');
}
else {
var commentError = document.getElementById("comment-error-text");
$('#toast-comment-success').toast('dispose');
$('#toast-comment-error').toast('dispose');
$('#toast-comment-error').toast('show');
document.getElementById('toast-comment-success').toast('dispose');
document.getElementById('toast-comment-error').toast('dispose');
document.getElementById('toast-comment-error').toast('show');
commentError.textContent = JSON.parse(xhr.response)["error"];
}
}
@ -268,14 +268,14 @@
commentForm=document.getElementById('comment-text-'+id);
commentForm.innerHTML=JSON.parse(xhr.response)["html"];
document.getElementById('cancel-edit-'+id).click()
$('#toast-comment-success').toast('dispose');
$('#toast-comment-error').toast('dispose');
$('#toast-comment-success').toast('show');
document.getElementById('toast-comment-success').toast('dispose');
document.getElementById('toast-comment-error').toast('dispose');
document.getElementById('toast-comment-success').toast('show');
}
else {
$('#toast-comment-success').toast('dispose');
$('#toast-comment-error').toast('dispose');
$('#toast-comment-error').toast('show');
document.getElementById('toast-comment-success').toast('dispose');
document.getElementById('toast-comment-error').toast('dispose');
document.getElementById('toast-comment-error').toast('show');
commentError.textContent = JSON.parse(xhr.response)["error"];
}
}
@ -385,9 +385,9 @@
}
else {
var commentError = document.getElementById("comment-error-text");
$('#toast-comment-success').toast('dispose');
$('#toast-comment-error').toast('dispose');
$('#toast-comment-error').toast('show');
document.getElementById('toast-comment-success').toast('dispose');
document.getElementById('toast-comment-error').toast('dispose');
document.getElementById('toast-comment-error').toast('show');
commentError.textContent = JSON.parse(xhr.response)["error"];
}
}
@ -396,8 +396,8 @@
document.getElementById(button1).classList.toggle("d-md-inline-block");
document.getElementById(button2).classList.toggle("d-md-inline-block");
$('#toast-post-success').toast('dispose');
$('#toast-post-success').toast('show');
document.getElementById('toast-post-success').toast('dispose');
document.getElementById('toast-post-success').toast('show');
if (distinguish=='yes') {
document.getElementById('toast-post-success-text').innerText = "Comment distinguished!";
}
@ -423,9 +423,9 @@
}
else {
var commentError = document.getElementById("comment-error-text");
$('#toast-comment-success').toast('dispose');
$('#toast-comment-error').toast('dispose');
$('#toast-comment-error').toast('show');
document.getElementById('toast-comment-success').toast('dispose');
document.getElementById('toast-comment-error').toast('dispose');
document.getElementById('toast-comment-error').toast('show');
commentError.textContent = JSON.parse(xhr.response)["error"];
}
}
@ -434,8 +434,8 @@
document.getElementById(button1).classList.toggle("d-none");
document.getElementById(button2).classList.toggle("d-none");
$('#toast-post-success').toast('dispose');
$('#toast-post-success').toast('show');
document.getElementById('toast-post-success').toast('dispose');
document.getElementById('toast-post-success').toast('show');
if (distinguish=='yes') {
document.getElementById('toast-post-success-text').innerText = "Comment distinguished!";
}
@ -468,14 +468,14 @@
clipboard.on('success', function(e) {
jQuery(function($) {
$('#toast-success').toast('show');
document.getElementById('toast-success').toast('show');
})
console.log(e);
});
clipboard.on('error', function(e) {
jQuery(function($) {
$('#toast-error').toast('show');
document.getElementById('toast-error').toast('show');
})
console.log(e);
});

View File

@ -199,7 +199,7 @@
id=$(this).data('id');
$('#post-text-'+id).toggleClass('d-none');
document.getElementById('post-text-'+id).toggleClass('d-none');
$('.text-expand-icon-'+id).toggleClass('fa-expand-alt');
$('.text-expand-icon-'+id).toggleClass('fa-compress-alt');
@ -214,11 +214,11 @@
if (!("standalone" in window.navigator && window.navigator.standalone)){
if (window.innerWidth <= 737){
try {
$('#mobile-prompt').tooltip('show')
document.getElementById('mobile-prompt').tooltip('show')
$('.tooltip')[0].addEventListener(
'click',
function(event){
$('#mobile-prompt').tooltip('hide')
document.getElementById('mobile-prompt').tooltip('hide')
var xhr = new XMLHttpRequest();
xhr.withCredentials=true;
xhr.open("POST", '/dismiss_mobile_tip', true);

View File

@ -98,7 +98,7 @@
// When GIF keyboard is hidden, hide all GIFs
$('#gifModal').on('hidden.bs.modal', function (e) {
document.getElementById('gifModal').on('hidden.bs.modal', function (e) {
document.getElementById('gifSearch').value = null;

View File

@ -21,14 +21,14 @@
clipboard.on('success', function(e) {
jQuery(function($) {
$('#toast-success').toast('show');
document.getElementById('toast-success').toast('show');
})
console.log(e);
});
clipboard.on('error', function(e) {
jQuery(function($) {
$('#toast-error').toast('show');
document.getElementById('toast-error').toast('show');
})
console.log(e);
});

View File

@ -31,7 +31,7 @@
}
};
$('#reportPostModal').on('hidden.bs.modal', function () {
document.getElementById('reportPostModal').on('hidden.bs.modal', function () {
var button = document.getElementById("reportPostButton");

View File

@ -21,14 +21,14 @@
clipboard.on('success', function(e) {
jQuery(function($) {
$('#toast-success').toast('show');
document.getElementById('toast-success').toast('show');
})
console.log(e);
});
clipboard.on('error', function(e) {
jQuery(function($) {
$('#toast-error').toast('show');
document.getElementById('toast-error').toast('show');
})
console.log(e);
});
@ -38,7 +38,7 @@
// Show confirm password field when user clicks email box
$('#new_email').on('input', function () {
document.getElementById('new_email').on('input', function () {
var id = document.getElementById("email-password");
var id2 = document.getElementById("email-password-label");
@ -52,7 +52,7 @@
// 2FA toggle modal
$('#2faModal').on('hidden.bs.modal', function () {
document.getElementById('2faModal').on('hidden.bs.modal', function () {
var box = document.getElementById("2faToggle");

View File

@ -148,8 +148,8 @@
window.location.reload(true);
}
else {
$('#toast-exile-error').toast('dispose');
$('#toast-exile-error').toast('show');
document.getElementById('toast-exile-error').toast('dispose');
document.getElementById('toast-exile-error').toast('show');
exileError.textContent = JSON.parse(xhr.response)["error"];
}
}

View File

@ -177,7 +177,7 @@
<div class="body w-lg-100">
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" id="2faToggle" name="2faToggle" onchange="$('#2faModal').modal('toggle')" {% if not mfa_secret %}checked=""{% endif %}>
<input type="checkbox" class="custom-control-input" id="2faToggle" name="2faToggle" onchange="document.getElementById('2faModal').modal('toggle')" {% if not mfa_secret %}checked=""{% endif %}>
<label class="custom-control-label" for="2faToggle"></label>
</div>

View File

@ -12,7 +12,7 @@
//Signup js
// Display username and password requirements on input
$('#password-register').on('input', function () {
document.getElementById('password-register').on('input', function () {
var charCount = document.getElementById("password-register").value;
var id = document.getElementById("passwordHelpRegister");
@ -31,7 +31,7 @@
// Check username length, special chars
$('#username-register').on('input', function () {
document.getElementById('username-register').on('input', function () {
var charCount = document.getElementById("username-register").value;
var id = document.getElementById("usernameHelpRegister");

View File

@ -6,14 +6,14 @@
clipboard.on('success', function(e) {
jQuery(function($) {
$('#toast-success').toast('show');
document.getElementById('toast-success').toast('show');
})
console.log(e);
});
clipboard.on('error', function(e) {
jQuery(function($) {
$('#toast-error').toast('show');
document.getElementById('toast-error').toast('show');
})
console.log(e);
});

View File

@ -11,7 +11,7 @@
<script>
$(document).ready(function() {
$('#submitform').submit(function() {
document.getElementById('submitform').submit(function() {
// disable button
$("#create_button").prop("disabled", true);
// add spinner to button
@ -436,23 +436,23 @@
if (filename.endsWith(".jpg") || filename.endsWith(".jpeg") || filename.endsWith(".png") || filename.endsWith(".webp"))
{
f.files = files;
$('#filename-show').text(filename);
$('#urlblock').addClass('d-none');
document.getElementById('filename-show').text(filename);
document.getElementById('urlblock').addClass('d-none');
var fileReader = new FileReader();
fileReader.readAsDataURL(f.files[0]);
fileReader.addEventListener("load", function () {$('#image-preview').attr('src', this.result);});
$('#file-upload').attr('required', false);
fileReader.addEventListener("load", function () {document.getElementById('image-preview').attr('src', this.result);});
document.getElementById('file-upload').attr('required', false);
checkForRequired();
}
}
$('#file-upload').on('change', function(e){
document.getElementById('file-upload').on('change', function(e){
f=document.getElementById('file-upload');
$('#urlblock').addClass('d-none');
$('#filename-show').text($('#file-upload')[0].files[0].name);
document.getElementById('urlblock').addClass('d-none');
document.getElementById('filename-show').text(document.getElementById('file-upload')[0].files[0].name);
var fileReader = new FileReader();
fileReader.readAsDataURL(f.files[0]);
fileReader.addEventListener("load", function () {$('#image-preview').attr('src', this.result);});
fileReader.addEventListener("load", function () {document.getElementById('image-preview').attr('src', this.result);});
checkForRequired();
})
</script>

View File

@ -62,9 +62,9 @@
let result = callback(xhr);
if (xhr.status >= 200 && xhr.status < 300) {
$('#toast-post-error').toast('dispose');
$('#toast-post-success').toast('dispose');
$('#toast-post-success').toast('show');
document.getElementById('toast-post-error').toast('dispose');
document.getElementById('toast-post-success').toast('dispose');
document.getElementById('toast-post-success').toast('show');
try {
if(typeof result == "string") {
@ -78,9 +78,9 @@
return true;
} else {
$('#toast-post-success').toast('dispose');
$('#toast-post-error').toast('dispose');
$('#toast-post-error').toast('show');
document.getElementById('toast-post-success').toast('dispose');
document.getElementById('toast-post-error').toast('dispose');
document.getElementById('toast-post-error').toast('show');
try {
if(typeof result == "string") {