@@ -698,25 +698,55 @@ window.AJAX.registerOnload('export.js', function () {
698698/**
699699 * Toggles display of options when quick and custom export are selected
700700 */
701- Export . toggleQuickOrCustom = function ( ) {
702- if ( $ ( 'input[name=\'quick_or_custom\']' ) . length === 0 // custom_no_form option
703- || $ ( '#radio_custom_export' ) . prop ( 'checked' ) // custom
704- ) {
705- $ ( '#databases_and_tables' ) . show ( ) ;
706- $ ( '#rows' ) . show ( ) ;
707- $ ( '#output' ) . show ( ) ;
708- $ ( '#format_specific_opts' ) . show ( ) ;
709- $ ( '#output_quick_export' ) . addClass ( 'd-none' ) ;
710- var selectedPluginName = $ ( '#plugins' ) . find ( 'option:selected' ) . val ( ) ;
711- $ ( '#' + selectedPluginName + '_options' ) . removeClass ( 'd-none' ) ;
712- } else { // quick
713- $ ( '#databases_and_tables' ) . hide ( ) ;
714- $ ( '#rows' ) . hide ( ) ;
715- $ ( '#output' ) . hide ( ) ;
716- $ ( '#format_specific_opts' ) . hide ( ) ;
717- $ ( '#output_quick_export' ) . removeClass ( 'd-none' ) ;
701+ function toggleQuickOrCustom ( ) {
702+ const isCustomNoFormOption = ! document . getElementById ( 'quick_or_custom' ) ;
703+ const radioCustomExportElement = document . getElementById ( 'radio_custom_export' ) ;
704+ const isCustomExport = isCustomNoFormOption
705+ || radioCustomExportElement instanceof HTMLInputElement
706+ && radioCustomExportElement . checked ;
707+
708+ const databasesAndTablesElement = document . getElementById ( 'databases_and_tables' ) ;
709+ if ( databasesAndTablesElement ) {
710+ databasesAndTablesElement . classList . toggle ( 'd-none' , ! isCustomExport ) ;
711+ }
712+
713+ const rowsElement = document . getElementById ( 'rows' ) ;
714+ if ( rowsElement ) {
715+ rowsElement . classList . toggle ( 'd-none' , ! isCustomExport ) ;
716+ }
717+
718+ const outputElement = document . getElementById ( 'output' ) ;
719+ if ( outputElement ) {
720+ outputElement . classList . toggle ( 'd-none' , ! isCustomExport ) ;
721+ }
722+
723+ const formatSpecificOptionsElement = document . getElementById ( 'format_specific_opts' ) ;
724+ if ( formatSpecificOptionsElement ) {
725+ formatSpecificOptionsElement . classList . toggle ( 'd-none' , ! isCustomExport ) ;
726+ }
727+
728+ const outputQuickExportElement = document . getElementById ( 'output_quick_export' ) ;
729+ if ( outputQuickExportElement ) {
730+ outputQuickExportElement . classList . toggle ( 'd-none' , isCustomExport ) ;
718731 }
719- } ;
732+
733+ if ( ! isCustomExport ) {
734+ return ;
735+ }
736+
737+ const selectedPluginElement = document . querySelector ( '#plugins > option[selected]' ) ;
738+ const selectedPluginName = selectedPluginElement instanceof HTMLOptionElement ? selectedPluginElement . value : null ;
739+ if ( selectedPluginName === null ) {
740+ return ;
741+ }
742+
743+ const pluginOptionsElement = document . getElementById ( selectedPluginName + '_options' ) ;
744+ if ( ! pluginOptionsElement ) {
745+ return ;
746+ }
747+
748+ pluginOptionsElement . classList . remove ( 'd-none' ) ;
749+ }
720750
721751var timeOut ;
722752
@@ -835,13 +865,13 @@ Export.addAlias = function (type, name, field, value) {
835865} ;
836866
837867window . AJAX . registerOnload ( 'export.js' , function ( ) {
838- $ ( 'input[type=\'radio\'][name=\'quick_or_custom\']' ) . on ( 'change' , Export . toggleQuickOrCustom ) ;
839-
868+ $ ( 'input[type=\'radio\'][name=\'quick_or_custom\']' ) . on ( 'change' , toggleQuickOrCustom ) ;
840869 $ ( '#format_specific_opts' ) . find ( 'div.format_specific_options' )
841870 . addClass ( 'd-none' )
842871 . find ( 'h3' )
843872 . remove ( ) ;
844- Export . toggleQuickOrCustom ( ) ;
873+ toggleQuickOrCustom ( ) ;
874+
845875 Export . toggleStructureDataOpts ( ) ;
846876 Export . toggleSqlIncludeComments ( ) ;
847877 Export . checkTableSelectAll ( ) ;
0 commit comments