1jQuery(document).ready(function($) { 2 var raf = requestAnimationFrame || mozRequestAnimationFrame || webkitRequestAnimationFrame || msRequestAnimationFrame; 3 4 if( $('.navbar-nav.navbar-right').length ) { 5 var $navbar = $('#masthead'); 6 var $nav = $('.navbar-nav', $navbar); 7 var $body = $('body'); 8 9 function enlightenment_fix_nav_position() { 10 nav_tick = false; 11 12 if( $(window).width() >= 768 ) { 13 if( ( $nav.offset().top - $navbar.offset().top - parseInt( $navbar.css('padding-top') ) > 0 ) ) { 14 $nav.removeClass('navbar-right'); 15 $body.css('margin-top', $navbar.outerHeight()); 16 } else if( ( $nav.offset().top - $navbar.offset().top - parseInt( $navbar.css('padding-top') ) == 0 ) ) { 17 $nav.addClass('navbar-right'); 18 $body.css('margin-top', ''); 19 } 20 } else { 21 $body.css('margin-top', ''); 22 } 23 } 24 25 if( raf ) { 26 raf(enlightenment_fix_nav_position); 27 } else { 28 enlightenment_fix_nav_position(); 29 } 30 31 var nav_tick = false; 32 33 $(window).resize(function() { 34 35 if( ! nav_tick && raf ) { 36 raf(enlightenment_fix_nav_position); 37 } else if( ! raf ) { 38 enlightenment_fix_nav_position(); 39 } 40 41 nav_tick = true; 42 }); 43 } 44 45 $('.searchform-dropdown').on('shown.bs.dropdown', function() { 46 $('#s').focus(); 47 }); 48 49 var navbar_offset = $('#masthead').offset().top; 50 if($('.subnav').length) { 51 var subnav_offset = $('.subnav').offset().top - 70; 52 } 53 54 if( $('.navbar-transparent').length ) { 55 var offset = $('.navbar').outerHeight() + 30; 56 var tick = false; 57 var lastScrollTop = 0; 58 59 function enlightenment_stick_navbar() { 60 tick = false; 61 var st = window.scrollY; 62 63 if( st > offset && st > lastScrollTop ) { 64 $('.navbar').removeClass('navbar-inverse'); 65 $('.navbar').addClass('navbar-default'); 66 } else if( st <= 20 ) { 67 $('.navbar').removeClass('navbar-default'); 68 $('.navbar').addClass('navbar-inverse'); 69 } 70 } 71 72 window.addEventListener('scroll', function() { 73 if( ! tick && raf ) { 74 raf(enlightenment_stick_navbar); 75 } 76 tick = true; 77 }); 78 } 79 80 $(document).scroll(function() { 81 if($('.subnav').length) { 82 if( document.body && document.body.scrollTop > subnav_offset ) { 83 $('.subnav').addClass('subnav-fixed'); 84 $('#page').addClass('page-subnav-offset'); 85 } else { 86 $('.subnav').removeClass('subnav-fixed'); 87 $('#page').removeClass('page-subnav-offset'); 88 } 89 } 90 }); 91 92 var offset = $('.navbar').outerHeight() + 30; 93 var ticker = false; 94 95 function enlightenment_shrink_navbar() { 96 ticker = false; 97 var st = window.scrollY; 98 99 if( typeof enlightenment_theme_call_js != 'undefined' && 1 == enlightenment_theme_call_js.shrink_navbar ) { 100 if( st > offset ) { 101 $('#masthead').removeClass('navbar-large'); 102 } 103 104 if( st <= 20 ) { 105 $('#masthead').addClass('navbar-large'); 106 } 107 } 108 } 109 110 window.addEventListener('scroll', function() { 111 if( ! ticker && raf ) { 112 raf(enlightenment_shrink_navbar); 113 } 114 ticker = true; 115 }); 116 117 function enlightenment_scroll_to_content(target) { 118 $('html, body').animate({ 119 scrollTop: $(target).offset().top - 59 120 }, 250); 121 } 122 123 $('.scroll-to-content a').click(function(event) { 124 event.preventDefault(); 125 var target = $(this).attr('href'); 126 127 128 if( raf ) { 129 raf(function() { 130 enlightenment_scroll_to_content(target); 131 }); 132 } else { 133 $('html, body').scrollTop( $(target).offset().top - 59 ); 134 } 135 }); 136 137 $('.nav > .dropdown > a:first-child').each(function() { 138 if($(this).attr('href').substr(0,1) != '#') { 139 $('li:first-child', $(this).parent()).not($('ul ul li', $(this).parent())).before('<li class="menu-item">' + $('<div>').append($(this).clone()).remove().html() + '</li>'); 140 $('li:first-child > a > .caret', $(this).parent()).remove(); 141 } 142 $(this).attr('href', '#' + $(this).parent().attr('id')); 143 $(this).addClass('dropdown-toggle'); 144 $(this).attr('data-toggle', 'dropdown'); 145 }); 146 $('.gallery-item').hover(function() { 147 var top = $(this).position().top; 148 var left = $(this).position().left; 149 var width = $(this).width(); 150 var height = $(this).height() + 1; 151 var marginLeft = $(this).width() + parseInt($(this).css('marginLeft')) * 2 + parseInt($(this).css('marginRight')); 152 var nexttop = $(this).next().position().top; 153 var nextleft = $(this).next().position().left; 154 $(this).css({ 155 position: 'absolute', 156 top: top, 157 left: left, 158 }); 159 $(this).after('<figure class="gallery-item dummy"></figure>') 160 $(this).next('.dummy').css({ 161 width: width, 162 height: height, 163 }); 164 $('.gallery-caption', this).css({ 165 padding: '10px', 166 height: 'auto', 167 }); 168 }, function() { 169 $('.gallery-caption', this).css({ 170 padding: 0, 171 height: 0, 172 }); 173 $(this).css({ 174 position: 'static', 175 }); 176 $(this).next('.dummy').remove(); 177 }); 178 if( $.fn.tooltip ) { 179 $('.custom-query-gallery .entry-media a').tooltip(); 180 } 181});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.