PluginProbe ʕ •ᴥ•ʔ
Post Views Counter / 1.3.4
Post Views Counter v1.3.4
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 5 years ago admin-post.js 5 years ago admin-quick-edit.js 5 years ago admin-settings.js 5 years ago admin-widgets.js 5 years ago frontend.js 5 years ago gutenberg.min.js 6 years ago
admin-settings.js
66 lines
1 ( function( $ ) {
2
3 // ready event
4 $( function() {
5 var ip_boxes = $( '#pvc_exclude_ips' ).find( '.ip-box' ).length;
6
7 $( '#pvc_exclude_ips .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 return confirm( pvcArgsSettings.resetToDefaults );
12 } );
13
14 // ask whether to reset views
15 $( document ).on( 'click', 'input[name="post_views_counter_reset_views"]', function() {
16 return confirm( pvcArgsSettings.resetViews );
17 } );
18
19 // remove ip box
20 $( document ).on( 'click', '.remove-exclude-ip', function( e ) {
21 e.preventDefault();
22
23 ip_boxes--;
24
25 var parent = $( this ).parent();
26
27 // remove ip box
28 parent.slideUp( 'fast', function() {
29 $( this ).remove();
30 } );
31 } );
32
33 // add ip box
34 $( document ).on( 'click', '.add-exclude-ip', function() {
35 ip_boxes++;
36
37 var parent = $( this ).parents( '#pvc_exclude_ips' ),
38 new_ip_box = parent.find( '.ip-box:last' ).clone().hide();
39
40 // clear value
41 new_ip_box.find( 'input' ).val( '' );
42
43 if ( ip_boxes > 1 ) {
44 new_ip_box.find( '.remove-exclude-ip' ).show();
45 }
46
47 // add and display new ip box
48 parent.find( '.ip-box:last' ).after( new_ip_box ).next().slideDown( 'fast' );
49 } );
50
51 // add current ip
52 $( document ).on( 'click', '.add-current-ip', function() {
53 // fill input with user's current ip
54 $( this ).parents( '#pvc_exclude_ips' ).find( '.ip-box' ).last().find( 'input' ).val( $( this ).attr( 'data-rel' ) );
55 } );
56
57 // toggle user roles
58 $( '#pvc_exclude-roles, #pvc_restrict_display-roles' ).on( 'change', function() {
59 if ( $( this ).is( ':checked' ) )
60 $( '.pvc_user_roles' ).slideDown( 'fast' );
61 else
62 $( '.pvc_user_roles' ).slideUp( 'fast' );
63 } );
64 } );
65
66 } )( jQuery );