/*! Plugin options and other jQuery stuff */

// dl-menu options
$(function() {
  $( '#dl-menu' ).dlmenu({
    animationClasses : { classin : 'dl-animate-in', classout : 'dl-animate-out' }
  });
});

// FitVids options
$(function() {
  $("article").fitVids();
});

$(".close-menu").click(function () {
  $(".menu").toggleClass("disabled");
  $(".links").toggleClass("enabled");
});

$(".about").click(function () {
  $("#about").css('display','block');
});

$(".close-about").click(function () {
  $("#about").css('display','');
});

// Add lightbox class to all image links
$("a[href$='.jpg'],a[href$='.jpeg'],a[href$='.JPG'],a[href$='.png'],a[href$='.gif']").addClass("image-popup");

// Magnific-Popup options
$(document).ready(function() {
  $('.image-popup').magnificPopup({
    type: 'image',
    tLoading: 'Loading image #%curr%...',
    gallery: {
      enabled: true,
      navigateByImgClick: true,
      preload: [0,1] // Will preload 0 - before current, and 1 after the current image
    },
    image: {
      tError: '<a href="%url%">Image #%curr%</a> could not be loaded.',
    },
    removalDelay: 300, // Delay in milliseconds before popup is removed
    // Class that is added to body when popup is open.
    // make it unique to apply your CSS animations just to this exact popup
    mainClass: 'mfp-fade'
  });
});

// header
$(document).ready(function(e) {
  $(window).scroll(function(){
    var header = $('.header-menu');
    var scroll = $(window).scrollTop();
    if(scroll > 300){
      header.attr('class', 'header-menu header-menu-overflow');
    } else {
      header.attr('class', 'header-menu header-menu-top');
    }
  });
});

//mobile menu
$(document).ready(function(){
  $("#menu").attr('style', '');
  $("#menu").mmenu({
    "extensions": [
      "border-full",
      "effect-zoom-menu",
      "effect-zoom-panels",
      "pageshadow",
      "theme-dark"
    ],
    "counters": true,
    "navbars": [
      {
        "position": "bottom",
        "content": [
          "<a class='fa fa-search' href='/search'></a>",
          "<a class='fa fa-envelope' href='#/'></a>",
          "<a class='fa fa-twitter' href='#/'></a>",
          "<a class='fa fa-facebook' href='#/'></a>"
        ]
      }
    ]
  });
});

var sharing = function(){
    $(document).ready(function(){
      $("body").floatingSocialShare({
        buttons: ["facebook","twitter","google-plus", "linkedin", "pinterest"],
        text: "Share with "
      });
    });
};//sharing

// jumping with offset
$(document).ready(function() {
  // replace all href click behavior
  // https://api.jquery.com/category/selectors/
  // TODO: process anchors only, skip unnecessary hrefs
  $('a[href^="#"]:not([href="#menu"]').click(function() {
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
        && location.hostname == this.hostname) {
      var target = $(this.hash);
      target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
      if (target.length) {
        $('html,body').animate({
          scrollTop: target.offset().top - 125 //offsets for fixed header
        }, 1000);
        return false;
      }
    }
  });
  // Executed on page load with URL containing an anchor tag.
  if($(location.href.split("#")[1])) {
    var target = $('#'+location.href.split("#")[1]);
    if (target.length) {
      $('html,body').animate({
        scrollTop: target.offset().top - 125 //offset height of header here too.
      }, 1000);
      return false;
    }
  }
});
// end of TOC jumping with offset

// vim: et tw=80 ts=2 sw=2 cc=80:

@@ -2537,192 +2537,69 @@
 %7B%0A  
-// replace all href click behavior%0A  // https://api.jquery.com/category/selectors/%0A  // TODO: process anchors only, skip unnecessary hrefs%0A  $('a%5Bhref%5E=%22#%22%5D:not(%5Bhref=%22#menu%22%5D').click(
+var scroll_time_ms = 600;%0A  var top_offset = 80;%0A  var foo = 
 func
@@ -2942,35 +2942,42 @@
 .offset().top - 
-125
+top_offset
  //offsets for f
@@ -2991,36 +2991,46 @@
 ader%0A        %7D, 
-1000
+scroll_time_ms
 );%0A        retur
@@ -3055,16 +3055,260 @@
    %7D%0A  %7D
+;%0A  // modifiy all href click behavior%0A  // https://api.jquery.com/category/selectors/%0A  // TODO: add markdown generated anchor ref%0A  $(%22#markdown-toc%22).find('a%5Bhref%5E=%22#%22%5D').click(foo);%0A  $(%22#__table-of-contents%22).find('a%5Bhref%5E=%22#%22%5D').click(foo
 );%0A  // 
@@ -3512,32 +3512,34 @@
 imate(%7B%0A        
+  
 scrollTop: targe
@@ -3559,61 +3559,69 @@
 p - 
-125 //offset height of header here too.%0A      %7D, 1000
+top_offset //offsets for fixed header%0A      %7D, scroll_time_ms
 );%0A 

Modify anchor of TOC elements only