forked from rDrama/rDrama
1
0
Fork 0
master
Aevann1 2021-09-27 02:09:25 +02:00
commit 0ac59168b4
5 changed files with 20 additions and 16 deletions

View File

@ -221,7 +221,10 @@ def message2(v, username):
user = get_user(username, v=v)
if hasattr(user, 'is_blocking') and user.is_blocking: return {"error": "You're blocking this user."}, 403
if hasattr(user, 'is_blocked') and user.is_blocked: return {"error": "This user is blocking you."}, 403
if v.admin_level <= 1:
if hasattr(user, 'is_blocked') and user.is_blocked: return {"error": "This user is blocking you."}, 403
message = request.values.get("message", "")[:1000].strip()
# check existing

View File

@ -23,14 +23,14 @@
commentFormID = form;
};
const TEXTAREA_POS = 'curr-pos'
const TEXTAREA_POS_ATTR = 'data-curr-pos'
// Insert EMOJI markdown into comment box function
function getEmoji(searchTerm, form) {
const commentBox = document.getElementById(form);
const old = commentBox.value;
const curPos = commentBox.data(TEXTAREA_POS);
const curPos = parseInt(commentBox.getAttribute(TEXTAREA_POS_ATTR));
const firstHalf = old.slice(0, curPos)
const lastHalf = old.slice(curPos)
@ -48,7 +48,7 @@
const newPos = curPos + emoji.length
commentBox.data(TEXTAREA_POS, newPos)
commentBox.setAttribute(TEXTAREA_POS_ATTR, newPos);
}
function loadEmojis(form) {
@ -92,7 +92,7 @@
container.innerHTML = container.innerHTML.replace(/@form@/g, form)
const commentBox = document.getElementById(form);
commentBox.data(TEXTAREA_POS, commentBox.selectionStart)
commentBox.setAttribute(TEXTAREA_POS_ATTR, commentBox.selectionStart);
for (i=0; i < emojis.length; i++) {

View File

@ -7,15 +7,16 @@
}
event.preventDefault();
var url= this.data('url');
let source = (event.target || event.srcElement).parentNode;
var url= source.dataset.bsUrl;
expandDesktopImage(url,url);
expandDesktopImage(url);
}
}
// Expand Images on Desktop
function expandDesktopImage(image, link) {
function expandDesktopImage(image) {
// Link text

View File

@ -190,7 +190,7 @@
{% endif %}
{% if hcaptcha %}
<div class="h-captcha" data-bs-sitekey="{{hcaptcha}}"></div>
<div class="h-captcha" data-sitekey="{{ hcaptcha }}"></div>
<script src="https://hcaptcha.com/1/api.js" async defer></script>
{% endif %}

View File

@ -425,23 +425,23 @@
if (filename.endsWith(".jpg") || filename.endsWith(".jpeg") || filename.endsWith(".png") || filename.endsWith(".webp"))
{
f.files = files;
document.getElementById('filename-show').text(filename);
document.getElementById('urlblock').addClass('d-none');
document.getElementById('filename-show').textContent = filename;
document.getElementById('urlblock').classList.add('d-none');
var fileReader = new FileReader();
fileReader.readAsDataURL(f.files[0]);
fileReader.addEventListener("load", function () {document.getElementById('image-preview').attr('src', this.result);});
document.getElementById('file-upload').attr('required', false);
fileReader.addEventListener("load", function () {document.getElementById('image-preview').setAttribute('src', this.result);});
document.getElementById('file-upload').setAttribute('required', 'false');
checkForRequired();
}
}
document.getElementById('file-upload').addEventListener('change', function(e){
f=document.getElementById('file-upload');
document.getElementById('urlblock').addClass('d-none');
document.getElementById('filename-show').text(document.getElementById('file-upload')[0].files[0].name);
document.getElementById('urlblock').classList.add('d-none');
document.getElementById('filename-show').textContent = document.getElementById('file-upload').files[0].name;
var fileReader = new FileReader();
fileReader.readAsDataURL(f.files[0]);
fileReader.addEventListener("load", function () {document.getElementById('image-preview').attr('src', this.result);});
fileReader.addEventListener("load", function () {document.getElementById('image-preview').setAttribute('src', this.result);});
checkForRequired();
})
</script>