'use strict';const dotclear_init=getData('dotclear_init');if(typeof dotclear_init.htmlFontSize!=='undefined'){document.documentElement.style.setProperty('--html-font-size',dotclear_init.htmlFontSize);} function chainHandler(obj,handlerName,handler){obj[handlerName]=(function(existingFunction){return function(){handler.apply(this,arguments);if(existingFunction)existingFunction.apply(this,arguments);};})(handlerName in obj?obj[handlerName]:null);} jQuery.fn.check=function(){return this.each(function(){if(this.checked!=undefined){this.checked=true;}});};jQuery.fn.unCheck=function(){return this.each(function(){if(this.checked!=undefined){this.checked=false;}});};jQuery.fn.setChecked=function(status){return this.each(function(){if(this.checked!=undefined){this.checked=status;}});};jQuery.fn.toggleCheck=function(){return this.each(function(){if(this.checked!=undefined){this.checked=!this.checked;}});};jQuery.fn.enableShiftClick=function(){this.on('click',function(event){if(event.shiftKey){if(dotclear.lastclicked!=''){let range;const trparent=$(this).parents('tr');const id=`#${dotclear.lastclicked}`;if(trparent.nextAll(id).length!=0){range=trparent.nextUntil(id);}else{range=trparent.prevUntil(id);} range.find('input[type=checkbox]').setChecked(dotclear.lastclickedstatus);this.checked=dotclear.lastclickedstatus;}}else{dotclear.lastclicked=$(this).parents('tr')[0].id;dotclear.lastclickedstatus=this.checked;} return true;});};jQuery.fn.toggleWithLegend=function(target,s){const defaults={img_on_txt:dotclear.img_plus_txt,img_on_alt:dotclear.img_plus_alt,img_off_txt:dotclear.img_minus_txt,img_off_alt:dotclear.img_minus_alt,unfolded_sections:dotclear.unfolded_sections,hide:true,legend_click:false,fn:false,user_pref:false,reverse_user_pref:false};const p=jQuery.extend(defaults,s);if(!target){return this;} const set_cookie=p.hide^p.reverse_cookie;if(p.cookie&&jQuery.cookie(p.cookie)){p.hide=p.reverse_cookie;} let set_user_pref=p.hide^p.reverse_user_pref;if(p.user_pref&&p.unfolded_sections!==undefined&&(p.user_pref in p.unfolded_sections)){p.hide=p.reverse_user_pref;} const toggle=function(i){const b=$(i).get(0);if(p.hide){b.firstChild.data=p.img_on_txt;b.setAttribute('value',p.img_on_txt);b.setAttribute('aria-label',p.img_on_alt);target.addClass('hide');}else{b.firstChild.data=p.img_off_txt;b.setAttribute('value',p.img_off_txt);b.setAttribute('aria-label',p.img_off_alt);target.removeClass('hide');if(p.fn){p.fn.apply(target);p.fn=false;}} if(p.cookie&&set_cookie){if(p.hide^p.reverse_cookie){jQuery.cookie(p.cookie,'',{expires:-1});}else{jQuery.cookie(p.cookie,1,{expires:30});}} p.hide=!p.hide;};return this.each(function(){const b=document.createElement('button');b.setAttribute('type','button');b.className='details-cmd';b.value=p.img_on_txt;b.setAttribute('aria-label',p.img_on_alt);const t=document.createTextNode(p.img_on_txt);b.appendChild(t);const ctarget=p.legend_click?this:b;$(ctarget).css('cursor','pointer');if(p.legend_click){$(ctarget).find('label').css('cursor','pointer');} $(ctarget).on('click',function(e){if(p.user_pref&&set_user_pref){jQuery.post('services.php',{f:'setSectionFold',section:p.user_pref,value:(p.hide^p.reverse_user_pref?1:0),xd_check:dotclear.nonce},function(){});jQuery.cookie(p.user_pref,'',{expires:-1});} toggle(b);e.preventDefault();return false;});toggle($(b).get(0));$(this).prepend(b);});};(function($){$.expandContent=function(opts){if(opts==undefined||opts.callback==undefined||!$.isFunction(opts.callback)){return;} if(opts.line!=undefined){multipleExpander(opts.line,opts.lines,opts.callback);} opts.lines.each(function(){singleExpander(this,opts.callback);});};const singleExpander=function(line,callback){$(``).on('click',function(e){toggleArrow(this);callback(line,'',e);e.preventDefault();}).prependTo($(line).children().get(0));};const multipleExpander=function(line,lines,callback){$(``).on('click',function(e){var action=toggleArrow(this);lines.each(function(){toggleArrow(this.firstChild.firstChild,action);callback(this,action,e);});e.preventDefault();}).prependTo($(line).children().get(0));};const toggleArrow=function(button,action){action=action||'';if(action==''){if(button.getAttribute('aria-label')==dotclear.img_plus_alt){action='open';}else{action='close';}} if(action=='open'){button.firstChild.data=dotclear.img_minus_txt;button.setAttribute('value',dotclear.img_minus_txt);button.setAttribute('aria-label',dotclear.img_minus_alt);}else{button.firstChild.data=dotclear.img_plus_txt;button.setAttribute('value',dotclear.img_plus_txt);button.setAttribute('aria-label',dotclear.img_plus_alt);} return action;};})(jQuery);jQuery.fn.helpViewer=function(){if(this.length<1){return this;} let select=$();const p={img_on_txt:dotclear.img_plus_txt,img_on_alt:dotclear.img_plus_alt,img_off_txt:dotclear.img_minus_txt,img_off_alt:dotclear.img_minus_alt};const This=this;const toggle=function(){$('#content').toggleClass('with-help');if(document.all){if($('#content').hasClass('with-help')){select=$('#content select:visible').hide();}else{select.show();}} $('p#help-button span a').text($('#content').hasClass('with-help')?dotclear.msg.help_hide:dotclear.msg.help);sizeBox();return false;};const sizeBox=function(){This.css('height','auto');if($('#wrapper').height()>This.height()){This.css('height',$('#wrapper').height()+'px');}};const textToggler=function(o){const b=$(``);o.css('cursor','pointer');let hide=true;o.prepend(' ').prepend(b);o.on('click',function(){$(this).nextAll().each(function(){if($(this).is('h4')){return false;} $(this).toggle();sizeBox();return true;});hide=!hide;const img=$(this).find('button.details-cmd');if(!hide){img.html(p.img_off_txt);img.attr('value',p.img_off_txt);img.attr('aria-label',p.img_off_alt);}else{img.html(p.img_on_txt);img.attr('value',p.img_on_txt);img.attr('aria-label',p.img_on_alt);}});};this.addClass('help-box');this.find('>hr').remove();this.find('h4').each(function(){textToggler($(this));});this.find('h4:first').nextAll('*:not(h4)').hide();sizeBox();const img=$(`

${dotclear.msg.help}

`);img.on('click',function(e){e.preventDefault();return toggle();});$('#content').append(img);const peInPage=$('#help-button').offset().top;$('#help-button').addClass('floatable');const peInFloat=$('#help-button').offset().top-$(window).scrollTop();$('#help-button').removeClass('floatable');$(window).on('scroll',function(){if($(window).scrollTop()>=peInPage-peInFloat){$('#help-button').addClass('floatable');}else{$('#help-button').removeClass('floatable');}});return this;};const dotclear={msg:{},enterKeyInForm:function(frm_id,ok_id,cancel_id){$(frm_id+':not('+cancel_id+')').on('keyup',function(e){if((e.key=='Enter')&&($(ok_id).prop('disabled')!==true)){e.preventDefault();e.stopPropagation();$(ok_id).trigger('click');}});},condSubmit:function(chkboxes,target){const checkboxes=$(chkboxes),submitButt=$(target);if(checkboxes===undefined||submitButt===undefined){return;} submitButt.attr('disabled',!checkboxes.is(':checked'));if(!checkboxes.is(':checked')){submitButt.addClass('disabled');}else{submitButt.removeClass('disabled');} checkboxes.on('click',function(){submitButt.attr('disabled',!checkboxes.is(':checked'));if(!checkboxes.is(':checked')){submitButt.addClass('disabled');}else{submitButt.removeClass('disabled');}});},hideLockable:function(){$('div.lockable').each(function(){const current_lockable_div=this;$(this).find('p.form-note').hide();$(this).find('input').each(function(){this.disabled=true;$(this).width(`${$(this).width() - 14}px`);const imgE=document.createElement('img');imgE.src='images/locker.png';imgE.style.position='absolute';imgE.style.top='1.8em';imgE.style.left=`${$(this).width() + 14}px`;imgE.alt=dotclear.msg.click_to_unlock;$(imgE).css('cursor','pointer');$(imgE).on('click',function(){$(this).hide();$(this).prev('input').each(function(){this.disabled=false;$(this).width(($(this).width()+14)+'px');});$(current_lockable_div).find('p.form-note').show();});$(this).parent().css('position','relative');$(this).after(imgE);});});},checkboxesHelpers:function(e,target,c,s){$(e).append(document.createTextNode(dotclear.msg.to_select));$(e).append(document.createTextNode(' '));$(``).on('click',function(){if(target!==undefined){target.check();}else{$(e).parents('form').find('input[type="checkbox"]').check();} if(c!==undefined&&s!==undefined){dotclear.condSubmit(c,s);} return false;}).appendTo($(e));$(e).append(document.createTextNode(' '));$(``).on('click',function(){if(target!==undefined){target.unCheck();}else{$(e).parents('form').find('input[type="checkbox"]').unCheck();} if(c!==undefined&&s!==undefined){dotclear.condSubmit(c,s);} return false;}).appendTo($(e));$(e).append(document.createTextNode(' '));$(``).on('click',function(){if(target!==undefined){target.toggleCheck();}else{$(e).parents('form').find('input[type="checkbox"]').toggleCheck();} if(c!==undefined&&s!==undefined){dotclear.condSubmit(c,s);} return false;}).appendTo($(e));},postsActionsHelper:function(){$('#form-entries').on('submit',function(){const action=$(this).find('select[name="action"]').val();if(action===undefined){return;} let checked=false;$(this).find('input[name="entries[]"]').each(function(){if(this.checked){checked=true;}});if(!checked){return false;} if(action=='delete'){return window.confirm(dotclear.msg.confirm_delete_posts.replace('%s',$('input[name="entries[]"]:checked').length));} return true;});},commentsActionsHelper:function(){$('#form-comments').on('submit',function(){const action=$(this).find('select[name="action"]').val();let checked=false;$(this).find('input[name="comments[]"]').each(function(){if(this.checked){checked=true;}});if(!checked){return false;} if(action=='delete'){return window.confirm(dotclear.msg.confirm_delete_comments.replace('%s',$('input[name="comments[]"]:checked').length));} return true;});},outgoingLinks:function(target){$(target).filter(function(){return((this.hostname&&this.hostname!=location.hostname&&!$(this).hasClass('modal')&&!$(this).hasClass('modal-image'))||$(this).hasClass('outgoing'));}).each(function(){$(this).prop('title',`${$(this).prop('title')} (${dotclear.msg.new_window})`);if(!$(this).hasClass('outgoing')){$(this).append(' ');}}).on('click',function(e){e.preventDefault();window.open($(this).attr('href'));});},responsiveCellHeaders:function(table,selector,offset=0,thead=false){try{let THarray=[];const ths=table.getElementsByTagName("th");for(let i=0;i0;colspan--){THarray.push(ths[i].innerText.replace('►',''));}} let styleElm=document.createElement("style");let styleSheet;document.head.appendChild(styleElm);styleSheet=styleElm.sheet;for(let i=offset;i