forked from rDrama/rDrama
1
0
Fork 0
master
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() { xhr.onload = function() {
if (xhr.status==204) {} if (xhr.status==204) {}
else if (xhr.status >= 200 && xhr.status < 300) { else if (xhr.status >= 200 && xhr.status < 300) {
$('#toast-post-success').toast('dispose'); document.getElementById('toast-post-success').toast('dispose');
$('#toast-post-success').toast('show'); document.getElementById('toast-post-success').toast('show');
document.getElementById('toast-post-success-text').innerText = JSON.parse(xhr.response)["message"]; document.getElementById('toast-post-success-text').innerText = JSON.parse(xhr.response)["message"];
callback(xhr) callback(xhr)
return true return true
@ -22,8 +22,8 @@
} else { } else {
data=JSON.parse(xhr.response); data=JSON.parse(xhr.response);
$('#toast-post-error').toast('dispose'); document.getElementById('toast-post-error').toast('dispose');
$('#toast-post-error').toast('show'); document.getElementById('toast-post-error').toast('show');
document.getElementById('toast-post-error-text').innerText = data["error"]; document.getElementById('toast-post-error-text').innerText = data["error"];
return false return false

View File

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

View File

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

View File

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

View File

@ -98,7 +98,7 @@
// When GIF keyboard is hidden, hide all GIFs // 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; document.getElementById('gifSearch').value = null;

View File

@ -21,14 +21,14 @@
clipboard.on('success', function(e) { clipboard.on('success', function(e) {
jQuery(function($) { jQuery(function($) {
$('#toast-success').toast('show'); document.getElementById('toast-success').toast('show');
}) })
console.log(e); console.log(e);
}); });
clipboard.on('error', function(e) { clipboard.on('error', function(e) {
jQuery(function($) { jQuery(function($) {
$('#toast-error').toast('show'); document.getElementById('toast-error').toast('show');
}) })
console.log(e); 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"); var button = document.getElementById("reportPostButton");

View File

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

View File

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

View File

@ -177,7 +177,7 @@
<div class="body w-lg-100"> <div class="body w-lg-100">
<div class="custom-control custom-switch"> <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> <label class="custom-control-label" for="2faToggle"></label>
</div> </div>

View File

@ -12,7 +12,7 @@
//Signup js //Signup js
// Display username and password requirements on input // 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 charCount = document.getElementById("password-register").value;
var id = document.getElementById("passwordHelpRegister"); var id = document.getElementById("passwordHelpRegister");
@ -31,7 +31,7 @@
// Check username length, special chars // 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 charCount = document.getElementById("username-register").value;
var id = document.getElementById("usernameHelpRegister"); var id = document.getElementById("usernameHelpRegister");

View File

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

View File

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

View File

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