420
edits
HyperNervie (talk | contribs) (Created page with "Input these in your browser console: <pre> mw.loader.using("oojs-ui-widgets").then(function () { function convertToOOUITabber(_, tabberDiv) { const $tabberDiv = $(tabberDiv); const $labels = $tabberDiv.find( "> .rhwiki-tabberneue-menu" + "> .rhwiki-tabberneue-option" + "> .rhwiki-tabberneue-label" ); const $panels = $tabberDiv.find( "> .rhwiki-tabberneue-content" + "> .rhwiki-...") |
HyperNervie (talk | contribs) No edit summary |
||
| Line 1: | Line 1: | ||
Input these in your browser console: | Input these in your browser console: | ||
<pre> | <pre> | ||
mw. | mw.hook("wikipage.content").add(function ($content) { | ||
$content.find(".rhwiki-tabberneue").each(function (_, tabberDiv) { | |||
$(tabberDiv) | |||
.children(".rhwiki-tabberneue-menu") | |||
.children(".rhwiki-tabberneue-label") | |||
.each(function (_, labelDiv) { | |||
$(labelDiv).on("click", clickOnLabel); | |||
}); | |||
}); | |||
function clickOnLabel() { | |||
const $this = $(this); | |||
if ($this.hasClass("selected")) return; | |||
const $tabber = $this.closest(".rhwiki-tabberneue"); | |||
if ($tabber.length === 0) return; | |||
const $labels = $tabber | |||
.children(".rhwiki-tabberneue-menu") | |||
.children(".rhwiki-tabberneue-label"); | |||
const selected = $labels.index($this); | |||
if (selected < 0) return; | |||
const $panels = $tabber | |||
.children(".rhwiki-tabberneue-content") | |||
.children(".rhwiki-tabberneue-panel"); | |||
for (let i = 0; i < $labels.length && i < $panels.length; i++) | |||
if (i === selected) { | |||
$($labels[i]).addClass("selected"); | |||
$($panels[i]).removeClass("hidden"); | |||
} else { | |||
$($labels[i]).removeClass("selected"); | |||
$($panels[i]).addClass("hidden"); | |||
} | |||
} | |||
}); | }); | ||
</pre> | </pre> | ||
| Line 51: | Line 42: | ||
<hr style="margin:1em 0"> | <hr style="margin:1em 0"> | ||
Here we have only one visible panel at the beginning, and the labels are styled properly so that when [[MediaWiki:Gadget-Tabber.js]] loads, there won't be any change to page appearance. Even if the script doesn't load successfully, readers just can't switch panels by clicking on labels. | Here we have only one visible panel at the beginning, and the labels are styled properly so that when [[MediaWiki:Gadget-Tabber.js]] loads, there won't be any change to page appearance. Even if the script doesn't load successfully, readers just can't switch panels by clicking on labels. | ||
{{tabber | |||
|shown=3 | |||
|tab-centered=yes | |||
|content-centered=yes | |||
|tab-1=<span title="Rhythm Tengoku">[[File:ConsoleGBA Icon.png|32px|link=]]</span> | |||
|content-1=[[File:Prologue GBA The Clappy Trio 2.png|240px]] | |||
|tab-2=<span title="Rhythm Tengoku (Arcade)">[[File:ConsoleArcade Icon.png|32px|link=]]</span> | |||
|content-2=[[File:Prologue Arcade The Clappy Trio 2.png|240px]] | |||
|tab-3=<span title="Rhythm Heaven Fever">[[File:ConsoleWii Icon.png|32px|link=]]</span> | |||
|content-3=[[File:Prologue Wii The Clappy Trio 2.png|240px]] | |||
|tab-4=<span title="Rhythm Heaven Megamix">[[File:Console3DS Icon.png|32px|link=]]</span> | |||
|content-4=[[File:Prologue 3DS The Clappy Trio 2.png|240px]] | |||
}} | |||
edits