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 7.6.8 7.6.9 7.7.0 7.8.0 7.8.1 7.8.10 7.8.11 7.8.12 7.8.13 7.8.14 7.8.15 7.8.16 7.8.17 7.8.18 7.8.2 7.8.3 7.8.4 7.8.5 7.8.5.1 7.8.6 7.8.7 7.8.8 7.8.9 7.9.0 7.9.1 7.9.10 7.9.11 7.9.2 7.9.3 7.9.4 7.9.5 7.9.6 7.9.7 7.9.8 7.9.9 8.0.0 8.0.1 8.0.2 8.0.3 8.0.4 8.0.5 8.0.6 8.0.7 8.0.8 8.1.0 8.1.1 8.1.2 8.1.3 8.1.4 8.2.0 trunk 1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 1.7.0 1.8.0 1.9.0 2.0.0 2.1.0 2.2.0 2.3.0 2.4.0 2.5.0 2.6.0 2.7.0 2.8.0 2.8.1 2.8.2 2.8.3 2.9.0 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.1.0 3.2.0 3.3.0 3.4.0 3.5.0 3.6.1 3.7.0 3.8.0 3.9.0 3.9.1 3.9.2 4.0.0 4.0.1 4.1.0 4.2.0 4.2.1 4.2.2 4.3.0 4.3.1 4.4.0 4.5.0 4.6.0 4.7.0 4.7.1 4.7.2 4.7.3 4.7.4 4.8.0 4.8.1 4.8.2 4.8.3 4.9.0 4.9.1 4.9.2 4.9.3 5.0.0
admin-site-enhancements / assets / js / content-order-sort.js
admin-site-enhancements / assets / js Last commit date
codemirror 1 year ago datatables 1 year ago admin-menu-organizer.js 1 year ago admin-page.js 1 year ago content-order-sort.js 1 year ago custom-admin-menu.js 1 year ago external-permalinks.js 1 year ago gutenberg-content-duplication.js 1 year ago hide-admin-notices.js 1 year ago jBox.all.min.js 1 year ago jquery.jsticky.mod.js 1 year ago jquery.jsticky.mod.min.js 1 year ago jquery.mjs.nestedSortable.js 1 year ago jquery.ui.touch-punch.min.js 1 year ago js.cookie.min.js 1 year ago list-tables-content-order.js 1 year ago media-replace.js 1 year ago multiple-user-roles.js 1 year ago select2.full.min.js 1 year ago toggle-hidden-menu.js 1 year ago
content-order-sort.js
143 lines
1 (function( $ ) {
2 'use strict';
3
4 $(document).ready( function() {
5 var itemList = $('#item-list'), // Container of item list
6 maxLevel = 6,
7 sort_started = {}, // For data related to the dragged element when dragging started
8 sort_finished = {}; // For data related to the dragged element when dragging has finished
9
10 // console.log(contentOrderSort); // Data passed from PHP via wp_localize_script
11 if (contentOrderSort.hierarchical == 'false') {
12 maxLevel = 1;
13 }
14
15 // Make item list into nested sortable
16 // Ref: https://api.jqueryui.com/sortable/
17 // Ref: https://github.com/ilikenwf/nestedSortable
18 itemList.nestedSortable({
19 // Disable nesting if set to true
20 protectRoot: true,
21 // Forces the placeholder to have a size.
22 forcePlaceholderSize: true,
23 // Restricts sort start click to the specified element.
24 // Allows for a helper element to be used for dragging display.
25 // If set to "clone", then the element will be cloned and the clone will be dragged.
26 helper: 'clone',
27 listType: 'ul',
28 items: 'li',
29 toleranceElement: '> div', // Direct children of the li element
30 handle: 'div', // The same <div> for toleranceElement is set as the drag handle
31 // Specifies which mode to use for testing whether the item being moved is hovering over another item.
32 // If set to 'pointr', is when the mouse pointer overlaps the other item.
33 tolerance: 'pointer',
34 // The maximum depth of nested items the list can accept.
35 maxLevels: maxLevel,
36 // Defines the opacity of the helper while sorting.
37 opacity: 0.6,
38 placeholder: 'ui-sortable-placeholder',
39 // Whether the sortable items should revert to their new positions using a smooth animation.
40 // If set as a number, it's in miliseconds
41 revert: 250,
42 // How far right or left (in pixels) the item has to travel
43 // in order to be nested or to be sent outside its current list. Default: 20
44 tabSize: 25,
45 // This event is triggered when sorting starts.
46 start: function (event, ui) {
47 sort_started.item = ui.item; // The jQuery object representing the current dragged element.
48 sort_started.prev = ui.item.prev(':not(".ui-sortable-placeholder")');
49 sort_started.next = ui.item.next(':not(".ui-sortable-placeholder")');
50 },
51 // This event is triggered when the user stopped sorting and the DOM position has changed.
52 update: function (event, ui) {
53 // Elements of the "Updating order..." notice
54 var updateNotice = $('#updating-order-notice'), // Wrapper
55 spinner = $('#spinner-img'), // Spinner
56 updateSuccess = $('.updating-order-notice .dashicons.dashicons-saved'); // Check mark
57
58 ui.item.find('div.row-content:first').append(updateNotice);
59
60 // Reset the state of the "Updating order..." indicator
61 $(spinner).show();
62 $(updateSuccess).hide();
63 $(updateNotice).css('background-color','#eee').fadeIn();
64
65 // Get the end items where the item was placed
66 sort_finished.item = ui.item; // The jQuery object representing the current dragged element.
67 sort_finished.prev = ui.item.prev(':not(".ui-sortable-placeholder")');
68 sort_finished.next = ui.item.next(':not(".ui-sortable-placeholder")');
69
70 var list_offset = parseInt(sort_finished.item.index());
71 sort_finished.item.attr('data-menu-order', list_offset);
72
73 // Get attributes
74 var attributes = {};
75 $.each(sort_finished.item[0].attributes, function () {
76 attributes[this.name] = this.value;
77 });
78 // console.log('attributes: ' + cleanStringify(attributes));
79
80 // Data for ajax call
81 var dataArgs = {
82 action: contentOrderSort.action, // from wp_localize_script
83 item_parent: 0, // We only deal with top-level items, not child items
84 start: 0, // Start processing menu_order update in DB from item with menu_order defined here
85 nonce: contentOrderSort.nonce,
86 post_id: sort_finished.item.attr('data-id'),
87 menu_order: sort_finished.item.attr('data-menu-order'),
88 excluded_items: {},
89 post_type: sort_started.item.attr('data-post-type'),
90 attributes: attributes,
91 };
92 // console.log('dataArgs: ' + cleanStringify(dataArgs));
93
94 // AJAX call to update menu_order for items in the list
95 $.ajax({
96 type: "POST",
97 url: ajaxurl,
98 data: dataArgs,
99 success: function(response) {
100 // console.log(response);
101 // Update the state of the "Updating order..." indicator
102 $(spinner).hide();
103 $(updateSuccess).show();
104 $(updateNotice).css('background-color','#cce5cc').delay(1000).fadeOut();
105 },
106 error: function(errorThrown) {
107 console.log(errorThrown);
108 }
109 });
110 }
111 });
112
113
114 });
115
116 // Convert object to simpler string for console.log. Ref: https://stackoverflow.com/a/48845206
117 // function cleanStringify(object) {
118 // if (object && typeof object === 'object') {
119 // object = copyWithoutCircularReferences([object], object);
120 // }
121 // return JSON.stringify(object);
122
123 // function copyWithoutCircularReferences(references, object) {
124 // var cleanObject = {};
125 // Object.keys(object).forEach(function(key) {
126 // var value = object[key];
127 // if (value && typeof value === 'object') {
128 // if (references.indexOf(value) < 0) {
129 // references.push(value);
130 // cleanObject[key] = copyWithoutCircularReferences(references, value);
131 // references.pop();
132 // } else {
133 // cleanObject[key] = '###_Circular_###';
134 // }
135 // } else if (typeof value !== 'function') {
136 // cleanObject[key] = value;
137 // }
138 // });
139 // return cleanObject;
140 // }
141 // }
142
143 })( jQuery );