;(function($){"use strict";ips.controller.register('cms.front.records.form',{lastChecked:'',initialize:function(){$('#elInput_'+this.scope.attr('data-ipsTitleField')).on('blur',$.proxy(this.updateSlug,this));this.scope.find('button[data-ipsChange]').on('click',$.proxy(this.manualToggle,this));this.scope.find('button[data-ipsCancel]').on('click',$.proxy(this.manualCancel,this));if(this.scope.find('input[name=record_static_furl_set_checkbox]').prop('checked')){this.scope.removeClass('ipsHide');this._show();}},_hide:function(){this.scope.find('span[data-ipsSlugManual]').addClass('ipsHide');this.scope.find('span[data-ipsSlugSlug]').removeClass('ipsHide');this.scope.find('span[data-ipsSlugExt]').removeClass('ipsHide');this.scope.find('button[data-ipsCancel]').addClass('ipsHide');this.scope.find('button[data-ipsChange]').removeClass('ipsHide');this.scope.find('input[name=record_static_furl_set_checkbox]').prop('checked',false);this.scope.find('input[name=record_static_furl_set]').val(0);},_show:function(){this.scope.find('button[data-ipsCancel]').removeClass('ipsHide');this.scope.find('button[data-ipsChange]').addClass('ipsHide');this.scope.find('span[data-ipsSlugManual]').removeClass('ipsHide');this.scope.find('span[data-ipsSlugSlug]').addClass('ipsHide');this.scope.find('span[data-ipsSlugExt]').addClass('ipsHide');this.scope.find('input[name=record_static_furl_set_checkbox]').prop('checked',true);this.scope.find('input[name=record_static_furl_set]').val(1);},manualCancel:function(e){e.preventDefault();this._hide();},manualToggle:function(e){e.preventDefault();this._show();},updateSlug:function(e){var value=$('#elInput_'+this.scope.attr('data-ipsTitleField')).val();var self=this;if(value!=this.lastChecked){ips.getAjax()(ips.getSetting('baseURL')+'index.php?app=cms&module=database&controller=ajax&do=makeFurl',{data:{slug:value}}).done(function(response){self.scope.removeClass('ipsHide');self.scope.find('span[data-ipsSlugSlug]').html('/'+response.slug);});this.lastChecked=value;}}});}(jQuery));;
;(function($){"use strict";ips.controller.register('cms.front.records.revisions',{initialize:function(){var self=this;ips.loader.getStatic(['applications/core/interface/static/codemirror/diff_match_patch.js','applications/core/interface/static/codemirror/codemirror.js']).then(function(){self._initCodeMirror();});},_initCodeMirror:function(){var self=this;var count=0;for(const elem of self.scope.find("[data-key]").toArray()){if($(elem).attr('data-method')=='merge'){CodeMirror.MergeView(document.getElementById($(elem).identify().attr('id')),{value:self.scope.find('[data-current="'+$(elem).attr('data-key')+'"]').val(),origLeft:self.scope.find('[data-original="'+$(elem).attr('data-key')+'"]').val(),lineWrapping:true,lineNumbers:false,mode:'htmlmixed',revertButtons:false});}
else if($(elem).attr('data-complete')===undefined){var diff=new diff_match_patch();var differences=diff.diff_main(self.scope.find('[data-original="'+$(elem).attr('data-key')+'"]').html(),self.scope.find('[data-current="'+$(elem).attr('data-key')+'"]').html());var currentDiff=diff.diff_prettyHtml(differences);self.scope.find('[data-current="'+$(elem).attr('data-key')+'"]').html(currentDiff);$(elem).attr('data-complete',1);}};}});}(jQuery));;