JAVASCRIPT   22

base.js

Guest on 19th July 2021 04:40:38 PM

  1. function getSearchTerm()
  2. {
  3.     var sPageURL = window.location.search.substring(1);
  4.     var sURLVariables = sPageURL.split('&');
  5.     for (var i = 0; i < sURLVariables.length; i++)
  6.     {
  7.         var sParameterName = sURLVariables[i].split('=');
  8.         if (sParameterName[0] == 'q')
  9.         {
  10.             return sParameterName[1];
  11.         }
  12.     }
  13. }
  14.  
  15. $(document).ready(function() {
  16.  
  17.     var search_term = getSearchTerm(),
  18.         $search_modal = $('#mkdocs_search_modal');
  19.  
  20.     if(search_term){
  21.         $search_modal.modal();
  22.     }
  23.  
  24.     // make sure search input gets autofocus everytime modal opens.
  25.     $search_modal.on('shown.bs.modal', function () {
  26.         $search_modal.find('#mkdocs-search-query').focus();
  27.     });
  28.  
  29.     // Highlight.js
  30.     hljs.initHighlightingOnLoad();
  31.     $('table').addClass('table table-striped table-hover');
  32. });
  33.  
  34.  
  35. $('body').scrollspy({
  36.     target: '.bs-sidebar',
  37. });
  38.  
  39. /* Prevent disabled links from causing a page reload */
  40. $("li.disabled a").click(function() {
  41.     event.preventDefault();
  42. });

Raw Paste


Login or Register to edit or fork this paste. It's free.