{#
/*
 * Spring Signage Ltd - http://www.springsignage.com
 * Copyright (C) 2017 Spring Signage Ltd
 * (notification-designer-javascript.twig)
 */
#}
<script type="text/javascript">

    // Runs after form open
    function text_form_edit_open() {

        // Set duration field, using the helper ()
        formHelpers.setupCheckboxInputFields($(this).find('form'), '#useDuration', '.duration-fields');

        // Set effect type input field, using the helper ()
        formHelpers.setupObjectValueInputFields($(this).find('form'), '#effect', ['.effect-controls'], ['none'], true);

        // Setup form Editor
        formHelpers.setupDualTypeTextArea(this, 'ta_text', !$(this).data('formEditorOnly'));

        // Set up the colour selectors
        $(this).find("#backgroundColor").colorpicker().attr('autocomplete', 'off');

        // Tidy up colorpickers on modal close
        if($(this).hasClass('modal')) {
            $(this).on("hide.bs.modal", function(e) {
                if(e.namespace === 'bs.modal') {
                    // Remove colour pickers
                    $(this).find("#backgroundColor").colorpicker('destroy');
                }
            });
        }
    }

    // Runs before form submit
    function text_form_edit_submit() {     

        // Update text callback fields
        formHelpers.updateCKEditor();
    }

</script>