%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/html/shaban/laviva/wp-content/themes/levelup/admin/assets/js/vc_extend/
Upload File :
Create Path :
Current File : /var/www/html/shaban/laviva/wp-content/themes/levelup/admin/assets/js/vc_extend/rdy_postlist.js

jQuery(document).ready(function($) {
    "use strict";

    $('.vc_custom_select_ids li').on('click', function() {
        if( $(this).hasClass('selected') ) {
            return true;
        }
        var prevVal = $('.vc_custom_select_ids_val').val();
        if (prevVal != '') {
            prevVal += ',';
        }
        $('.vc_custom_select_ids_val').val( prevVal + $(this).attr('data-val') );

        $('.vc_custom_select_ids_vals').html($('.vc_custom_select_ids_vals').html() + '<li data-val="' + $(this).attr('data-val') + '">' + $(this).html() + '<button>×</button></li>');

        $('.vc_custom_select_ids_vals li button').on('click', function() {
            ids_select_remove($(this).parent());
            ids_select_change();
        });

        ids_select_change();
    });

    function ids_select_remove(el) {
        var vals = $('.vc_custom_select_ids_val').val().split(",");
        var newVals = '';
        for (var i = 0; i < vals.length; i++) {
            if( vals[i] != el.attr('data-val') ) {
                if(newVals != '') {
                    newVals += ',';
                }
                newVals += vals[i];
            }
        };
        $('.vc_custom_select_ids_val').val(newVals);
        el.remove();
    }

    function ids_select_change() {
        $('.vc_custom_select_ids li').removeClass('selected');
        var vals = $('.vc_custom_select_ids_val').val().split(",");
        for (var i = 0; i < vals.length; i++) {
            $('.vc_custom_select_ids li[data-val="' + vals[i] + '"]').addClass('selected');
        };
    }

    $('.vc_custom_select_ids_vals li button').on('click', function() {
        ids_select_remove($(this).parent());
        ids_select_change();
    });

    $('body').on('click', function() {
        $('.vc_custom_select_ids_vals').removeClass('active');
    });

    $('.vc_custom_select_ids_vals, .vc_custom_select_ids').on('click', function(e) {
        $('.vc_custom_select_ids_vals').addClass('active');
        e.stopPropagation();
    });

})

Zerion Mini Shell 1.0