PluginProbe ʕ •ᴥ•ʔ
Post Views Counter / 1.2.2
Post Views Counter v1.2.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 10 years ago admin-post.js 10 years ago admin-quick-edit.js 10 years ago admin-settings.js 10 years ago chart.min.js 10 years ago frontend.js 10 years ago
admin-settings.js
74 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 // remove ip box
17 $( document ).on( 'click', '.remove-exclude-ip', function ( e ) {
18 e.preventDefault();
19
20 ip_boxes--;
21
22 var parent = $( this ).parent();
23
24 // remove ip box
25 parent.slideUp( 'fast', function() {
26 $( this ).remove();
27 } );
28 } );
29
30 // add ip box
31 $( document ).on( 'click', '.add-exclude-ip', function () {
32 ip_boxes++;
33
34 var parent = $( this ).parents( '#pvc_exclude_ips' ),
35 new_ip_box = parent.find( '.ip-box:last' ).clone().hide();
36
37 // clear value
38 new_ip_box.find( 'input' ).val( '' );
39
40 if ( ip_boxes > 1 ) {
41 new_ip_box.find( '.remove-exclude-ip' ).show();
42 }
43
44 // add and display new ip box
45 parent.find( '.ip-box:last' ).after( new_ip_box ).next().slideDown( 'fast' );
46 } );
47
48 // add current ip
49 $( document ).on( 'click', '.add-current-ip', function () {
50 // fill input with user's current ip
51 $( this ).parents( '#pvc_exclude_ips' ).find( '.ip-box' ).last().find( 'input' ).val( $( this ).attr( 'data-rel' ) );
52 } );
53
54 // toggle user roles
55 $( '#pvc_exclude-roles, #pvc_restrict_display-roles' ).change( function () {
56 if ( $( this ).is(':checked') ) {
57 $( '.pvc_user_roles' ).slideDown( 'fast' );
58 } else {
59 $( '.pvc_user_roles' ).slideUp( 'fast' );
60 }
61 } );
62
63 } );
64
65 } )( jQuery );
66
67 /*
68 * checkBo lightweight jQuery plugin v0.1.4 by @ElmahdiMahmoud
69 * Licensed under the MIT license - https://github.com/elmahdim/checkbo/blob/master/LICENSE
70 *
71 * Custom checkbox and radio
72 * Author URL: elmahdim.com
73 */
74 !function(e){e.fn.checkBo=function(c){return c=e.extend({},{checkAllButton:null,checkAllTarget:null,checkAllTextDefault:null,checkAllTextToggle:null},c),this.each(function(){function t(e){this.input=e}function n(){var c=e(this).is(":checked");e(this).closest("label").toggleClass("checked",c)}function i(e,c,t){e.text(e.parent(a).hasClass("checked")?t:c)}function h(c){var t=c.attr("data-show");c=c.attr("data-hide"),e(t).removeClass("is-hidden"),e(c).addClass("is-hidden")}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");s.wrap('<span class="cb-inner"><i></i></span>'),f.wrap('<span class="cb-inner"><i></i></span>');var k=new t("input:checkbox"),r=new t("input:radio");if(t.prototype.checkbox=function(e){var c=e.find(this.input).is(":checked");e.find(this.input).prop("checked",!c).trigger("change")},t.prototype.radiobtn=function(c,t){var n=e('input:radio[name="'+t+'"]');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()},s.on("change",n),f.on("change",n),a.find("a").on("click",function(e){e.stopPropagation()}),a.on("click",function(c){c.preventDefault(),k.checkbox(e(this)),c=e(this).attr("data-toggle"),e(c).toggleClass("is-hidden"),h(e(this))}),d.on("click",function(c){c.preventDefault(),r.radiobtn(e(this),e(this).find("input:radio").attr("name")),h(e(this))}),e.fn.toggleCheckbox=function(){this.prop("checked",!this.is(":checked"))},e.fn.switcherChecker=function(){var c=e(this),t=c.find("input"),n=c.find(".cb-state");t.is(":checked")?(c.addClass("checked"),n.html(t.attr("data-state-on"))):(c.removeClass("checked"),n.html(t.attr("data-state-off")))},o.on("click",function(c){c.preventDefault(),c=e(this),c.find("input").toggleCheckbox(),c.switcherChecker(),e(c.attr("data-toggle")).toggleClass("is-hidden")}),o.each(function(){e(this).switcherChecker()}),c.checkAllButton&&c.checkAllTarget){var u=e(this);u.find(e(c.checkAllButton)).on("click",function(){u.find(c.checkAllTarget).find("input:checkbox").each(function(){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()}),i(u.find(e(c.checkAllButton)).find(".toggle-text"),c.checkAllTextDefault,c.checkAllTextToggle)}),u.find(c.checkAllTarget).find(a).on("click",function(){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)})}l.find('[checked="checked"]').closest("label").addClass("checked"),l.find("input").is("input:disabled")&&l.find("input:disabled").closest("label").off().addClass("disabled")})}}(jQuery,window,document);