MediaWiki:Common.js/OOUI-IndexLayout-frameless.js
Chú ý: Sau khi lưu trang, có thể bạn sẽ phải xóa bộ nhớ đệm của trình duyệt để xem các thay đổi.
- Firefox / Safari: Nhấn giữ phím Shift trong khi nhấn Tải lại (Reload), hoặc nhấn tổ hợp Ctrl-F5 hay Ctrl-R (⌘R trên Mac)
- Google Chrome: Nhấn tổ hợp Ctrl-Shift-R (⇧⌘R trên Mac)
- Internet Explorer / Edge: Nhấn giữ phím Ctrl trong khi nhấn Làm tươi (Refresh), hoặc nhấn tổ hợp Ctrl-F5
- Opera: Nhấn tổ hợp Ctrl-F5.
mw.loader.using(["oojs-ui-widgets"], function() {
function trySettingTab(indexLayout, hash) {
var possiblePanelName = hash.slice(1);
var possiblePanel = possiblePanelName && indexLayout.getTabPanel(possiblePanelName);
if (possiblePanel) {
indexLayout.setTabPanel(possiblePanelName);
indexLayout.scrollElementIntoView();
}
}
function makeTabWindow($tabbedWindows) {
var tabs = [];
$tabbedWindows.each(function() {
var panelLayout;
var indexLayout = new OO.ui.IndexLayout({
expanded: false,
autoFocus: false,
framed: false
});
$(this).find(".indexLayout-tab").each(function() {
var id = mw.util.escapeIdForLink($(this).attr("title"))
+ "-" + $(this).parent(".mw-tabbed").attr("id");
$(this).attr("id", id);
var label = $(this).attr("title");
var content = $(this).html();
var tabPanel = new OO.ui.TabPanelLayout(id, {
expanded: false,
label: label,
$content: content
});
tabs.push(tabPanel);
});
indexLayout.addTabPanels(tabs);
tabs = [];
panelLayout = new OO.ui.PanelLayout({
expanded: false,
content: [indexLayout]
});
$(this).empty();
$(this).append(panelLayout.$element);
trySettingTab(indexLayout, location.hash);
if (history.replaceState) {
indexLayout.on("set", function(tabPanel) {
history.replaceState(null, document.title, "#" + tabPanel.getName());
});
}
window.addEventListener("hashchange", function () {
trySettingTab(indexLayout, location.hash);
});
});
}
var $tabbedWindows = $(".indexLayout.frameless");
makeTabWindow($tabbedWindows);
});