PluginProbe ʕ •ᴥ•ʔ
Post Views Counter / 1.0.3
Post Views Counter v1.0.3
1.7.13 1.7.12 1.7.11 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.2.0 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3 1.3.1 1.3.10 1.3.11 1.3.12 1.3.13 1.3.2 1.3.2.1 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.7.0 1.7.1 1.7.10 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.7 1.7.8 1.7.9
post-views-counter / js / admin.js
post-views-counter / js Last commit date
admin.js 12 years ago frontend.js 12 years ago
admin.js
94 lines
1 jQuery(document).ready(function($) {
2
3 // default chosen
4 $('.pvc-chosen').chosen({
5 disable_search_threshold: 8,
6 display_selected_options: false,
7 search_contains: true,
8 width: '300px'
9 });
10
11
12 // time types and position
13 $('.pvc-chosen-short').chosen({
14 disable_search_threshold: 8,
15 width: '200px'
16 });
17
18
19 // ask whether reset options to defaults
20 $(document).on('click', '.reset_pvc_settings', function() {
21 return confirm(pvcArgsSettings.resetToDefaults);
22 });
23
24
25 // removes ip box
26 $(document).on('click', '.remove-exclude-ip', function() {
27 var parent = $(this).parent(),
28 nextParent = parent.parent(),
29 addButton = parent.find('.add-exclude-ip').hide(),
30 addCurrentIPButton = parent.find('.add-current-ip').hide();
31
32 // removes ip box
33 parent.remove();
34
35 var children = nextParent.find('div');
36
37 // was there add button?
38 if(addButton.length === 1) {
39 children.last().append(addButton.show(), ' ', addCurrentIPButton.show());
40 // children.last().append();
41 }
42
43 // only one ip box left?
44 if(children.length === 1) {
45 children.find('.remove-exclude-ip').hide();
46 }
47 });
48
49
50 // adds ip box
51 $(document).on('click', '.add-exclude-ip', function() {
52 var parent = $(this).parent(),
53 newBox = parent.clone().hide();
54
55 // clears value
56 newBox.find('input').first().val('');
57
58 // removes add buttons
59 $(this).remove();
60 parent.find('.add-current-ip').remove();
61
62 // adds and displays new ip box
63 parent.after(newBox.show());
64
65 parent.parent().find('.remove-exclude-ip').show();
66 });
67
68
69 // adds current ip
70 $(document).on('click', '.add-current-ip', function() {
71 // fills input with user's current ip
72 $(this).parent().find('input').first().val($(this).attr('data-rel'));
73 });
74
75
76 // displays user roles if needed
77 $(document).on('change', '.pvc-chosen-groups', function() {
78 var foundRoles = false;
79
80 // checks whether roles are selected
81 $(this).find(':selected').each(function(i, item) {
82 if(item.value === 'roles') {
83 foundRoles = true;
84 }
85 });
86
87 // are roles selected?
88 if(foundRoles) {
89 $(this).parent().find('.pvc_user_roles').fadeIn(300);
90 } else {
91 $(this).parent().find('.pvc_user_roles').fadeOut(300);
92 }
93 });
94 });