github.com/pritambaral/docker@v1.4.2-0.20150120174542-b2fe1b3dd952/docs/theme/mkdocs/js/base.js (about) 1 $(document).ready(function () 2 { 3 4 // Tipue Search activation 5 $('#tipue_search_input').tipuesearch({ 6 'mode': 'json', 7 'contentLocation': '/search_content.json' 8 }); 9 10 prettyPrint(); 11 12 // Resizing 13 resizeMenuDropdown(); 14 // checkToScrollTOC(); 15 $(window).resize(function() { 16 if(this.resizeTO) 17 { 18 clearTimeout(this.resizeTO); 19 } 20 this.resizeTO = setTimeout(function () 21 { 22 resizeMenuDropdown(); 23 // checkToScrollTOC(); 24 }, 500); 25 }); 26 27 /* Follow TOC links (ScrollSpy) */ 28 $('body').scrollspy({ 29 target: '#toc_table', 30 }); 31 32 /* Prevent disabled link clicks */ 33 $("li.disabled a").click(function () 34 { 35 event.preventDefault(); 36 }); 37 38 // Submenu ensured drop-down functionality for desktops & mobiles 39 $('.dd_menu').on({ 40 click: function () 41 { 42 $(this).toggleClass('dd_on_hover'); 43 }, 44 mouseenter: function () 45 { 46 $(this).addClass('dd_on_hover'); 47 }, 48 mouseleave: function () 49 { 50 $(this).removeClass('dd_on_hover'); 51 }, 52 }); 53 54 }); 55 56 function resizeMenuDropdown () 57 { 58 $('.dd_menu > .dd_submenu').css("max-height", ($('body').height() - 160) + 'px'); 59 } 60 61 // https://github.com/bigspotteddog/ScrollToFixed 62 function checkToScrollTOC () 63 { 64 if ( $(window).width() >= 768 ) 65 { 66 // If TOC is hidden, expand. 67 $('#toc_table > #toc_navigation').css("display", "block"); 68 // Then attach or detach fixed-scroll 69 if ( ($('#toc_table').height() + 100) >= $(window).height() ) 70 { 71 $('#toc_table').trigger('detach.ScrollToFixed'); 72 $('#toc_navigation > li.active').removeClass('active'); 73 } 74 else 75 { 76 $('#toc_table').scrollToFixed({ 77 marginTop: $('#nav_menu').height(), 78 limit: function () { return $('#footer').offset().top - 450; }, 79 zIndex: 1, 80 minWidth: 768, 81 removeOffsets: true, 82 }); 83 } 84 } 85 } 86 87 function getCookie(cname) { 88 var name = cname + "="; 89 var ca = document.cookie.split(';'); 90 for(var i=0; i<ca.length; i++) { 91 var c = ca[i].trim(); 92 if (c.indexOf(name) == 0) return c.substring(name.length,c.length); 93 } 94 return ""; 95 }