PluginProbe ʕ •ᴥ•ʔ
Post Views Counter / 1.4.2
Post Views Counter v1.4.2
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-settings.js
post-views-counter / js Last commit date
admin-dashboard.js 2 years ago admin-post.js 5 years ago admin-quick-edit.js 5 years ago admin-settings.js 2 years ago admin-widgets.js 5 years ago block-editor.min.js 2 years ago counter.js 2 years ago counter.min.js 2 years ago frontend.js 2 years ago frontend.min.js 2 years ago
admin-settings.js
80 lines
1 ( function( $ ) {
2
3 // ready event
4 $( function() {
5 var ip_boxes = $( '#post_views_counter_general_exclude_ips_setting' ).find( '.ip-box' ).length;
6
7 $( '#post_views_counter_general_exclude_ips_setting .ip-box:first' ).find( '.remove-exclude-ip' ).hide();
8
9 // ask whether to reset options to defaults
10 $( document ).on( 'click', '.reset_pvc_settings', function() {
11 var result = confirm( pvcArgsSettings.resetToDefaults );
12
13 if ( result && $( this ).hasClass( 'reset_post_views_counter_settings_general' ) ) {
14 $( 'input[data-pvc-menu="submenu"]' ).before( $( 'input[data-pvc-menu="topmenu"]' ) );
15 }
16
17 return result;
18 } );
19
20 // ask whether to reset views
21 $( document ).on( 'click', 'input[name="post_views_counter_reset_views"]', function() {
22 return confirm( pvcArgsSettings.resetViews );
23 } );
24
25 // remove ip box
26 $( document ).on( 'click', '.remove-exclude-ip', function( e ) {
27 e.preventDefault();
28
29 ip_boxes--;
30
31 var parent = $( this ).parent();
32
33 // remove ip box
34 parent.slideUp( 'fast', function() {
35 $( this ).remove();
36 } );
37 } );
38
39 // add ip box
40 $( document ).on( 'click', '.add-exclude-ip', function() {
41 ip_boxes++;
42
43 var parent = $( this ).parents( '#post_views_counter_general_exclude_ips_setting' ),
44 new_ip_box = parent.find( '.ip-box:last' ).clone().hide();
45
46 // clear value
47 new_ip_box.find( 'input' ).val( '' );
48
49 if ( ip_boxes > 1 )
50 new_ip_box.find( '.remove-exclude-ip' ).show();
51
52 // add and display new ip box
53 parent.find( '.ip-box:last' ).after( new_ip_box ).next().slideDown( 'fast' );
54 } );
55
56 // add current ip
57 $( document ).on( 'click', '.add-current-ip', function() {
58 // fill input with user's current ip
59 $( this ).parents( '#post_views_counter_general_exclude_ips_setting' ).find( '.ip-box' ).last().find( 'input' ).val( $( this ).attr( 'data-rel' ) );
60 } );
61
62 // toggle user roles
63 $( '#pvc_exclude-roles, #pvc_restrict_display-roles' ).on( 'change', function() {
64 if ( $( this ).is( ':checked' ) )
65 $( '.pvc_user_roles' ).slideDown( 'fast' );
66 else
67 $( '.pvc_user_roles' ).slideUp( 'fast' );
68 } );
69
70 // menu position referer update
71 $( 'input[name="post_views_counter_settings_other[menu_position]"]' ).on( 'change', function() {
72 if ( $( this ).val() === 'top' ) {
73 $( 'input[data-pvc-menu="submenu"]' ).after( $( 'input[data-pvc-menu="topmenu"]' ) );
74 } else {
75 $( 'input[data-pvc-menu="submenu"]' ).before( $( 'input[data-pvc-menu="topmenu"]' ) );
76 }
77 } );
78 } );
79
80 } )( jQuery );