1 $(document).ready(function(){ 2 $('div.section').hide(); 3 if (window.location.href.indexOf('#')==-1) { 4 window.location.href += '#introduction'; 5 } 6 nav = $('#navigation'); 7 links = ''; 8 $('h3').each(function(index){ 9 section = $(this).parents('div.section'); 10 text = $(this).text(); 11 name = section[0].id; 12 $(this).html('<a name="'+name+'" href="#introduction" onClick="goHome">'+text+'</a>'); 13 links = links+'<a href="#'+name+'" onClick="handleClick(this,\''+name+'\')">'+text+'</a>'; 14 if (window.location.href.indexOf('#'+name)==-1) { 15 section.hide(); 16 } else { 17 section.show(); 18 } 19 }); 20 nav.html(links); 21 22 Hyphenator.config({ 23 displaytogglebox: false, 24 }); 25 Hyphenator.addExceptions('de', 'Groß-va-ter'); 26 Hyphenator.run(); 27 28 //$('#HyphenatorToggleBox').css('right:100px;'); 29 }); 30 31 function goHome() { 32 $('#navigation a').show(); 33 } 34 35 function handleClick(node, name) { 36 $('#navigation a').show(); 37 /* $(node).hide(); */ 38 $('div.section').hide(); 39 $('div.section#'+name).show(); 40 } 41 42 function LoadSample(selector) { 43 if (selector.value.match(/(cs|de|en|fr|fi|pl)/i)) { 44 $.get('sample-'+selector.value+'.html', {}, function(data){ 45 data = Hyphenator.hyphenate(data, selector.value); 46 $('#demo_example').html(data); 47 }); 48 } else if (selector.value=='--') { 49 alert('Please select a language!'); 50 } else { 51 alert('No fiddling with the code!'); 52 } 53 } 54