PluginProbe ʕ •ᴥ•ʔ
Strong Testimonials / 2.38
Strong Testimonials v2.38
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-form.js
strong-testimonials / admin / js Last commit date
lib 7 years ago addon-licenses.js 7 years ago admin-compat.js 7 years ago admin-fields.js 7 years ago admin-form.js 7 years ago admin-global.js 7 years ago admin-order.js 7 years ago custom-spinner.js 7 years ago help.js 7 years ago rating-edit.js 7 years ago view-category-filter.js 7 years ago views.js 7 years ago
admin-form.js
165 lines
1 /**
2 * Strong Testimonials admin
3 *
4 * @namespace jQuery
5 */
6
7 jQuery(document).ready(function ($) {
8
9 /**
10 * ----------------------------------------
11 * Admin notification email events
12 * ----------------------------------------
13 */
14
15 var $notifyAdmin = $('#wpmtst-options-admin-notify');
16 var $notifyFields = $('#admin-notify-fields');
17
18 if ($notifyAdmin.is(':checked')) {
19 $notifyFields.slideDown();
20 }
21
22 $notifyAdmin.change(function (e) {
23 if ($(this).is(':checked')) {
24 $notifyFields.slideDown();
25 $(this).blur();
26 }
27 else {
28 $notifyFields.slideUp();
29 }
30 });
31
32 $('#add-recipient').click(function (e) {
33 var $this = $(this);
34 var key = $this.parent().siblings('.recipient').length;
35 var data = {
36 'action': 'wpmtst_add_recipient',
37 'key': key,
38 };
39 $.get(ajaxurl, data, function (response) {
40 $this.parent().before(response).prev().find('.admin_name').first().focus();
41 });
42 });
43
44 $notifyFields.on('click', '.delete-recipient', function (e) {
45 $(this).closest('.email-option.recipient').remove();
46 });
47
48 /**
49 * ----------------------------------------
50 * Admin notification email tags
51 *
52 * Thanks http://skfox.com/2008/11/26/jquery-example-inserting-text-with-drag-n-drop/
53 * ----------------------------------------
54 */
55
56 var $tagListItems = $('#wpmtst-tags-list li');
57
58 $tagListItems.attr('title', wpmtst_admin.templateTagTitle);
59
60 $tagListItems.on('click', function () {
61 $('#wpmtst-option-email-message').insertAtCaret($(this).text());
62 return false;
63 });
64
65 $.fn.insertAtCaret = function (myValue) {
66 return this.each(function () {
67 var sel;
68 //IE support
69 if (document.selection) {
70 this.focus();
71 sel = document.selection.createRange();
72 sel.text = myValue;
73 this.focus();
74 }
75 //MOZILLA / NETSCAPE support
76 else if (this.selectionStart || this.selectionStart === '0') {
77 var startPos = this.selectionStart;
78 var endPos = this.selectionEnd;
79 var scrollTop = this.scrollTop;
80 this.value = this.value.substring(0, startPos) + myValue + this.value.substring(endPos, this.value.length);
81 this.focus();
82 this.selectionStart = startPos + myValue.length;
83 this.selectionEnd = startPos + myValue.length;
84 this.scrollTop = scrollTop;
85 } else {
86 this.value += myValue;
87 this.focus();
88 }
89 });
90 };
91
92 /**
93 * Autosize textarea
94 */
95 var ta = document.getElementsByClassName('autosize');
96 autosize(ta);
97
98 /**
99 * ----------------------------------------
100 * Form Settings
101 * ----------------------------------------
102 */
103
104 /**
105 * Restore all default messages
106 */
107 $('#restore-default-messages').click(function (e) {
108 var data = {
109 'action': 'wpmtst_restore_default_messages'
110 };
111
112 $.get(ajaxurl, data, function (response) {
113
114 var object = JSON.parse(response);
115
116 for (var key in object) {
117
118 if (object.hasOwnProperty(key)) {
119
120 var targetId = key.replace(/-/g, '_');
121 var el = $('[id=\'' + targetId + '\']');
122 el.val(object[key]['text']);
123
124 if ('submission_success' === targetId) {
125 var editor = tinyMCE.activeEditor;
126 if (editor && editor instanceof tinymce.Editor && !editor.hidden) {
127 tinyMCE.activeEditor.setContent(object[key]['text']);
128 }
129 }
130
131 }
132
133 }
134
135 });
136 });
137
138 /**
139 * Restore a single default message
140 */
141 $('.restore-default-message').click(function (e) {
142 var targetId = $(e.target).data('targetId');
143 var data = {
144 'action': 'wpmtst_restore_default_message',
145 'field': targetId
146 };
147
148 $.get(ajaxurl, data, function (response) {
149
150 var object = JSON.parse(response);
151
152 $('[id=\'' + targetId + '\']').val(object['text']);
153
154 if ('submission_success' === targetId) {
155 var editor = tinyMCE.activeEditor;
156 if (editor && editor instanceof tinymce.Editor && !editor.hidden) {
157 tinyMCE.activeEditor.setContent(object['text']);
158 }
159 }
160 });
161
162 });
163
164 });
165