'use strict';$(()=>{$('.modal-image').magnificPopup({type:'image',});$('#file-unzip').each(function(){const a=document.createElement('a');const mediaId=$(this).find('input[name=id]').val();const This=$(this);a.href='#';$(a).text(dotclear.msg.zip_file_content);This.before(a);$(a).wrap('<p></p>');$(a).on('click',()=>{dotclear.jsonServicesGet('getZipMediaContent',(data)=>{const div=document.createElement('div');const list=document.createElement('ul');let expanded=false;$(div).css({overflow:'auto',margin:'1em 0',padding:'1px 0.5em',});$(div).addClass('fieldset');$(div).append(list);This.before(div);$(a).hide();$(div).before(`<h3>${dotclear.msg.zip_file_content}</h3>`);for(const elt in data){$(list).append(`<li>${elt}</li>`);if($(div).height()>200&&!expanded){$(div).css({height:'200px',});expanded=true;}}},{id:mediaId},(error)=>{window.alert(error);},);return false;});});$('#file-unzip').on('submit',function(){if($(this).find('#inflate_mode').val()=='current'){return window.confirm(dotclear.msg.confirm_extract_current);}
return true;});$('#delete-form input[name="delete"]').on('click',()=>{const m_name=$('#delete-form input[name="remove"]').val();return window.confirm(dotclear.msg.confirm_delete_media.replace('%s',m_name));});$('#save_settings').on('submit',()=>{$('input[name="pref_src"]').val($('input[name="src"][type=radio]:checked').attr('value'));$('input[name="pref_alignment"]').val($('input[name="alignment"][type=radio]:checked').attr('value'));$('input[name="pref_insertion"]').val($('input[name="insertion"][type=radio]:checked').attr('value'));$('input[name="pref_legend"]').val($('input[name="legend"][type=radio]:checked').attr('value'));});$('#media-insert-form :input:visible:enabled:checked:first, #media-insert-form :input:visible:enabled:first').trigger('focus',);dotclear.enterKeyInForm('#media-insert-form','#media-insert-ok','#media-insert-cancel');});