1( function( $, elementor ) { 2 3 'use strict'; 4 5 var WPKoiStickyColumn = { 6 7 init: function() { 8 elementor.hooks.addAction( 'frontend/element_ready/column', WPKoiStickyColumn.elementorColumn ); 9 10 }, 11 12 elementorColumn: function( $scope ) { 13 var $target = $scope, 14 $window = $( window ), 15 columnId = $target.data( 'id' ), 16 editMode = Boolean( elementor.isEditMode() ), 17 settings = {}, 18 stickyInstance = null, 19 stickyInstanceOptions = { 20 topSpacing: 50, 21 bottomSpacing: 50, 22 containerSelector: '.elementor-row', 23 innerWrapperSelector: '.elementor-column-wrap', 24 }; 25 26 if ( ! editMode ) { 27 settings = $target.data( 'settings' ); 28 29 if ( $target.hasClass( 'wpkoi-sticky-column' ) ) { 30 31 if ( -1 !== settings['stickyOn'].indexOf( elementorFrontend.getCurrentDeviceMode() ) ) { 32 33 stickyInstanceOptions.topSpacing = settings['topSpacing']; 34 stickyInstanceOptions.bottomSpacing = settings['bottomSpacing']; 35 36 $target.data( 'stickyColumnInit', true ); 37 stickyInstance = new StickySidebar( $target[0], stickyInstanceOptions ); 38 39 $window.on( 'resize.WPKoiStickyColumnStickyColumn orientationchange.WPKoiStickyColumnStickyColumn', WPKoiStickyColumnTools.debounce( 50, resizeDebounce ) ); 40 } 41 } 42 } else { 43 settings = WPKoiStickyColumn.columnEditorSettings( columnId ); 44 45 if ( 'true' === settings['sticky'] ) { 46 $target.addClass( 'wpkoi-sticky-column' ); 47 48 if ( -1 !== settings['stickyOn'].indexOf( elementorFrontend.getCurrentDeviceMode() ) ) { 49 stickyInstanceOptions.topSpacing = settings['topSpacing']; 50 stickyInstanceOptions.bottomSpacing = settings['bottomSpacing']; 51 52 $target.data( 'stickyColumnInit', true ); 53 stickyInstance = new StickySidebar( $target[0], stickyInstanceOptions ); 54 55 $window.on( 'resize.WPKoiStickyColumnStickyColumn orientationchange.WPKoiStickyColumnStickyColumn', WPKoiStickyColumnTools.debounce( 50, resizeDebounce ) ); 56 } 57 } 58 } 59 60 function resizeDebounce() { 61 var currentDeviceMode = elementorFrontend.getCurrentDeviceMode(), 62 availableDevices = settings['stickyOn'] || [], 63 isInit = $target.data( 'stickyColumnInit' ); 64 65 if ( -1 !== availableDevices.indexOf( currentDeviceMode ) ) { 66 67 if ( ! isInit ) { 68 $target.data( 'stickyColumnInit', true ); 69 stickyInstance = new StickySidebar( $target[0], stickyInstanceOptions ); 70 stickyInstance.updateSticky(); 71 } 72 } else { 73 $target.data( 'stickyColumnInit', false ); 74 stickyInstance.destroy(); 75 } 76 } 77 78 }, 79 80 columnEditorSettings: function( columnId ) { 81 var editorElements = null, 82 columnData = {}; 83 84 if ( ! window.elementor.hasOwnProperty( 'elements' ) ) { 85 return false; 86 } 87 88 editorElements = window.elementor.elements; 89 90 if ( ! editorElements.models ) { 91 return false; 92 } 93 94 $.each( editorElements.models, function( index, obj ) { 95 96 $.each( obj.attributes.elements.models, function( index, obj ) { 97 if ( columnId == obj.id ) { 98 columnData = obj.attributes.settings.attributes; 99 } 100 } ); 101 102 } ); 103 104 return { 105 'sticky': columnData['wpkoi_tricks_column_sticky'] || false, 106 'topSpacing': columnData['wpkoi_tricks_top_spacing'] || 50, 107 'bottomSpacing': columnData['wpkoi_tricks_bottom_spacing'] || 50, 108 'stickyOn': columnData['wpkoi_tricks_column_sticky_on'] || [ 'desktop', 'tablet', 'mobile'] 109 } 110 111 }, 112 113 }; 114 115 $( window ).on( 'elementor/frontend/init', WPKoiStickyColumn.init ); 116 117 var WPKoiStickyColumnTools = { 118 debounce: function( threshold, callback ) { 119 var timeout; 120 121 return function debounced( $event ) { 122 function delayed() { 123 callback.call( this, $event ); 124 timeout = null; 125 } 126 127 if ( timeout ) { 128 clearTimeout( timeout ); 129 } 130 131 timeout = setTimeout( delayed, threshold ); 132 }; 133 } 134 } 135 136}( jQuery, window.elementorFrontend ) );
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.