Dateien nach "js" hochladen

This commit is contained in:
M_Viper 2025-03-06 21:37:43 +00:00
parent aa6ce3d6b3
commit 457b31c3db
3 changed files with 71 additions and 0 deletions

View File

@ -0,0 +1,16 @@
document.addEventListener("DOMContentLoaded", function () {
const btn = document.getElementById("wp_multi_insert_shortcode");
const dropdown = document.getElementById("wp_multi_shortcode_dropdown");
if (btn && dropdown) {
btn.addEventListener("click", function () {
const shortcode = dropdown.value;
if (shortcode) {
window.send_to_editor("[" + shortcode + "]");
} else {
alert("Bitte einen Shortcode auswählen.");
}
});
}
});

21
js/tinymce-shortcodes.js Normal file
View File

@ -0,0 +1,21 @@
(function() {
tinymce.create('tinymce.plugins.wp_multi_shortcodes', {
init: function(editor, url) {
editor.addButton('wp_multi_shortcodes', {
type: 'menubutton',
text: 'Shortcodes',
icon: false,
menu: wpMultiShortcodes.map(function(shortcode) {
return {
text: shortcode.shortcode_name,
onclick: function() {
editor.insertContent('[' + shortcode.shortcode_name + ']');
}
};
})
});
}
});
tinymce.PluginManager.add('wp_multi_shortcodes', tinymce.plugins.wp_multi_shortcodes);
})();

34
js/wp-stat-notice.js Normal file
View File

@ -0,0 +1,34 @@
jQuery(document).ready(function($) {
// Wenn der Benutzer den Button zum Melden des Beitrags klickt
$('body').on('click', '.report-post', function() {
var postId = $(this).data('post-id');
$(this).next('.report-reason').toggle(); // Zeigt das Textfeld zum Gründen an
});
// Wenn der Benutzer das Formular absendet
$('body').on('click', '#submit-report', function() {
var postId = $(this).closest('.report-reason').prev('.report-post').data('post-id');
var reason = $('#report-reason').val();
if (reason.trim() == '') {
alert('Bitte geben Sie einen Grund an.');
return;
}
// AJAX-Anfrage, um den Report zu senden
$.post(ajaxurl, {
action: 'report_post',
post_id: postId,
reason: reason
}, function(response) {
if (response.success) {
alert('Bericht erfolgreich gesendet!');
// Verstecke das Formular nach dem Absenden
$('#report-reason').val('');
$('#submit-report').closest('.report-reason').hide();
} else {
alert('Fehler beim Senden des Berichts.');
}
});
});
});