forked from MarseyWorld/MarseyWorld
convert "var" to "let" and "const"
parent
30405e1841
commit
c0676e198c
|
@ -1,4 +1,4 @@
|
|||
declare var process: {
|
||||
declare const process: {
|
||||
env: Record<string, any>;
|
||||
};
|
||||
|
||||
|
|
|
@ -124,8 +124,8 @@ function bet_vote(t, oid) {
|
|||
for(let el of document.getElementsByClassName('cost')) {
|
||||
el.classList.add('d-none')
|
||||
}
|
||||
var scoretext = document.getElementById('option-' + oid);
|
||||
var score = Number(scoretext.textContent);
|
||||
const scoretext = document.getElementById('option-' + oid);
|
||||
const score = Number(scoretext.textContent);
|
||||
scoretext.textContent = score + 1;
|
||||
|
||||
document.getElementById("user-coins-amount").innerText = parseInt(document.getElementById("user-coins-amount").innerText) - 200;
|
||||
|
|
|
@ -250,7 +250,7 @@ function post_comment(fullname, hide){
|
|||
}
|
||||
|
||||
document.onpaste = function(event) {
|
||||
var focused = document.activeElement;
|
||||
const focused = document.activeElement;
|
||||
const files = structuredClone(event.clipboardData.files);
|
||||
|
||||
if (files.length > 4)
|
||||
|
@ -262,7 +262,7 @@ document.onpaste = function(event) {
|
|||
if (!files.length) return
|
||||
|
||||
if (focused.id.includes('reply-form-body-')) {
|
||||
var fullname = focused.dataset.fullname;
|
||||
const fullname = focused.dataset.fullname;
|
||||
f=document.getElementById('file-upload-reply-' + fullname);
|
||||
try {
|
||||
let filename = ''
|
||||
|
@ -275,7 +275,7 @@ document.onpaste = function(event) {
|
|||
catch(e) {}
|
||||
}
|
||||
else if (focused.id.includes('comment-edit-body-')) {
|
||||
var id = focused.dataset.id;
|
||||
const id = focused.dataset.id;
|
||||
f=document.getElementById('file-edit-reply-' + id);
|
||||
let filename = ''
|
||||
for (const file of files)
|
||||
|
@ -285,7 +285,7 @@ document.onpaste = function(event) {
|
|||
document.getElementById('filename-edit-reply-' + id).textContent = filename;
|
||||
}
|
||||
else if (focused.id.includes('post-edit-box-')) {
|
||||
var id = focused.dataset.id;
|
||||
const id = focused.dataset.id;
|
||||
f=document.getElementById('file-upload-edit-' + id);
|
||||
let filename = ''
|
||||
for (const file of files)
|
||||
|
|
|
@ -156,9 +156,9 @@ function autoExpand(field) {
|
|||
|
||||
field.style.height = 'inherit';
|
||||
|
||||
var computed = window.getComputedStyle(field);
|
||||
let computed = window.getComputedStyle(field);
|
||||
|
||||
var height = parseInt(computed.getPropertyValue('border-top-width'), 10)
|
||||
let height = parseInt(computed.getPropertyValue('border-top-width'), 10)
|
||||
+ parseInt(computed.getPropertyValue('padding-top'), 10)
|
||||
+ field.scrollHeight
|
||||
+ parseInt(computed.getPropertyValue('padding-bottom'), 10)
|
||||
|
@ -182,7 +182,7 @@ function smoothScrollTop()
|
|||
// Click navbar to scroll back to top
|
||||
const nav = document.getElementsByTagName('nav')
|
||||
|
||||
if (nav) {
|
||||
if (nav.length) {
|
||||
nav[0].addEventListener('click', (e) => {
|
||||
if (e.target.id === "navbar" ||
|
||||
e.target.classList.contains("container-fluid") ||
|
||||
|
@ -272,7 +272,7 @@ function bs_trigger(e) {
|
|||
}
|
||||
}
|
||||
|
||||
var bsTriggerOnReady = function() {
|
||||
let bsTriggerOnReady = function() {
|
||||
bs_trigger(document);
|
||||
}
|
||||
|
||||
|
@ -313,13 +313,13 @@ function showmore() {
|
|||
}
|
||||
|
||||
function formatDate(d) {
|
||||
var year = d.getFullYear();
|
||||
var monthAbbr = d.toLocaleDateString('en-us', {month: 'short'});
|
||||
var day = d.getDate();
|
||||
var hour = ("0" + d.getHours()).slice(-2);
|
||||
var minute = ("0" + d.getMinutes()).slice(-2);
|
||||
var second = ("0" + d.getSeconds()).slice(-2);
|
||||
var tzAbbr = d.toLocaleTimeString('en-us', {timeZoneName: 'short'}).split(' ')[2];
|
||||
let year = d.getFullYear();
|
||||
let monthAbbr = d.toLocaleDateString('en-us', {month: 'short'});
|
||||
let day = d.getDate();
|
||||
let hour = ("0" + d.getHours()).slice(-2);
|
||||
let minute = ("0" + d.getMinutes()).slice(-2);
|
||||
let second = ("0" + d.getSeconds()).slice(-2);
|
||||
let tzAbbr = d.toLocaleTimeString('en-us', {timeZoneName: 'short'}).split(' ')[2];
|
||||
|
||||
return (day + " " + monthAbbr + " " + year + " "
|
||||
+ hour + ":" + minute + ":" + second + " " + tzAbbr);
|
||||
|
@ -383,15 +383,12 @@ function sendFormXHR(e, extraActionsOnSuccess) {
|
|||
document.getElementById('toast-post-error-text').innerText = "Error, please try again later."
|
||||
try {
|
||||
let data=JSON.parse(xhr.response);
|
||||
var myToast = bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-error'));
|
||||
myToast.show();
|
||||
bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-error')).show();
|
||||
document.getElementById('toast-post-error-text').innerText = data["error"];
|
||||
if (data && data["details"]) document.getElementById('toast-post-error-text').innerText = data["details"];
|
||||
} catch(e) {
|
||||
var myToast = bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-success'));
|
||||
myToast.hide();
|
||||
var myToast = bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-error'));
|
||||
myToast.show();
|
||||
bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-success')).hide();
|
||||
bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-error')).show();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
const fireworks = document.getElementsByClassName("firework")
|
||||
var counter = 0
|
||||
let counter = 0
|
||||
|
||||
for (let firework of fireworks){
|
||||
var timeout = 2000 * counter
|
||||
const timeout = 2000 * counter
|
||||
counter++
|
||||
setTimeout(() => {
|
||||
setInterval(() => {
|
||||
firework.firstElementChild.src = "/i/firework-trail.webp"
|
||||
|
||||
var xpos = Math.floor(Math.random() * 80) + 5
|
||||
var ypos = 95
|
||||
const xpos = Math.floor(Math.random() * 80) + 5
|
||||
let ypos = 95
|
||||
firework.style.top=ypos+"%"
|
||||
firework.style.left=xpos+"%"
|
||||
|
||||
firework.style.display="inline-block"
|
||||
var hue = Math.floor(Math.random()*360)+1
|
||||
const hue = Math.floor(Math.random()*360)+1
|
||||
firework.style.filter="hue-rotate("+hue+"deg)"
|
||||
|
||||
var id = null
|
||||
var height = Math.floor(Math.random()*60)+15
|
||||
let id = null
|
||||
const height = Math.floor(Math.random()*60)+15
|
||||
clearInterval(id);
|
||||
id = setInterval(frame, 20);
|
||||
|
||||
var vnum = Math.floor(Math.random()*1000)
|
||||
const vnum = Math.floor(Math.random()*1000)
|
||||
|
||||
function frame() {
|
||||
if (ypos <= height) {
|
||||
|
|
|
@ -13,15 +13,15 @@ async function getGif(searchTerm) {
|
|||
document.getElementById('gifSearch').value = null;
|
||||
}
|
||||
|
||||
var loadGIFs = document.getElementById('gifs-load-more');
|
||||
const loadGIFs = document.getElementById('gifs-load-more');
|
||||
|
||||
var noGIFs = document.getElementById('no-gifs-found');
|
||||
const noGIFs = document.getElementById('no-gifs-found');
|
||||
|
||||
var container = document.getElementById('GIFs');
|
||||
const container = document.getElementById('GIFs');
|
||||
|
||||
var backBtn = document.getElementById('gifs-back-btn');
|
||||
const backBtn = document.getElementById('gifs-back-btn');
|
||||
|
||||
var cancelBtn = document.getElementById('gifs-cancel-btn');
|
||||
const cancelBtn = document.getElementById('gifs-cancel-btn');
|
||||
|
||||
container.innerHTML = '';
|
||||
|
||||
|
@ -43,9 +43,9 @@ async function getGif(searchTerm) {
|
|||
|
||||
let response = await fetch("/giphy?searchTerm=" + searchTerm + "&limit=48");
|
||||
let data = await response.json()
|
||||
var max = data.length - 1
|
||||
const max = data.length - 1
|
||||
data = data.data
|
||||
var gifURL = [];
|
||||
const gifURL = [];
|
||||
|
||||
if (max <= 0) {
|
||||
noGIFs.innerHTML = '<div class="text-center py-3 mt-3"><div class="mb-3"><i class="fas fa-frown text-gray-500" style="font-size: 3.5rem"></i></div><p class="font-weight-bold text-gray-500 mb-0">Aw shucks. No GIFs found...</p></div>';
|
||||
|
@ -53,7 +53,7 @@ async function getGif(searchTerm) {
|
|||
loadGIFs.innerHTML = null;
|
||||
}
|
||||
else {
|
||||
for (var i = 0; i < 48; i++) {
|
||||
for (let i = 0; i < 48; i++) {
|
||||
gifURL[i] = "https://media.giphy.com/media/" + data[i].id + "/giphy.webp";
|
||||
if (data[i].username==''){
|
||||
container.innerHTML += ('<div class="card bg-white" style="overflow: hidden" data-bs-dismiss="modal" aria-label="Close" onclick="insertGIF(\'' + 'https://media.giphy.com/media/' + data[i].id + '/giphy.webp' + '\',\'' + commentFormID + '\')"><img loading="lazy" class="img-fluid" src="' + gifURL[i] + '"></div>');
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
let purchaseQuantity = 1;
|
||||
var lotteryOnReady = function () {
|
||||
const lotteryOnReady = function () {
|
||||
checkLotteryStats();
|
||||
|
||||
// Show ticket being pulled.
|
||||
|
|
|
@ -54,17 +54,17 @@ function markdown(t) {
|
|||
input = input.replace(/\|\|(.*?)\|\|/g, '<spoiler>$1</spoiler>')
|
||||
input = input.replace(/(\n|^)>([^ >][^\n]*)/g, '$1<g>\>$2</g>')
|
||||
|
||||
var emojis = Array.from(input.matchAll(/:([a-z0-9_\-!#@]{1,36}):(?!\/)/gi))
|
||||
const emojis = Array.from(input.matchAll(/:([a-z0-9_\-!#@]{1,36}):(?!\/)/gi))
|
||||
if(emojis != null){
|
||||
for(i = 0; i < emojis.length; i++){
|
||||
var old = emojis[i][0];
|
||||
const old = emojis[i][0];
|
||||
if (old.includes('marseyrandom')) continue
|
||||
var emoji = old.replace(/[:!@#]/g,'').toLowerCase();
|
||||
var mirroredClass = old.indexOf('!') == -1 ? '' : 'mirrored';
|
||||
var emojiClass = old.indexOf('#') == -1 ? 'emoji' : 'emoji-lg';
|
||||
const emoji = old.replace(/[:!@#]/g,'').toLowerCase();
|
||||
const mirroredClass = old.indexOf('!') == -1 ? '' : 'mirrored';
|
||||
const emojiClass = old.indexOf('#') == -1 ? 'emoji' : 'emoji-lg';
|
||||
if (emoji.endsWith('pat') && emoji != 'marseyunpettablepat') {
|
||||
emoji = emoji.substr(0, emoji.length - 3);
|
||||
var url = old.indexOf('@') != -1 ? `/@${emoji}/pic` : `/e/${emoji}.webp`;
|
||||
const url = old.indexOf('@') != -1 ? `/@${emoji}/pic` : `/e/${emoji}.webp`;
|
||||
input = input.replace(old, `<span class="pat-preview ${mirroredClass}" data-bs-toggle="tooltip"><img src="/i/hand.webp"><img class="${emojiClass}" src="${url}"></span>`);
|
||||
} else {
|
||||
input = input.replace(old, `<img class="${emojiClass} ${mirroredClass}" src="/e/${emoji}.webp">`);
|
||||
|
@ -75,8 +75,8 @@ function markdown(t) {
|
|||
let options = Array.from(input.matchAll(/\s*\$\$([^\$\n]+)\$\$\s*/gi))
|
||||
if(options != null){
|
||||
for(i = 0; i < options.length; i++){
|
||||
var option = options[i][0];
|
||||
var option2 = option.replace(/\$\$/g, '').replace(/\n/g, '')
|
||||
const option = options[i][0];
|
||||
const option2 = option.replace(/\$\$/g, '').replace(/\n/g, '')
|
||||
input = input.replace(option, '');
|
||||
input += `<div class="custom-control"><input type="checkbox" class="custom-control-input" id="option-${i}"><label class="custom-control-label" for="option-${i}">${option2} - <a>0 votes</a></label></div>`;
|
||||
}
|
||||
|
@ -85,8 +85,8 @@ function markdown(t) {
|
|||
options = Array.from(input.matchAll(/\s*&&([^\$\n]+)&&\s*/gi))
|
||||
if(options != null){
|
||||
for(i = 0; i < options.length; i++){
|
||||
var option = options[i][0];
|
||||
var option2 = option.replace(/&&/g, '').replace(/\n/g, '')
|
||||
const option = options[i][0];
|
||||
const option2 = option.replace(/&&/g, '').replace(/\n/g, '')
|
||||
input = input.replace(option, '');
|
||||
input += `<div class="custom-control"><input type="radio" name="choice" class="custom-control-input" id="option-${i}"><label class="custom-control-label" for="option-${i}">${option2} - <a>0 votes</a></label></div>`;
|
||||
}
|
||||
|
@ -100,13 +100,13 @@ function markdown(t) {
|
|||
|
||||
function charLimit(form, text) {
|
||||
|
||||
var input = document.getElementById(form);
|
||||
const input = document.getElementById(form);
|
||||
|
||||
var text = document.getElementById(text);
|
||||
text = document.getElementById(text);
|
||||
|
||||
var length = input.value.length;
|
||||
const length = input.value.length;
|
||||
|
||||
var maxLength = input.getAttribute("maxlength");
|
||||
const maxLength = input.getAttribute("maxlength");
|
||||
|
||||
if (length >= maxLength) {
|
||||
text.style.color = "#E53E3E";
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
var prevScrollpos = window.pageYOffset;
|
||||
let prevScrollpos = window.pageYOffset;
|
||||
window.onscroll = function () {
|
||||
var currentScrollPos = window.pageYOffset;
|
||||
const currentScrollPos = window.pageYOffset;
|
||||
|
||||
var topBar = document.getElementById("fixed-bar-mobile");
|
||||
const topBar = document.getElementById("fixed-bar-mobile");
|
||||
|
||||
var bottomBar = document.getElementById("mobile-bottom-navigation-bar");
|
||||
const bottomBar = document.getElementById("mobile-bottom-navigation-bar");
|
||||
|
||||
var dropdown = document.getElementById("mobileSortDropdown");
|
||||
const dropdown = document.getElementById("mobileSortDropdown");
|
||||
|
||||
var navbar = document.getElementById("navbar");
|
||||
const navbar = document.getElementById("navbar");
|
||||
|
||||
if (bottomBar != null) {
|
||||
if (prevScrollpos > currentScrollPos && (window.innerHeight + currentScrollPos) < (document.body.offsetHeight - 65)) {
|
||||
|
|
|
@ -16,7 +16,7 @@ function urlB64ToUint8Array(base64String) {
|
|||
}
|
||||
|
||||
function updateSubscriptionOnServer(subscription, apiEndpoint) {
|
||||
var formData = new FormData();
|
||||
const formData = new FormData();
|
||||
formData.append("subscription_json", JSON.stringify(subscription));
|
||||
|
||||
const xhr = createXhrWithFormKey(
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
var isleft = true
|
||||
const isleft = true
|
||||
setInterval(() => {
|
||||
let ricardo1 = document.getElementById("ricardo1")
|
||||
var height = Math.floor(Math.random()*60)+10
|
||||
const height = Math.floor(Math.random()*60)+10
|
||||
if (ricardo1) {
|
||||
ricardo1.firstElementChild.src = ""
|
||||
|
||||
|
@ -20,7 +20,7 @@ setInterval(() => {
|
|||
|
||||
setInterval(() => {
|
||||
let ricardo2 = document.getElementById("ricardo2")
|
||||
var xpos = Math.floor(Math.random()*9)*10
|
||||
const xpos = Math.floor(Math.random()*9)*10
|
||||
|
||||
if (ricardo2) ricardo2.style.left=xpos+"%"
|
||||
}, 1700)
|
|
@ -1,22 +0,0 @@
|
|||
function block_user() {
|
||||
var usernameField = document.getElementById("exile-username");
|
||||
var isValidUsername = usernameField.checkValidity();
|
||||
username = usernameField.value;
|
||||
if (isValidUsername) {
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open("post", "/settings/block");
|
||||
xhr.setRequestHeader('xhr', 'xhr');
|
||||
f=new FormData();
|
||||
f.append("username", username);
|
||||
f.append("formkey", formkey());
|
||||
xhr.onload=function(){
|
||||
if (xhr.status<300) {
|
||||
location.reload();
|
||||
}
|
||||
else {
|
||||
showToast(false, "Error, please try again later.");
|
||||
}
|
||||
}
|
||||
xhr.send(f)
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@ function post(url) {
|
|||
};
|
||||
|
||||
function updatebgselection(){
|
||||
var bgselector = document.getElementById("backgroundSelector");
|
||||
const bgselector = document.getElementById("backgroundSelector");
|
||||
const backgrounds = [
|
||||
{
|
||||
folder: "glitter",
|
||||
|
@ -96,7 +96,7 @@ function updatebgselection(){
|
|||
updatebgselection();
|
||||
|
||||
document.onpaste = function(event) {
|
||||
var focused = document.activeElement;
|
||||
const focused = document.activeElement;
|
||||
if (focused.id == 'bio-text') {
|
||||
const files = structuredClone(event.clipboardData.files);
|
||||
|
||||
|
|
|
@ -8,3 +8,36 @@ const twoStepModal = bootstrap.Modal.getOrCreateInstance(document.getElementById
|
|||
function emailVerifyText() {
|
||||
document.getElementById("email-verify-text").innerHTML = "Verification email sent! Please check your inbox.";
|
||||
}
|
||||
|
||||
function block_user() {
|
||||
const usernameField = document.getElementById("block-username");
|
||||
const isValidUsername = usernameField.checkValidity();
|
||||
username = usernameField.value;
|
||||
if (isValidUsername) {
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open("post", "/settings/block");
|
||||
xhr.setRequestHeader('xhr', 'xhr');
|
||||
f=new FormData();
|
||||
f.append("username", username);
|
||||
f.append("formkey", formkey());
|
||||
xhr.onload=function(){
|
||||
if (xhr.status<300) {
|
||||
location.reload();
|
||||
}
|
||||
else {
|
||||
showToast(false, "Error, please try again later.");
|
||||
}
|
||||
}
|
||||
xhr.send(f)
|
||||
}
|
||||
}
|
||||
|
||||
function unblock_user(t, url) {
|
||||
postToast(t, url,
|
||||
{
|
||||
},
|
||||
() => {
|
||||
t.parentElement.parentElement.remove();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
document.getElementById('password-register').addEventListener('input', function () {
|
||||
|
||||
var charCount = document.getElementById("password-register").value;
|
||||
var id = document.getElementById("passwordHelpRegister");
|
||||
var successID = document.getElementById("passwordHelpSuccess");
|
||||
const charCount = document.getElementById("password-register").value;
|
||||
const id = document.getElementById("passwordHelpRegister");
|
||||
const successID = document.getElementById("passwordHelpSuccess");
|
||||
|
||||
if (charCount.length >= 8) {
|
||||
id.classList.add("d-none");
|
||||
|
|
|
@ -10,7 +10,7 @@ function sort_table(n) {
|
|||
if (!('sortKey' in x.dataset)) {
|
||||
x = x.getElementsByTagName('a')[0] || x;
|
||||
}
|
||||
var attr;
|
||||
let attr;
|
||||
if ('sortKey' in x.dataset) {
|
||||
attr = x.dataset.sortKey;
|
||||
} else if ('time' in x.dataset) {
|
||||
|
|
|
@ -83,7 +83,7 @@ document.onpaste = function(event) {
|
|||
document.getElementById('urlblock').classList.add('d-none');
|
||||
if (IMAGE_FORMATS.some(s => filename.endsWith(s)))
|
||||
{
|
||||
var fileReader = new FileReader();
|
||||
const fileReader = new FileReader();
|
||||
fileReader.readAsDataURL(f.files[0]);
|
||||
fileReader.addEventListener("load", function () {document.getElementById('image-preview').setAttribute('src', this.result);});
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ document.getElementById('file-upload').addEventListener('change', function(){
|
|||
filename = f.files[0].name.toLowerCase()
|
||||
if (IMAGE_FORMATS.some(s => filename.endsWith(s)))
|
||||
{
|
||||
var fileReader = new FileReader();
|
||||
const fileReader = new FileReader();
|
||||
fileReader.readAsDataURL(f.files[0]);
|
||||
fileReader.addEventListener("load", function () {document.getElementById('image-preview').setAttribute('src', this.result);});
|
||||
}
|
||||
|
@ -128,15 +128,15 @@ function savetext() {
|
|||
|
||||
function autoSuggestTitle() {
|
||||
|
||||
var urlField = document.getElementById("post-url");
|
||||
const urlField = document.getElementById("post-url");
|
||||
|
||||
var titleField = document.getElementById("post-title");
|
||||
const titleField = document.getElementById("post-title");
|
||||
|
||||
var isValidURL = urlField.checkValidity();
|
||||
const isValidURL = urlField.checkValidity();
|
||||
|
||||
if (isValidURL && urlField.value.length > 0 && titleField.value === "") {
|
||||
|
||||
var x = new XMLHttpRequest();
|
||||
const x = new XMLHttpRequest();
|
||||
x.withCredentials=true;
|
||||
x.onreadystatechange = function() {
|
||||
if (x.readyState == 4 && x.status == 200 && !titleField.value) {
|
||||
|
|
|
@ -619,7 +619,7 @@ def settings_unblock_user(v):
|
|||
if not v.shadowbanned and user.admin_level >= PERMS['USER_BLOCKS_VISIBLE']:
|
||||
send_notification(user.id, f"@{v.username} has unblocked you!")
|
||||
cache.delete_memoized(frontlist)
|
||||
return {"message": f"@{user.username} unblocked."}
|
||||
return {"message": f"@{user.username} unblocked successfully!"}
|
||||
|
||||
@app.get("/settings/apps")
|
||||
@auth_required
|
||||
|
|
|
@ -895,7 +895,7 @@
|
|||
};
|
||||
const base64Mark = btoa(markTemplate("{{v.id}}"));
|
||||
|
||||
var style = document.createElement('style');
|
||||
const style = document.createElement('style');
|
||||
style.innerHTML = `.actual-post:not(.deleted, .banned),.comment-section>.comment{background-image:url("data:image/svg+xml;base64,${base64Mark}")}`;
|
||||
document.getElementsByTagName('head')[0].appendChild(style);
|
||||
}
|
||||
|
|
|
@ -201,7 +201,7 @@
|
|||
tt.show()
|
||||
document.getElementsByClassName('tooltip')[0].onclick = function(e) {
|
||||
tt.hide()
|
||||
var xhr = new XMLHttpRequest();
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.withCredentials=true;
|
||||
xhr.open("POST", '/dismiss_mobile_tip', true);
|
||||
xhr.setRequestHeader('xhr', 'xhr');
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
<div class="modal fade" id="2faModal" tabindex="-1" role="dialog" aria-labelledby="2faModalTitle" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">
|
||||
{% if mfa_secret %}
|
||||
Setup two-step login
|
||||
{% elif mfa_secret and not v.email %}
|
||||
Email required for two-step login
|
||||
{% else %}
|
||||
Disable two-step login
|
||||
{% endif %}
|
||||
</h5>
|
||||
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true"><i class="far fa-times"></i></span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="/settings/security" method="post">
|
||||
<input type="hidden" name="formkey" value="{{v|formkey}}">
|
||||
<input type="hidden" name="2fa_secret" value="{{mfa_secret}}">
|
||||
<div class="modal-body">
|
||||
{% if mfa_secret %}
|
||||
<p><span class="font-weight-bold">Step 1:</span> Scan this barcode (or enter the code) using a two-factor authentication app such as Google Authenticator or Authy.</p>
|
||||
<div class="text-center mb-3">
|
||||
<img alt="two-factor QR code" loading="lazy" class="img-fluid" width=175 src="/2faqr/{{mfa_secret}}">
|
||||
<div class="text-small text-muted mt-1">Or enter this code: {{mfa_secret}}</div>
|
||||
</div>
|
||||
<p><span class="font-weight-bold">Step 2:</span> Enter the six-digit code generated in the authenticator app and your {{SITE_NAME}} account password.</p>
|
||||
<label for="2fa_input">6-digit code</label>
|
||||
<input autocomplete="off" type="text" class="form-control mb-2" id="2fa_input" name="2fa_token" placeholder="# # # # # #" required>
|
||||
|
||||
<label for="2fa_input_password">Password</label>
|
||||
<input autocomplete="off" type="password" class="form-control mb-2" id="2fa_input_password" name="password" oninput="document.getElementById('toggle2faButton').disabled=false" required>
|
||||
{% else %}
|
||||
<div class="alert alert-warning" role="alert">
|
||||
<i class="fas fa-info-circle"></i>
|
||||
To disable two-step login, please enter your {{SITE_NAME}} account password and the 6-digit code generated in your authentication app. If you no longer have your two-step device, <a href="/lost_2fa">click here</a>.
|
||||
</div>
|
||||
|
||||
<label for="2fa_input_password">Password</label>
|
||||
<input autocomplete="off" type="password" class="form-control mb-2" id="2fa_input_password" name="password" required>
|
||||
|
||||
<label for="2fa_input">6-digit code</label>
|
||||
<input autocomplete="off" type="text" class="form-control mb-2" id="2fa_input" name="2fa_remove" placeholder="# # # # # #" oninput="document.getElementById('toggle2faButton').disabled=false" required>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-link text-muted" data-bs-dismiss="modal">Cancel</button>
|
||||
<input autocomplete="off" id="toggle2faButton" class="btn btn-primary" type="submit" onclick="disable(this)" value="Enable 2-step login" disabled>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,22 +0,0 @@
|
|||
<div class="modal fade" id="blockmodal" tabindex="-1" role="dialog" aria-labelledby="blockmodal" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<form class="m-auto" action="/settings/block" id="block-form" method="post" onsubmit="return false;">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Block users</h5>
|
||||
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true"><i class="far fa-times"></i></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<input type="hidden" name="formkey" value="{{v|formkey}}">
|
||||
<input autocomplete="off" type="text" name="username" placeholder="Enter username..." id="block-username" class="form-control" maxlength=25 required>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-link text-muted" data-bs-dismiss="modal">Cancel</button>
|
||||
<button type="button" class="btn btn-primary" id="blockUserButton" onclick="block_user()">Block user</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
|
@ -177,7 +177,7 @@
|
|||
{% include "user_in_table.html" %}
|
||||
</td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-primary" onclick="postToastSwitch(this,'/settings/unblock?username={{user.username}}&formkey={{v|formkey}}')">Unblock</button>
|
||||
<button type="button" class="btn btn-primary" onclick="unblock_user(this, '/settings/unblock?username={{user.username}}&formkey={{v|formkey}}')">Unblock</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
|
@ -198,13 +198,88 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{%- include 'modals/2fa.html' -%}
|
||||
{%- include 'modals/blockuser.html' -%}
|
||||
|
||||
<div class="modal fade" id="2faModal" tabindex="-1" role="dialog" aria-labelledby="2faModalTitle" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">
|
||||
{% if mfa_secret %}
|
||||
Setup two-step login
|
||||
{% elif mfa_secret and not v.email %}
|
||||
Email required for two-step login
|
||||
{% else %}
|
||||
Disable two-step login
|
||||
{% endif %}
|
||||
</h5>
|
||||
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true"><i class="far fa-times"></i></span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="/settings/security" method="post">
|
||||
<input type="hidden" name="formkey" value="{{v|formkey}}">
|
||||
<input type="hidden" name="2fa_secret" value="{{mfa_secret}}">
|
||||
<div class="modal-body">
|
||||
{% if mfa_secret %}
|
||||
<p><span class="font-weight-bold">Step 1:</span> Scan this barcode (or enter the code) using a two-factor authentication app such as Google Authenticator or Authy.</p>
|
||||
<div class="text-center mb-3">
|
||||
<img alt="two-factor QR code" loading="lazy" class="img-fluid" width=175 src="/2faqr/{{mfa_secret}}">
|
||||
<div class="text-small text-muted mt-1">Or enter this code: {{mfa_secret}}</div>
|
||||
</div>
|
||||
<p><span class="font-weight-bold">Step 2:</span> Enter the six-digit code generated in the authenticator app and your {{SITE_NAME}} account password.</p>
|
||||
<label for="2fa_input">6-digit code</label>
|
||||
<input autocomplete="off" type="text" class="form-control mb-2" id="2fa_input" name="2fa_token" placeholder="# # # # # #" required>
|
||||
|
||||
<label for="2fa_input_password">Password</label>
|
||||
<input autocomplete="off" type="password" class="form-control mb-2" id="2fa_input_password" name="password" oninput="document.getElementById('toggle2faButton').disabled=false" required>
|
||||
{% else %}
|
||||
<div class="alert alert-warning" role="alert">
|
||||
<i class="fas fa-info-circle"></i>
|
||||
To disable two-step login, please enter your {{SITE_NAME}} account password and the 6-digit code generated in your authentication app. If you no longer have your two-step device, <a href="/lost_2fa">click here</a>.
|
||||
</div>
|
||||
|
||||
<label for="2fa_input_password">Password</label>
|
||||
<input autocomplete="off" type="password" class="form-control mb-2" id="2fa_input_password" name="password" required>
|
||||
|
||||
<label for="2fa_input">6-digit code</label>
|
||||
<input autocomplete="off" type="text" class="form-control mb-2" id="2fa_input" name="2fa_remove" placeholder="# # # # # #" oninput="document.getElementById('toggle2faButton').disabled=false" required>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-link text-muted" data-bs-dismiss="modal">Cancel</button>
|
||||
<input autocomplete="off" id="toggle2faButton" class="btn btn-primary" type="submit" onclick="disable(this)" value="Enable 2-step login" disabled>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="blockmodal" tabindex="-1" role="dialog" aria-labelledby="blockmodal" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<form class="m-auto" action="/settings/block" id="block-form" method="post" onsubmit="return false;">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Block user</h5>
|
||||
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true"><i class="far fa-times"></i></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<input type="hidden" name="formkey" value="{{v|formkey}}">
|
||||
<input autocomplete="off" type="text" name="username" placeholder="Enter username..." id="block-username" class="form-control" maxlength=25 required>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-link text-muted" data-bs-dismiss="modal">Cancel</button>
|
||||
<button type="button" class="btn btn-primary" id="blockUserButton" onclick="block_user()">Block user</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="toast error" id="toast-exile-error" role="alert" aria-live="assertive" aria-atomic="true" data-bs-animation="true" data-bs-autohide="true" data-bs-delay="5000">
|
||||
<div class="toast-body text-center">
|
||||
<i class="fas fa-exclamation-circle text-danger mr-2"></i><span id="toast-error-message">Error. Please try again.</span>
|
||||
</div>
|
||||
</div>
|
||||
<script defer src="{{'js/settings_blocks.js' | asset}}"></script>
|
||||
{% endblock %}
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
document.getElementById('filename-show').textContent = filename;
|
||||
if (IMAGE_FORMATS.some(s => filename.endsWith(s)))
|
||||
{
|
||||
var fileReader = new FileReader();
|
||||
const fileReader = new FileReader();
|
||||
fileReader.readAsDataURL(f.files[0]);
|
||||
fileReader.addEventListener("load", function () {
|
||||
document.getElementById('image-preview').setAttribute('src', this.result);
|
||||
|
@ -97,7 +97,7 @@
|
|||
filename = f.files[0].name.toLowerCase()
|
||||
if (IMAGE_FORMATS.some(s => filename.endsWith(s)))
|
||||
{
|
||||
var fileReader = new FileReader();
|
||||
const fileReader = new FileReader();
|
||||
fileReader.readAsDataURL(f.files[0]);
|
||||
fileReader.addEventListener("load", function () {
|
||||
document.getElementById('image-preview').setAttribute('src', this.result);
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
document.getElementById('filename-show').textContent = filename;
|
||||
if (IMAGE_FORMATS.some(s => filename.endsWith(s)))
|
||||
{
|
||||
var fileReader = new FileReader();
|
||||
const fileReader = new FileReader();
|
||||
fileReader.readAsDataURL(f.files[0]);
|
||||
fileReader.addEventListener("load", function () {
|
||||
document.getElementById('image-preview').setAttribute('src', this.result);
|
||||
|
@ -99,7 +99,7 @@
|
|||
filename = f.files[0].name.toLowerCase()
|
||||
if (IMAGE_FORMATS.some(s => filename.endsWith(s)))
|
||||
{
|
||||
var fileReader = new FileReader();
|
||||
const fileReader = new FileReader();
|
||||
fileReader.readAsDataURL(f.files[0]);
|
||||
fileReader.addEventListener("load", function () {
|
||||
document.getElementById('image-preview').setAttribute('src', this.result);
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
document.getElementById('filename-show').textContent = filename;
|
||||
if (IMAGE_FORMATS.some(s => filename.endsWith(s)))
|
||||
{
|
||||
var fileReader = new FileReader();
|
||||
const fileReader = new FileReader();
|
||||
fileReader.readAsDataURL(f.files[0]);
|
||||
fileReader.addEventListener("load", function () {
|
||||
document.getElementById('image-preview').setAttribute('src', this.result);
|
||||
|
@ -91,7 +91,7 @@
|
|||
filename = f.files[0].name.toLowerCase()
|
||||
if (IMAGE_FORMATS.some(s => filename.endsWith(s)))
|
||||
{
|
||||
var fileReader = new FileReader();
|
||||
const fileReader = new FileReader();
|
||||
fileReader.readAsDataURL(f.files[0]);
|
||||
fileReader.addEventListener("load", function () {
|
||||
document.getElementById('image-preview').setAttribute('src', this.result);
|
||||
|
|
Loading…
Reference in New Issue