Skip to content

Commit

Permalink
more general global object, align with button Add Namespace
Browse files Browse the repository at this point in the history
nspicker looks as a copied general purpose ns picker. Therefore, just
override it.
Fixes #131
  • Loading branch information
Klap-in committed Jul 14, 2023
1 parent fc9297f commit cd23b2a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion script.js
Expand Up @@ -772,9 +772,18 @@ jQuery(function () {
});

//add namespace to selection button
bc_nspicker.init(jQuery('#dokuwiki__content'));
bc_nspicker.init(jQuery('.dokuwiki:first'));
jQuery('form.selectnamespace button').on('click', function(event) {
bc_nspicker.val = null;

//place dialog near the button
let offset = jQuery(this).offset();
let offsetparent = jQuery(this).parent().parent().offset();
bc_nspicker.$picker.css({
'top': offset.top + 'px',
'left': offsetparent.left - 0 + 'px',
});

bc_nspicker.toggle();
event.preventDefault();
return 'bc__nspicker';
Expand Down
2 changes: 1 addition & 1 deletion script/nspicker.js
Expand Up @@ -47,7 +47,7 @@ var bc_nspicker = {
.attr('id', 'bc__nspicker')
.css({
'position': 'absolute',
'top': (pos.top + 20) + 'px',
'top': (pos.top + 20) + 'px', //overwritten later with position of Add Namespace button.
'left': (pos.left + 80) + 'px'
})
.hide()
Expand Down

0 comments on commit cd23b2a

Please sign in to comment.