User:Albuseer/vector/improve.js

/* jQuery section Begin */ jQuery(document).ready(function($){

$(window).load(function{

$(':header').each( function{    $(this)    .append(' ')    .append( $(this).children('span.editsection') .css('display','inline') .css('float','none') .css('font-size','small') .css('margin-left','5px') .css('line-height','90%').hide )   .hover( function{$(this).children('span.editsection').show}, function{$(this).children('span.editsection').hide} ); } );

/* Improved TOC */

if ($('table#toc.toc').length>0){ if ($('table#toc.toc').position.left==0 && $('table#toc.toc li').length>10 && $('.toclevel-1>ul').length>0){ $('.toclevel-1>ul').hide $('table#toc.toc #toctitle').append(   $(' ').css('font-size','94%').append('[').append( $('').attr('id','toggleDetail').attr('href','javascript:void(0)').html('＋').click(     function{       $('li.toclevel-1>ul').slideToggle;       if ($(this).html=='－'){$(this).html('＋')}       else{$(this).html('－')}      }     ) ).append(']') ) $('table#toc.toc') .css('position','absolute') .css('float','left') .css('margin-right','1em') .css('z-index','1') .after(  $(' ')   .attr('id','tocspace')   .css('height',$('table#toc.toc').height)   .css('padding','8px')  ).hover(   function{return},   function{ if ($('#toggleDetail').html=='－'){    $('li.toclevel-1>ul').slideToggle;$('#toggleDetail').html('＋')   }}  ) $('table#toc.toc #togglelink').click(function{jQuery('#tocspace').css('height',jQuery('table#toc.toc').height)}) } }

/* $('#mw-panel > div.portal:not(.persistent)') .addClass('collapsed') .removeClass('expanded') .find('div.body').hide if ( $.cookie('vector-nav-expand') && $('#mw-panel > div.portal#'+$.cookie('vector-nav-expand')).length ){ $('#mw-panel > div.portal#'+$.cookie('vector-nav-expand')) .addClass('expanded') .removeClass('collapsed') .find('div.body').show } $('#mw-panel h3 > a').unbind('click').click(function(e){e.preventDefault}) $('#mw-panel > div.portal:not(.persistent) > h3').click( function {   if ($(this).parent.hasClass('expanded')){    $.cookie('vector-nav-expand',$(this).parent.attr('id'),{expires: 7, path: '/'})   }else{    $.cookie('vector-nav-expand','',{expires: 7, path: '/'})   }   $(this).parent.siblings('div.portal:not(.persistent)')    .addClass('collapsed')    .removeClass('expanded')    .find('div.body')    .hide('fast');   if ($('#mw-panel').css('position')=='absolute'){hide_lang;}  } );*/ /* language section collapse */ var langs; try{ langs = prefered_langs; } catch(err) { langs = ['en','de','fr','pl','it','ja','nl','es','simple','zh','zh-classical','zh-yue','wuu','la']; } var finish = langs.length; var pan_top = $('#mw-panel').position.top-$(document).scrollTop;

var show_lang = function{ $('#mw-panel').css('position','absolute').css('top',$(document).scrollTop+pan_top) .animate({top:$(document).scrollTop},'slow'); $('#p-lang > div > ul > li').show; $('#p-lang-show').hide; }; var hide_lang = function{ var top = $('#mw-panel').position.top-$(document).scrollTop; $('#mw-panel').css('position','fixed').css('top',top).animate({top:pan_top},'slow'); $('#p-lang > div > ul > li').hide; langs.map(   function(lang){return $('.interwiki-'+lang).show;}  ); $('#p-lang-show').show; }; if ($('#p-lang > div > ul > li').length > finish){ $('#p-lang > div > ul > li').hide; langs.map(   function(lang){return $('.interwiki-'+lang).show;}  ); $('#p-lang > div > ul').append(   $(' All '+$('#p-lang > div > ul > li').length+' ')    .click(show_lang)  ); $('#p-lang > div > ul').append(   $(' Hide ')    .click(hide_lang).hide  ); } $('#mw-panel').css('position','fixed');

$(window).scroll(function{ if ( $('#mw-panel').css('position')=='absolute' && ( $('#mw-panel').offset.top>$(document).scrollTop+pan_top ||        $('#p-lang-hide').offset.top<$(document).scrollTop+pan_top ) )  {hide_lang} });

});

/* jQuery section End */ });