1/*! ET frontend-builder-global-functions.js */ 2(function($){ 3 window.et_pb_smooth_scroll = function( $target, $top_section, speed, easing ) { 4 var $window_width = $( window ).width(); 5 6 if ( $( 'body' ).hasClass( 'et_fixed_nav' ) && $window_width > 980 ) { 7 $menu_offset = $( '#top-header' ).outerHeight() + $( '#main-header' ).outerHeight() - 1; 8 } else { 9 $menu_offset = -1; 10 } 11 12 if ( $ ('#wpadminbar').length && $window_width > 600 ) { 13 $menu_offset += $( '#wpadminbar' ).outerHeight(); 14 } 15 16 //fix sidenav scroll to top 17 if ( $top_section ) { 18 $scroll_position = 0; 19 } else { 20 $scroll_position = $target.offset().top - $menu_offset; 21 } 22 23 // set swing (animate's scrollTop default) as default value 24 if( typeof easing === 'undefined' ){ 25 easing = 'swing'; 26 } 27 28 $( 'html, body' ).animate( { scrollTop : $scroll_position }, speed, easing ); 29 }; 30 31 window.et_pb_form_placeholders_init = function( $form ) { 32 $form.find('input:text, input[type="email"], input[type="url"], textarea').each(function(index,domEle){ 33 var $et_current_input = jQuery(domEle), 34 $et_comment_label = $et_current_input.siblings('label'), 35 et_comment_label_value = $et_current_input.siblings('label').text(); 36 if ( $et_comment_label.length ) { 37 $et_comment_label.hide(); 38 if ( $et_current_input.siblings('span.required') ) { 39 et_comment_label_value += $et_current_input.siblings('span.required').text(); 40 $et_current_input.siblings('span.required').hide(); 41 } 42 $et_current_input.val(et_comment_label_value); 43 } 44 }).bind('focus',function(){ 45 var et_label_text = jQuery(this).siblings('label').text(); 46 if ( jQuery(this).siblings('span.required').length ) et_label_text += jQuery(this).siblings('span.required').text(); 47 if (jQuery(this).val() === et_label_text) jQuery(this).val(""); 48 }).bind('blur',function(){ 49 var et_label_text = jQuery(this).siblings('label').text(); 50 if ( jQuery(this).siblings('span.required').length ) et_label_text += jQuery(this).siblings('span.required').text(); 51 if (jQuery(this).val() === "") jQuery(this).val( et_label_text ); 52 }); 53 }; 54 55 window.et_duplicate_menu = function( menu, append_to, menu_id, menu_class, menu_click_event ){ 56 append_to.each( function() { 57 var $this_menu = $(this), 58 $cloned_nav; 59 60 // make this function work with existing menus, without cloning 61 if ( '' !== menu ) { 62 menu.clone().attr('id',menu_id).removeClass().attr('class',menu_class).appendTo( $this_menu ); 63 } 64 65 $cloned_nav = $this_menu.find('> ul'); 66 $cloned_nav.find('.menu_slide').remove(); 67 $cloned_nav.find('li:first').addClass('et_first_mobile_item'); 68 69 $cloned_nav.find( 'a' ).on( 'click', function(){ 70 $(this).parents( '.et_mobile_menu' ).siblings( '.mobile_menu_bar' ).trigger( 'click' ); 71 } ); 72 73 if ( 'no_click_event' !== menu_click_event ) { 74 $this_menu.on( 'click', '.mobile_menu_bar', function(){ 75 if ( $this_menu.hasClass('closed') ){ 76 $this_menu.removeClass( 'closed' ).addClass( 'opened' ); 77 $cloned_nav.stop().slideDown( 500 ); 78 } else { 79 $this_menu.removeClass( 'opened' ).addClass( 'closed' ); 80 $cloned_nav.stop().slideUp( 500 ); 81 } 82 return false; 83 } ); 84 } 85 } ); 86 87 $('#mobile_menu .centered-inline-logo-wrap').remove(); 88 }; 89 90 // remove placeholder text before form submission 91 window.et_pb_remove_placeholder_text = function( $form ) { 92 $form.find('input:text, textarea').each(function(index,domEle){ 93 var $et_current_input = jQuery(domEle), 94 $et_label = $et_current_input.siblings('label'), 95 et_label_value = $et_current_input.siblings('label').text(); 96 97 if ( $et_label.length && $et_label.is(':hidden') ) { 98 if ( $et_label.text() == $et_current_input.val() ) 99 $et_current_input.val( '' ); 100 } 101 }); 102 }; 103 104 window.et_fix_fullscreen_section = function() { 105 var $et_window = $(window); 106 107 $( 'section.et_pb_fullscreen' ).each( function(){ 108 var $this_section = $( this ); 109 110 $.proxy( et_calc_fullscreen_section, $this_section )(); 111 112 $et_window.on( 'resize', $.proxy( et_calc_fullscreen_section, $this_section ) ); 113 }); 114 }; 115 116 window.et_bar_counters_init = function( $bar_item ) { 117 if ( ! $bar_item.length ) { 118 return; 119 } 120 121 $bar_item.css({ 122 'width' : parseFloat( $bar_item.attr( 'data-width' ) ) + '%' 123 }); 124 }; 125 126 window.et_fix_pricing_currency_position = function( $pricing_table ) { 127 var $all_pricing_tables = typeof $pricing_table !== 'undefined' ? $pricing_table : $( '.et_pb_pricing_table' ); 128 129 if ( ! $all_pricing_tables.length ) { 130 return; 131 } 132 133 $all_pricing_tables.each( function() { 134 var $this_table = $( this ), 135 $price_container = $this_table.find( '.et_pb_et_price' ), 136 $currency = $price_container.length ? $price_container.find( '.et_pb_dollar_sign' ) : false, 137 $price = $price_container.length ? $price_container.find( '.et_pb_sum' ) : false;
138 139 if ( ! $currency || ! $price ) { 140 return; 141 } 142 143 // adjust the margin of currency sign to make sure it doesn't overflow the price 144 $currency.css( { 'marginLeft' : - $currency.width() + 'px' } ); 145 }); 146 }; 147 148 window.et_pb_set_responsive_grid = function( $grid_items_container, single_item_selector ) { 149 setTimeout(function () { 150 var container_width = $grid_items_container.innerWidth(); 151 var $grid_items = $grid_items_container.find(single_item_selector); 152 var item_width = $grid_items.outerWidth(true); 153 var last_item_margin = item_width - $grid_items.outerWidth(); 154 var columns_count = Math.round((container_width + last_item_margin) / item_width); 155 var counter = 1; 156 var first_in_row = 1; 157 var $first_in_last_row = $(); 158 159 $grid_items.removeClass('last_in_row first_in_row on_last_row'); 160 $grid_items.filter(':visible').each(function () { 161 var $this_element = $(this); 162 163 if (!$this_element.hasClass('inactive')) { 164 if (first_in_row === counter) { 165 $this_element.addClass('first_in_row'); 166 $first_in_last_row = $this_element; 167 } else if (0 === counter % columns_count) { 168 $this_element.addClass('last_in_row'); 169 first_in_row = counter + 1; 170 } 171 counter++; 172 } 173 }); 174 if ($first_in_last_row.length) { 175 var $module = $first_in_last_row.parents('.et_pb_module'); 176 //set margin bottom to 0 if the gallery is the last module on the column 177 if ($module.is(':last-child')) { 178 var column = $first_in_last_row.parents('.et_pb_column')[0]; 179 $(column).find('.et_pb_grid_item').removeClass('on_last_row'); 180 // keep gutter margin if gallery has pagination 181 var pagination = $module.find('.et_pb_gallery_pagination'); 182 if (0 === pagination.length) { 183 pagination = $module.find('.et_pb_portofolio_pagination'); 184 } 185 if (0 === pagination.length || (pagination.length > 0 && !pagination.is(':visible'))) { 186 $first_in_last_row.addClass('on_last_row'); 187 $first_in_last_row.nextAll().addClass('on_last_row'); 188 } 189 } 190 } 191 }, 1); // need this timeout to make sure all the css applied before calculating sizes 192 }; 193 194 window.et_pb_set_tabs_height = function( $tabs_module ) { 195 if ( typeof $tabs_module === 'undefined' ) { 196 $tabs_module = $( '.et_pb_tabs' ); 197 } 198 199 if ( ! $tabs_module.length ) { 200 return; 201 } 202 203 $tabs_module.each( function() { 204 var $tab_controls = $( this ).find( '.et_pb_tabs_controls' ); 205 var $all_tabs = $tab_controls.find( 'li' ); 206 var max_height = 0; 207 var small_columns = '.et_pb_column_1_3, .et_pb_column_1_4, .et_pb_column_3_8'; 208 var in_small_column = $( this ).parents( small_columns ).length > 0; 209 var on_small_screen = parseFloat( $( window ).width() ) < 768; 210 var vertically_stacked = in_small_column || on_small_screen; 211 212 if ( vertically_stacked ) { 213 $( this ).addClass( 'et_pb_tabs_vertically_stacked' ); 214 } 215 216 // determine the height of the tallest tab 217 if ( $all_tabs.length ) { 218 // remove the height attribute if it was added to calculate the height correctly 219 $tab_controls.children('li').removeAttr('style'); 220 221 $all_tabs.each( function() { 222 var tab_height = $( this ).outerHeight(); 223 224 if ( vertically_stacked ) { 225 return; 226 } 227 228 if ( tab_height > max_height ) { 229 max_height = tab_height; 230 } 231 }); 232 } 233 234 if ( 0 !== max_height ) { 235 // set the height of tabs container based on the height of the tallest tab 236 $tab_controls.children('li').css('height', max_height); 237 } 238 }); 239 }; 240 241 window.et_pb_box_shadow_apply_overlay = function (el) { 242 var pointerEventsSupport = document.body.style.pointerEvents !== undefined 243 && 244 //For some reasons IE 10 tells that supports pointer-events, but it doesn't 245 (document.documentMode === undefined || document.documentMode >= 11); 246 247 if (pointerEventsSupport) { 248 $(el).each(function () { 249 if (! $(this).children('.box-shadow-overlay').length) { 250 $(this)
251 .addClass('has-box-shadow-overlay') 252 .prepend('<div class="box-shadow-overlay"></div>'); 253 } 254 }); 255 } else { 256 $(el).addClass('.et-box-shadow-no-overlay'); 257 } 258 }; 259 260 window.et_pb_init_nav_menu = function($et_menus) { 261 $et_menus.each(function() { 262 var $et_menu = $(this); 263 264 // don't attach event handlers several times to the same menu 265 if ( $et_menu.data('et-is-menu-ready') ) { 266 return; 267 } 268 269 $et_menu.find('li').hover(function() { 270 window.et_pb_toggle_nav_menu($(this), 'open'); 271 }, function() { 272 window.et_pb_toggle_nav_menu($(this), 'close'); 273 } ); 274 275 // close all opened menus on touch outside the menu 276 $('body').on('touchend', function(event){ 277 if ($(event.target).closest('ul.nav, ul.menu').length < 1 && $('.et-hover').length > 0) { 278 window.et_pb_toggle_nav_menu($('.et-hover'), 'close'); 279 } 280 }); 281 282 // Dropdown menu adjustment for touch screen 283 $et_menu.find('li.menu-item-has-children').on('touchend', function(event) { 284 var $closest_li = $(event.target).closest('.menu-item'); 285 286 // no need special processing if parent li doesn't have hidden child elements 287 if (! $closest_li.hasClass('menu-item-has-children')) { 288 return; 289 } 290 291 var $this_el = $(this); 292 var is_mega_menu_opened = $closest_li.closest('.mega-menu-parent.et-touch-hover').length > 0; 293 294 // open submenu on 1st tap 295 // open link on second tap 296 if ($this_el.hasClass('et-touch-hover') || is_mega_menu_opened) { 297 var href = $this_el.find('>a').attr('href'); 298 299 if (typeof href !== 'undefined') {//if parent link is not empty then open the link 300 window.location = $this_el.find('>a').attr('href'); 301 } 302 } else { 303 var $opened_menu = $(event.target); 304 var $already_opened_menus = $opened_menu.closest('.menu-item').siblings('.et-touch-hover'); 305 // close the menu before opening new one 306 if ($opened_menu.closest('.et-touch-hover').length < 1) { 307 window.et_pb_toggle_nav_menu($('.et-hover'), 'close', 0); 308 } 309 310 $this_el.addClass('et-touch-hover'); 311 312 if ($already_opened_menus.length > 0) { 313 var $submenus_in_already_opened = $already_opened_menus.find('.et-touch-hover'); 314 // close already opened submenus to avoid overlaps 315 window.et_pb_toggle_nav_menu($already_opened_menus, 'close'); 316 window.et_pb_toggle_nav_menu($submenus_in_already_opened, 'close'); 317 } 318 // open new submenu 319 window.et_pb_toggle_nav_menu($this_el, 'open'); 320 } 321 322 event.preventDefault(); 323 event.stopPropagation(); 324 } ); 325 326 $et_menu.find( 'li.mega-menu' ).each(function(){ 327 var $li_mega_menu = $(this), 328 $li_mega_menu_item = $li_mega_menu.children( 'ul' ).children( 'li' ), 329 li_mega_menu_item_count = $li_mega_menu_item.length; 330 331 if ( li_mega_menu_item_count < 4 ) { 332 $li_mega_menu.addClass( 'mega-menu-parent mega-menu-parent-' + li_mega_menu_item_count ); 333 } 334 }); 335 336 // mark the menu as ready 337 $et_menu.data('et-is-menu-ready', 'ready'); 338 }); 339 }; 340 341 window.et_pb_toggle_nav_menu = function($element, state, delay) { 342 if ( 'open' === state ) { 343 if ( ! $element.closest( 'li.mega-menu' ).length || $element.hasClass( 'mega-menu' ) ) { 344 $element.addClass( 'et-show-dropdown' ); 345 $element.removeClass( 'et-hover' ).addClass( 'et-hover' ); 346 } 347 } else { 348 var closeDelay = typeof delay !== 'undefined' ? delay : 200; 349 $element.removeClass( 'et-show-dropdown' ); 350 $element.removeClass( 'et-touch-hover' ); 351 352 setTimeout( function() { 353 if ( ! $element.hasClass( 'et-show-dropdown' ) ) { 354 $element.removeClass( 'et-hover' ); 355 } 356 }, closeDelay ); 357 } 358 }; 359 360 window.et_pb_apply_sticky_image_effect = function($sticky_image_el) { 361 var $row = $sticky_image_el.closest('.et_pb_row'); 362 var $section = $row.closest('.et_pb_section'); 363 var $column = $sticky_image_el.closest('.et_pb_column'); 364 var sticky_class = 'et_pb_section_sticky'; 365 var sticky_mobile_class = 'et_pb_section_sticky_mobile'; 366 var $lastRowInSection = $section.children('.et_pb_row').last(); 367 var $lastColumnInRow = $row.children('.et_pb_column').last(); 368 var $lastModuleInColumn = $column.children('.et_pb_module').last(); 369
370 // If it is not in the last row, continue 371 if (! $row.is($lastRowInSection)) { 372 return true; 373 } 374 375 $lastRowInSection.addClass('et-last-child'); 376 377 // Make sure sticky image is the last element in the column 378 if (! $sticky_image_el.is($lastModuleInColumn)) { 379 return true; 380 } 381 382 // If it is in the last row, find the parent section and attach new class to it 383 if (! $section.hasClass(sticky_class)) { 384 $section.addClass(sticky_class); 385 } 386 387 $column.addClass('et_pb_row_sticky'); 388 389 if (! $section.hasClass(sticky_mobile_class) && $column.is($lastColumnInRow)) { 390 $section.addClass(sticky_mobile_class); 391 } 392 }; 393})(jQuery);
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.