1/******************************************************************************/ 2/******************************************************************************/ 3 4;(function($,doc,win) 5{ 6 "use strict"; 7 8 var Header=function(object,themeOption) 9 { 10 /**********************************************************************/ 11 12 var $self=this; 13 var $themeOption=themeOption; 14 15 var $header; 16 var $headerTop; 17 var $headerBottom; 18 19 var $headerTopLogo; 20 var $headerTopSocial; 21 22 var $headerTopMenuDefaultList; 23 24 var $headerTopMenuResponsive; 25 26 /**********************************************************************/ 27 28 this.create=function() 29 { 30 $header=$('.theme-page-header'); 31 $headerTop=$header.find('.theme-page-header-top'); 32 $headerBottom=$header.find('.theme-page-header-bottom'); 33 34 $headerTopLogo=$headerTop.find('.theme-page-header-top-logo'); 35 $headerTopSocial=$headerTop.find('.theme-page-header-top-social-list'); 36 $headerTopMenuDefaultList=$headerTop.find('.theme-page-header-top-menu-default>ul'); 37 $headerTopMenuResponsive=$headerTop.find('.theme-page-header-top-menu-responsive'); 38 39 /***/ 40 41 if($headerBottom.hasClass('theme-page-header-bottom-type-image')) 42 { 43 var imageLength=parseInt($headerBottom.find('img').length,10); 44 if(imageLength) 45 { 46 var imageCounter=0; 47 $headerBottom.find('img').on('load',function() 48 { 49 imageCounter++; 50 if(imageCounter===imageLength) $self.build(); 51 }).each(function() 52 { 53 if(this.complete) $(this).load(); 54 }); 55 } 56 else $self.build(); 57 } 58 else $self.build(); 59 }; 60 61 /**********************************************************************/ 62 63 this.build=function() 64 { 65 if($headerTopMenuDefaultList.length===1) 66 { 67 if($headerTopMenuDefaultList.length===1 && parseInt($themeOption.menu.animation_enable,10)===1) 68 { 69 $headerTopMenuDefaultList.superfish( 70 { 71 delay : parseInt($themeOption.menu.animation_delay,10), 72 speed : parseInt($themeOption.menu.animation_speed_open,10), 73 speedOut : parseInt($themeOption.menu.animation_speed_close,10), 74 cssArrows : false, 75 animation : {opacity:'show'}, 76 onInit : function() 77 { 78 79 } 80 }); 81 } 82 } 83 84 /***/ 85 86 $(window).windowDimensionListener({change:function(width,height) 87 { 88 if(width || height) 89 { 90 $self.createHeaderSticky(); 91 $self.createHeaderResponsive(); 92 $self.setHeaderMinHeight(); 93 } 94 }}); 95 96 /***/ 97 98 if(parseInt($themeOption.header.sticky_enable,10)===1) 99 { 100 $(window).scroll(function() 101 { 102 $self.createHeaderSticky(); 103 }); 104 } 105 106 /***/ 107 108 $self.createMenuResponsive(); 109 110 /***/ 111 112 $header.css({display:'block'}); 113 }; 114 115 /**********************************************************************/ 116 117 this.createHeaderResponsive=function() 118 { 119 if($headerTopLogo.actual('outerWidth')+$headerTopSocial.actual('outerWidth')>$header.actual('outerWidth')) 120 { 121 $header.addClass('theme-mode-responsive theme-mode-responsive-state-2').removeClass('theme-mode-responsive-state-1'); 122 return; 123 } 124 125 if($headerTopMenuDefaultList.length) 126 { 127 if($headerTopLogo.actual('outerWidth')>$headerTopMenuDefaultList.offset().left) 128 { 129 $header.addClass('theme-mode-responsive theme-mode-responsive-state-1').removeClass('theme-mode-responsive-state-2'); 130 return; 131 } 132 133 if($headerTopMenuDefaultList.offset().left+$headerTopMenuDefaultList.actual('outerWidth')>$headerTopSocial.offset().left) 134 { 135 $header.addClass('theme-mode-responsive theme-mode-responsive-state-1').removeClass('theme-mode-responsive-state-2'); 136 return; 137 } 138 } 139 140 $headerTopMenuResponsive.css({'display':'none'}); 141 142 $header.removeClass('theme-mode-responsive').removeClass('theme-mode-responsive-state-1').removeClass('theme-mode-responsive-state-2'); 143 }; 144 145 /**********************************************************************/ 146 147 this.createHeaderSticky=function() 148 { 149 if(parseInt($themeOption.header.sticky_enable,10)!==1) return; 150 151 var offset=(parseInt($('#wpadminbar').length,10)===1 ? $('#wpadminbar').actual('height') : 0); 152 153 if($header.hasClass('theme-mode-responsive')) 154 { 155 $header.removeClass('theme-page-header-sticky'); 156 return; 157 } 158 159 if($header.hasClass('theme-page-header-sticky')) 160 { 161 if($(window).scrollTop()<=$header.position().top-offset) 162 { 163 $header.removeClass('theme-page-header-sticky'); 164 } 165 } 166 else 167 {
168 if($(window).scrollTop()>$header.position().top-offset) 169 { 170 $header.addClass('theme-page-header-sticky'); 171 } 172 } 173 }; 174 175 /**********************************************************************/ 176 177 this.setHeaderResponsive=function() 178 { 179 var width=$header.parent().actual('width')+17; 180 181 if(width<$themeOption.header.menu_responsive_mode) 182 { 183 $header.addClass('theme-mode-responsive'); 184 $header.removeClass('theme-header-menu-sticky'); 185 } 186 else $header.removeClass('theme-mode-responsive'); 187 }; 188 189 /**********************************************************************/ 190 191 this.createMenuResponsive=function() 192 { 193 $headerTopSocial.children('a:last').on('click',function(e) 194 { 195 e.preventDefault(); 196 $self.openMenuResponsive(); 197 }); 198 199 $headerTopMenuResponsive.find('>ul').prepend('<li><a href="#"><span></span><span></span><span class="theme-icon-meta-arrow-large-tb"></span></a></li>') 200 201 $headerTopMenuResponsive.find('li.menu-item-has-children>a>span:first-child+span+span').addClass('theme-icon-meta-arrow-large-tb'); 202 203 $headerTopMenuResponsive.find('>ul>li:first-child>a').on('click',function() 204 { 205 $self.closeMenuResponsive(); 206 }); 207 208 $headerTopMenuResponsive.find('span.theme-icon-meta-arrow-large-tb').on('click',function(e) 209 { 210 e.preventDefault(); 211 $(this).parent('a').next('ul').slideToggle(200); 212 }); 213 }; 214 215 /**********************************************************************/ 216 217 this.openMenuResponsive=function() 218 { 219 $headerTopMenuResponsive.css({'top':-1*$headerTopMenuResponsive.actual('outerHeight'),'display':'block'}); 220 221 $headerTopMenuResponsive.animate({top:0},{duration:500,easing:'easeInOutCubic'},function() 222 { 223 224 }); 225 }; 226 227 /**********************************************************************/ 228 229 this.closeMenuResponsive=function() 230 { 231 var height=-1*$headerTopMenuResponsive.actual('outerHeight'); 232 233 $headerTopMenuResponsive.animate({top:height},{duration:500,easing:'easeInOutCubic'},function() 234 { 235 $headerTopMenuResponsive.css('display','none'); 236 }); 237 }; 238 239 /**********************************************************************/ 240 241 this.setHeaderMinHeight=function() 242 { 243 $header.css('min-height',$headerTop.actual('outerHeight')); 244 }; 245 246 /**********************************************************************/ 247 }; 248 249 /**************************************************************************/ 250 251 $.fn.header=function(themeOption) 252 { 253 var header=new Header(this,themeOption); 254 header.create(); 255 }; 256 257 /**************************************************************************/ 258 259})(jQuery,document,window); 260 261/******************************************************************************/ 262/******************************************************************************/
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.