master
Aevann1 2021-09-26 11:21:59 +02:00
parent 9c9c745dfb
commit 60a1e2279d
5 changed files with 38 additions and 32 deletions

View File

@ -1,5 +1,5 @@
<script src="https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.8/dist/clipboard.min.jsscript>
{% if v %}
<script>
@ -108,12 +108,12 @@
// Expand comment box on focus, hide otherwise
$('.comment-box').focus(function (event) {
event.preventDefault();
$(this).parent().parent().addClass("collapsed");
});
for(let el of document.getElementsByClassName('comment-box')) {
el.addEventListener('focus', function(event) {
event.preventDefault();
this.parent().parent().addClass("collapsed");
});
}
// Open comment reply box

View File

@ -192,18 +192,21 @@
autoExpand(event.target);
}, false);
$('.text-expand').click(function(event){
if (event.which != 1) {
return
};
id=$(this).data('id');
for(let el of document.getElementsByClassName('text-expand')) {
el.onclick = function(event){
if (event.which != 1) {
return
};
id=this.data('id');
document.getElementById('post-text-'+id).toggleClass('d-none');
$('.text-expand-icon-'+id).toggleClass('fa-expand-alt');
$('.text-expand-icon-'+id).toggleClass('fa-compress-alt');
document.getElementById('post-text-'+id).toggleClass('d-none');
document.getElementsByClassName('text-expand-icon-'+id)[0].toggleClass('fa-expand-alt');
document.getElementsByClassName('text-expand-icon-'+id)[0].toggleClass('fa-compress-alt');
})
}
}
</script>
@ -215,7 +218,8 @@
if (window.innerWidth <= 737){
try {
document.getElementById('mobile-prompt').tooltip('show')
$('.tooltip')[0].addEventListener(
document.getElementsByClassName('tooltip')[0].addEventListener(
'click',
function(event){
document.getElementById('mobile-prompt').tooltip('hide')

View File

@ -26,7 +26,7 @@
function getEmoji(searchTerm, form) {
const commentBox = document.getElementById(form);
const old = commentBox.value;
const curPos = $(commentBox).data(TEXTAREA_POS);
const curPos = commentBox.data(TEXTAREA_POS);
const firstHalf = old.slice(0, curPos)
const lastHalf = old.slice(curPos)
@ -44,7 +44,7 @@
const newPos = curPos + emoji.length
$(commentBox).data(TEXTAREA_POS, newPos)
commentBox.data(TEXTAREA_POS, newPos)
}
function loadEmojis(form) {
@ -88,7 +88,7 @@
container.innerHTML = container.innerHTML.replace(/@form@/g, form)
const commentBox = document.getElementById(form);
$(commentBox).data(TEXTAREA_POS, commentBox.selectionStart)
commentBox.data(TEXTAREA_POS, commentBox.selectionStart)
for (i=0; i < emojis.length; i++) {

View File

@ -1,15 +1,17 @@
<script>
$('.expandable-image').click( function(event) {
for(let el of document.getElementsByClassName('expandable-image')) {
el.onclick = function(event) {
if (event.which != 1) {
return
if (event.which != 1) {
return
}
event.preventDefault();
var url= this.data('url');
expandDesktopImage(url,url);
}
event.preventDefault();
var url= $(this).data('url');
expandDesktopImage(url,url);
})
}
// Expand Images on Desktop

View File

@ -10,12 +10,12 @@
<script>
$(document).ready(function() {
document.ready(function() {
document.getElementById('submitform').submit(function() {
// disable button
$("#create_button").prop("disabled", true);
document.getElementById('create_button').prop("disabled", true);
// add spinner to button
$("#create_button").html('<span class="spinner-border spinner-border-sm mr-2" role="status" aria-hidden="true"></span>Creating post');
document.getElementById('create_button').html('<span class="spinner-border spinner-border-sm mr-2" role="status" aria-hidden="true"></span>Creating post');
});
});