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