Sha256: d4f0cc8779010b46f454b4084cc7c9db2d91a5d278f660a3bb21ec9e461a513e

Contents?: true

Size: 1.37 KB

Versions: 14

Compression:

Stored size: 1.37 KB

Contents

//= require ../lib/_jquery
//= require ../lib/_jquery_ui
//= require ../lib/_jquery.tocify
//= require ../lib/_imagesloaded.min
(function (global) {
  'use strict';

  var closeToc = function() {
    $(".tocify-wrapper").removeClass('open');
    $("#nav-button").removeClass('open');
  };

  var makeToc = function() {
    global.toc = $("#toc").tocify({
      selectors: 'h1, h2',
      extendPage: false,
      theme: 'none',
      smoothScroll: false,
      showEffectSpeed: 0,
      hideEffectSpeed: 180,
      ignoreSelector: '.toc-ignore',
      highlightOffset: 60,
      scrollTo: -1,
      scrollHistory: true,
      hashGenerator: function (text, element) {
        return element.prop('id');
      }
    }).data('toc-tocify');

    $("#nav-button").click(function() {
      $(".tocify-wrapper").toggleClass('open');
      $("#nav-button").toggleClass('open');
      return false;
    });

    $(".page-wrapper").click(closeToc);
    $(".tocify-item").click(closeToc);
  };

  // Hack to make already open sections to start opened,
  // instead of displaying an ugly animation
  function animate() {
    setTimeout(function() {
      toc.setOption('showEffectSpeed', 180);
    }, 50);
  }

  $(function() {
    makeToc();
    animate();
    setupLanguages($('body').data('languages'));
    $('.content').imagesLoaded( function() {
      global.toc.calculateHeights();
    });
  });
})(window);

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
blocks-4.0.1 docs/javascripts/app/toc.js
blocks-4.0.0 docs/javascripts/app/toc.js
blocks-4.0.0.rc2 docs/javascripts/app/toc.js
blocks-4.0.0.rc1 docs/javascripts/app/toc.js
blocks-3.0.4 docs/javascripts/app/toc.js
blocks-3.0.3 docs/javascripts/app/toc.js
blocks-3.0.2 docs/javascripts/app/toc.js
blocks-3.0.1 docs/javascripts/app/toc.js
blocks-3.0.0 docs/javascripts/app/toc.js
blocks-3.0.0.rc9 docs/javascripts/app/toc.js
blocks-3.0.0.rc8 docs/javascripts/app/toc.js
blocks-3.0.0.rc7 docs/javascripts/app/toc.js
blocks-3.0.0.rc6 docs/javascripts/app/toc.js
blocks-3.0.0.rc5 docs/javascripts/app/toc.js