HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux WebLive 5.15.0-79-generic #86-Ubuntu SMP Mon Jul 10 16:07:21 UTC 2023 x86_64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/wpamazingsecret/wp-content/plugins_/woocommerce-multilingual/res/js/exchange-rates.js
jQuery( function($){

    WCMLExchangeRates = {

        init: function(){

            $('#online-exchange-rates').on( 'change', '#exchange-rates-automatic', WCMLExchangeRates.toggleManualAutomatic );
            $('#online-exchange-rates').on( 'click', '#update-rates-manually', WCMLExchangeRates.updateRatesManually);
            $('#online-exchange-rates').on( 'change', 'input[name=exchange-rates-service]', WCMLExchangeRates.selectService );
            $('#online-exchange-rates').on( 'change', 'input[name=update-schedule]', WCMLExchangeRates.updateFrequency );

            WCMLExchangeRates.selectedService = $('input[name=exchange-rates-service]:checked').val();
            $('#online-exchange-rates').on( 'change', 'input[name=exchange-rates-service]', WCMLExchangeRates.toggleUpdateManuallyButton );
            $('#online-exchange-rates').on( 'change', 'input[name=lifting_charge]', WCMLExchangeRates.toggleUpdateManuallyButton );

        },

        toggleManualAutomatic: function(){

            if($(this).prop('checked')){
                $('#exchange-rates-online-wrap').fadeIn();
                WCML_Tooltip && WCML_Tooltip.init(); // Re-init tooltips for the previously invisible ones.
            }else{
                $('#exchange-rates-online-wrap').fadeOut();
            }

        },

        updateRatesManually: function(){

            var updateButton = $(this);

            $('#exchange-rates-error').html('').hide();
            $('#update-rates-spinner').css({ visibility: 'visible' });
            $('.exchange-rates-sources .notice-error').html('').hide();
            updateButton.prop('disabled', true);

            $.ajax({
                type: "post",
                url: ajaxurl,
                dataType: 'json',
                data: {
                    action: "wcml_update_exchange_rates",
                    wcml_nonce: $('#update-exchange-rates-nonce').val()
                },
                success: function (response) {

                    if (response.success) {
                        $('#exchange-rates-success').fadeIn();
                        $('#update-rates-time .time').html( response.last_updated );
                    }else{
                        if( response.error ){
                            var serviceErrorWrap = $('#service-error-' + response.service );
                            serviceErrorWrap.html( response.error ).fadeIn();
                        }
                    }

                    $('#update-rates-spinner').css({ visibility: 'hidden' });
                    updateButton.prop('disabled', false);

                    for( code in response.rates ){
                        $('#currency_row_' + code + ' span.rate').hide().html( response.rates[code] ).fadeIn('slow');
                    }

                }
            })

        },

        /**
         * @todo remove when moving to auto-saving forms
         */
        toggleUpdateManuallyButton: function(){

            if( WCMLExchangeRates.selectedService == $(this).val() ){
                $('#update-rates-manually').prop( 'disabled', false );
                $('#update-rates-manually').next('.wcml-tip').hide();
            } else {
                $('#update-rates-manually').prop( 'disabled', true );
                $('#update-rates-manually').next('.wcml-tip').show().tipTip( WCML_Tooltip.default_args);
            }

        },

        selectService: function(){

            $('.service-details-wrap').hide();
            $(this).parent().find('.service-details-wrap').show();

        },

        updateFrequency: function(){

            $('[name="update-weekly-day"], [name="update-monthly-day"]').prop('disabled', true);
            $(this).parent().find('select').prop('disabled', false);

        }
    }



    WCMLExchangeRates.init();

});