/** * Delete Page Button plugin scripts * * @copyright (c) 2020 Damien Regad * @license GPLv2 or later (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * @author Damien Regad */ jQuery(function() { // Get current template name, see action_plugin_deletepagebutton::addJsInfo() // noinspection JSUnresolvedVariable let template = JSINFO.deletepagebutton_template; // jQuery selector for the Delete Page button let selector; switch (template) { case 'bootstrap3': selector = 'li.action a.deletepagebutton'; break; // Default selector (from DokuWiki default template) case 'dokuwiki': default: selector = '.deletepagebutton a'; } let $button = jQuery(selector); if ($button.length === 0) { const urlGitHubNewIssue = 'https://github.com/dregad/dokuwiki-plugin-deletepagebutton/issues/new' + "?labels=bug" + "&title=Confirmation+dialog+not+working+with+" + template + "+template" + "&body=Please+provide+sample+HTML+for+the+*Delete+Page*+button"; console.warn( "DokuWiki DeletePageButton plugin: Template '" + template + "' " + "is not fully supported (the Confirmation dialog will not work). " + "Please report the problem by clicking the following URL " + urlGitHubNewIssue ); return; } $button.on('click', function(e) { e.preventDefault(); let submit_url = this.href; let $dialog = jQuery( '