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 / assets / js / gamipress-log-extra-data-ui.js

gamipress-log-extra-data-ui.js in GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI 7.9.8, at assets/js/gamipress-log-extra-data-ui.js

60 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (function($) {
2 function gamipress_update_log_tags_list() {
3 var type = $('#log-data .cmb2-id-type select').val();
4
5 // Show/hide tags based on type
6 var tags_to_show = [];
7 switch (type) {
8 case 'event_trigger':
9 tags_to_show = ['user', 'trigger-type', 'count'];
10 break;
11 case 'achievement_earn':
12 case 'achievement_award':
13 tags_to_show = ['user', 'achievement', 'achievement-type'];
14 break;
15 case 'rank_earn':
16 case 'rank_award':
17 tags_to_show = ['user', 'rank', 'rank-type'];
18 break;
19 case 'points_earn':
20 case 'points_deduct':
21 case 'points_award':
22 case 'points_revoke':
23 tags_to_show = ['user', 'points', 'points-type', 'total-points'];
24 break;
25 }
26
27 if( type === 'achievement_award' || type === 'rank_award' || type === 'points_award' || type === 'points_revoke' ) {
28 tags_to_show.push('admin');
29 }
30
31 var tags_to_show_selector = '#tag-' + tags_to_show.join(', #tag-');
32
33 $('.gamipress-log-pattern-tags-list li:not(' + tags_to_show_selector + ')').hide();
34 $(tags_to_show_selector).show();
35 }
36
37 gamipress_update_log_tags_list();
38
39 $('#log-data .cmb2-id-type select').on('change', function() {
40 var type = $(this).val();
41
42 gamipress_update_log_tags_list();
43
44 $( '#log-extra-data-ui').html('<span class="spinner is-active" style="float: none;"></span>');
45
46 // Ajax request to get log extra data form
47 jQuery.post(
48 ajaxurl,
49 {
50 action: 'gamipress_get_log_extra_data_ui',
51 nonce: gamipress_log_extra_data_ui.nonce,
52 log_id: $('input#object_id').val(),
53 type: type
54 },
55 function( response ) {
56 $( '#log-extra-data-ui').html(response);
57 }
58 );
59 });
60 })(jQuery);