HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: /var/www/html/bwcdev/wp-content/themes/salient/nectar/options/fields/color/field_color_farb.js
/*global jQuery, document, $colorpicker_inputs:true*/
jQuery(document).ready(function () {

    /*
     *
     * Redux_Options_color function
     * Adds farbtastic to color elements
     *
     */
    $colorpicker_inputs = jQuery('input.popup-colorpicker');

    $colorpicker_inputs.each(
        function () {
            var $input, sIdSelector, oFarb;
            $input = jQuery(this);
            sIdSelector = "#" + jQuery(this).attr('id') + "picker";
            oFarb = jQuery.farbtastic(
                sIdSelector,
                function (color) {
                    $input.css({
                        backgroundColor: color,
                        color: oFarb.hsl[2] > 0.5 ? '#000' : '#fff'
                    }).val(color);
                    if (oFarb.bound === true) {
                        $input.change();
                    } else {
                        oFarb.bound = true;
                    }
                }
            );
            oFarb.setColor($input.val());
        }
    );

    $colorpicker_inputs.each(function (e) {
        jQuery(this).next('.farb-popup').hide();
    });

    $colorpicker_inputs.live('focus', function (e) {
        jQuery(this).next('.farb-popup').show();
        jQuery(this).parents('li').css({
            position : 'relative',
            zIndex : '9999'
        })
        jQuery('#tabber').css({overflow : 'visible'});
    });

    $colorpicker_inputs.live('blur', function (e) {
        jQuery(this).next('.farb-popup').hide();
        jQuery(this).parents('li').css({
            zIndex : '0'
        })
    });
});