varios small changes

This commit is contained in:
noxy
2019-11-29 19:39:08 +00:00
parent 50ba00431b
commit 55be581dac
11 changed files with 48 additions and 18 deletions

7
public/njum/js/clipboard.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -1016,7 +1016,7 @@ function deleteComment(self) {
if(retval == 'success') {
flash('success', 'Comment deleted');
comment.removeClass('panel-default').addClass('panel-danger');
comment.find('.panel-footer').children('a[onclick="deleteComment($(this))"]').replaceWith('<a href="#" onclick="restoreComment($(this))"><i style="color:green"; class="fa fa-refresh" aria-hidden="true"></i></a>');
comment.find('.panel-footer').children('a[onclick="deleteComment($(this))"]').replaceWith('<a href="href="#' + id + '"' + 'onclick="restoreComment($(this))"><i style="color:green"; class="fa fa-refresh" aria-hidden="true"></i></a>');
comment.find('.panel-footer > a[onclick="editComment($(this))"]').remove();
}
else if(retval == 'invalid_request') flash('error', 'Invalid request');
@@ -1048,7 +1048,7 @@ function restoreComment(self) {
if(retval == 'success') {
flash('success', 'Comment restored');
comment.removeClass('panel-danger').addClass('panel-default');
comment.find('.panel-footer').children('a[onclick]').replaceWith('<a href="#" onclick="deleteComment($(this))"><i style="color:red"; class="fa fa-times" aria-hidden="true"></i></a> <a href="#" onclick="editComment($(this))"><i style="color:cyan;" class="fa fa-pencil-square" aria-hidden="true"></i></a>');
comment.find('.panel-footer').children('a[onclick]').replaceWith('<a href="href="#' + id + '"' + 'onclick="deleteComment($(this))"><i style="color:red"; class="fa fa-times" aria-hidden="true"></i></a> <a href="href="#' + id + '"' + 'onclick="editComment($(this))"><i style="color:cyan;" class="fa fa-pencil-square" aria-hidden="true"></i></a>');
}
else if(retval == 'invalid_request') flash('error', 'Invalid request');
else if(retval == 'not_logged_in') flash('error', 'Not logged in');
@@ -1074,11 +1074,11 @@ function editComment(self) {
body.replaceWith(textarea);
textarea.val($('<div>').html(retval.comment).text());
self.prev().remove();
self.replaceWith('<a href="#" class="saveCommentEdit">[save]</a> <a href="#" class="abortCommentEdit">[abort]</a>');
self.replaceWith('<a href="#" class="saveCommentEdit">[save]</a> <a href="#' + id + '"' + 'class="abortCommentEdit">[abort]</a>');
comment.find('.abortCommentEdit').on('click', function(e) {
e.preventDefault();
$(this).prev().remove();
$(this).replaceWith('<a class="delete_comment" href="#" onclick="deleteComment($(this))">[del]</a> <a class="edit_comment" href="#" onclick="editComment($(this))">[edit]</a>');
$(this).replaceWith('<a class="delete_comment" href="#' + id + '"' + 'onclick="deleteComment($(this))">[del]</a> <a class="edit_comment" href="#' + id + '"' + 'onclick="editComment($(this))">[edit]</a>');
textarea.replaceWith(body);
});
comment.find('.saveCommentEdit').on('click', function(e) {
@@ -1313,4 +1313,11 @@ function Copy() {
console.log(Url.innerHTML)
Url.select();
document.execCommand("copy");
}
}
// Vielen Dank an Flummi!
// This code snippet makes full and valid urls clickable in the info box!
const infoboxContent = document.querySelector("button#infobox");
if(infoboxContent)
infoboxContent.dataset.content = infoboxContent.dataset.content.replace(/(https?:\/\/[^\s]+)/g, "<a href='$1' target='_blank' rel='extern'>$1</a>");