1/* 2 scripts.js 3 4 License: GNU General Public License v3.0 5 License URI: http://www.gnu.org/licenses/gpl-3.0.html 6 7 Copyright: (c) 2013 Alexander "Alx" Agnarson, http://alxmedia.se 8*/ 9 10jQuery(document).ready(function($) { 11 12/* Toggle header search 13/* ------------------------------------ */ 14 $('.toggle-search').click(function(){ 15 $('.toggle-search').toggleClass('active'); 16 $('.search-expand').fadeToggle(250); 17 setTimeout(function(){ 18 $('.search-expand input').focus(); 19 }, 300); 20 }); 21 22/* Scroll to top 23/* ------------------------------------ */ 24 $('a#back-to-top').click(function() { 25 $('html, body').animate({scrollTop:0},'slow'); 26 return false; 27 }); 28 29/* Tabs widget 30/* ------------------------------------ */ 31 (function() { 32 var $tabsNav = $('.alx-tabs-nav'), 33 $tabsNavLis = $tabsNav.children('li'), 34 $tabsContainer = $('.alx-tabs-container'); 35 36 $tabsNav.each(function() { 37 var $this = $(this); 38 $this.next().children('.alx-tab').stop(true,true).hide() 39 .siblings( $this.find('a').attr('href') ).show(); 40 $this.children('li').first().addClass('active').stop(true,true).show(); 41 }); 42 43 $tabsNavLis.on('click', function(e) { 44 var $this = $(this); 45 46 $this.siblings().removeClass('active').end() 47 .addClass('active'); 48 49 $this.parent().next().children('.alx-tab').stop(true,true).hide() 50 .siblings( $this.find('a').attr('href') ).fadeIn(); 51 e.preventDefault(); 52 }).children( window.location.hash ? 'a[href=' + window.location.hash + ']' : 'a:first' ).trigger('click'); 53 54 })(); 55 56/* Comments / pingbacks tabs 57/* ------------------------------------ */ 58 $(".comment-tabs li").click(function() { 59 $(".comment-tabs li").removeClass('active'); 60 $(this).addClass("active"); 61 $(".comment-tab").hide(); 62 var selected_tab = $(this).find("a").attr("href"); 63 $(selected_tab).fadeIn(); 64 return false; 65 }); 66 67/* Table odd row class 68/* ------------------------------------ */ 69 $('table tr:odd').addClass('alt'); 70 71/* Sidebar collapse 72/* ------------------------------------ */ 73 $('body').addClass('s1-collapse'); 74 $('body').addClass('s2-collapse'); 75 76 $('.s1 .sidebar-toggle').click(function(){ 77 $('body').toggleClass('s1-collapse').toggleClass('s1-expand'); 78 if ($('body').is('.s2-expand')) { 79 $('body').toggleClass('s2-expand').toggleClass('s2-collapse'); 80 } 81 }); 82 $('.s2 .sidebar-toggle').click(function(){ 83 $('body').toggleClass('s2-collapse').toggleClass('s2-expand'); 84 if ($('body').is('.s1-expand')) { 85 $('body').toggleClass('s1-expand').toggleClass('s1-collapse'); 86 } 87 }); 88 89/* Dropdown menu animation 90/* ------------------------------------ */ 91 $('.nav ul.sub-menu').hide(); 92 $('.nav li').hover( 93 function() { 94 $(this).children('ul.sub-menu').slideDown('fast'); 95 }, 96 function() { 97 $(this).children('ul.sub-menu').hide(); 98 } 99 ); 100 101/* Mobile menu smooth toggle height 102/* ------------------------------------ */ 103 $('.nav-toggle').on('click', function() { 104 slide($('.nav-wrap .nav', $(this).parent())); 105 }); 106 107 function slide(content) { 108 var wrapper = content.parent(); 109 var contentHeight = content.outerHeight(true); 110 var wrapperHeight = wrapper.height(); 111 112 wrapper.toggleClass('expand'); 113 if (wrapper.hasClass('expand')) { 114 setTimeout(function() { 115 wrapper.addClass('transition').css('height', contentHeight); 116 }, 10); 117 } 118 else { 119 setTimeout(function() { 120 wrapper.css('height', wrapperHeight); 121 setTimeout(function() { 122 wrapper.addClass('transition').css('height', 0); 123 }, 10); 124 }, 10); 125 } 126 127 wrapper.one('transitionEnd webkitTransitionEnd transitionend oTransitionEnd msTransitionEnd', function() { 128 if(wrapper.hasClass('open')) { 129 wrapper.removeClass('transition').css('height', 'auto'); 130 } 131 }); 132 } 133 134});
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.