PluginProbe
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI / 7.9.8
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI v7.9.8
8.0.4 8.0.3 8.0.1 8.0.2 8.0.0 7.9.9.7 7.9.9.6 7.9.9.5 7.9.9.4 7.9.9.3 7.9.9.2 7.9.9.1 7.9.9 7.9.8 7.9.7 7.9.6 7.9.5 7.9.4 7.9.3 7.9.2 7.9.1 7.9.0 7.8.9 7.8.8 7.8.7 All 46 releases
gamipress / libraries / ct / assets / js / ct.js

ct.js in GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI 7.9.8, at libraries/ct/assets/js/ct.js

51 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (function ( $ ) {
2
3 // EDIT
4
5 // On click ct save, show spinner
6 $("#publishing-action #ct-save").on("click", function(e) {
7 var $this = $(this);
8
9 if( $this.prop('disabled') === true ) {
10 return;
11 }
12
13 $this.closest('#publishing-action').find('.spinner').addClass('is-active');
14 $this.hide();
15 $this.closest('#publishing-action').find('#ct-save-disabled').show();
16 });
17
18 // On click ct add, show spinner
19 $("#ct_add_form #ct-add").on("click", function(e) {
20 var $this = $(this);
21
22 if( $this.prop('disabled') === true ) {
23 return;
24 }
25
26 var any_error = false;
27
28 $this.closest('form').find('input[required="1"]').each(function() {
29 var field = $(this);
30
31 if( field.val() === '' ) {
32 field.parent().addClass('form-required form-invalid');
33 any_error = true;
34 }
35 })
36
37 if( any_error ) {
38 return;
39 }
40
41 $this.closest('.submit').find('.spinner').addClass('is-active');
42 $this.hide();
43 $this.closest('.submit').find('#ct-add-disabled').show();
44 });
45
46 $("body").on("keyup", ".form-required.form-invalid input, .form-required.form-invalid textarea", function(e) {
47 $(this).parent().removeClass('form-required');
48 $(this).parent().removeClass('form-invalid');
49 });
50
51 })( jQuery );