
<!-- Javascript Start -->

<!-- jQuery -->
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>

<!-- Bootstrap Core JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>

<!-- Plugin JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>

<!-- Custom Theme JavaScript -->
<!--* Start Bootstrap - Grayscale Bootstrap Theme (http://startbootstrap.com)
* Code licensed under the Apache License v2.0.
* For details, see http://www.apache.org/licenses/LICENSE-2.0.-->
<script>
function toggleNavCollapse(){50<$(".navbar").offset().top?$(".navbar-fixed-top").addClass("top-nav-collapse"):$(".navbar-fixed-top").removeClass("top-nav-collapse");}
$(document).ready(toggleNavCollapse);
$(window).scroll(toggleNavCollapse);$(function(){$("a.page-scroll").bind("click",function(b){var a=$(this);$("html, body").stop().animate({scrollTop:$(a.attr("href")).offset().top-50},1500,"easeInOutExpo",function(){a.blur()});b.preventDefault()})});$(".navbar-collapse ul li a").click(function(){$(".navbar-toggle:visible").click()});
</script>

{% if page.section-type == "index" %}

  <!-- Collapse navbar when navbar-brand is clicked -->

  <script>
  $(function(){$(".navbar-brand").click(function(){$(".collapse.in")&&$(".collapse.in").animate({height:"1px"},500,function(){$(".collapse.in").removeClass("in")})})});
  </script>

{% endif %}

{% if site.syntax-highlight and page.section-type == "post" %}

  <!-- Syntax highlight in post pages-->

  <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.2/highlight.min.js"></script>
  <script>hljs.initHighlightingOnLoad();</script>

{% endif %}

{% if jekyll.environment == "production" %}
  {% if site.google-tracking-id %}

  <!-- Google Tracking Id Start -->

  <script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
    ga('create', '{{ site.google-tracking-id }}', 'auto');
    ga('send', 'pageview');
  </script>

  <!-- Google Tracking Id End -->

  {% endif %}
{% endif %}

{% if site.disqus-shortname and jekyll.environment == "production" %}

  <!-- Disqus -->

  {% if page.section-type == "post" %}

    <script type="text/javascript">
    var disqus_shortname = '{{ site.disqus-shortname }}';
    (function() {
        var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
        dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
    })();
    </script>

  {% endif %}

  {% if page.section-type == "post" or page.section-type == "blog" or page.section-type == "index" or page.section-type == "tag" %}

    <!-- Comments Counter Start -->

    <script type="text/javascript">
    /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
    var disqus_shortname = '{{ site.disqus-shortname }}'; // required: replace example with your forum shortname

    /* * * DON'T EDIT BELOW THIS LINE * * */
    (function () {
    var s = document.createElement('script'); s.async = true;
    s.type = 'text/javascript';
    s.src = '//' + disqus_shortname + '.disqus.com/count.js';
    (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
    }());
    </script>

    <!-- Comments Counter End -->

  {% endif %}

{% endif %}

{% if page.section-type == "post" %}

  <!-- Share buttons Start -->

  <script src="{{site.baseurl}}/js/rrssb.min.js"></script>

  <!-- Share buttons End -->

{% endif %}

{% if site.dynamic-typing and page.section-type == "index" %}

  <!-- Dynamic Typing Start -->

  <script type="text/javascript" src="{{site.baseurl}}/js/typed.min.js"></script>
  <script type="text/javascript">

  var myQuotes =  new Array();
  {% for line in site.lines %}
    myQuotes.push("{{ line.text }}");
  {% endfor %}

  function shuffle(array) {
    var currentIndex = array.length, temporaryValue, randomIndex ;

    // While there remain elements to shuffle...
    while (0 !== currentIndex) {

      // Pick a remaining element...
      randomIndex = Math.floor(Math.random() * currentIndex);
      currentIndex -= 1;

      // And swap it with the current element.
      temporaryValue = array[currentIndex];
      array[currentIndex] = array[randomIndex];
      array[randomIndex] = temporaryValue;
    }

    return array;
  }

  {% if site.shuffle %}
    shuffle(myQuotes)
  {% endif %}

    $(".intro-text").typed({
      strings: myQuotes,
      typeSpeed: {{ site.type-speed }},
      backDelay: {{ site.delete-delay }},
      startDelay: {{ site.start-delay }},
      loop: {{ site..loop }},
      loopCount: {{ site.loop-count }},
      cursorChar: "|"
    });
  </script>

  <!-- Dynamic Typing End  -->

{% endif %}

<script>
function addTohistory() {
  if (!window.location.host.startsWith("127.0.0.1")) {
    history.pushState({}, '{{page.title}}', '{{site.url}}{{site.baseurl}}{{page.url}}');
  }
}
</script>

<!-- Gesture Navigation / Swipe Instruction Start -->
{% if site.enable-gesture-navigation %}

  {% if page.section-type == "post" %}

    <!-- Post Gesture Navigation Start -->

    <script type="text/javascript" src="{{site.baseurl}}/js/hammer.min.js"></script>

    <script>
      var post = document.getElementById('post');

      new Hammer(post).on('swipeleft', function(event) {
        addTohistory();
        {% if site.baseurl == "" and page.previous == nil %}
          document.location.replace("/");
        {% else %}
          document.location.replace("{{site.baseurl}}{{page.previous.url}}");
        {% endif %}
      });

      new Hammer(post).on('swiperight', function(event) {
        addTohistory();
        {% if site.baseurl == "" and page.next == nil %}
          document.location.replace("/");
        {% else %}
          document.location.replace("{{site.baseurl}}{{page.next.url}}");
        {% endif %}
      });
    </script>

    <!-- Post Gesture Navigation Start -->

  {% endif %}

  {% if page.section-type == "blog" %}

    <!-- Blog Gesture Navigation Start -->

    <script type="text/javascript" src="{{site.baseurl}}/js/hammer.min.js"></script>

    <script>
      var page = document.getElementById('page');

      new Hammer(page).on('swipeleft', function(event) {
        addTohistory();
        {% if site.baseurl == "" and paginator.next_page_path == nil %}
          document.location.replace("/");
        {% else %}
          document.location.replace("{{site.baseurl}}{{paginator.next_page_path}}");
        {% endif %}
      });
      new Hammer(page).on('swiperight', function(event) {
        addTohistory();
        {% if site.baseurl == "" and paginator.previous_page_path == nil %}
          document.location.replace("/");
        {% else %}
          document.location.replace("{{site.baseurl}}{{paginator.previous_page_path}}");
        {% endif %}
      });
    </script>

    <!-- Blog Gesture Navigation Start -->

  {% endif %}

  {% if page.section-type == "blog" %}

    <!-- Swipe Instructions for Blog Start -->

    <script>
      $(document).ready(function(){
        if(!localStorage.getItem('blog-swipeshowed')){
          $("#swipe-instruction").fadeIn();
          $("#swipe-instruction .close-swipe-instruction").click(function(){
            $("#swipe-instruction").fadeOut();
          });
          localStorage.setItem('blog-swipeshowed', true);
        }
      });
    </script>

    <!-- Swipe Instructions for Blog End -->

  {% endif %}

  {% if page.section-type == "post" %}

    <!-- Swipe Instructions for Post Start -->

    <script>
      $(document).ready(function(){
        if(!localStorage.getItem('post-swipeshowed')){
          $("#swipe-instruction").fadeIn();
          $("#swipe-instruction .close-swipe-instruction").click(function(){
            $("#swipe-instruction").fadeOut();
          });
          localStorage.setItem('post-swipeshowed', true);
        }
      });
    </script>

    <!-- Swipe Instructions for Post End -->

  {% endif %}

<!-- Gesture Navigation / Swipe Instruction End -->

{% endif %}

<!-- Javascript End -->
