all repos — h3rald @ 640fa955633370e1ec7d4f18aec87f24cdc8c46c

The sources of https://h3rald.com

content/js/init.js

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
$(document).ready(function() {
	// Manage dates
	$('.timeago').timeago();
  // Search
  $("#h3rald-search-btn").click(function(){
    h3rald_search();
  })
  $("#h3rald-search-box").keydown(function(e){
    q = $("#h3rald-search-box").val();
    if (q.length == 1){
      $("#h3rald-search-results").addClass("hidden");
      $("#main").show();
    }
    if (e.which == 13) {
      e.preventDefault();
      h3rald_search();
    }
  })
  var navHeight = $('.navbar-collapse').height();

  $('.navbar-collapse').on('show.bs.collapse', function(){
    if($(this).height() != 0){
      navHeight = $(this).height();
    }
    $('body').animate({
      'padding-top': parseInt($("body").css("padding-top")) + navHeight
    }, 300);
  });

  $('.navbar-collapse').on('hide.bs.collapse', function(){
    navHeight = $(this).height();
    $('body').animate({
      'padding-top': parseInt($("body").css("padding-top")) - navHeight
    }, 300);
  });
});