Server IP : 104.21.14.48 / Your IP : 3.138.172.170 [ Web Server : Apache System : Linux b70eb322-3aee-0c53-7c82-0db91281f2c6.secureserver.net 6.1.90-1.el9.elrepo.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 2 12:09:22 EDT 2024 x86_64 User : root ( 0) PHP Version : 8.0.30.2 Disable Function : NONE Domains : 0 Domains MySQL : ON | cURL : ON | WGET : ON | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/wp-content/plugins/gravityforms/includes/addon/js/ |
Upload File : |
var GFFeedOrder = function( args ) { var self = this, $ = jQuery; /** * Initialize Feed Ordering */ self.init = function() { // Assign options to instance. self.options = args; // Prepare sorting handle. var sortHandleMarkup = '<td class="sort-column"><i class="gform-icon gform-icon--drag-indicator feed-sort-handle"></i></td>'; // Add sorting handle to table. $( '.wp-list-table thead tr, .wp-list-table tfoot tr' ).append( '<th class="sort-column"></th>' ); $( '.wp-list-table tbody tr' ).append( sortHandleMarkup ); // Initialize sorting. self.initSorting(); }; /** * Initialize jQuery UI Sortable. */ self.initSorting = function() { $( '.wp-list-table tbody' ).sortable( { cursor: 'move', handle: '.feed-sort-handle', placeholder: 'feed-placeholder', tolerance: 'pointer', create: function() { $( '.wp-list-table' ).addClass( 'feed-list-sortable' ); }, helper: self.fixSortableColumnWidths, start: self.setPlaceholderHeight, update: self.updateFeedOrder, } ); } /** * Fix table column widths. */ self.fixSortableColumnWidths = function( event, tr ) { var $originals = tr.children(), $helper = tr.clone(); $helper.children().each( function( index ) { $( this ).width( $originals.eq( index ).width() ); } ); return $helper; } /** * Get order of feeds. */ self.getFeedOrder = function() { // Get all the checkboxes from the feed list table. var feed_checkboxes = $( '.wp-list-table tbody .check-column input[type="checkbox"]' ); // Map a function to the feed checkboxes array that returns the checkbox value. return feed_checkboxes.map( function() { return $( this ).val(); } ).get(); } /** * Set height of the placeholder draggable feed. */ self.setPlaceholderHeight = function( event, ui ) { // Set the height of the placeholder to the height of the feed being moved. $( '.wp-list-table .feed-placeholder' ).height( ui.item.height() ); } /** * Save the feed ordering to the database. */ self.updateFeedOrder = function( event, ui ) { $.ajax( ajaxurl, { method: 'POST', dataType: 'JSON', data: { action: 'gf_save_feed_order', addon: self.options.addon, form_id: self.options.formId, feed_order: self.getFeedOrder(), nonce: self.options.nonce, } } ); } this.init(); }