-window.showTocToggle = function() {
- if ( document.createTextNode ) {
- // Uses DOM calls to avoid document.write + XHTML issues
-
- var linkHolder = document.getElementById( 'toctitle' );
- var existingLink = document.getElementById( 'togglelink' );
- if ( !linkHolder || existingLink ) {
- // Don't add the toggle link twice
- return;
- }
-
- var outerSpan = document.createElement( 'span' );
- outerSpan.className = 'toctoggle';
-
- var toggleLink = document.createElement( 'a' );
- toggleLink.id = 'togglelink';
- toggleLink.className = 'internal';
- toggleLink.href = '#';
- addClickHandler( toggleLink, function( evt ) { toggleToc(); return killEvt( evt ); } );
-
- toggleLink.appendChild( document.createTextNode( mediaWiki.msg( 'hidetoc' ) ) );
-
- outerSpan.appendChild( document.createTextNode( '[' ) );
- outerSpan.appendChild( toggleLink );
- outerSpan.appendChild( document.createTextNode( ']' ) );
-
- linkHolder.appendChild( document.createTextNode( ' ' ) );
- linkHolder.appendChild( outerSpan );
-
- var cookiePos = document.cookie.indexOf( "hidetoc=" );
- if ( cookiePos > -1 && document.cookie.charAt( cookiePos + 8 ) == 1 ) {
- toggleToc();
- }
- }
-};
-