22,688
edits
No edit summary |
mNo edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 62: | Line 62: | ||
sections[seci] = {}; | sections[seci] = {}; | ||
legends[0].className = 'mainTab'; | legends[0].className = 'mainTab'; | ||
sections[seci].html = legends[0].innerHTML; | |||
sections[seci].secid = children[i].id; | sections[seci].secid = children[i].id; | ||
seci++; | seci++; | ||
Line 88: | Line 84: | ||
a.href = '#' + sections[i].secid; | a.href = '#' + sections[i].secid; | ||
a.onmousedown = a.onclick = uncoverTabSection; | a.onmousedown = a.onclick = uncoverTabSection; | ||
a. | a.innerHTML = sections[i].html; | ||
a.tc = tc; | a.tc = tc; | ||
a.secid = sections[i].secid; | a.secid = sections[i].secid; | ||
Line 95: | Line 91: | ||
} | } | ||
tabcontainers[tc].parentNode.insertBefore( toc, tabcontainers[tc] ); | tabcontainers[tc].parentNode.insertBefore( toc, tabcontainers[tc] ); | ||
} | } | ||
} | } | ||
Line 121: | Line 114: | ||
} | } | ||
/* Fix hidden section links */ | |||
window.onhashchange = function() { | window.onhashchange = function() { | ||
escapedHash = $.escapeSelector(decodeURI(location.hash.split('#').pop())); | escapedHash = $.escapeSelector(decodeURI(location.hash.split('#').pop())); | ||
tabId = $('#' + escapedHash).closest('.tabsection').attr('id'); | tabId = $('#' + escapedHash).closest('.tabsection').attr('id'); | ||
if ( tabId ) { | if (tabId) { | ||
$('a[href="#' + tabId + '"]').click(); | $('a[href="#' + tabId + '"]').click(); | ||
} | |||
hiddenParents = $('#' + escapedHash).parents('.mw-collapsed'); | |||
if (hiddenParents.length) { | |||
hiddenParents.each(function() { | |||
$(this).find('.mw-collapsible-toggle-collapsed').first().click(); | |||
}); | |||
} | |||
if (tabId || hiddenParents.length) { | |||
location.href = location.hash; | location.href = location.hash; | ||
} | } | ||
} | } | ||
setTimeout(function() { | |||
if (location.hash) { | |||
window.dispatchEvent(new HashChangeEvent('hashchange')); | |||
} | |||
}, 100); | |||
$( tabSystem ); | $( tabSystem ); |