forked from rDrama/rDrama
1129 lines
32 KiB
HTML
1129 lines
32 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
{% include "bootstrap.html" %}
|
|
|
|
{% if v and v.agendaposter %}
|
|
<script src="/assets/js/bug-min.js" type="text/javascript"></script>
|
|
<script type="text/javascript">
|
|
new BugController({
|
|
imageSprite: "/assets/js/fly-sprite.png",
|
|
canDie: false,
|
|
minBugs: 5,
|
|
maxBugs: 30,
|
|
mouseOver: "fly"
|
|
});
|
|
new SpiderController({
|
|
imageSprite: "/assets/js/spider-sprite.png",
|
|
canDie: false,
|
|
minBugs: 2,
|
|
maxBugs: 20,
|
|
mouseOver: "fly"
|
|
});
|
|
</script>
|
|
{% endif %}
|
|
|
|
<script>
|
|
|
|
// comment collapse
|
|
|
|
// Toggle comment collapse
|
|
|
|
function collapse_comment(comment_id) {
|
|
|
|
var comment = "comment-" + comment_id;
|
|
|
|
document.getElementById(comment).classList.toggle("collapsed");
|
|
|
|
};
|
|
|
|
//Commenting form
|
|
|
|
// Expand comment box on focus, hide otherwise
|
|
|
|
$('.comment-box').focus(function (event) {
|
|
event.preventDefault();
|
|
|
|
$(this).parent().parent().addClass("collapsed");
|
|
|
|
});
|
|
|
|
// Comment edit form
|
|
|
|
toggleEdit=function(id){
|
|
comment=document.getElementById("comment-text-"+id);
|
|
form=document.getElementById("comment-edit-"+id);
|
|
box=document.getElementById('edit-box-comment-'+id);
|
|
actions = document.getElementById('comment-' + id +'-actions');
|
|
|
|
comment.classList.toggle("d-none");
|
|
form.classList.toggle("d-none");
|
|
actions.classList.toggle("d-none");
|
|
autoExpand(box);
|
|
};
|
|
|
|
// Post edit form
|
|
|
|
togglePostEdit=function(id){
|
|
|
|
body=document.getElementById("post-body");
|
|
title=document.getElementById("post-title");
|
|
form=document.getElementById("edit-post-body-"+id);
|
|
box=document.getElementById("post-edit-box-"+id);
|
|
box2=document.getElementById("post-edit-box2-"+id);
|
|
|
|
body.classList.toggle("d-none");
|
|
title.classList.toggle("d-none");
|
|
form.classList.toggle("d-none");
|
|
autoExpand(box);
|
|
autoExpand(box2);
|
|
};
|
|
|
|
//comment modding
|
|
function removeComment(post_id) {
|
|
url="/api/ban_comment/"+post_id
|
|
|
|
callback=function(){
|
|
document.getElementById("comment-"+post_id+"-only").classList.add("banned");
|
|
|
|
button=document.getElementById("moderate-"+post_id);
|
|
button.onclick=function(){approveComment(post_id)};
|
|
button.innerHTML='<i class="fas fa-clipboard-check"></i>Approve'
|
|
}
|
|
post(url, callback, "Comment has been removed.")
|
|
};
|
|
|
|
function approveComment(post_id) {
|
|
url="/api/unban_comment/"+post_id
|
|
|
|
callback=function(){
|
|
document.getElementById("comment-"+post_id+"-only").classList.remove("banned");
|
|
|
|
button=document.getElementById("moderate-"+post_id);
|
|
button.onclick=function(){removeComment(post_id)};
|
|
button.innerHTML='<i class="fas fa-trash-alt"></i>Remove'
|
|
}
|
|
|
|
post(url, callback, "Comment has been approved.")
|
|
}
|
|
|
|
admin_comment=function(cid){
|
|
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
xhr.open("post", "/api/distinguish_comment/"+cid);
|
|
|
|
var form = new FormData();
|
|
|
|
form.append('formkey', formkey());
|
|
|
|
xhr.withCredentials=true;
|
|
xhr.onload=function(){
|
|
if (xhr.status==200) {
|
|
comment=document.getElementById('comment-'+cid+'-only');
|
|
comment.innerHTML=JSON.parse(xhr.response)["html"];
|
|
}
|
|
else {
|
|
var commentError = document.getElementById("comment-error-text");
|
|
$('#toast-comment-success').toast('dispose');
|
|
$('#toast-comment-error').toast('dispose');
|
|
$('#toast-comment-error').toast('show');
|
|
commentError.textContent = JSON.parse(xhr.response)["error"];
|
|
}
|
|
}
|
|
xhr.send(form)
|
|
}
|
|
|
|
//Autoexpand textedit comments
|
|
|
|
function autoExpand (field) {
|
|
|
|
//get current scroll position
|
|
xpos=window.scrollX;
|
|
ypos=window.scrollY;
|
|
|
|
// Reset field height
|
|
field.style.height = 'inherit';
|
|
|
|
// Get the computed styles for the element
|
|
var computed = window.getComputedStyle(field);
|
|
|
|
// Calculate the height
|
|
var height = parseInt(computed.getPropertyValue('border-top-width'), 10)
|
|
+ parseInt(computed.getPropertyValue('padding-top'), 10)
|
|
+ field.scrollHeight
|
|
+ parseInt(computed.getPropertyValue('padding-bottom'), 10)
|
|
+ parseInt(computed.getPropertyValue('border-bottom-width'), 10)
|
|
+ 32;
|
|
|
|
field.style.height = height + 'px';
|
|
|
|
//keep window position from changing
|
|
window.scrollTo(xpos,ypos);
|
|
|
|
};
|
|
|
|
document.addEventListener('input', function (event) {
|
|
if (event.target.tagName.toLowerCase() !== 'textarea') return;
|
|
autoExpand(event.target);
|
|
}, false);
|
|
|
|
// Delete Post
|
|
|
|
function delete_postModal(id) {
|
|
|
|
// Passed data for modal
|
|
|
|
document.getElementById("deletePostButton-mobile").addEventListener("click", delete_post);
|
|
|
|
document.getElementById("deletePostButton").addEventListener("click", delete_post);
|
|
|
|
function delete_post(){
|
|
|
|
this.innerHTML='<span class="spinner-border spinner-border-sm mr-2" role="status" aria-hidden="true"></span>Deleting post';
|
|
this.disabled = true;
|
|
post('/delete_post/' + id,
|
|
callback = function() {
|
|
|
|
location.reload();
|
|
}
|
|
)
|
|
}
|
|
|
|
};
|
|
|
|
// Delete Comment
|
|
|
|
function delete_commentModal(id) {
|
|
|
|
// Passed data for modal
|
|
|
|
document.getElementById("deleteCommentButton").onclick = function() {
|
|
|
|
this.innerHTML='<span class="spinner-border spinner-border-sm mr-2" role="status" aria-hidden="true"></span>Deleting comment';
|
|
this.disabled = true;
|
|
post('/delete/comment/' + id,
|
|
callback = function() {
|
|
|
|
location.reload();
|
|
}
|
|
)
|
|
}
|
|
|
|
};
|
|
|
|
//flagging
|
|
// Flag Comment
|
|
|
|
report_commentModal = function(id, author) {
|
|
|
|
document.getElementById("comment-author").textContent = author;
|
|
|
|
//offtopic.disabled=true;
|
|
|
|
document.getElementById("reportCommentButton").onclick = function() {
|
|
|
|
this.innerHTML='<span class="spinner-border spinner-border-sm mr-2" role="status" aria-hidden="true"></span>Reporting comment';
|
|
this.disabled = true;
|
|
var xhr = new XMLHttpRequest();
|
|
xhr.open("POST", '/api/flag/comment/'+id, true);
|
|
var form = new FormData()
|
|
form.append("formkey", formkey());
|
|
form.append("reason", document.getElementById("reason-comment").value);
|
|
|
|
xhr.withCredentials=true;
|
|
|
|
xhr.onload=function() {
|
|
document.getElementById("reportCommentFormBefore").classList.add('d-none');
|
|
document.getElementById("reportCommentFormAfter").classList.remove('d-none');
|
|
};
|
|
|
|
xhr.onerror=function(){alert(errortext)};
|
|
xhr.send(form);
|
|
}
|
|
|
|
};
|
|
|
|
$('#reportCommentModal').on('hidden.bs.modal', function () {
|
|
|
|
var button = document.getElementById("reportCommentButton");
|
|
|
|
var beforeModal = document.getElementById("reportCommentFormBefore");
|
|
var afterModal = document.getElementById("reportCommentFormAfter");
|
|
|
|
button.innerHTML='Report comment';
|
|
button.disabled= false;
|
|
afterModal.classList.add('d-none');
|
|
|
|
if ( beforeModal.classList.contains('d-none') ) {
|
|
beforeModal.classList.remove('d-none');
|
|
}
|
|
|
|
});
|
|
|
|
|
|
// Flag Submission
|
|
|
|
report_postModal = function(id, author, board) {
|
|
|
|
document.getElementById("post-author").textContent = author;
|
|
|
|
submitbutton=document.getElementById("reportPostButton");
|
|
|
|
submitbutton.onclick = function() {
|
|
|
|
this.innerHTML='<span class="spinner-border spinner-border-sm mr-2" role="status" aria-hidden="true"></span>Reporting post';
|
|
this.disabled = true;
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
xhr.open("POST", '/api/flag/post/'+id, true);
|
|
var form = new FormData()
|
|
form.append("formkey", formkey());
|
|
form.append("reason", document.getElementById("reason").value);
|
|
|
|
xhr.withCredentials=true;
|
|
|
|
xhr.onload=function() {
|
|
document.getElementById("reportPostFormBefore").classList.add('d-none');
|
|
document.getElementById("reportPostFormAfter").classList.remove('d-none');
|
|
};
|
|
|
|
xhr.onerror=function(){alert(errortext)};
|
|
xhr.send(form);
|
|
|
|
}
|
|
};
|
|
|
|
$('#reportPostModal').on('hidden.bs.modal', function () {
|
|
|
|
var button = document.getElementById("reportPostButton");
|
|
|
|
var beforeModal = document.getElementById("reportPostFormBefore");
|
|
var afterModal = document.getElementById("reportPostFormAfter");
|
|
|
|
button.innerHTML='Report post';
|
|
button.disabled= false;
|
|
|
|
afterModal.classList.add('d-none');
|
|
|
|
if ( beforeModal.classList.contains('d-none') ) {
|
|
beforeModal.classList.remove('d-none');
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('.expandable-image').click( function(event) {
|
|
|
|
if (event.which != 1) {
|
|
return
|
|
}
|
|
event.preventDefault();
|
|
|
|
var url= $(this).data('url');
|
|
|
|
expandDesktopImage(url,url);
|
|
})
|
|
|
|
$('.text-expand').click(function(event){
|
|
if (event.which != 1) {
|
|
return
|
|
};
|
|
id=$(this).data('id');
|
|
|
|
|
|
$('#post-text-'+id).toggleClass('d-none');
|
|
$('.text-expand-icon-'+id).toggleClass('fa-expand-alt');
|
|
$('.text-expand-icon-'+id).toggleClass('fa-compress-alt');
|
|
|
|
})
|
|
|
|
// Text Formatting
|
|
|
|
// Bold Text
|
|
|
|
makeBold = function (form) {
|
|
var text = document.getElementById(form);
|
|
var startIndex = text.selectionStart,
|
|
endIndex = text.selectionEnd;
|
|
var selectedText = text.value.substring(startIndex, endIndex);
|
|
|
|
var format = '**'
|
|
|
|
if (selectedText.includes('**')) {
|
|
text.value = selectedText.replace(/\*/g, '');
|
|
|
|
}
|
|
else if (selectedText.length == 0) {
|
|
text.value = text.value.substring(0, startIndex) + selectedText + text.value.substring(endIndex);
|
|
}
|
|
else {
|
|
text.value = text.value.substring(0, startIndex) + format + selectedText + format + text.value.substring(endIndex);
|
|
}
|
|
}
|
|
|
|
// Italicize Comment Text
|
|
|
|
makeItalics = function (form) {
|
|
var text = document.getElementById(form);
|
|
var startIndex = text.selectionStart,
|
|
endIndex = text.selectionEnd;
|
|
var selectedText = text.value.substring(startIndex, endIndex);
|
|
|
|
var format = '*'
|
|
|
|
if (selectedText.includes('*')) {
|
|
text.value = selectedText.replace(/\*/g, '');
|
|
|
|
}
|
|
else if (selectedText.length == 0) {
|
|
text.value = text.value.substring(0, startIndex) + selectedText + text.value.substring(endIndex);
|
|
}
|
|
else {
|
|
text.value = text.value.substring(0, startIndex) + format + selectedText + format + text.value.substring(endIndex);
|
|
}
|
|
}
|
|
|
|
// Quote Comment Text
|
|
|
|
makeQuote = function (form) {
|
|
var text = document.getElementById(form);
|
|
var startIndex = text.selectionStart,
|
|
endIndex = text.selectionEnd;
|
|
var selectedText = text.value.substring(startIndex, endIndex);
|
|
|
|
var format = '>'
|
|
|
|
if (selectedText.includes('>')) {
|
|
text.value = text.value.substring(0, startIndex) + selectedText.replace(/\>/g, '') + text.value.substring(endIndex);
|
|
|
|
}
|
|
else if (selectedText.length == 0) {
|
|
text.value = text.value.substring(0, startIndex) + selectedText + text.value.substring(endIndex);
|
|
}
|
|
else {
|
|
text.value = text.value.substring(0, startIndex) + format + selectedText + text.value.substring(endIndex);
|
|
}
|
|
}
|
|
|
|
// Expand Images on Desktop
|
|
|
|
function expandDesktopImage(image, link) {
|
|
|
|
// Link text
|
|
|
|
var linkText = document.getElementById("desktop-expanded-image-link");
|
|
var imgLink = document.getElementById("desktop-expanded-image-wrap-link");
|
|
|
|
var inlineImage = document.getElementById("desktop-expanded-image");
|
|
|
|
inlineImage.src = image.replace("100w.gif", "giphy.gif");
|
|
linkText.href = image;
|
|
imgLink.href=image;
|
|
|
|
linkText.textContent = 'View original';
|
|
};
|
|
|
|
post_comment=function(fullname){
|
|
|
|
|
|
var form = new FormData();
|
|
|
|
form.append('formkey', formkey());
|
|
form.append('parent_fullname', fullname);
|
|
form.append('submission', document.getElementById('reply-form-submission-'+fullname).value);
|
|
form.append('body', document.getElementById('reply-form-body-'+fullname).value);
|
|
form.append('file', document.getElementById('file-upload-reply-'+fullname).files[0]);
|
|
var xhr = new XMLHttpRequest();
|
|
xhr.open("post", "/api/comment");
|
|
xhr.withCredentials=true;
|
|
xhr.onload=function(){
|
|
if (xhr.status==200) {
|
|
commentForm=document.getElementById('comment-form-space-'+fullname);
|
|
commentForm.innerHTML=JSON.parse(xhr.response)["html"];
|
|
$('#toast-comment-success').toast('dispose');
|
|
$('#toast-comment-error').toast('dispose');
|
|
$('#toast-comment-success').toast('show');
|
|
}
|
|
else {
|
|
var commentError = document.getElementById("comment-error-text");
|
|
$('#toast-comment-success').toast('dispose');
|
|
$('#toast-comment-error').toast('dispose');
|
|
$('#toast-comment-error').toast('show');
|
|
commentError.textContent = JSON.parse(xhr.response)["error"];
|
|
}
|
|
}
|
|
xhr.send(form)
|
|
|
|
document.getElementById('save-reply-to-'+fullname).classList.add('disabled');
|
|
|
|
}
|
|
|
|
herald_comment=function(bid,cid){
|
|
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
xhr.open("post", "/mod/distinguish_comment/"+bid+'/'+cid);
|
|
|
|
var form = new FormData();
|
|
|
|
form.append('formkey', formkey());
|
|
|
|
xhr.withCredentials=true;
|
|
xhr.onload=function(){
|
|
if (xhr.status==200) {
|
|
comment=document.getElementById('comment-'+cid+'-only');
|
|
comment.innerHTML=JSON.parse(xhr.response)["html"];
|
|
}
|
|
else {
|
|
var commentError = document.getElementById("comment-error-text");
|
|
$('#toast-comment-success').toast('dispose');
|
|
$('#toast-comment-error').toast('dispose');
|
|
$('#toast-comment-error').toast('show');
|
|
commentError.textContent = JSON.parse(xhr.response)["error"];
|
|
}
|
|
}
|
|
xhr.send(form)
|
|
|
|
}
|
|
|
|
comment_edit=function(id){
|
|
|
|
var commentError = document.getElementById("comment-error-text");
|
|
|
|
var form = new FormData();
|
|
|
|
form.append('formkey', formkey());
|
|
form.append('body', document.getElementById('comment-edit-body-'+id).value);
|
|
form.append('file', document.getElementById('file-edit-reply-'+id).files[0]);
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
xhr.open("post", "/edit_comment/"+id);
|
|
xhr.withCredentials=true;
|
|
xhr.onload=function(){
|
|
if (xhr.status==200) {
|
|
commentForm=document.getElementById('comment-text-'+id);
|
|
commentForm.innerHTML=JSON.parse(xhr.response)["html"];
|
|
document.getElementById('cancel-edit-'+id).click()
|
|
$('#toast-comment-success').toast('dispose');
|
|
$('#toast-comment-error').toast('dispose');
|
|
$('#toast-comment-success').toast('show');
|
|
}
|
|
else {
|
|
$('#toast-comment-success').toast('dispose');
|
|
$('#toast-comment-error').toast('dispose');
|
|
$('#toast-comment-error').toast('show');
|
|
commentError.textContent = JSON.parse(xhr.response)["error"];
|
|
}
|
|
}
|
|
xhr.send(form)
|
|
|
|
}
|
|
|
|
|
|
block_user=function() {
|
|
|
|
var exileForm = document.getElementById("exile-form");
|
|
|
|
var exileError = document.getElementById("toast-error-message");
|
|
|
|
var usernameField = document.getElementById("exile-username");
|
|
|
|
var isValidUsername = usernameField.checkValidity();
|
|
|
|
username = usernameField.value;
|
|
|
|
if (isValidUsername) {
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
xhr.open("post", "/settings/block");
|
|
xhr.withCredentials=true;
|
|
f=new FormData();
|
|
f.append("username", username);
|
|
f.append("formkey", formkey());
|
|
xhr.onload=function(){
|
|
if (xhr.status<300) {
|
|
window.location.reload(true);
|
|
}
|
|
else {
|
|
$('#toast-exile-error').toast('dispose');
|
|
$('#toast-exile-error').toast('show');
|
|
exileError.textContent = JSON.parse(xhr.response)["error"];
|
|
}
|
|
}
|
|
xhr.send(f)
|
|
}
|
|
|
|
}
|
|
|
|
//mobile prompt
|
|
if (("standalone" in window.navigator) && // Check if "standalone" property exists
|
|
window.navigator.standalone){ // Test if using standalone navigator
|
|
|
|
// Web page is loaded via app mode (full-screen mode)
|
|
// (window.navigator.standalone is TRUE if user accesses website via App Mode)
|
|
|
|
} else {
|
|
if (window.innerWidth <= 737){
|
|
try {
|
|
$('#mobile-prompt').tooltip('show')
|
|
$('.tooltip')[0].addEventListener(
|
|
'click',
|
|
function(event){
|
|
$('#mobile-prompt').tooltip('hide')
|
|
var xhr = new XMLHttpRequest();
|
|
xhr.withCredentials=true;
|
|
xhr.open("POST", '/dismiss_mobile_tip', true);
|
|
xhr.send();
|
|
}
|
|
)
|
|
} catch (error) {
|
|
console.error(error);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Voting
|
|
|
|
var upvote = function(event) {
|
|
|
|
var type = event.target.dataset.contentType;
|
|
var id = event.target.dataset.idUp;
|
|
|
|
var downvoteButton = document.getElementsByClassName(type + '-' + id + '-down');
|
|
var upvoteButton = document.getElementsByClassName(type + '-' + id + '-up');
|
|
var scoreText = document.getElementsByClassName(type + '-score-' + id);
|
|
|
|
for (var j = 0; j < upvoteButton.length && j < downvoteButton.length && j < scoreText.length; j++) {
|
|
|
|
var thisUpvoteButton = upvoteButton[j];
|
|
var thisDownvoteButton = downvoteButton[j];
|
|
var thisScoreText = scoreText[j];
|
|
var thisScore = Number(thisScoreText.textContent);
|
|
|
|
if (thisUpvoteButton.classList.contains('active')) {
|
|
thisUpvoteButton.classList.remove('active')
|
|
thisScoreText.textContent = thisScore - 1
|
|
voteDirection = "0"
|
|
} else if (thisDownvoteButton.classList.contains('active')) {
|
|
thisUpvoteButton.classList.add('active')
|
|
thisDownvoteButton.classList.remove('active')
|
|
thisScoreText.textContent = thisScore + 2
|
|
voteDirection = "1"
|
|
} else {
|
|
thisUpvoteButton.classList.add('active')
|
|
thisScoreText.textContent = thisScore + 1
|
|
voteDirection = "1"
|
|
}
|
|
|
|
if (thisUpvoteButton.classList.contains('active')) {
|
|
thisScoreText.classList.add('score-up')
|
|
thisScoreText.classList.remove('score-down')
|
|
thisScoreText.classList.remove('score')
|
|
} else if (thisDownvoteButton.classList.contains('active')) {
|
|
thisScoreText.classList.add('score-down')
|
|
thisScoreText.classList.remove('score-up')
|
|
thisScoreText.classList.remove('score')
|
|
} else {
|
|
thisScoreText.classList.add('score')
|
|
thisScoreText.classList.remove('score-up')
|
|
thisScoreText.classList.remove('score-down')
|
|
}
|
|
}
|
|
|
|
post_toast("/api/vote/" + type + "/" + id + "/" + voteDirection);
|
|
|
|
}
|
|
|
|
var downvote = function(event) {
|
|
|
|
var type = event.target.dataset.contentType;
|
|
var id = event.target.dataset.idDown;
|
|
|
|
var downvoteButton = document.getElementsByClassName(type + '-' + id + '-down');
|
|
var upvoteButton = document.getElementsByClassName(type + '-' + id + '-up');
|
|
var scoreText = document.getElementsByClassName(type + '-score-' + id);
|
|
|
|
for (var j = 0; j < upvoteButton.length && j < downvoteButton.length && j < scoreText.length; j++) {
|
|
|
|
var thisUpvoteButton = upvoteButton[j];
|
|
var thisDownvoteButton = downvoteButton[j];
|
|
var thisScoreText = scoreText[j];
|
|
var thisScore = Number(thisScoreText.textContent);
|
|
|
|
if (thisDownvoteButton.classList.contains('active')) {
|
|
thisDownvoteButton.classList.remove('active')
|
|
thisScoreText.textContent = thisScore + 1
|
|
voteDirection = "0"
|
|
} else if (thisUpvoteButton.classList.contains('active')) {
|
|
thisDownvoteButton.classList.add('active')
|
|
thisUpvoteButton.classList.remove('active')
|
|
thisScoreText.textContent = thisScore - 2
|
|
voteDirection = "-1"
|
|
} else {
|
|
thisDownvoteButton.classList.add('active')
|
|
thisScoreText.textContent = thisScore - 1
|
|
voteDirection = "-1"
|
|
}
|
|
|
|
if (thisUpvoteButton.classList.contains('active')) {
|
|
thisScoreText.classList.add('score-up')
|
|
thisScoreText.classList.remove('score-down')
|
|
thisScoreText.classList.remove('score')
|
|
} else if (thisDownvoteButton.classList.contains('active')) {
|
|
thisScoreText.classList.add('score-down')
|
|
thisScoreText.classList.remove('score-up')
|
|
thisScoreText.classList.remove('score')
|
|
} else {
|
|
thisScoreText.classList.add('score')
|
|
thisScoreText.classList.remove('score-up')
|
|
thisScoreText.classList.remove('score-down')
|
|
}
|
|
}
|
|
|
|
post_toast("/api/vote/" + type + "/" + id + "/" + voteDirection);
|
|
|
|
}
|
|
|
|
|
|
var register_votes = function() {
|
|
var upvoteButtons = document.getElementsByClassName('upvote-button')
|
|
|
|
var downvoteButtons = document.getElementsByClassName('downvote-button')
|
|
|
|
var voteDirection = 0
|
|
|
|
for (var i = 0; i < upvoteButtons.length; i++) {
|
|
upvoteButtons[i].addEventListener('click', upvote, false);
|
|
upvoteButtons[i].addEventListener('keydown', function(event) {
|
|
if (event.keyCode === 13) {
|
|
upvote(event)
|
|
}
|
|
}, false)
|
|
};
|
|
|
|
for (var i = 0; i < downvoteButtons.length; i++) {
|
|
downvoteButtons[i].addEventListener('click', downvote, false);
|
|
downvoteButtons[i].addEventListener('keydown', function(event) {
|
|
if (event.keyCode === 13) {
|
|
downvote(event)
|
|
}
|
|
}, false)
|
|
};
|
|
}
|
|
|
|
register_votes()
|
|
|
|
function vote_comment(comment_id, direction) {
|
|
url="/api/vote/comment/"+ comment_id +"/"+direction;
|
|
|
|
callback=function(){
|
|
thing = document.getElementById("comment-"+ comment_id+"-actions");
|
|
uparrow1=document.getElementById("comment-"+ comment_id +"-up");
|
|
downarrow1=document.getElementById("comment-"+ comment_id +"-down");
|
|
scoreup1=document.getElementById("comment-"+ comment_id +"-score-up");
|
|
scorenone1=document.getElementById("comment-"+ comment_id +"-score-none");
|
|
scoredown1=document.getElementById("comment-"+ comment_id +"-score-down");
|
|
|
|
if (direction=="1") {
|
|
thing.classList.add("upvoted");
|
|
thing.classList.remove("downvoted");
|
|
uparrow1.onclick=function(){vote_comment(comment_id, 0)};
|
|
downarrow1.onclick=function(){vote_comment(comment_id, -1)};
|
|
scoreup1.classList.remove("d-none");
|
|
scorenone1.classList.add("d-none");
|
|
scoredown1.classList.add("d-none");
|
|
}
|
|
else if (direction=="-1"){
|
|
thing.classList.remove("upvoted");
|
|
thing.classList.add("downvoted");
|
|
uparrow1.onclick=function(){vote_comment(comment_id, 1)};
|
|
downarrow1.onclick=function(){vote_comment(comment_id, 0)};
|
|
scoreup1.classList.add("d-none");
|
|
scorenone1.classList.add("d-none");
|
|
scoredown1.classList.remove("d-none");
|
|
}
|
|
else if (direction=="0"){
|
|
thing.classList.remove("upvoted");
|
|
thing.classList.remove("downvoted");
|
|
uparrow1.onclick=function(){vote_comment(comment_id, 1)};
|
|
downarrow1.onclick=function(){vote_comment(comment_id, -1)};
|
|
scoreup1.classList.add("d-none");
|
|
scorenone1.classList.remove("d-none");
|
|
scoredown1.classList.add("d-none");
|
|
}
|
|
}
|
|
|
|
post(url, callback, "Unable to vote at this time. Please try again later.");
|
|
}
|
|
</script>
|
|
{% if v %}
|
|
<script src="https://js.pusher.com/beams/1.0/push-notifications-cdn.js"></script>
|
|
|
|
<script>
|
|
const beamsClient = new PusherPushNotifications.Client({
|
|
instanceId: '02ddcc80-b8db-42be-9022-44c546b4dce6',
|
|
});
|
|
|
|
beamsClient
|
|
.start()
|
|
.then((beamsClient) => beamsClient.getDeviceId())
|
|
.then(() => beamsClient.addDeviceInterest(v.strid))
|
|
.then(() => beamsClient.getDeviceInterests())
|
|
.catch(console.error);
|
|
</script>
|
|
{% endif %}
|
|
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
|
|
|
<meta name="thumbnail" content="/assets/images/preview.png">
|
|
|
|
<link rel="icon" type="image/png" href="/assets/images/favicon.png">
|
|
|
|
{% block title %}
|
|
<title>Drama</title>
|
|
|
|
<meta property="og:type" content="article" />
|
|
<meta property="og:title" content="Drama" />
|
|
<meta property="og:site_name" content="rdrama.net" />
|
|
<meta property="og:image" content="{{'/assets/images/preview.png' | full_link}}" />
|
|
<meta property="og:url" content="{{request.path | full_link}}">
|
|
<meta property="og:description" name="description" content="Dude bussy lmao">
|
|
<meta property="og:author" name="author" content="@drama" />
|
|
<meta property="og:site_name" content="rdrama.net" />
|
|
|
|
<meta name="twitter:card" content="summary_large_image"/>
|
|
<meta name="twitter:site" content="@drama">
|
|
<meta name="twitter:title" content="Drama" />
|
|
<meta name="twitter:creator" content="@drama">
|
|
<meta name="twitter:description" content="Dude bussy lmao" />
|
|
<meta name="twitter:image" content="/assets/images/preview.png" />
|
|
<meta name="twitter:url" content="{{request.path | full_link}}" />
|
|
{% endblock %}
|
|
|
|
<!-- Bootstrap core CSS -->
|
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
|
|
integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
|
|
|
|
<!-- iOS webapp -->
|
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
<meta name="apple-touch-fullscreen" content="yes">
|
|
<meta name="format-detection" content="telephone=no">
|
|
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
|
|
|
|
<link rel="apple-touch-icon" sizes="180x180" href="/assets/images/favicon.png">
|
|
<!---<link rel="icon" type="image/png" sizes="32x32" href="/assets/images/favicon.png">
|
|
<link rel="icon" type="image/png" sizes="16x16" href="/assets/images/favicon.png">--->
|
|
<link rel="manifest" href="/assets/manifest.json">
|
|
<link rel="mask-icon" href="/assets/images/favicon.png" color="#FF66AC">
|
|
<link rel="shortcut icon" href="/assets/images/favicon.png">
|
|
<meta name="apple-mobile-web-app-title" content="Drama">
|
|
<meta name="application-name" content="Drama">
|
|
<meta name="msapplication-TileColor" content="#FF66AC">
|
|
<meta name="msapplication-config" content="/assets/images/browserconfig.xml">
|
|
<meta name="theme-color" content="#FF66AC">
|
|
|
|
|
|
|
|
<link
|
|
rel="apple-touch-startup-image"
|
|
sizes="320x480"
|
|
href="/assets/images/favicon.png"
|
|
/>
|
|
<link
|
|
rel="apple-touch-startup-image"
|
|
sizes="640x960"
|
|
href="/assets/images/favicon.png"
|
|
/>
|
|
<link
|
|
rel="apple-touch-icon"
|
|
sizes="640x1136"
|
|
href="/assets/images/favicon.png"
|
|
/>
|
|
<link
|
|
rel="apple-touch-icon"
|
|
sizes="750x1334"
|
|
href="/assets/images/favicon.png"
|
|
/>
|
|
<link
|
|
rel="apple-touch-startup-image"
|
|
sizes="768x1004"
|
|
href="/assets/images/favicon.png"
|
|
/>
|
|
<link
|
|
rel="apple-touch-startup-image"
|
|
sizes="768x1024"
|
|
href="/assets/images/favicon.png"
|
|
/>
|
|
<link
|
|
rel="apple-touch-startup-image"
|
|
sizes="828x1792"
|
|
href="/assets/images/favicon.png"
|
|
/>
|
|
<link
|
|
rel="apple-touch-startup-image"
|
|
sizes="1024x748"
|
|
href="/assets/images/favicon.png"
|
|
/>
|
|
<link
|
|
rel="apple-touch-startup-image"
|
|
sizes="1024x768"
|
|
href="/assets/images/favicon.png"
|
|
/>
|
|
<link
|
|
rel="apple-touch-startup-image"
|
|
sizes="1125x2436"
|
|
href="/assets/images/favicon.png"
|
|
/>
|
|
<link
|
|
rel="apple-touch-startup-image"
|
|
sizes="1242x2208"
|
|
href="/assets/images/favicon.png"
|
|
/>
|
|
<link
|
|
rel="apple-touch-startup-image"
|
|
sizes="1242x2688"
|
|
href="/assets/images/favicon.png"
|
|
/>
|
|
<link
|
|
rel="apple-touch-startup-image"
|
|
sizes="1334x750"
|
|
href="/assets/images/favicon.png"
|
|
/>
|
|
<link
|
|
rel="apple-touch-startup-image"
|
|
sizes="1536x2008"
|
|
href="/assets/images/favicon.png"
|
|
/>
|
|
<link
|
|
rel="apple-touch-startup-image"
|
|
sizes="1536x2048"
|
|
href="/assets/images/favicon.png"
|
|
/>
|
|
<link
|
|
rel="apple-touch-startup-image"
|
|
sizes="1668x2224"
|
|
href="/assets/images/favicon.png"
|
|
/>
|
|
<link
|
|
rel="apple-touch-startup-image"
|
|
sizes="1792x828"
|
|
href="/assets/images/favicon.png"
|
|
/>
|
|
<link
|
|
rel="apple-touch-startup-image"
|
|
sizes="2048x1496"
|
|
href="/assets/images/favicon.png"
|
|
/>
|
|
<link
|
|
rel="apple-touch-startup-image"
|
|
sizes="2048x1536"
|
|
href="/assets/images/favicon.png"
|
|
/>
|
|
<link
|
|
rel="apple-touch-startup-image"
|
|
sizes="2048x2732"
|
|
href="/assets/images/favicon.png"
|
|
/>
|
|
<link
|
|
rel="apple-touch-startup-image"
|
|
sizes="2208x1242"
|
|
href="/assets/images/favicon.png"
|
|
/>
|
|
<link
|
|
rel="apple-touch-startup-image"
|
|
sizes="2224x1668"
|
|
href="/assets/images/favicon.png"
|
|
/>
|
|
<link
|
|
rel="apple-touch-startup-image"
|
|
sizes="2436x1125"
|
|
href="/assets/images/favicon.png"
|
|
/>
|
|
<link
|
|
rel="apple-touch-startup-image"
|
|
sizes="2668x1242"
|
|
href="/assets/images/favicon.png"
|
|
/>
|
|
<link
|
|
rel="apple-touch-startup-image"
|
|
sizes="2737x2048"
|
|
href="/assets/images/favicon.png"
|
|
/>
|
|
|
|
|
|
|
|
<!-- Drama CSS -->
|
|
|
|
{% block stylesheets %}
|
|
|
|
{% if v %}
|
|
<link rel="stylesheet" href="/assets/style/{{v.theme}}_{{v.themecolor}}.css">
|
|
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/style/agendaposter.css">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
|
|
{% else %}
|
|
<link rel="stylesheet" href="/assets/style/dark_ff66ac.css">
|
|
{% endif %}
|
|
|
|
{% endblock %}
|
|
|
|
<!-- Font Awesome -->
|
|
<link href="/assets/style/fa.css" rel="stylesheet"> <!--load all styles -->
|
|
|
|
{% block fixedMobileBarJS %}
|
|
{% endblock %}
|
|
|
|
{% if v %}
|
|
|
|
<script>
|
|
function formkey() {
|
|
return '{{v.formkey}}';
|
|
}
|
|
</script>
|
|
{% endif %}
|
|
|
|
</head>
|
|
|
|
<body id="{% if request.path != '/comments' %}{% block pagetype %}frontpage{% endblock %}{% endif %}" style="overflow-x: hidden;">
|
|
<a href="https://secure.actblue.com/donate/ms_blm_homepage_2019"><img src="/assets/images/blm.png" width="100%"></a>
|
|
|
|
{% include "header.html" %}
|
|
|
|
<!-- Page Content -->
|
|
|
|
{% block mobileUserBanner %}
|
|
{% endblock %}
|
|
|
|
{% block mobileBanner %}
|
|
{% endblock %}
|
|
|
|
{% block postNav %}
|
|
{% endblock %}
|
|
|
|
<div class="container">
|
|
<div class="row justify-content-around" id="main-content-row">
|
|
|
|
{% block leftSidebar %}
|
|
{% block leftSidebarBlock %}
|
|
{% endblock %}
|
|
{% endblock %}
|
|
|
|
<div class="col h-100 {% block customPadding %}{% if not '/message' in request.path %}custom-gutters{% endif %}{% endblock %}" id="main-content-col">
|
|
|
|
{% block desktopUserBanner %}
|
|
{% endblock %}
|
|
|
|
{% block desktopBanner %}
|
|
{% endblock %}
|
|
|
|
{% block PseudoSubmitForm %}
|
|
{% endblock %}
|
|
|
|
{% block searchText %}
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
{% endblock %}
|
|
|
|
{% block pagenav %}
|
|
{% endblock %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
{% block mobilenavbar %}
|
|
{% include "mobile_navigation_bar.html" %}
|
|
{% endblock %}
|
|
|
|
{% block actionsModal %}
|
|
{% endblock %}
|
|
|
|
{% block reportCommentModal %}
|
|
{% endblock %}
|
|
|
|
{% block guildModal %}
|
|
{% endblock %}
|
|
|
|
{% block GIFtoast %}
|
|
{% endblock %}
|
|
|
|
{% block GIFpicker %}
|
|
{% endblock %}
|
|
|
|
<!-- Clipboard Toast -->
|
|
|
|
<div class="toast clipboard" id="toast-success" role="alert" aria-live="assertive" aria-atomic="true" data-animation="true" data-autohide="true" data-delay="5000">
|
|
<div class="toast-body text-center">
|
|
<i class="fas fa-check-circle text-success mr-2"></i>Link copied to clipboard
|
|
</div>
|
|
</div>
|
|
|
|
<div class="toast clipboard" id="toast-error" role="alert" aria-live="assertive" aria-atomic="true" data-animation="true" data-autohide="true" data-delay="5000">
|
|
<div class="toast-body text-center">
|
|
<i class="fas fa-exclamation-circle text-danger mr-2"></i>Unable to copy link
|
|
</div>
|
|
</div>
|
|
|
|
<div class="toast" id="toast-post-success" style="position: fixed; bottom: 1.5rem; margin: 0 auto; left: 0; right: 0; width: 275px; z-index: 1000" role="alert" aria-live="assertive" aria-atomic="true" data-animation="true" data-autohide="true" data-delay="5000">
|
|
<div class="toast-body bg-success text-center text-white">
|
|
<i class="fas fa-comment-alt-smile mr-2"></i><span id="toast-post-success-text"></span>
|
|
</div>
|
|
</div>
|
|
<div class="toast" id="toast-post-error" style="position: fixed; bottom: 1.5rem; margin: 0 auto; left: 0; right: 0; width: 275px; z-index: 1000" role="alert" aria-live="assertive" aria-atomic="true" data-animation="true" data-autohide="true" data-delay="5000">
|
|
<div class="toast-body bg-danger text-center text-white">
|
|
<i class="fas fa-exclamation-circle mr-2"></i><span id="toast-post-error-text"></span>
|
|
</div>
|
|
</div>
|
|
|
|
{% if v %}
|
|
{% include "flag_post_modal.html" %}
|
|
{% include "flag_comment_modal.html" %}
|
|
{% include "gif_modal.html" %}
|
|
{% include "delete_comment_modal.html" %}
|
|
{% include "delete_post_modal.html" %}
|
|
{% endif %}
|
|
|
|
{% include "expanded_image_modal.html" %}
|
|
|
|
<script src="/assets/js/all_js.js"></script>
|
|
|
|
<!-- ClipboardJS -->
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js"></script>
|
|
|
|
<!-- Instantiate clipboard by passing a string selector -->
|
|
<script type="text/javascript">
|
|
var clipboard = new ClipboardJS('.copy-link');
|
|
clipboard.on('success', function(e) {
|
|
|
|
jQuery(function($) {
|
|
$('#toast-success').toast('show');
|
|
})
|
|
console.log(e);
|
|
});
|
|
clipboard.on('error', function(e) {
|
|
|
|
jQuery(function($) {
|
|
$('#toast-error').toast('show');
|
|
})
|
|
console.log(e);
|
|
});
|
|
</script>
|
|
|
|
<!-- Mobile "install the app" tooltip -->
|
|
|
|
|
|
{% if request.path=='/' and g.system and g.timestamp>session.get('tooltip_last_dismissed',0)+60*60*24 and (not g.system.endswith('/chrome') and not g.system.endswith('/other')) and not g.system.endswith('/webview') %}
|
|
|
|
<div id="mobile-prompt-container" class="fixed-bottom">
|
|
<div id="mobile-prompt" href="javascript:void(0)" data-toggle="tooltip" data-container="#mobile-prompt-container" data-placement="top" data-trigger="click" title="Install the Drama webapp by saving this page to your home screen!"></div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
</body>
|
|
|
|
</html> |