import * as $ from 'jquery';
import {handleIconUpload} from "./handleIconUpload";
import {updateGlobalTimerPreview} from "./global-timer/updateGlobalTimerPreview";
$(document).ready(function($) {

    handleIconUpload({
        uploadButtonSelector: '.develux-upload-timer-icon-button',
        imageContainerSelector: '.timer-icon-box-js',
        inputIdFieldSelector: '#develux-timer-bg-icon',
        inputUrlFieldSelector: '#develux-timer-bg-icon-url',
        removeButtonSelector: '.develux-remove-timer-bg-icon'
    });
    handleIconUpload({
        uploadButtonSelector: '.develux-change-timer-bg-icon-js',
        imageContainerSelector: '.timer-icon-box-js',
        inputIdFieldSelector: '#develux-timer-bg-icon',
        inputUrlFieldSelector: '#develux-timer-bg-icon-url',
        removeButtonSelector: '.develux-remove-timer-bg-icon'
    });

    // ------------------------------------- Label live preview ---------------------------------------------------

    $('.develux-input-js').on('input', function() {
        updateGlobalTimerPreview();
    });
    $('select.develux-input-js, input.develux-input-js').on('change', function() {
        updateGlobalTimerPreview();
    });

    updateGlobalTimerPreview();
});