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 / rating-edit.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
rating-edit.js
86 lines
1 /**
2 * Edit rating
3 */
4
5 jQuery(document).ready(function ($) {
6
7 var editRating = function () {
8 var ratingBox = $(this).closest(".edit-rating-box"),
9 ratingField = ratingBox.data("field"),
10 ratingForm = ratingBox.find('.rating-form'),
11 ratingDisplay = ratingBox.find('.rating-display'),
12 box = ratingBox.find('.edit-rating-success'),
13 revert_e = ratingBox.find('.current-rating').val(),
14 postId = $('#post_ID').val() || 0,
15 buttons2 = ratingBox.find('.edit-rating-buttons-2');
16
17 ratingForm.find("input[value=" + revert_e + "]").prop("checked", true);
18
19 //TODO Refactor so "off" isn't necssary!
20 buttons2.children('.save').off("click");
21 buttons2.children('.cancel').off("click");
22
23 ratingDisplay.hide();
24 ratingForm.showInlineBlock();
25
26 box.html('');
27
28 buttons2.children('.save').on("click", function () {
29 var new_rating = ratingForm.find("input:checked").val();
30 var name_on_form = ratingForm.find("input:checked").attr("name");
31 var field_name = name_on_form.match(/\[(.*)\]/).pop();
32
33 if (new_rating === revert_e) {
34 buttons2.children('.cancel').trigger('click');
35 return;
36 }
37
38 $.post(ajaxurl, {
39 action: 'wpmtst_edit_rating',
40 post_id: postId,
41 field_name: field_name,
42 rating: new_rating,
43 editratingnonce: $('#edit-' + ratingField + '-nonce').val()
44 }, function (data) {
45 var obj = JSON.parse(data);
46
47 var stars = ratingDisplay.find(".inner");
48 stars.html(obj.display);
49
50 box.html(obj.message);
51
52 ratingForm.find("input[value=" + new_rating + "]").prop("checked", true);
53
54 if (box.hasClass('hidden')) {
55 box.fadeIn('fast', function () {
56 box.removeClass('hidden');
57 });
58 }
59
60 revert_e = new_rating;
61 ratingBox.find('.current-rating').val(new_rating);
62 ratingForm.hide();
63 ratingDisplay.showInlineBlock();
64 });
65 return false;
66 });
67
68 buttons2.children('.cancel').on("click", function () {
69 ratingForm.find("input[value=" + revert_e + "]").prop("checked", true);
70 ratingForm.hide();
71 ratingDisplay.showInlineBlock();
72 return false;
73 });
74
75 buttons2.children('.zero').on("click", function () {
76 ratingForm.find("input[value=0]").prop("checked", true);
77 $(this).trigger('blur');
78 return false;
79 });
80
81 }
82
83 $(".edit-rating").on('click', editRating);
84
85 });
86