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