PluginProbe ʕ •ᴥ•ʔ
Post Views Counter / 1.3.1
Post Views Counter v1.3.1
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 6 years ago admin-post.js 6 years ago admin-quick-edit.js 6 years ago admin-settings.js 6 years ago admin-widgets.js 6 years ago chart.min.js 6 years ago frontend.js 6 years ago gutenberg.min.js 6 years ago
admin-settings.js
133 lines
1 ( function ( $ ) {
2
3 $( document ).ready( function () {
4
5 $( '.post-views-counter-settings' ).checkBo();
6
7 var ip_boxes = $( '#pvc_exclude_ips' ).find( '.ip-box' ).length;
8
9 $( '#pvc_exclude_ips .ip-box:first' ).find( '.remove-exclude-ip' ).hide();
10
11 // ask whether to reset options to defaults
12 $( document ).on( 'click', '.reset_pvc_settings', function () {
13 return confirm( pvcArgsSettings.resetToDefaults );
14 } );
15
16 // ask whether to reset views
17 $( document ).on( 'click', 'input[name="post_views_counter_reset_views"]', function () {
18 return confirm( pvcArgsSettings.resetViews );
19 } );
20
21 // remove ip box
22 $( document ).on( 'click', '.remove-exclude-ip', function ( e ) {
23 e.preventDefault();
24
25 ip_boxes--;
26
27 var parent = $( this ).parent();
28
29 // remove ip box
30 parent.slideUp( 'fast', function () {
31 $( this ).remove();
32 } );
33 } );
34
35 // add ip box
36 $( document ).on( 'click', '.add-exclude-ip', function () {
37 ip_boxes++;
38
39 var parent = $( this ).parents( '#pvc_exclude_ips' ),
40 new_ip_box = parent.find( '.ip-box:last' ).clone().hide();
41
42 // clear value
43 new_ip_box.find( 'input' ).val( '' );
44
45 if ( ip_boxes > 1 ) {
46 new_ip_box.find( '.remove-exclude-ip' ).show();
47 }
48
49 // add and display new ip box
50 parent.find( '.ip-box:last' ).after( new_ip_box ).next().slideDown( 'fast' );
51 } );
52
53 // add current ip
54 $( document ).on( 'click', '.add-current-ip', function () {
55 // fill input with user's current ip
56 $( this ).parents( '#pvc_exclude_ips' ).find( '.ip-box' ).last().find( 'input' ).val( $( this ).attr( 'data-rel' ) );
57 } );
58
59 // toggle user roles
60 $( '#pvc_exclude-roles, #pvc_restrict_display-roles' ).change( function () {
61 if ( $( this ).is( ':checked' ) ) {
62 $( '.pvc_user_roles' ).slideDown( 'fast' );
63 } else {
64 $( '.pvc_user_roles' ).slideUp( 'fast' );
65 }
66 } );
67
68 } );
69
70 } )( jQuery );
71
72 /*
73 * checkBo lightweight jQuery plugin v0.1.4 by @ElmahdiMahmoud
74 * Licensed under the MIT license - https://github.com/elmahdim/checkbo/blob/master/LICENSE
75 *
76 * Custom checkbox and radio
77 * Author URL: elmahdim.com
78 */
79 !function ( e ) {
80 e.fn.checkBo = function ( c ) {
81 return c = e.extend( { }, { checkAllButton: null, checkAllTarget: null, checkAllTextDefault: null, checkAllTextToggle: null }, c ), this.each( function () {
82 function t( e ) {
83 this.input = e
84 }
85 function n() {
86 var c = e( this ).is( ":checked" );
87 e( this ).closest( "label" ).toggleClass( "checked", c )
88 }
89 function i( e, c, t ) {
90 e.text( e.parent( a ).hasClass( "checked" ) ? t : c )
91 }
92 function h( c ) {
93 var t = c.attr( "data-show" );
94 c = c.attr( "data-hide" ), e( t ).removeClass( "is-hidden" ), e( c ).addClass( "is-hidden" )
95 }
96 var l = e( this ), a = l.find( ".cb-checkbox" ), d = l.find( ".cb-radio" ), o = l.find( ".cb-switcher" ), s = a.find( "input:checkbox" ), f = d.find( "input:radio" );
97 s.wrap( '<span class="cb-inner"><i></i></span>' ), f.wrap( '<span class="cb-inner"><i></i></span>' );
98 var k = new t( "input:checkbox" ), r = new t( "input:radio" );
99 if ( t.prototype.checkbox = function ( e ) {
100 var c = e.find( this.input ).is( ":checked" );
101 e.find( this.input ).prop( "checked", !c ).trigger( "change" )
102 }, t.prototype.radiobtn = function ( c, t ) {
103 var n = e( 'input:radio[name="' + t + '"]' );
104 n.prop( "checked", !1 ), n.closest( n.closest( d ) ).removeClass( "checked" ), c.addClass( "checked" ), c.find( this.input ).get( 0 ).checked = c.hasClass( "checked" ), c.find( this.input ).change()
105 }, s.on( "change", n ), f.on( "change", n ), a.find( "a" ).on( "click", function ( e ) {
106 e.stopPropagation()
107 } ), a.on( "click", function ( c ) {
108 c.preventDefault(), k.checkbox( e( this ) ), c = e( this ).attr( "data-toggle" ), e( c ).toggleClass( "is-hidden" ), h( e( this ) )
109 } ), d.on( "click", function ( c ) {
110 c.preventDefault(), r.radiobtn( e( this ), e( this ).find( "input:radio" ).attr( "name" ) ), h( e( this ) )
111 } ), e.fn.toggleCheckbox = function () {
112 this.prop( "checked", !this.is( ":checked" ) )
113 }, e.fn.switcherChecker = function () {
114 var c = e( this ), t = c.find( "input" ), n = c.find( ".cb-state" );
115 t.is( ":checked" ) ? ( c.addClass( "checked" ), n.html( t.attr( "data-state-on" ) ) ) : ( c.removeClass( "checked" ), n.html( t.attr( "data-state-off" ) ) )
116 }, o.on( "click", function ( c ) {
117 c.preventDefault(), c = e( this ), c.find( "input" ).toggleCheckbox(), c.switcherChecker(), e( c.attr( "data-toggle" ) ).toggleClass( "is-hidden" )
118 } ), o.each( function () {
119 e( this ).switcherChecker()
120 } ), c.checkAllButton && c.checkAllTarget ) {
121 var u = e( this );
122 u.find( e( c.checkAllButton ) ).on( "click", function () {
123 u.find( c.checkAllTarget ).find( "input:checkbox" ).each( function () {
124 u.find( e( c.checkAllButton ) ).hasClass( "checked" ) ? u.find( c.checkAllTarget ).find( "input:checkbox" ).prop( "checked", !0 ).change() : u.find( c.checkAllTarget ).find( "input:checkbox" ).prop( "checked", !1 ).change()
125 } ), i( u.find( e( c.checkAllButton ) ).find( ".toggle-text" ), c.checkAllTextDefault, c.checkAllTextToggle )
126 } ), u.find( c.checkAllTarget ).find( a ).on( "click", function () {
127 u.find( c.checkAllButton ).find( "input:checkbox" ).prop( "checked", !1 ).change().removeClass( "checked" ), i( u.find( e( c.checkAllButton ) ).find( ".toggle-text" ), c.checkAllTextDefault, c.checkAllTextToggle )
128 } )
129 }
130 l.find( '[checked="checked"]' ).closest( "label" ).addClass( "checked" ), l.find( "input" ).is( "input:disabled" ) && l.find( "input:disabled" ).closest( "label" ).off().addClass( "disabled" )
131 } )
132 }
133 }( jQuery, window, document );