Team:NTU-Taida/Templates/Footer
From 2012.igem.org
(Difference between revisions)
(增加縮排功能) |
|||
Line 26: | Line 26: | ||
// all other sidebars | // all other sidebars | ||
$('#toc>tbody>tr>td>ul>li.toclevel-1>a').each(function(index){ | $('#toc>tbody>tr>td>ul>li.toclevel-1>a').each(function(index){ | ||
- | $('ul.sub-navlist').append('<li><a href="'+ $(this).attr('href') +'-sec">'+$(this).children('span.toctext').text()+'</a></li>'); | + | $('ul.sub-navlist').append('<li><a href="'+ $(this).attr('href') +'-sec">'+ abbrSubnavText($(this).children('span.toctext').text())+'</a></li>'); |
if(index==0){ | if(index==0){ | ||
$('h2[class!="firstHeading"]').has('span.mw-headline').eq(index).before('<section id="'+$(this).attr('href').slice(1)+'-sec">') | $('h2[class!="firstHeading"]').has('span.mw-headline').eq(index).before('<section id="'+$(this).attr('href').slice(1)+'-sec">') | ||
Line 33: | Line 33: | ||
} | } | ||
}); | }); | ||
+ | } | ||
+ | |||
+ | |||
+ | function abbrSubnavText(displayText){ | ||
+ | if (displayText.length >= 23){ | ||
+ | var arrayAbbrText = displayText.split(' '); | ||
+ | var newDisplayText=""; | ||
+ | var i = -1; | ||
+ | do{ | ||
+ | i++; | ||
+ | newDisplayText = newDisplayText + ' ' + arrayAbbrText[i]; | ||
+ | }while (i < arrayAbbrText.length && newDisplayText.length < 23) | ||
+ | return newDisplayText; | ||
+ | }else{ | ||
+ | return displayText; | ||
+ | } | ||
} | } | ||
$('h2[class!="firstHeading"]').has('span.mw-headline').wrap('<div class="page-header"></div>'); | $('h2[class!="firstHeading"]').has('span.mw-headline').wrap('<div class="page-header"></div>'); |
Revision as of 16:00, 24 September 2012