# content-protector/3.5.4/assets/admin/passster-admin.js

Passster – Password Protect Pages and Content, version 3.5.4. 68 lines.

- Page: https://pluginprobe.com/plugins/content-protector/3.5.4/code/assets/admin/passster-admin.js
- Raw: https://pluginprobe.com/plugins/content-protector/3.5.4/raw/assets/admin/passster-admin.js
- Modified: 2022-01-10T16:23:32+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/content-protector/3.5.4/code/assets/admin/passster-admin.js#L10-L20`.

```javascript
jQuery(document).ready(function( $ ) {

    // page restriction conditional fields.
    var ps_selected = $('#passster-protection-type').find('option:selected').val();
    ps_show_selected(ps_selected);

    $('#passster-protection-type').on('change', function(){
        value = $(this).find('option:selected').val();
        ps_show_selected(value);
  
    });

    function ps_show_selected( value ) {
        if ('password' === value ) {
            $('#passster-password').parent().show();
        } else {
            $('#passster-password').parent().hide();
        }

        if ('passwords' === value ) {
            $('#passster-passwords').parent().show();
        } else {
            $('#passster-passwords').parent().hide();
        }

        if ('password_list' === value ) {
            $('#passster-password-list').parent().show();
        } else {
            $('#passster-password-list').parent().hide();
        }

        if ('api' === value ) {
            $('#passster-api').parent().show();
        } else {
            $('#passster-api').parent().hide();
        }
    }

	/* premium indicator */
    $("input.premium").attr('disabled', 'disabled');
    let td = $("input.premium").parent();
    $(td).append('<span class="pro">PRO</span>');
    
    // toggle admin notice if clicked.
    $( '.passster-notice button.notice-dismiss' ).on( 'click', function() {
        var data = { 'action': 'passster_dismiss_notice' };

        $.post( ps_admin_ajax.ajax_url, data, function( response ) {
        });
    });

    // reset usage data.
    $('#passster-reset-usage-data').on('click', function(e) {
        $.ajax({
            type: 'post',
            dataType: 'json',
            url: ps_admin_ajax.ajax_url,
            data: { 'action': 'reset_usage_data', 'nonce' : ps_admin_ajax.nonce },
            success: function(response){
                if ( true === response.success ) {
                    $('#passster-reset-success').append( ps_admin_ajax.reset_message );
                }
            }
        });
    });
});


```
