source/javascripts/octopress.js
1eddd60a
 window.addEvent('domready', function() {
a55a5515
   codeblocks = $$('div.highlight');
   codeblocks.each(addExpander);
1eddd60a
 });
 
 function addExpander(div){
   new Element('span',{
 		html: 'expand »',
 		'class': 'pre_expander',
     'events': {
       'click': function(){
         toggleExpander();
       }
     }
 	}).inject(div, 'top');
 }
 function toggleExpander(){
   var html = '';
a55a5515
   if($('main').toggleClass('expanded').hasClass('expanded'))
1eddd60a
     html = '« contract';
a55a5515
   else
1eddd60a
     html = 'expand »';
   $$('div.highlight span.pre_expander').each(function(span){
0b744bae
       span.set('html',html);
1eddd60a
   });
a55a5515
 }
 function enableCompressedLayout(codeblocks){
   if(!codeblocks.length) return;
   new Element('span',{
 		html: 'Collapse layout',
 		'id': 'collapser',
     'events': {
       'click': function(){
         if($('page').toggleClass('collapsed').hasClass('collapsed'))
           this.set('html','Expand layout');
         else
           this.set('html','Collapse layout');
       }
     }
 	}).inject($('main'), 'top');
1eddd60a
 }