MediaWiki:Gadget-oswf-core.js
Revision as of 18:25, 3 October 2022 by Jacmob (talk | contribs) (Created page with "var showText = 'Get started with this task', hideText = 'Hide additional info', showTitle = 'Show the guidance for this task', hideTitle = 'Hide the guidance for this task'; function init() { $('.oswf-guidance').each(function(i,e){ var $this = $(e), $content, toggleButton, showing = false; $content = $('<div>').append($this.contents()); $content.hide(); toggleButton = new OO.ui.ButtonWidget({ icon: 'expand', title: showTitle, label: showTex...")
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
1 var showText = 'Get started with this task',
2 hideText = 'Hide additional info',
3 showTitle = 'Show the guidance for this task',
4 hideTitle = 'Hide the guidance for this task';
5
6 function init() {
7 $('.oswf-guidance').each(function(i,e){
8 var $this = $(e),
9 $content,
10 toggleButton,
11 showing = false;
12
13 $content = $('<div>').append($this.contents());
14 $content.hide();
15
16 toggleButton = new OO.ui.ButtonWidget({
17 icon: 'expand',
18 title: showTitle,
19 label: showText,
20 flags: ['primary', 'progressive']
21 });
22
23 toggleButton.on('click', function(){
24 showing = !showing;
25 if (showing) {
26 toggleButton.setIcon('collapse').setTitle(hideTitle).setLabel(hideText);
27
28 } else {
29 toggleButton.setIcon('expand').setTitle(showTitle).setLabel(showText);
30 }
31 $content.toggle();
32 });
33
34 $this.append(toggleButton.$element).append($content);
35 });
36
37 }
38 $(init);