MediaWiki:Common.js: Difference between revisions
m Add searchable floating contents panel |
m Use one floating page tools container |
||
| Line 14: | Line 14: | ||
}); | }); | ||
(function () { | |||
window.muhroGetFloatingTools = function () { | |||
var $tools = $('#muhro-floating-tools'); | |||
if (!$tools.length) { | |||
$tools = $('<div>') | |||
.attr('id', 'muhro-floating-tools') | |||
.addClass('muhro-floating-tools noprint'); | |||
$('body').append($tools); | |||
} | |||
return $tools; | |||
}; | |||
}()); | |||
(function () { | (function () { | ||
| Line 84: | Line 99: | ||
'aria-label': 'Collapsible content controls' | 'aria-label': 'Collapsible content controls' | ||
}) | }) | ||
.addClass('muhro-collapse-controls | .addClass('muhro-collapse-controls') | ||
.append($expand, $collapse); | .append($expand, $collapse); | ||
| Line 100: | Line 115: | ||
updateButtons($root, $expand, $collapse); | updateButtons($root, $expand, $collapse); | ||
window.muhroGetFloatingTools().prepend($controls); | |||
return true; | return true; | ||
} | } | ||
| Line 218: | Line 233: | ||
$wrapper = $('<div>') | $wrapper = $('<div>') | ||
.attr('id', 'muhro-floating-toc') | .attr('id', 'muhro-floating-toc') | ||
.addClass('muhro-floating-toc | .addClass('muhro-floating-toc') | ||
.append($button, $panel); | .append($button, $panel); | ||
| Line 243: | Line 258: | ||
}); | }); | ||
window.muhroGetFloatingTools().append($wrapper); | |||
} | } | ||
mw.hook('wikipage.content').add(addFloatingToc); | mw.hook('wikipage.content').add(addFloatingToc); | ||
}()); | }()); | ||