Files
dokuwiki-plugin-do/scripts/userTasksOverlay.js
Michael Große 0f68f75c40 Change usertasks button to html <button> tag
Since the link is not actually a link, it is not linking to another page
nor to an anchor on the current page, change it to a button. This
represents the actual function better and has the positive side effect
that the button is now reachable via tab-key on the keyboard.

SPR-977
2017-05-02 16:54:53 +02:00

36 lines
1.1 KiB
JavaScript

// eslint-disable-next-line func-names
jQuery(function () {
'use strict';
var $userTasksButtons = jQuery('button.plugin__do_usertasks');
$userTasksButtons.click(function handleUserTasksButtonClick(event) {
var $this;
event.stopPropagation();
event.preventDefault();
if (jQuery('.plugin__do_usertasks_list').length) {
jQuery('.plugin__do_usertasks_list').toggle();
return;
}
$this = jQuery(this);
jQuery.get(
DOKU_BASE + 'lib/exe/ajax.php',
{
call: 'plugin_do_userTasksOverlay',
}
).done(function showUserTasksOverlay(data) {
var $wrapper = jQuery('<div class="plugin__do_usertasks_list"></div>');
$wrapper.css({ display: 'inline-block', position: 'absolute' });
$wrapper.append(jQuery(data));
$wrapper.appendTo('.dokuwiki');
$wrapper.position({
my: 'middle top',
at: 'right bottom',
of: $this,
});
});
});
});