PluginProbe ʕ •ᴥ•ʔ
Strong Testimonials / 3.3.2
Strong Testimonials v3.3.2
3.3.2 3.3.1 trunk 1.0.1 2.30.9 2.31.10 2.32 2.32.1 2.32.2 2.32.3 2.32.4 2.33 2.34 2.35 2.36 2.37 2.38 2.38.1 2.39 2.39.1 2.39.2 2.39.3 2.40.0 2.40.1 2.40.2 2.40.3 2.40.4 2.40.5 2.40.6 2.40.7 2.41.0 2.41.1 2.50.0 2.50.1 2.50.2 2.50.3 2.50.4 2.51.0 2.51.1 2.51.2 2.51.3 2.51.4 2.51.5 2.51.6 2.51.7 2.51.8 2.51.9 3.0.0 3.0.1 3.0.2 3.0.3 3.1.0 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 3.1.19 3.1.2 3.1.20 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.14 3.2.15 3.2.16 3.2.17 3.2.18 3.2.19 3.2.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 3.3.0
strong-testimonials / admin / js / admin-order.js
strong-testimonials / admin / js Last commit date
lib 1 year ago admin-fields.js 1 year ago admin-form.js 1 year ago admin-global.js 1 year ago admin-order.js 1 year ago custom-spinner.js 1 year ago help.js 1 year ago rating-edit.js 1 year ago selectize.js 1 year ago st-uninstall.js 1 year ago strong-testimonials-elementor-editor.js 1 year ago view-category-filter.js 1 year ago views.js 1 month ago
admin-order.js
131 lines
1 /**
2 * Admin list order
3 * Strong Testimonials
4 */
5
6 // set cell widths to prevent shrinkage
7 function setCellWidths() {
8 jQuery('td, th', 'table.posts').each(function () {
9 var cell = jQuery(this);
10 cell.width(cell.width());
11 });
12 };
13
14 // reset cell widths
15 function resetCellWidths(reset) {
16 jQuery('td, th', 'table.posts').each(function () {
17 var cell = jQuery(this);
18 cell.width('');
19 }).promise().done(setCellWidths);
20 };
21
22 // Returns a function, that, as long as it continues to be invoked, will not
23 // be triggered. The function will be called after it stops being called for
24 // N milliseconds. If `immediate` is passed, trigger the function on the
25 // leading edge, instead of the trailing.
26 // Thanks http://davidwalsh.name/javascript-debounce-function
27 function debounce(func, wait, immediate) {
28 var timeout;
29 return function () {
30 var context = this, args = arguments;
31 var later = function () {
32 timeout = null;
33 if (!immediate) func.apply(context, args);
34 };
35 var callNow = immediate && !timeout;
36 clearTimeout(timeout);
37 timeout = setTimeout(later, wait);
38 if (callNow) func.apply(context, args);
39 };
40 };
41
42 // window resize listener
43 var myEfficientFn = debounce(resetCellWidths, 100);
44 window.addEventListener('resize', myEfficientFn);
45
46
47 jQuery(document).ready(function ($) {
48
49 $.fn.strongSort = function (options) {
50
51 var $this = this;
52 var $handles = $(options.handles);
53
54 var toggleReorder = function () {
55 $this.sortable("enable");
56 $handles.show();
57 }
58
59 this.sortable({
60 disabled: true, // initially disabled
61 items: 'tr',
62 axis: 'y',
63 handle: options.handles,
64 forcePlaceholderSize: true,
65 placeholder: "sortable-placeholder",
66 start: function (e, ui) {
67 // set height of placeholder to match current dragged element
68 ui.placeholder.height(ui.helper.height());
69 ui.helper.css("cursor", "move");
70 },
71 helper: function (e, ui) {
72 var $originals = ui.children();
73 var $helper = ui.clone();
74 $helper.children().each(function (index) {
75 // set helper cell sizes to match the original sizes
76 $(this).width($originals.eq(index).width());
77 });
78 return $helper;
79 },
80 update: function (e, ui) {
81 ui.item.find(".column-handle").addClass("refresh");
82 $.post(ajaxurl, {
83 action: 'st-update-menu-order',
84 posts: $('#the-list').sortable('serialize'),
85 order: wpmtstOrderHelper,
86 nonce: wpmtstOrderHelper.nonce,
87 },
88 function (data) {
89 // update menu order shown
90 var $orders = $(".menu-order");
91 var obj = JSON.parse(data);
92 var orderArray = $.map(obj, function (val, i) {
93 $orders.eq(i).html(val);
94 });
95 })
96 .done(function () {
97 // update zebra striping
98 $("#the-list").find("tr:even").removeClass("alternate");
99 ui.item.effect('highlight', {}, 2000);
100 ui.item.find(".column-handle").removeClass("refresh");
101 })
102
103 }
104 });
105
106 toggleReorder();
107
108 return this;
109 }
110
111 // Init
112
113 setCellWidths();
114
115 $("#screen-meta").on("change", ".metabox-prefs", resetCellWidths);
116
117 $("#the-list").strongSort({
118 handles: 'td.column-handle'
119 });
120
121 $("td.column-handle").on( 'mouseenter mouseleave',
122 function () {
123 $(this).closest("tr").addClass("reorder-hover");
124 },
125 function () {
126 $(this).closest("tr").removeClass("reorder-hover");
127 }
128 );
129
130 });
131