PluginProbe ʕ •ᴥ•ʔ
Post Views Counter / 1.6.0
Post Views Counter v1.6.0
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 column-modal.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
129 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 // ask whether to import views
25 $( document ).on( 'click', 'input[name="post_views_counter_import_views"]', function() {
26 return confirm( pvcArgsSettings.importViews );
27 } );
28
29 // remove ip box
30 $( document ).on( 'click', '.remove-exclude-ip', function( e ) {
31 e.preventDefault();
32
33 ip_boxes--;
34
35 var parent = $( this ).parent();
36
37 // remove ip box
38 parent.slideUp( 'fast', function() {
39 $( this ).remove();
40 } );
41 } );
42
43 // add ip box
44 $( document ).on( 'click', '.add-exclude-ip', function() {
45 ip_boxes++;
46
47 var parent = $( this ).parents( '#post_views_counter_general_exclude_ips_setting' ),
48 new_ip_box = parent.find( '.ip-box:last' ).clone().hide();
49
50 // clear value
51 new_ip_box.find( 'input' ).val( '' );
52
53 if ( ip_boxes > 1 )
54 new_ip_box.find( '.remove-exclude-ip' ).show();
55
56 // add and display new ip box
57 parent.find( '.ip-box:last' ).after( new_ip_box ).next().slideDown( 'fast' );
58 } );
59
60 // add current ip
61 $( document ).on( 'click', '.add-current-ip', function() {
62 // fill input with user's current ip
63 $( this ).parents( '#post_views_counter_general_exclude_ips_setting' ).find( '.ip-box' ).last().find( 'input' ).val( $( this ).attr( 'data-rel' ) );
64 } );
65
66 // toggle user roles
67 $( '#pvc_exclude-roles, #pvc_restrict_display-roles' ).on( 'change', function() {
68 if ( $( this ).is( ':checked' ) )
69 $( '.pvc_user_roles' ).slideDown( 'fast' );
70 else
71 $( '.pvc_user_roles' ).slideUp( 'fast' );
72 } );
73
74 // menu position referer update
75 $( 'input[name="post_views_counter_settings_display[menu_position]"], input[name="post_views_counter_settings_other[menu_position]"]' ).on( 'change', function() {
76 if ( $( this ).val() === 'top' )
77 $( 'input[data-pvc-menu="submenu"]' ).after( $( 'input[data-pvc-menu="topmenu"]' ) );
78 else
79 $( 'input[data-pvc-menu="submenu"]' ).before( $( 'input[data-pvc-menu="topmenu"]' ) );
80 } );
81
82 // import provider switching
83 $( 'input[name="pvc_import_provider"]' ).on( 'change', function() {
84 var selectedProvider = $( this ).val(),
85 $current = $( '.pvc-provider-content:visible' ),
86 $target = $( '.pvc-provider-' + selectedProvider );
87
88 if ( ! $target.length || $target.is( ':visible' ) )
89 return;
90
91 $current.stop( true, true ).slideUp( 'fast', function() {
92 $target.stop( true, true ).slideDown( 'fast' );
93 } );
94 } );
95
96 // import strategy description switching
97 ( function() {
98 var $container = $( '.pvc-import-strategy-details' ),
99 $strategyRadios = $( 'input[name="pvc_import_strategy"]' );
100
101 if ( ! $container.length || ! $strategyRadios.length )
102 return;
103
104 var showStrategy = function( slug ) {
105 var $target = $container.find( '.pvc-strategy-' + slug );
106
107 if ( ! $target.length )
108 return;
109
110 var $current = $container.find( '.pvc-strategy-content:visible' );
111
112 if ( $target.is( ':visible' ) )
113 return;
114
115 $current.stop( true, true ).slideUp( 'fast', function() {
116 $target.stop( true, true ).slideDown( 'fast' );
117 } );
118 };
119
120 $strategyRadios.on( 'change', function() {
121 showStrategy( $( this ).val() );
122 } );
123
124 showStrategy( $strategyRadios.filter( ':checked' ).val() );
125 } )();
126 } );
127
128 } )( jQuery );
129