Sha256: aed8309d008322b98728841011b06d3acd64e797a24eaf903a16e57d8fe7b96a

Contents?: true

Size: 1.82 KB

Versions: 17

Compression:

Stored size: 1.82 KB

Contents

// I know, I know.
$(function() {
    // #M0001 -> $(the section + the method body)
    function m(name) {
      var base = $(name);
      return base.parent().add(base.next());
    }
    
    // #class-something -> $(the section below)
    function s(name) {
      return $(name).next();
    }

  $('.source-link a').click(function() {
    var link = $(this);
    var code = link.parent().next();
    if (link.text() == 'show source') {
      code.show();
      link.text('hide source');
    } else {
      code.hide();
      link.text('show source');
    }
    return false;
  });
  
  if ($('.ref')[0]) {
    
    $('.mod').hide(); 
    $('.method').hide();
    
    var hash = window.location.hash.replace(/--$/, '');
    
    if (hash.substring(0, 2) == "#M") {
      // Show the method and the section
      m(hash).show();
    } else if (hash.substring(0, 7) == "#class-") {
      // Show the section.
      s(hash).show();
    } else {
      // Show the first section.
      s("h2:first").show();
    }
    
    // We need to scroll!
    if (hash != window.location.hash) {
      window.location.hash = hash;
    }
    
    $('a[href*="#class-"]').click(function() {
      var link = this.href;
      var id = link.substring(link.indexOf("#"));
      if ($(this).parent().is("h2")) {
        // We're in a headline
        s(id).toggle();
        window.location.hash = id + "--";
        return false;
      } else {
        // A normal link
        s(id).show();
      }
    });
    
    $('a[href*="#M"]').click(function() {
      var link = this.href;
      var id = link.substring(link.indexOf("#"));
      if ($(this).parent().is("h4")) {
        // We're in a headline
        window.location.hash = id + "--";
        s(id).toggle();
        return false;
      } else {
        // Normal link
        m(id).show();
      }
    });
    
  }
  
});

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
camping-3.2.6 extras/rdoc/generator/template/flipbook/js/camping.js
camping-3.2.5 extras/rdoc/generator/template/flipbook/js/camping.js
camping-3.2.4 extras/rdoc/generator/template/flipbook/js/camping.js
camping-3.2.3 extras/rdoc/generator/template/flipbook/js/camping.js
camping-3.2.2 extras/rdoc/generator/template/flipbook/js/camping.js
camping-3.2.1 extras/rdoc/generator/template/flipbook/js/camping.js
camping-3.2.0 extras/rdoc/generator/template/flipbook/js/camping.js
camping-3.1.3 extras/rdoc/generator/template/flipbook/js/camping.js
camping-3.1.2 extras/rdoc/generator/template/flipbook/js/camping.js
camping-3.1.0 extras/rdoc/generator/template/flipbook/js/camping.js
camping-3.0.2 extras/rdoc/generator/template/flipbook/js/camping.js
camping-3.0.1 extras/rdoc/generator/template/flipbook/js/camping.js
camping-3.0.0 extras/rdoc/generator/template/flipbook/js/camping.js
camping-2.1.532 extras/rdoc/generator/template/flipbook/js/camping.js
camping-2.1.531 extras/rdoc/generator/template/flipbook/js/camping.js
camping-2.1.523 extras/rdoc/generator/template/flipbook/js/camping.js
camping-2.1.467 extras/rdoc/generator/template/flipbook/js/camping.js