Sha256: 5b65d25793354620282db2bc4e9d39ef8110d451655bec7cbfc6d0fd8b49d485

Contents?: true

Size: 979 Bytes

Versions: 6

Compression:

Stored size: 979 Bytes

Contents

function toggleSource(id) {
  var src = $('#' + id).toggle();
  var isVisible = src.is(':visible');
  $('#l_' + id).html(isVisible ? 'hide' : 'show');
}

window.highlight = function(url) {
  var hash = url.match(/#([^#]+)$/);
  if (hash) {
    var link = document.querySelector('a[name=' + hash[1] + ']');
    if(link) {
      var parent = link.parentElement;

      parent.classList.add('highlight');

      setTimeout(function() {
        parent.classList.remove('highlight');
      }, 1000);
    }
  }
};

document.addEventListener("turbolinks:load", function() {
  highlight('#' + location.hash);
  $('.description pre').each(function() {
    hljs.highlightBlock(this);
  });
});

// Keep scroll position for panel
(function() {
  var scrollTop = 0;

  addEventListener("turbolinks:before-render", function() {
    scrollTop = $('#panel').first().scrollTop();
  })

  addEventListener("turbolinks:render", function() {
    $('#panel').first().scrollTop(scrollTop);
  })
})()

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sdoc-2.1.0 lib/rdoc/generator/template/rails/resources/js/main.js
sdoc-2.0.4 lib/rdoc/generator/template/rails/resources/js/main.js
sdoc-2.0.3 lib/rdoc/generator/template/rails/resources/js/main.js
sdoc-2.0.2 lib/rdoc/generator/template/rails/resources/js/main.js
sdoc-2.0.1 lib/rdoc/generator/template/rails/resources/js/main.js
sdoc-2.0.0 lib/rdoc/generator/template/rails/resources/js/main.js