forked from rDrama/rDrama
1
0
Fork 0
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 %} {% if v %}
<script> <script>
@ -108,12 +108,12 @@
// Expand comment box on focus, hide otherwise // Expand comment box on focus, hide otherwise
$('.comment-box').focus(function (event) { for(let el of document.getElementsByClassName('comment-box')) {
el.addEventListener('focus', function(event) {
event.preventDefault(); event.preventDefault();
this.parent().parent().addClass("collapsed");
$(this).parent().parent().addClass("collapsed");
}); });
}
// Open comment reply box // Open comment reply box

View File

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

View File

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

View File

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

View File

@ -10,12 +10,12 @@
<script> <script>
$(document).ready(function() { document.ready(function() {
document.getElementById('submitform').submit(function() { document.getElementById('submitform').submit(function() {
// disable button // disable button
$("#create_button").prop("disabled", true); document.getElementById('create_button').prop("disabled", true);
// add spinner to button // 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');
}); });
}); });