Version 5.0.0 beta 11.1
This commit is contained in:
1 parent
264eeb97e0
commit
90e8c7e903
466 files changed
+7796
-2394
No files matched your search
@@ -10,7 +10,7 @@ if(this._editorPreferences['lines']){$('#elTemplateEditor_preferences_menu').fin
|
||||
this._tabContent.find('[data-group]').each(function(i,item){var original=self._tabContent.find('[data-fileid="'+$(item).attr('data-fileid')+
|
||||
'"] input[data-role="variables"]');if(original.length){original.after($('<input/>').attr('type','hidden').attr('name',original.attr('name')).attr('value',original.attr('value')).attr('data-role','variables'))
|
||||
original.remove();}
|
||||
ips.loader.get(['core/interface/codemirror/diff_match_patch.js','core/interface/codemirror/codemirror.js']).then(function(){self._initCodeMirror($(item).attr('data-fileid'),$(item).attr('data-type'));});});},menuSelected:function(e,data){if(data.originalEvent){data.originalEvent.preventDefault();}
|
||||
ips.loader.getStatic(['applications/core/interface/static/codemirror/diff_match_patch.js','applications/core/interface/static/codemirror/codemirror.js']).then(function(){self._initCodeMirror($(item).attr('data-fileid'),$(item).attr('data-type'));});});},menuSelected:function(e,data){if(data.originalEvent){data.originalEvent.preventDefault();}
|
||||
if(data.triggerID=='elTemplateEditor_preferences'){if(data.selectedItemID=='diff'){this.toggleDiff();}
|
||||
else if(data.selectedItemID=='wrap'){this._changeEditorPreference(!ips.utils.db.get('templateEditor','wrap'),'wrap','lineWrapping');}else{this._changeEditorPreference(!ips.utils.db.get('templateEditor','lines'),'lines','lineNumbers');}}},_changeEditorPreference:function(toValue,type,cmName){if(toValue){$('#elTemplateEditor_preferences_menu').find('[data-ipsMenuValue="'+type+'"]').addClass('ipsMenu_itemChecked');}else{$('#elTemplateEditor_preferences_menu').find('[data-ipsMenuValue="'+type+'"]').removeClass('ipsMenu_itemChecked');}
|
||||
this._editorPreferences[type]=toValue;ips.utils.db.set('templateEditor',type,toValue);for(var i in this._cmInstances){if(this._cmInstances[i]instanceof CodeMirror.MergeView){this._cmInstances[i].edit.setOption(cmName,toValue);this._cmInstances[i].left.orig.setOption(cmName,toValue);}else{this._cmInstances[i].setOption(cmName,toValue);}}},openedDialog:function(e,data){if(data.elemID=='elTemplateEditor_variables'||data.elemID=='elTemplateEditor_attributes'){this._insertVariablesIntoDialog(data);}},_insertVariablesIntoDialog:function(data){var active=this._getActiveTab();if(!active.tabPanel){return;}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
;(function($,_,undefined){"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($,_,undefined){"use strict";ips.controller.register('cms.front.records.revisions',{initialize:function(){var self=this;ips.loader.get(['core/interface/codemirror/diff_match_patch.js','core/interface/codemirror/codemirror.js']).then(function(){self._initCodeMirror();});},_initCodeMirror:function(){var self=this;var count=0;_.each(self.scope.find("[data-key]"),function(elem){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});}
|
||||
;(function($,_,undefined){"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;_.each(self.scope.find("[data-key]"),function(elem){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(_.isUndefined($(elem).attr('data-complete'))){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,_));;
|
||||
@@ -1,4 +1,4 @@
|
||||
;(function($,_,undefined){"use strict";ips.controller.register('core.admin.templates.simple',{_cmInstances:{},initialize:function(){this.on('click','button[type="submit"]',this.save);this.on('tabChanged',this.changedTab);var debounce=_.debounce(_.bind(this._recalculatePanelWrapper,this),100);this.on(window,'resize',debounce);this.setup();},setup:function(){var self=this;ips.loader.get(['core/interface/codemirror/diff_match_patch.js','core/interface/codemirror/codemirror.js']).then(function(){self._initCodeMirror('theme_simple_header','htmlmixed');self._initCodeMirror('theme_simple_footer','htmlmixed');self._initCodeMirror('theme_simple_css','css');});},_initCodeMirror:function(key,type){var self=this;this._cmInstances[key]=CodeMirror.fromTextArea(document.getElementById('elTextarea_'+key),{mode:type,lineNumbers:false});this._cmInstances[key].setSize(null,this._getContentHeight());this.scope.find('#elTextarea_'+key).parent().addClass('i-background_3 i-padding_2');},changedTab:function(e,data){this._recalculatePanelWrapper();},save:function(e){e.preventDefault();var self=this;var form=this.scope.find('form[data-formid="form"]');var save={};_.each(this._cmInstances,function(key,cm){key.save();});form.find('input').each(function(){save[$(this).attr('name')]=$(this).val();});form.find('textarea').each(function(){save[$(this).attr('name')]=$(this).val();});Debug.log(save);self.scope.find('button[type="submit"]').addClass('ipsButton--disabled').removeClass('ipsButton--primary');ips.getAjax()(form.attr('action'),{dataType:'json',data:save,type:'post'}).done(function(response){ips.ui.flashMsg.show(ips.getString('saved'));}).fail(function(jqXHR){var message=ips.getString('saveThemeError');try
|
||||
;(function($,_,undefined){"use strict";ips.controller.register('core.admin.templates.simple',{_cmInstances:{},initialize:function(){this.on('click','button[type="submit"]',this.save);this.on('tabChanged',this.changedTab);var debounce=_.debounce(_.bind(this._recalculatePanelWrapper,this),100);this.on(window,'resize',debounce);this.setup();},setup: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('theme_simple_header','htmlmixed');self._initCodeMirror('theme_simple_footer','htmlmixed');self._initCodeMirror('theme_simple_css','css');});},_initCodeMirror:function(key,type){var self=this;this._cmInstances[key]=CodeMirror.fromTextArea(document.getElementById('elTextarea_'+key),{mode:type,lineNumbers:false});this._cmInstances[key].setSize(null,this._getContentHeight());this.scope.find('#elTextarea_'+key).parent().addClass('i-background_3 i-padding_2');},changedTab:function(e,data){this._recalculatePanelWrapper();},save:function(e){e.preventDefault();var self=this;var form=this.scope.find('form[data-formid="form"]');var save={};_.each(this._cmInstances,function(key,cm){key.save();});form.find('input').each(function(){save[$(this).attr('name')]=$(this).val();});form.find('textarea').each(function(){save[$(this).attr('name')]=$(this).val();});Debug.log(save);self.scope.find('button[type="submit"]').addClass('ipsButton--disabled').removeClass('ipsButton--primary');ips.getAjax()(form.attr('action'),{dataType:'json',data:save,type:'post'}).done(function(response){ips.ui.flashMsg.show(ips.getString('saved'));}).fail(function(jqXHR){var message=ips.getString('saveThemeError');try
|
||||
{message=$.parseJSON(jqXHR.responseText);}
|
||||
catch(e){}
|
||||
ips.ui.alert.show({type:'alert',message:message,icon:'warn'});}).always(function(){self.scope.find('button[type="submit"]').removeClass('ipsButton--disabled').addClass('ipsButton--primary');});},_getContentHeight:function(){return $(window).height()-this.scope.find('#tabs_form').offset().top-250;},_recalculatePanelWrapper:function(){var self=this;_.each(this._cmInstances,function(key,cm){key.setSize(null,self._getContentHeight());});}});}(jQuery,_));;
|
||||
@@ -1,7 +1,8 @@
|
||||
ips.templates.set('follow.frequency'," {{#hasNotifications}} <i class='fa-solid fa-bell'></i> {{/hasNotifications}} {{^hasNotifications}} <i class='fa-regular fa-bell-slash'></i> {{/hasNotifications}} {{text}}");;
|
||||
ips.templates.set('follow.frequency'," {{#hasNotifications}} <i class='fa-regular fa-bell'></i> {{/hasNotifications}} {{^hasNotifications}} <i class='fa-regular fa-bell-slash'></i> {{/hasNotifications}} {{text}}");;
|
||||
;(function($,_,undefined){"use strict";ips.controller.register('core.front.system.manageFollowed',{initialize:function(){$(document).on('followingItem',_.bind(this.followingItemChange,this));this.setup();},setup:function(){this._followID=this.scope.attr('data-followID');},followingItemChange:function(e,data){if(data.feedID!=this._followID){return;}
|
||||
if(!_.isUndefined(data.unfollow)){this.scope.find('[data-role="followDate"], [data-role="followFrequency"]').html('');this.scope.find('[data-role="followAnonymous"]').addClass('ipsHide');this.scope.find('[data-role="followButton"]').addClass('ipsButton--disabled');this.scope.addClass('i-opacity_4');return;}
|
||||
this.scope.find('[data-role="followAnonymous"]').toggleClass('ipsHide',!data.anonymous);if(data.notificationType){this.scope.find('[data-role="followFrequency"]').html(ips.templates.render('follow.frequency',{hasNotifications:(data.notificationType!=='none'),text:ips.getString('followFrequency_'+data.notificationType)}));}}});}(jQuery,_));;
|
||||
if(!_.isUndefined(data.unfollow)){this.scope.find('[data-role="followDate"], [data-role="followFrequency"]').html('');this.scope.find('[data-role="followAnonymous"]').attr('hidden','');this.scope.find('[data-role="followButton"]').addClass('ipsButton--disabled');this.scope.addClass('i-opacity_4');return;}
|
||||
if(data.anonymous){this.scope.find('[data-role="followAnonymous"]').removeAttr('hidden');}else{this.scope.find('[data-role="followAnonymous"]').attr('hidden','');}
|
||||
if(data.notificationType){this.scope.find('[data-role="followFrequency"]').html(ips.templates.render('follow.frequency',{hasNotifications:(data.notificationType!=='none'),text:ips.getString('followFrequency_'+data.notificationType)}));}}});}(jQuery,_));;
|
||||
;(function($,_,undefined){"use strict";ips.controller.register('core.front.system.metaTagEditor',{_changed:false,initialize:function(){this.on('click','[data-action="addMeta"]',this.addMetaBlock);this.on('click','[data-action="deleteMeta"]',this.removeMetaBlock);this.on('click','[data-action="deleteDefaultMeta"]',this.removeDefaultMeta);this.on('click','[data-action="restoreMeta"]',this.restoreDefaultMeta);this.on('change','input, select',this.changed);this.on('submit','form',this.formSubmit);this.on(window,'beforeunload',this.beforeUnload);this.on('change','[data-role="metaTagChooser"]',this.toggleNameField);this.setup();},setup:function(){this.scope.css({zIndex:"10000"});},toggleNameField:function(e){if($(e.currentTarget).val()=='other'){$(e.currentTarget).closest('ul').find('[data-role="metaTagName"]').show();}
|
||||
else
|
||||
{$(e.currentTarget).closest('ul').find('[data-role="metaTagName"]').hide();}},restoreDefaultMeta:function(e){var tag=$(e.currentTarget).attr('data-tag');var copy=this.scope.find('[data-role="metaTemplate"]').clone().attr('data-role','metaTagRow').hide();if(tag=='robots'||tag=='keywords'||tag=='description'){copy.find('select[name="meta_tag_name[]"]').val(tag);}
|
||||
@@ -27,7 +28,7 @@ else
|
||||
const enableLink=pushElement.contents();pushElement.html(ips.templates.render('core.notifications.checking'));const jsonSubscription=JSON.parse(JSON.stringify(subscription));const key=jsonSubscription.keys.p256dh;ips.getAjax()(ips.getSetting('baseURL')+'index.php?app=core&module=system&controller=notifications&do=verifySubscription',{type:'post',data:{key}}).done((response,status,jqXHR)=>{if(jqXHR.status===200){pushElement.html(ips.templates.render('core.notifications.success'));return;}
|
||||
pushElement.html(enableLink);}).fail(()=>{pushElement.html(enableLink);});}).catch(err=>{Debug.error(err);pushElement.html(ips.templates.render('core.notifications.notSupported'));});}else if(Notification.permission==='denied'){pushElement.html(ips.templates.render('core.notifications.fail'));}}else{Debug.log("Notifications not supported");pushElement.html(ips.templates.render('core.notifications.notSupported'));}
|
||||
pushElement.slideDown();},enablePush:function(e){e.preventDefault();ips.utils.notification.requestPermission();},subscribePending:function(e,data){this.scope.find('[data-action="enablePush"]').html(ips.templates.render('core.notifications.pending')).show();},subscribeSuccess:function(e,data){this.scope.find('[data-action="enablePush"]').html(ips.templates.render('core.notifications.success')).show();},subscribeFail:function(e,data){this.scope.find('[data-action="enablePush"]').html(ips.templates.render('core.notifications.fail')).show();},permissionDenied:function(){this.scope.find('[data-action="enablePush"]').html(ips.templates.render('core.notifications.fail')).show();},promptMe:function(e){if($(e.target).is(':checked')){ips.utils.cookie.unset('noBrowserNotifications');if(!ips.utils.notification.hasPermission()){ips.utils.notification.requestPermission();}else{ips.ui.flashMsg.show(ips.getString('saved'));}}else{ips.utils.cookie.set('noBrowserNotifications',true,true);ips.ui.flashMsg.show(ips.getString('saved'));}},_showNotificationChoice:function(){this.scope.find('[data-role="browserNotifyInfo"]').show();var type=ips.utils.notification.permissionLevel();switch(type){case'denied':$('#elBrowserNotifications').prop('checked',false).prop('disabled',true);this.scope.find('[data-role="browserNotifyDisabled"]').show();break;case'granted':$('#elBrowserNotifications').prop('checked',!ips.utils.cookie.get('noBrowserNotifications'));break;default:break;}},showNotificationSettings:function(e){e.preventDefault();var target=$(e.currentTarget);var expandedContainer=target.parent().find('[data-role="notificationSettingsWindow"]');this.scope.find('.cNotificationTypes__row--selected').removeClass('cNotificationTypes__row--selected');this.scope.find('[data-action="showNotificationSettings"]').show();this.scope.find('[data-role="notificationSettingsWindow"]').hide();target.parent().addClass('cNotificationTypes__row--selected');target.find('.cNotificationSettings_expand').addClass('ipsLoading ipsLoading--tiny').find('i').addClass('ipsHide');ips.getAjax()(target.attr('href')).done(function(response){expandedContainer.html(response).show();target.hide();target.find('.cNotificationSettings_expand').removeClass('ipsLoading').find('i').removeClass('ipsHide');}).fail(function(){window.location=target.attr('href');})},closeNotificationSettings:function(e){e.preventDefault();this.scope.find('.cNotificationTypes__row--selected').removeClass('cNotificationTypes__row--selected');this.scope.find('[data-action="showNotificationSettings"]').show();this.scope.find('[data-role="notificationSettingsWindow"]').hide();},saveNotificationSettings:function(e){e.preventDefault();var target=$(e.target);var form=target.closest('form');var container=form.closest('[data-role="notificationSettingsWindow"]');var containerParent=container.closest('.cNotificationTypes__row');var closeIcon=container.find('[data-action="closeNotificationSettings"]');closeIcon.addClass('ipsLoading ipsLoading--tiny').text('');ips.getAjax()(form.attr('action'),{data:form.serialize(),type:'post'}).done(function(response){closeIcon.removeClass('ipsLoading').html('×');containerParent.find('[data-action="showNotificationSettings"]').html(response);ips.ui.flashMsg.show(ips.getString('saved'));});}});}(jQuery,_));;
|
||||
;(function($,_,undefined){"use strict";ips.controller.register('core.front.system.referrals',{initialize:function(){$('.cReferrer_copy').each(function(){$(this).hide();});ips.loader.get(['core/interface/clipboard/clipboard.min.js']).then(function(){if(ClipboardJS.isSupported()){$('.cReferrer_copy').each(function(){$(this).show();});var clipboard=new ClipboardJS('.cReferrer_copy');clipboard.on('success',function(e){ips.ui.flashMsg.show(ips.getString('copied'));e.clearSelection();});}else{$('.cReferrals_directLink_input').removeClass('ipsHide');$('.cReferrals_directLink_link').addClass('ipsHide');}});}});}(jQuery,_));;
|
||||
;(function($,_,undefined){"use strict";ips.controller.register('core.front.system.referrals',{initialize:function(){$('.cReferrer_copy').each(function(){$(this).hide();});ips.loader.getStatic("/applications/core/interface/static/clipboard/clipboard.min.js").then(function(){if(ClipboardJS.isSupported()){$('.cReferrer_copy').each(function(){$(this).show();});var clipboard=new ClipboardJS('.cReferrer_copy');clipboard.on('success',function(e){ips.ui.flashMsg.show(ips.getString('copied'));e.clearSelection();});}else{$('.cReferrals_directLink_input').removeClass('ipsHide');$('.cReferrals_directLink_link').addClass('ipsHide');}});}});}(jQuery,_));;
|
||||
;(function($,_,undefined){"use strict";ips.controller.register('core.front.system.register',{usernameField:null,timers:{'username':null,'email':null},ajax:ips.getAjax(),popup:null,passwordBlurred:true,dirty:false,initialize:function(){this.on('keyup','#elInput_username',this.changeUsername);this.on('blur','#elInput_username',this.changeUsername);this.on('keyup','#elInput_password_confirm',this.confirmPassword);this.on('blur','#elInput_password_confirm',this.confirmPassword);this.on('click','a[data-ipsPbrCancel]',this.cancelPbr);this.setup();},setup:function(){this.usernameField=this.scope.find('#elInput_username');this.passwordField=this.scope.find('#elInput_password');this.confirmPasswordField=this.scope.find('#elInput_password_confirm');this.usernameField.after($('<span/>').attr('data-role','validationCheck'));this.confirmPasswordField.after($('<span/>').attr('data-role','validationCheck'));this.convertExistingErrors();},convertExistingErrors:function(){var fields=this.scope.find('#elInput_username, #elInput_password, #elInput_password_confirm');var self=this;fields.each(function(){var elem=$(this);var wrapper=elem.closest('.ipsFieldRow');if(!wrapper.hasClass('ipsFieldRow_error')){return;}
|
||||
var message=wrapper.find('.i-color_warning').html();self._clearResult(elem);wrapper.find('[data-role="validationCheck"]').show().html(ips.templates.render('core.forms.validateFailText',{message:message}));elem.removeClass('ipsField_success').addClass('ipsField_error');});},cancelPbr:function(e){var url=$(e.target).closest('[data-ipsPbrCancel]').attr('href');e.preventDefault();e.stopPropagation();ips.ui.alert.show({type:'confirm',message:ips.getString('pbr_confirm_title'),subText:ips.getString('pbr_confirm_text'),icon:'warn',buttons:{ok:ips.getString('pbr_confirm_ok'),cancel:ips.getString('pbr_confirm_cancel')},callbacks:{ok:function(){window.location=url;},cancel:function(){return false;}}});},changeUsername:function(e){if(this.timers['username']){clearTimeout(this.timers['username']);}
|
||||
if(this.usernameField.val().length>4||e.type!="keyup"){this.timers['username']=setTimeout(_.bind(this._doCheck,this,this.usernameField),700);}else{this._clearResult(this.usernameField);}},changePassword:function(e){if(this.timers['password']){clearTimeout(this.timers['password']);}
|
||||
|
||||
@@ -46,14 +46,14 @@ let basePages=Math.ceil(Math.abs(children[children.length-1].getBoundingClientRe
|
||||
return basePages;},setupObserver(){if(this._observer){this._observer.disconnect();}
|
||||
if(this.getCarousel()instanceof HTMLElement){this._observer=new ResizeObserver(_.debounce(()=>this.updateCarouselIndicator()));this._observer.observe(this.getCarousel());}}});}(jQuery,_));;
|
||||
;(function($,_){"use strict";let pageLoadTime;setTimeout(()=>pageLoadTime=Date.now());let state='unloaded';const whenLoadedCallbacks=[];function whenLoaded(){return new Promise(resolve=>{if(state==='loaded'){resolve();return;}
|
||||
whenLoadedCallbacks.push(resolve);if(state==='unloaded'){ips.loader.get(['core/front/controllers/widgets/ips.widgets.block.js']).then(async()=>{if(!window.ips.utils.pagebuilder){const url=ips.getSetting('baseURL')+`/applications/core/interface/pagebuilder/manifest.json?v=${ips.getSetting('pagebuilderKey')}`
|
||||
whenLoadedCallbacks.push(resolve);if(state==='unloaded'){ips.loader.get(['core/front/controllers/widgets/ips.widgets.block.js']).then(async()=>{if(!window.ips.utils.pagebuilder){const url=ips.getSetting('baseURL')+`/applications/core/interface/static/pagebuilder/manifest.json?v=${ips.getSetting('pagebuilderKey')}&antiCache=${encodeURIComponent(ips.getSetting('jsAntiCache'))}`
|
||||
const data=await ips.fetch(url)
|
||||
const toLoad=[];for(const key in data){if(data[key].file?.match(/\.css$/i)){const href=ips.getSetting('baseURL')+'/applications/core/interface/pagebuilder/'+data[key].file
|
||||
const toLoad=[];for(const key in data){if(data[key].file?.match(/\.css$/i)){const href=ips.getSetting('baseURL')+'/applications/core/interface/static/pagebuilder/'+data[key].file+`?antiCache=${encodeURIComponent(ips.getSetting('jsAntiCache'))}`
|
||||
if(!document.querySelector(`[href="${encodeURI(href)}"]`)){const style=document.createElement('link')
|
||||
style.rel='stylesheet'
|
||||
style.href=href
|
||||
document.head.appendChild(style)}}else if(data[key].isEntry){toLoad.push(ips.getSetting('baseURL')+'/applications/core/interface/pagebuilder/'+data[key].file)}}
|
||||
if(toLoad.length){await ips.loader.get(toLoad)}}
|
||||
document.head.appendChild(style)}}else if(data[key].isEntry){toLoad.push('/applications/core/interface/static/pagebuilder/'+data[key].file)}}
|
||||
if(toLoad.length){await ips.loader.getStatic(toLoad)}}
|
||||
state='loaded';while(whenLoadedCallbacks.length){whenLoadedCallbacks.shift()();}})
|
||||
state='loading';}})}
|
||||
ips.controller.register('core.front.widgets.manager',{_loadedManager:false,_loadingManager:false,_inManagingState:false,_wasUnused:false,initialize(){this.on('click','[data-action="openSidebar"]',this.openSidebarManager);this.on('click','[data-action="closeSidebar"]',this.closeSidebarManager);this._wasUnused=!!document.querySelector('.ipsLayout__secondary-column.ipsLayout__secondary-column--hide')||this._wasUnused;whenLoaded().then(()=>{if(ips.utils.url.getParam('_blockManager')){this.openSidebarManager();}});window.addEventListener('historychange',_.debounce((e)=>{if(ips.utils.history.getLastChangeType()!=='pagebuilder'&&e.detail?.type!=='pop'){return;}
|
||||
@@ -73,7 +73,7 @@ this.scope.addClass('cWidgetsManaging');},closeSidebarManager(e){e?.preventDefau
|
||||
if(ips.utils.url.getParam('_blockManager')){if(ips.utils.history.getState('pagebuilder').artificial){window.history.back()}
|
||||
setTimeout(()=>ips.utils.history.replaceState({},'pagebuilder',window.location.href.replace(/\?(.*?)&?_blockManager=[^&]*/,'?$1').replace(/[?&]+$/,'')))}}},_setUpDragging(){this.elem.querySelectorAll('[data-role="availableBlocks"] ul').forEach(list=>{list.style.zIndex=ips.ui.zIndex();list.querySelectorAll(':scope > .cSidebarManager_block').forEach(item=>this._setupDraggingOnItem(item));})},_setupDraggingOnItem(item){item.setAttribute('draggable','true');const wrapBehavior=item.dataset.widgetLayouts?.split(',')?.[0]?.trim()||'table'
|
||||
item.addEventListener('dragstart',function(e){e.stopPropagation();e.dataTransfer.clearData();const data={blockID:e.target.dataset.blockid,blockTitle:e.target.dataset.blocktitle,allowReuse:e.target.dataset.allowreuse,config:!!e.target.dataset.blockconfig,blank:e.target.dataset.blockerrormessage,menustyle:e.target.dataset.menustyle,ipsWrapBehavior:wrapBehavior,};e.dataTransfer.setData('application/x.ipsblock',JSON.stringify(data));ipsSettings.__pageeditor_last_dragged_widget_data__=data;item.addEventListener('dragend',e=>{delete ipsSettings.__pageeditor_last_dragged_widget_data__;},{once:true});})},async _showManager(){this.scope.find('#elSidebarManager').removeAttr('hidden');this._fadeUnmanagedRoots();if(!this._loadedManager&&!this._loadingManager){try{const response=await ips.fetch(ips.getSetting('baseURL')+'index.php?app=core&module=system&controller=widgets&do=getBlockList',{data:{pageApp:$('body').attr('data-pageApp')}})
|
||||
this._loadedManager=true;this.scope.find('[data-role="availableBlocks"]').html(response);this._setUpDragging();this.setupSearch();this.setupFavorites();try{$(document).trigger('contentChange',[$('#elSidebarManager')]);}catch(e){Debug.error(e);}
|
||||
this._loadedManager=true;this.scope.find('[data-role="availableBlocks"]').html(response);this.scope.find('[data-role="availableBlocks"]').attr("data-unloaded",null);this._setUpDragging();this.setupSearch();this.setupFavorites();try{$(document).trigger('contentChange',[$('#elSidebarManager')]);}catch(e){Debug.error(e);}
|
||||
document.dispatchEvent(new CustomEvent('ipsWidgetManagerLoaded',{bubbles:true,cancelable:true}))}catch(e){Debug.error(e)
|
||||
ips.ui.alert.show({type:'alert',icon:'warn',message:ips.getString('sidebar_fetch_blocks_error'),callbacks:{}});}
|
||||
this.scope.find('[data-role="availableBlocks"]').removeClass('ipsLoading ipsLoading_dark');this._loadingManager=false;}else{this._setUpDragging();this.setupSearch();this.setupFavorites();}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
;(function($,undefined){"use strict";ips.controller.register('core.global.core.coverPhoto',{_image:null,_existingPosition:0,_tooltip:null,_expandedCover:false,_newPosition:0,_container:null,_editingPosScroll:0,_editingPosMouse:0,initialize:function(){var self=this;this.on('menuItemSelected',function(e,data){var button=$(data.originalEvent.target).closest('a[data-action]');switch($(button).attr('data-action')){case'removeCoverPhoto':self.removePhoto(data);break;case'positionCoverPhoto':self.positionPhoto(data.originalEvent);break;}});this.on('click','[data-action="savePosition"]',this.savePosition);this.on('click','[data-action="cancelPosition"]',this.cancelPosition);this.on('click','[data-action="toggleCoverPhoto"]',this.toggleCoverPhoto);this.setup();},setup:function(){this._image=this.scope.find('.ipsCoverPhoto__image');var doPosition=ips.utils.url.getParam('_position');if(doPosition!=undefined)this.positionPhoto();this.scope.find('a[data-action="positionCoverPhoto"]').parent().removeClass('ipsHide');},removePhoto:function(data){data.originalEvent.preventDefault();var self=this;var target=$(data.originalEvent.target).closest('[data-action="removeCoverPhoto"]');ips.ui.alert.show({type:'confirm',icon:'warn',message:ips.getString('confirmRemoveCover'),callbacks:{ok:function(){ips.getAjax()($(target).attr('href')+'&wasConfirmed=1').done(function(){ips.utils.anim.go('fadeOut',self._image).done(function(){ips.ui.flashMsg.show(ips.getString('removeCoverDone'));});data.menuElem.find('[data-role="photoEditOption"]').hide();}).fail(function(err){window.location=$(target).attr('href');});}}});},savePosition:function(e){e.preventDefault();let newPos=((this._container.scrollTop/(this._container.scrollHeight-this._container.clientHeight))*100);newPos=newPos||0;this._newPosition=newPos;this.scope.attr('data-coverOffset',this._newPosition);this.scope.css({'--offset':this._newPosition});ips.getAjax()(this.scope.attr('data-url')+'&do=coverPhotoPosition'+'&offset='+this._newPosition).fail(function(err){this.scope.attr('data-url')+'&do=coverPhotoPosition'+'&offset='+this._newPosition;});this._resetImage();},cancelPosition:function(e){e.preventDefault();this._resetImage();},positionPhoto:function(e){if(e!=undefined)e.preventDefault();this.scope.addClass('ipsCoverPhoto--editing');this._existingPosition=parseInt(this.scope.attr('data-coveroffset'))||0;this._container=this.scope.find('.ipsCoverPhoto__container')[0];this._mouseDownHandler=this._mouseDownHandler.bind(this);this._container.addEventListener('mousedown',this._mouseDownHandler);this._mouseUpHandler=this._mouseUpHandler.bind(this);this._container.addEventListener('mouseup',this._mouseUpHandler);this._mouseOutHandler=this._mouseOutHandler.bind(this);this._container.addEventListener('mouseout',this._mouseOutHandler);this._container.scrollTop=(this._container.scrollHeight-this._container.clientHeight)*(this._existingPosition/100);this.scope.find('.ipsCoverPhoto__container').after(ips.templates.render('core.coverPhoto.controls'));this._showTooltip();},_mouseDownHandler:function(e){e.preventDefault();this._editingPosMouse=e.clientY;this._editingPosScroll=this._container.scrollTop;this._mouseMoveHandler=this._mouseMoveHandler.bind(this);this._container.addEventListener('mousemove',this._mouseMoveHandler);},_mouseMoveHandler:function(e){let dy=(e.clientY-this._editingPosMouse)*2.3;this._container.scrollTop=this._editingPosScroll-dy;},_mouseUpHandler:function(e){this._container.removeEventListener('mousemove',this._mouseMoveHandler);},_mouseOutHandler:function(e){this._container.removeEventListener('mousemove',this._mouseMoveHandler);},_resetImage:function(){this._container.removeEventListener('mousedown',this._mouseDownHandler);this.scope.removeClass('ipsCoverPhoto--editing');this.scope.find('[data-role="reposition"]').remove();this.scope.find('[data-role="coverPhotoControls"]').remove();this._hideTooltip();ips.utils.history.pushState({},'core.global.core.coverPhoto',ips.utils.url.removeParam('csrfKey',this.scope.attr('data-url')));},_showTooltip:function(msg){if(!this._tooltip){this._buildTooltip();}
|
||||
this._tooltip.hide().text(ips.getString('dragCoverPhoto'));this._positionTooltip();},_hideTooltip:function(){if(this._tooltip&&this._tooltip.is(':visible')){ips.utils.anim.go('fadeOut',this._tooltip);}},_positionTooltip:function(){var positionInfo={trigger:this.scope.find('.ipsCoverPhoto__container'),target:this._tooltip,center:true,above:true};var tooltipPosition=ips.utils.position.positionElem(positionInfo);this._tooltip.css({left:tooltipPosition.left+'px',top:tooltipPosition.top+'px',position:(tooltipPosition.fixed)?'fixed':'absolute',zIndex:ips.ui.zIndex()});if(tooltipPosition.location.vertical=='top'){this._tooltip.addClass('ipsTooltip_top');}else{this._tooltip.addClass('ipsTooltip_bottom');}
|
||||
this._tooltip.show();},_buildTooltip:function(){var tooltipHTML=ips.templates.render('core.tooltip',{id:'elCoverPhotoTooltip'});ips.getContainer().append(tooltipHTML);this._tooltip=$('#elCoverPhotoTooltip');},toggleCoverPhoto:function(){if(this._expandedCover==false){let naturalImage=this.scope.find('.ipsCoverPhoto__image')[0],ratio=naturalImage.naturalWidth/naturalImage.naturalHeight;this.scope.find('.ipsCoverPhoto__container').css("--coverPhoto--ratio",ratio);this._expandedCover=true;this.scope.addClass('ipsCoverPhoto--expanded');}else{this._expandedCover=false;this.scope.removeClass('ipsCoverPhoto--expanded');}},});}(jQuery));;
|
||||
;(function($,_,undefined){"use strict";ips.controller.register('core.global.core.cropper',{_image:null,_coords:{},initialize:function(){this.setup();},setup:function(){var self=this;this._image=this.scope.find('[data-role="profilePhoto"]');this._coords={topLeftX:this.scope.find('[data-role="topLeftX"]'),topLeftY:this.scope.find('[data-role="topLeftY"]'),bottomRightX:this.scope.find('[data-role="bottomRightX"]'),bottomRightY:this.scope.find('[data-role="bottomRightY"]'),};this._image.css({maxWidth:'100%'});ips.loader.get(['core/interface/cropper/cropper.min.js']).then(function(){self._image.imagesLoaded(_.bind(self._startCropper,self));});},_startCropper:function(){var self=this;var width=this._image.width();var height=this._image.height();this._image.closest('[data-role="cropper"]').css({width:width+'px',height:height+'px'});var cropper=new Cropper(this._image.get(0),{aspectRatio:1/1,autoCropArea:0.9,responsive:true,zoomOnWheel:false,crop:function(e){self._coords.topLeftX.val(e.detail.x);self._coords.topLeftY.val(e.detail.y);self._coords.bottomRightX.val(e.detail.width+e.detail.x);self._coords.bottomRightY.val(e.detail.height+e.detail.y);}});}});}(jQuery,_));;
|
||||
;(function($,_,undefined){"use strict";ips.controller.register('core.global.core.cropper',{_image:null,_coords:{},initialize:function(){this.setup();},setup:function(){var self=this;this._image=this.scope.find('[data-role="profilePhoto"]');this._coords={topLeftX:this.scope.find('[data-role="topLeftX"]'),topLeftY:this.scope.find('[data-role="topLeftY"]'),bottomRightX:this.scope.find('[data-role="bottomRightX"]'),bottomRightY:this.scope.find('[data-role="bottomRightY"]'),};this._image.css({maxWidth:'100%'});ips.loader.getStatic(['applications/core/interface/static/cropper/cropper.min.js']).then(function(){self._image.imagesLoaded(_.bind(self._startCropper,self));});},_startCropper:function(){var self=this;var width=this._image.width();var height=this._image.height();this._image.closest('[data-role="cropper"]').css({width:width+'px',height:height+'px'});var cropper=new Cropper(this._image.get(0),{aspectRatio:1/1,autoCropArea:0.9,responsive:true,zoomOnWheel:false,crop:function(e){self._coords.topLeftX.val(e.detail.x);self._coords.topLeftY.val(e.detail.y);self._coords.bottomRightX.val(e.detail.width+e.detail.x);self._coords.bottomRightY.val(e.detail.height+e.detail.y);}});}});}(jQuery,_));;
|
||||
;(function($,_,undefined){"use strict";ips.controller.register('core.global.core.datetime',{initialize:function(){this.setup();},setup:function(){var formatObject={format:$(this.scope).attr('data-format')};var localeTimeFormat=ips.utils.time.localeTimeFormat($('html').attr('lang'));if(localeTimeFormat.meridiem){formatObject.meridiem=localeTimeFormat.meridiem;}
|
||||
$(this.scope).text(ips.utils.time.formatTime(new Date($(this.scope).attr('data-time')),formatObject));}});}(jQuery,_));;
|
||||
;(function($,_,undefined){"use strict";ips.controller.register('core.global.core.embeddedvideo',{initialize:function(){var video=this.scope.get(0);var canPlay=false;this.scope.find('source').each(function(){if(video.canPlayType($(this).attr('type'))){canPlay=true;}});if(!canPlay){if(this.scope.find('embed').length){this.scope.replaceWith(this.scope.find('embed'));}else{this.scope.replaceWith($(this.scope).find('a'));}}}});}(jQuery,_));;
|
||||
|
||||
@@ -6,7 +6,7 @@ if(this.scope.attr('data-bulkUpload')){this._bulkUpload=true;}
|
||||
if(this.scope.attr('data-multipleFiles')){this._allowMultipleFiles=true;}
|
||||
if(this.scope.attr('data-newVersion')){this._newVersion=true;}
|
||||
this._ui={progressBar:this.scope.find('#elDownloadsSubmit_progress'),screenshots:this.scope.find('#elDownloadsSubmit_screenshots'),fileInfo:this.scope.find('#elDownloadsSubmit_otherinfo')};var hideProgressBar=function(force=false){self._ui.progressBar.hide();};if(!this._hasExistingFiles()&&!this._newVersion){hideProgressBar(true);this._ui.screenshots.hide();this._ui.fileInfo.hide();this.scope.find('[data-role="submitForm"]').prop('disabled',true);this._toggleFileImportOptions();}else if(this._newVersion){hideProgressBar(true);this._toggleFileImportOptions(true);}else{if(!this.scope.find('input[name^="files_existing"]').length){hideProgressBar();}else{this._hiddenUploader=true;}
|
||||
if(!this._hasExistingScreenshots()&&this._requireScreenshots){this._ui.fileInfo.hide();this.scope.find('[data-role="submitForm"]').prop('disabled',true);}}},confirmURLs:function(e){e.preventDefault();var gotURLs=this._confirmMenu('url_files','elURLFiles');if(gotURLs){this._doneUploadStep();}},confirmImports:function(e){e.preventDefault();var gotImports=this._confirmMenu('import_files','elImportFiles');if(gotImports){this._doneUploadStep();}},confirmScreenshots:function(e){e.preventDefault();var gotURLs=this._confirmMenu('url_screenshots','elURLScreenshots');if(gotURLs){this._doneScreenshotStep();}},uploadMore:function(e){e.preventDefault();this._hiddenUploader=false;this._overriddenUploader=true;},fileAdded:function(e,data){if(!this._bulkUpload){if(data.uploader=='files'){this._doneUploadStep();}else if(data.uploader=='screenshots'){this._doneScreenshotStep();}}else{this.scope.find('[data-role="submitForm"]').prop('disabled',false);}},fileDeleted:function(e,data){if(data.uploader!='files'){return;}
|
||||
if(!this._hasExistingScreenshots()&&this._requireScreenshots){this._ui.fileInfo.hide();this.scope.find('[data-role="submitForm"]').prop('disabled',true);}}},confirmURLs:function(e){var gotURLs=this._confirmMenu('url_files','elURLFiles');if(gotURLs){this._doneUploadStep();}},confirmImports:function(e){var gotImports=this._confirmMenu('import_files','elImportFiles');if(gotImports){this._doneUploadStep();}},confirmScreenshots:function(e){var gotURLs=this._confirmMenu('url_screenshots','elURLScreenshots');if(gotURLs){this._doneScreenshotStep();}},uploadMore:function(e){this._hiddenUploader=false;this._overriddenUploader=true;},fileAdded:function(e,data){if(!this._bulkUpload){if(data.uploader=='files'){this._doneUploadStep();}else if(data.uploader=='screenshots'){this._doneScreenshotStep();}}else{this.scope.find('[data-role="submitForm"]').prop('disabled',false);}},fileDeleted:function(e,data){if(data.uploader!='files'){return;}
|
||||
if(data.count===0){this.scope.find('#elDownloadsSubmit_progress .ipsProgress__progress').attr('data-progress','0%').css({width:'0%'});this._ui.progressBar.hide();this._hiddenUploader=false;this._overriddenUploader=true;}},uploadCounter:function(e,data){if(data.uploader!='files'){return;}
|
||||
this._uploadedCount=data.count;this._toggleFileImportOptions();},uploadProgress:function(e,data){if(data.uploader!='files'){return;}
|
||||
var self=this;this._showProgress();this.scope.find('#elDownloadsSubmit_progress .ipsProgress__progress').attr('data-progress',data.percent+'%').css({width:data.percent+'%'});if(data.percent===100&&!this._progressbarTimeout){this._progressbarTimeout=setTimeout(function(){self._ui.progressBar.find('.ipsProgress').removeClass('ipsProgress--animated');self._progressbarTimeout=null;},300);}},_confirmMenu:function(inputName,elemID){var length=0;var invalid=0;this.scope.find('input[name^="'+inputName+'"]').each(function(){if($(this).val().trim()){length++;}
|
||||
|
||||
@@ -20,7 +20,7 @@ ips.templates.set('core.rating.star'," <li class='{{className}}' data-ratingValu
|
||||
</div>
|
||||
<input type="text" data-role="widgetSearch" placeholder="{{#lang}}sidebarManagerSearchPlaceholder{{/lang}}" class="ipsInput ipsInput--widget-search" />
|
||||
</div>
|
||||
<div data-role='availableBlocks' class='ipsLoading ipsScrollbar'></div>
|
||||
<div data-role='availableBlocks' data-unloaded="true" class='ipsLoading ipsScrollbar'></div>
|
||||
<div data-role="emptyMessage" class="i-padding_2" hidden>{{#lang}}sidebarManagerSearchEmpty{{/lang}}</div>
|
||||
</div>
|
||||
<div id='elSidebarManager_submit' class='i-flex_00 i-padding_3 ipsButtons i-gap_2'>
|
||||
@@ -155,7 +155,7 @@ ips.templates.set('tableOfContents.linkOptions',`\
|
||||
`);ips.templates.set('ips.ui.controls.cannot_load',`
|
||||
<div class="{{{classList}}} ipsControls__fail-message">{{message}}</div>
|
||||
`,{classList:'ipsMessage ipsMessage--info',get message(){return ips.getString('ips.ui.controls.cannot_load')}});
|
||||
;(function($,_,undefined){"use strict";ips.createModule('ips.loader',function(){var _loadedScripts=[],_loadingScripts=[];var init=function(){var scripts=$('script[src][data-ips]');scripts.each(function(){var scriptInfo=ips.utils.url.getURIObject($(this).attr('src'));if(scriptInfo.queryKey.src){var paths=_getPathScripts(scriptInfo.queryKey.src);_.each(paths,function(value){_loadedScripts.push(value);});}else if(scriptInfo.path.indexOf('interface/')!==-1){var interfaces=_getInterfaceScript(scriptInfo.path);if(interfaces){_loadedScripts.push(interfaces);}}else{var other=_getOtherScript(scriptInfo.source);if(other){_loadedScripts.push(other);}}});},_getOtherScript=function(path){path=path.replace(ips.getSetting('baseURL'),'');if(path.startsWith('/')){path=path.substring(1);}
|
||||
;(function($,_,undefined){"use strict";ips.createModule('ips.loader',function(){var _loadedScripts=[],_loadingScripts=[];const LOADER_STATES={};var init=function(){var scripts=$('script[src][data-ips]');scripts.each(function(){var scriptInfo=ips.utils.url.getURIObject($(this).attr('src'));if(scriptInfo.queryKey.src){var paths=_getPathScripts(scriptInfo.queryKey.src);_.each(paths,function(value){_loadedScripts.push(value);});}else if(scriptInfo.path.indexOf('interface/')!==-1){var interfaces=_getInterfaceScript(scriptInfo.path);if(interfaces){_loadedScripts.push(interfaces);}}else{var other=_getOtherScript(scriptInfo.source);if(other){_loadedScripts.push(other);}}});},_getOtherScript=function(path){path=path.replace(ips.getSetting('baseURL'),'');if(path.startsWith('/')){path=path.substring(1);}
|
||||
if(path.startsWith('applications/')){path=path.replace(/^applications\//i,'')}
|
||||
return path;},_getInterfaceScript=function(path){var pieces=_.compact(path.split('/').reverse());var path=[];for(var i=0;i<pieces.length;i++){if(pieces[i]=='interface'){path.push('interface');path.push(pieces[i+1]);break;}
|
||||
path.push(pieces[i]);}
|
||||
@@ -175,7 +175,12 @@ if(remoteFiles.length){for(var i=0;i<remoteFiles.length;i++){_insertScript([remo
|
||||
return deferred.promise();},_insertScript=function(toLoad,cached){for(var i=0;i<toLoad.length;i++){_loadingScripts.push(toLoad[i]);}
|
||||
Debug.log("Loading: "+toLoad.join(', '));var url='';if(toLoad[0].match(/^(http|\/\/)/i)){url=toLoad[0].match(/^http/)?toLoad[0].replace(/^.+?\/\/(.*)$/,'//$1'):toLoad[0];}else{url=ips.getSetting('jsURL')+'?src='+encodeURIComponent(toLoad.join(','));}
|
||||
setTimeout(function(){$.ajax({dataType:'script',cache:(_.isUndefined(cached))?true:cached,url:url,data:{antiCache:ips.getSetting('jsAntiCache'),csrfKey:null,}}).fail(function(jqXHR,textStatus,errorThrown){Debug.error("Failed to load: "+toLoad.join(', '));Debug.log(textStatus);}).always(function(){for(var i=0;i<toLoad.length;i++){var index=_.indexOf(_loadingScripts,toLoad[i]);if(index!==-1){_loadingScripts.splice(index,1);}}}).done(function(){for(var i=0;i<toLoad.length;i++){_loadedScripts.push(toLoad[i]);}
|
||||
$(document).trigger('scriptLoaded',[toLoad]);Debug.log("Loaded: "+toLoad.join(', '));})},500);};return{init:init,get:get}});}(jQuery,_));;
|
||||
$(document).trigger('scriptLoaded',[toLoad]);Debug.log("Loaded: "+toLoad.join(', '));})},500);};return{init:init,get:get,getStatic(paths){if(!Array.isArray(paths)){paths=[paths];}
|
||||
const uniquePaths=new Set();for(let path of paths){if(path.startsWith('http://')||path.startsWith("https://")){uniquePaths.add(path);}else{path=window.location.protocol+ips.getSetting('baseURL').replace(/\/+$/,'')+"/"+path.replace(/^\/+/,'');uniquePaths.add(path);}}
|
||||
return Promise.all([...uniquePaths].map(path=>new Promise((resolve,reject)=>{LOADER_STATES[path]=LOADER_STATES[path]||{state:'unloaded',resolvers:new Set(),rejectors:new Set(),err:undefined,}
|
||||
const{state,resolvers,rejectors,err}=LOADER_STATES[path];if(state==='loaded'){return resolve();}
|
||||
if(state==='error'){return reject(err);}
|
||||
resolvers.add(resolve);rejectors.add(reject);if(state==='unloaded'){LOADER_STATES[path].state='loading';const script=document.createElement('script');const url=new URL(path);url.searchParams.set('antiCache',ips.getSetting('jsAntiCache'));script.src=url;script.addEventListener('load',()=>{Debug.log(`Loaded static script ${path}`);LOADER_STATES[path].state='loaded';resolvers.forEach(resolver=>resolver());resolvers.clear();rejectors.clear();},{once:true});script.addEventListener('error',()=>{LOADER_STATES[path].state='error';LOADER_STATES[path].err=new Error(`Failed to load ${path}`);Debug.error(LOADER_STATES[path].err);rejectors.forEach(rejector=>rejector(LOADER_STATES[path].err));rejectors.clear();resolvers.clear();},{once:true});document.body.appendChild(script);}})));}}});}(jQuery,_));;
|
||||
;(function($,_,undefined){"use strict";ips.createModule('ips.model',function(){var _models={};var register=function(id,definition){var Base=getBaseModel();$.extend(Base.prototype,definition);var obj=new Base(id);if(_.isFunction(obj.initialize)){obj.initialize.call(obj);}},getBaseModel=function(){var baseModel=function(id){this.modelID=id;};baseModel.method('trigger',function(elem,ev,data){var args=ips.utils.argsToArray(arguments);elem=(!_.isElement(elem))?$(document):$(args.shift());ev=args[0];data=args[1]||{};if(!data.stack){data.stack=[];}
|
||||
data.stack.push('models.'+this.modelID);elem.trigger(ev,data);});baseModel.method('on',function(elem,ev,delegate,fn){var args=ips.utils.argsToArray(arguments);elem=(!_.isElement(elem)&&elem!=document)?$(document):$(args.shift());ev=args[0];fn=(args.length==3)?args[2]:args[1];delegate=(args.length==3)?args[1]:undefined;if(!_.isFunction(fn)){Debug.warn("Callback function for "+ev+" doesn't exist in "+this.modelID);return;}
|
||||
fn=_.bind(fn,this);if(delegate){elem.on(ev,delegate,fn);}else{elem.on(ev,fn);}});baseModel.method('getData',function(data,eventData){var self=this;var ajaxObj=ips.getAjax();if(!data.url.startsWith('http')){data.url=ips.getSetting('baseURL')+'index.php?'+data.url;}
|
||||
@@ -498,18 +503,13 @@ const editorLocation=document.createElement('div')
|
||||
editorLocation.dataset.role='reactRoot'
|
||||
textArea.parentElement.insertBefore(editorLocation,textArea)
|
||||
config.content=textArea.innerHTML
|
||||
let result=await ips.utils.tiptap.editorInstance(editorLocation,config);textArea.ipsHide()
|
||||
instance=result[0]
|
||||
config.onUpdate=(editor)=>{const value=editor.getValue();textArea.innerHTML="";textArea.appendChild(document.createTextNode(value));}
|
||||
textArea.ipsHide()
|
||||
let result=await ips.utils.tiptap.editorInstance(editorLocation,config);instance=result[0]
|
||||
textArea.dispatchEvent(new CustomEvent('ips:codeboxAfterInit',{bubbles:true,cancelable:true,detail:{instance,config}}))
|
||||
const parser=new DOMParser()
|
||||
instance.on('update',({editor})=>{textArea.innerHTML=""
|
||||
const doc=parser.parseFromString(editor.getHTML(),'text/html')
|
||||
let actualCode='';for(let code of doc.querySelectorAll('code')){actualCode+=code.innerText;}
|
||||
textArea.appendChild(document.createTextNode(actualCode))})
|
||||
textArea.addEventListener('insertCode',e=>{if(e?.detail?.content){let content=e.detail.content;if(typeof content==='string'){content={type:'text',text:content}}
|
||||
instance.chain().insertContent(content).focus().run();}})
|
||||
textArea.addEventListener('insertCode',e=>{if(e?.detail?.content){let content=e.detail.content;if(typeof content==='string'){instance.executeEdits("insertCode",[{text:content,range:instance.getSelection()}]);instance.focus();}else{throw new TypeError(`The content property of the event insertCode is expected to be a string`);}}})
|
||||
reactRoot=result[1]}
|
||||
function destruct(){instance.destroy()
|
||||
function destruct(){instance?.dispose()
|
||||
reactRoot.unmount();}
|
||||
return{instance,destruct,init}}}(jQuery,_));;
|
||||
((($,_)=>{"use strict";ips.createModule('ips.ui._codehighlighting',function(){let timeout;let attempts=0;function inject(){clearTimeout(timeout);window.removeEventListener('load',inject);if(typeof ips.ui?.codehighlighting==='object'){return;}
|
||||
@@ -517,7 +517,7 @@ if(!document?.body){if(attempts++<5){timeout=setTimeout(inject,100);Debug.log(`A
|
||||
return;}
|
||||
const script=document.createElement('script')
|
||||
document.body.appendChild(script)
|
||||
script.src=ips.getSetting('baseURL').replace(/\/+$/,"")+"/applications/core/interface/codehighlighting/codehighlighting.js"}
|
||||
script.src=ips.getSetting('baseURL').replace(/\/+$/,"")+"/applications/core/interface/static/codehighlighting/codehighlighting.js?antiCache="+encodeURIComponent(ips.getSetting('jsAntiCache'));}
|
||||
try{if(!document?.body){throw new Error();}
|
||||
inject();}catch(e){window.addEventListener('load',inject,{once:true});timeout=setTimeout(()=>{if(typeof ips.ui?.codehighlighting==="object"){return;}
|
||||
Debug.warn(`The codehighlighting module was not appended to document.body because the window's \`load\` event didn't fire within 2 seconds after ips.ui._codehighlighting was initialized.`);inject()},2000);}
|
||||
@@ -589,8 +589,8 @@ if(!Number.isInteger(response.expiresAt)){response.expiresAt=Math.round(response
|
||||
if(response.expiresAt*1000>Date.now()){CACHED_REMOTE_RESPONSES.set(src,response);}}
|
||||
return response.html;}catch(e){return ips.templates.render("ips.ui.controls.cannot_load",{message:typeof e.responseJSON?.errorMessage==='string'?e.responseJSON.errorMessage:undefined});}}
|
||||
ips.ui.registerWidget('controls',ips.ui.controls,['src']);return{respond}});}(jQuery,_));;
|
||||
;(function($,_,undefined){"use strict";ips.createModule('ips.ui.copy',function(){var respond=function(elem,options,e){ips.loader.get(['core/interface/clipboard/clipboard.min.js']).then(function(){if(ClipboardJS.isSupported()){elem.find('[data-role="copyButton"]').show();if(elem.find('[data-role="copyButton"]').attr('href')){elem.find('[data-role="copyButton"]').on('click',function(e){e.preventDefault();e.stopPropagation();});}
|
||||
var clipboard=new ClipboardJS(elem.find('[data-role="copyButton"]').get(0));clipboard.on('success',function(e){if(elem.attr('data-ipsCopy-flashmessage')!==undefined){ips.ui.flashMsg.show(ips.getString('copied'))}else{elem.find('[data-role="copyButton"]').text(ips.getString('copied'));}});}});};ips.ui.registerWidget('copy',ips.ui.copy,[]);return{respond:respond,};});}(jQuery,_));;
|
||||
;(function($,_,undefined){"use strict";ips.createModule('ips.ui.copy',function(){var respond=function(elem,options,e){ips.loader.getStatic("/applications/core/interface/static/clipboard/clipboard.min.js").then(function(){if(ClipboardJS.isSupported()){elem.find('[data-role="copyButton"]').show();if(elem.find('[data-role="copyButton"]').attr('href')){elem.find('[data-role="copyButton"]').on('click',function(e){e.preventDefault();e.stopPropagation();});}
|
||||
var clipboard=new ClipboardJS(elem.find('[data-role="copyButton"]').get(0));clipboard.on('success',function(e){if(elem.attr('data-ipsCopy-flashmessage')!==undefined){ips.ui.flashMsg.show(ips.getString('copied'))}else{elem.find('[data-role="copyButton"]').text(ips.getString('copied'));}});}});};ips.ui.registerWidget('copy',ips.ui.copy,[]);return{respond};});}(jQuery,_));;
|
||||
;(function(){"use strict";ips.createModule('ips.ui.details',function(){var respond=function(elem){document.addEventListener('click',toggleDetails);},toggleDetails=function(e){const summary=e.target.closest('[data-ipsdetails] summary');if(!summary)return;const details=summary.closest('details'),content=details.querySelector('i-details-content'),isOpen=details.open;if(!details||!content)return;e.preventDefault();if(!isOpen)details.open=true;content.style.setProperty('--i-animating-height',content.scrollHeight+'px');content.setAttribute('data-ips-animating',(isOpen)?'closing':'opening');Promise.all(content.getAnimations().map((a)=>a.finished)).then(()=>{if(isOpen)details.open=false;content.removeAttribute('data-ips-animating');});};ips.ui.registerWidget('details',ips.ui.details);return{respond:respond}});}());;
|
||||
;(function($,_,undefined){"use strict";ips.createModule('ips.ui.dialog',function(){var defaults={modal:true,draggable:false,className:'ipsDialog',extraClass:'',close:true,fixed:false,narrow:false,callback:null,forceReload:false,flashMessage:'',flashMessageTimeout:2,flashMessageEscape:true,remoteVerify:true,remoteSubmit:false,destructOnClose:false,ajax:{type:'get',data:{}}};var showStack=[];var respond=function(elem,options,e){e.preventDefault();if(!options.url&&!options.content&&$(elem).attr('href')){options.url=$(elem).attr('href');}
|
||||
if(!$(elem).data('_dialog')){$(elem).data('_dialog',dialogObj(elem,_.defaults(options,defaults)));}
|
||||
@@ -659,13 +659,13 @@ const script=document.createElement('script');script.setAttribute("src",pluginUR
|
||||
document.body.appendChild(script)
|
||||
script.dataset.ipsEditorPlugins=''
|
||||
pluginTimeouts.add(setTimeout(()=>document.dispatchEvent(new CustomEvent('ips:editorPluginsError')),5000))}
|
||||
function loadTiptap(){state="loading";Debug.log("Loading the editor from the interface");const manifestURL=ips.getSetting('baseURL').replace(/\/+$/,'')+'/applications/core/interface/tiptap/manifest.json'
|
||||
ips.fetch(manifestURL).then(response=>{if(typeof response==='object'){for(const details of Object.values(response)){if(details.isEntry){const src=ips.getSetting('baseURL').replace(/\/+$/,'')+'/applications/core/interface/tiptap/'+details.file
|
||||
function loadTiptap(){state="loading";Debug.log("Loading the editor from the interface");const manifestURL=ips.getSetting('baseURL').replace(/\/+$/,'')+'/applications/core/interface/static/tiptap/manifest.json?antiCache='+encodeURIComponent(ips.getSetting('jsAntiCache'))
|
||||
ips.fetch(manifestURL).then(response=>{if(typeof response==='object'){for(const details of Object.values(response)){if(details.isEntry){const src=ips.getSetting('baseURL').replace(/\/+$/,'')+'/applications/core/interface/static/tiptap/'+details.file+`?antiCache=${encodeURIComponent(ips.getSetting('jsAntiCache'))}`
|
||||
const scriptElem=document.createElement('script')
|
||||
scriptElem.type='module'
|
||||
document.head.appendChild(scriptElem)
|
||||
scriptElem.src=src
|
||||
if(Array.isArray(details.css)){for(const css of details.css){const src=ips.getSetting('baseURL').replace(/\/+$/,'')+'/applications/core/interface/tiptap/'+css
|
||||
if(Array.isArray(details.css)){for(const css of details.css){const src=ips.getSetting('baseURL').replace(/\/+$/,'')+'/applications/core/interface/static/tiptap/'+css
|
||||
const styleElem=document.createElement('link')
|
||||
styleElem.rel='stylesheet'
|
||||
styleElem.setAttribute('href',src)
|
||||
@@ -731,9 +731,10 @@ $(document).on('fileDeleted',_deleteFile);_cleanUpStaleAutoSaves();}
|
||||
function _cleanUpStaleAutoSaves(){for(let[k,v]of Object.entries(ips.utils.db.getByType('editorSave'))){try{let time=v?.time||v?.[1]
|
||||
if(!time){continue;}
|
||||
if(time<Math.round(new Date().getTime()/1000)-(86400*3)){ips.utils.db.remove('editorSave',k);}}catch(err){Debug.error("Trying to remove editorSave keys:");Debug.error(err);}}}
|
||||
let destroyed=false;function destruct(){if(destroyed){return;}
|
||||
let destroyed=false;function destruct(clearAutoSave=true){if(destroyed){return;}
|
||||
destroyed=true;try{_reactRoot?.unmount()}catch(e){const r=_reactRoot;setTimeout(()=>r.unmount(),100);}
|
||||
instance?.commands?.clearAutosave?.();instance?.destroy()
|
||||
if(clearAutoSave){instance?.commands?.clearAutosave?.();}
|
||||
instance?.destroy()
|
||||
clearTextarea()
|
||||
_reactRoot=undefined;_offEvents();instance=undefined;editorLocation?.remove();editorLocation=null;}
|
||||
function getInstance(){if(instance){return instance;}
|
||||
@@ -795,7 +796,7 @@ if(update&&_isShowing){_content.html(message);ips.utils.anim.go('pulseOnce',_box
|
||||
return;}
|
||||
_currentDismissHandler=null;_isShowing=true;_content.html(message);_box.attr('class','').addClass(options.extraClasses).addClass(options.dismissable?'ipsFlashMsg_dismissable':'').addClass(options.position=='bottom'?'ipsFlashMsg--bottom':'ipsFlashMsg--top').on('click','a:not( [data-action="dismissFlashMessage"] )',function(){hide();}).animationComplete(function(){if(!options.sticky){setTimeout(hide,options.timeout*1000);}});if(_.isFunction(options.dismissable)){_currentDismissHandler=options.dismissable;}
|
||||
ips.utils.anim.go('fadeInDown',_box);},hide=function(){if(_queue.length){var next=_queue.shift();show(next[0],next[1],true);}else{_box.animationComplete(function(){_isShowing=false;_box.hide();if(_queue.length){var next=_queue.shift();show(next[0],next[1]);}});ips.utils.anim.go('fadeOutDown',_box);}},dismiss=function(e){e.preventDefault();hide();if(_.isFunction(_currentDismissHandler)){_currentDismissHandler();_currentDismissHandler=null;}},_initElement=function(){$('body').append(ips.templates.render("core.general.flashMsg"));_box=$('#elFlashMessage').hide();_content=(_box.is('[data-role="flashMessage"]'))?_box:_box.find('[data-role="flashMessage"]');_box.on('click','a[data-action="dismissFlashMessage"]',dismiss);_doneInit=true;};ips.ui.registerWidget('flashMsg',ips.ui.flashMsg,['text','extraClasses','timeout','position','sticky','dismissable']);init();return{respond,show};});}(jQuery,_));;
|
||||
;(function($,_){"use strict";ips.createModule('ips.ui.form',function(){const _cmInstances={};const _support={};const formTypes={'unlimited':'[data-control~="unlimited"]','date':'input[type="date"], [data-control~="date"]','range':'input[type="range"], [data-control~="range"]','color':'input[type="color"], [data-control~="color"]','dimensions':'[data-control~="dimensions"]','dimensionsUnlimited':'[data-control~="dimensionsUnlimited"]','jsDisable':'input[data-control~="jsdisable"]','codemirror':'[data-control~="codemirror"]','granularCheckboxset':'[data-control~="granularCheckboxset"]',};const _controlMethods={codemirror(elem){ips.loader.get(['core/interface/codemirror/diff_match_patch.js','core/interface/codemirror/codemirror.js']).then(function(){const elemId=$(elem).attr('id');if(!_.isUndefined(_cmInstances[elemId])){_cmInstances[elemId].save();$(_cmInstances[elemId].getWrapperElement()).remove();delete _cmInstances[elemId];}
|
||||
;(function($,_){"use strict";ips.createModule('ips.ui.form',function(){const _cmInstances={};const _support={};const formTypes={'unlimited':'[data-control~="unlimited"]','date':'input[type="date"], [data-control~="date"]','range':'input[type="range"], [data-control~="range"]','color':'input[type="color"], [data-control~="color"]','dimensions':'[data-control~="dimensions"]','dimensionsUnlimited':'[data-control~="dimensionsUnlimited"]','jsDisable':'input[data-control~="jsdisable"]','codemirror':'[data-control~="codemirror"]','granularCheckboxset':'[data-control~="granularCheckboxset"]',};const _controlMethods={codemirror(elem){ips.loader.getStatic(['applications/core/interface/static/codemirror/diff_match_patch.js','applications/core/interface/static/codemirror/codemirror.js']).then(function(){const elemId=$(elem).attr('id');if(!_.isUndefined(_cmInstances[elemId])){_cmInstances[elemId].save();$(_cmInstances[elemId].getWrapperElement()).remove();delete _cmInstances[elemId];}
|
||||
_cmInstances[elemId]=CodeMirror.fromTextArea(document.getElementById(elemId),{mode:$(elem).attr('data-mode'),lineWrapping:true,lineNumbers:false,leaveSubmitMethodAlone:true});if($(elem).attr('data-height')){_cmInstances[elemId].setSize(null,$(elem).attr('data-height'));$('div[data-codemirrorid='+elemId+'] ul[data-role=tagsList]').css('max-height',$(elem).attr('data-height'));}
|
||||
$('#'+elemId).data('CodeMirrorInstance',_cmInstances[elemId]);$('[data-codemirrorcustomtag]').on('click',function(e){_cmInstances[elemId].replaceRange($(e.currentTarget).attr('data-codemirrorcustomtag'),_cmInstances[elemId].getCursor("end"));});});},range(elem){if(_.isUndefined(_support['range'])){const i=document.createElement("input");i.setAttribute("type","range");_support['range']=!(i.type==='text');}
|
||||
if(!_support['range']){elem.siblings('[data-role="rangeBoundary"]').hide();}else{const valueElem=$('#'+elem.attr('name')+'_rangeValue');valueElem.text(elem.val());elem.on('change',function(){valueElem.text(elem.val());});}},unlimited(elem){elem=$(elem).get(0);elem.addEventListener('change',()=>_unlimitedCheck());if(!elem.dataset.initialized){elem.dataset.initializd='1';_unlimitedCheck();}
|
||||
@@ -1212,19 +1213,20 @@ siblings=siblings.reverse();element=this.elem.nextElementSibling
|
||||
while(element?.dataset?.ipsaccordion!==undefined){if(ips.ui.accordion.getInstance(element)){siblings.push(ips.ui.accordion.getInstance(element))}
|
||||
element=element.nextElementSibling}
|
||||
return siblings}}})(jQuery,_));;
|
||||
;(function($,_,undefined){"use strict";const endCachingDebounced=_.throttle((elem)=>{ips.utils.position.endCaching(elem);},100,{leading:false});ips.createModule('ips.ui.tooltip',function(){let _tooltip=null,_timer=[],_currentElem=null,_showTimeout;function respond(elem,options,e){clearTimeout(_showTimeout);if(ips.utils.events.isTouchDevice()){return;}
|
||||
;(function($,_,undefined){"use strict";const endCachingDebounced=_.throttle((elem)=>{ips.utils.position.endCaching(elem);},100,{leading:false});ips.createModule('ips.ui.tooltip',function(){let _tooltip=null,_timer=[],_currentElem=null,_showTimeout,_visible=false,_lastOptions={},_mo=new MutationObserver(_.throttle(()=>{if(_currentElem&&_tooltip&&_visible&&!_lastOptions.ajax){if(_currentElem.attr('title')){_currentElem.attr("_title",null)}
|
||||
const content=_getContent(_currentElem,_lastOptions);if(_lastOptions.safe){_tooltip.html(content)}else{_tooltip.text(content)}}},30));function respond(elem,options,e){clearTimeout(_showTimeout);if(ips.utils.events.isTouchDevice()){return;}
|
||||
if(!_tooltip){_createTooltipElement();}
|
||||
if(e.type==='mouseleave'||e.type==='blur'||e.type==='focusout'){_hide();}else{const content=_getContent(elem,options);if(content){ips.utils.position.startCaching();_showTimeout=setTimeout(()=>{_show(elem,options,content);endCachingDebounced();});}}}
|
||||
function _calculatePosition(elem,_tooltip){const positionInfo={trigger:elem,target:_tooltip,center:true,above:true,stemOffset:{left:10,top:0}};const tooltipEl=$(_tooltip).get(0);const tooltipPosition=ips.utils.position.positionElem(positionInfo);Object.assign(tooltipEl.style,{left:((tooltipPosition.left>0)?tooltipPosition.left:20)+'px',top:tooltipPosition.top+'px',position:(tooltipPosition.fixed)?'fixed':'absolute',zIndex:ips.ui.zIndex()});if(tooltipPosition.location.vertical==='top'){tooltipEl.classList.add('ipsTooltip_top')
|
||||
tooltipEl.classList.remove('ipsTooltip_bottom');}else{tooltipEl.classList.add('ipsTooltip_bottom')
|
||||
tooltipEl.classList.remove('ipsTooltip_top');}
|
||||
tooltipEl.classList.remove('ipsTooltip_left','ipsTooltip_right');if(tooltipPosition.left>0){if(tooltipPosition.location.horizontal==='left'){tooltipEl.classList.add('ipsTooltip_left');}else if(tooltipPosition.location.horizontal==='right'){tooltipEl.classList.add('ipsTooltip_right');}}}
|
||||
function _show(elem,options,content){elem=$(elem);ips.utils.anim.cancel(_tooltip);if(options.safe){_tooltip.hide().html(content);}else{_tooltip.hide().text(content);}
|
||||
function _show(elem,options,content){elem=$(elem);_lastOptions=options;ips.utils.anim.cancel(_tooltip);if(options.safe){_tooltip.hide().html(content);}else{_tooltip.hide().text(content);}
|
||||
if(options.ajax&&!elem.data('_tooltip')){ips.getAjax()(options.ajax).done(response=>{$(elem).data('_tooltip',response);if(options.safe){_tooltip.html(response);}else{_tooltip.text(response);}
|
||||
_calculatePosition(elem,_tooltip);});}
|
||||
_calculatePosition(elem,_tooltip);});}else{_mo.observe(elem.get(0),{attributes:true,subtree:true,characterData:true});}
|
||||
const element=$(elem).get(0);if(element.hasAttribute('title')){element.setAttribute('_title',element.getAttribute('title'));element.removeAttribute('title');}
|
||||
_tooltip.show();_calculatePosition(elem,_tooltip);_currentElem=elem;_timer.push(setInterval(_checkForElemPresence,100));setTimeout(()=>$(elem).trigger('tooltipShown'),1);}
|
||||
function _hide(){ips.utils.anim.go('fadeOut',_tooltip);_currentElem=null;if(_timer.length){for(var i=0;i<_timer.length;i++){clearInterval(_timer[i]);}
|
||||
_tooltip.show();_visible=true;_calculatePosition(elem,_tooltip);_currentElem=elem;_timer.push(setInterval(_checkForElemPresence,100));setTimeout(()=>$(elem).trigger('tooltipShown'),1);}
|
||||
function _hide(){_mo.disconnect();ips.utils.anim.go('fadeOut',_tooltip);_visible=false;_currentElem=null;if(_timer.length){for(var i=0;i<_timer.length;i++){clearInterval(_timer[i]);}
|
||||
_timer=[];}}
|
||||
function _checkForElemPresence(element){if(!_currentElem||!_currentElem.length||!_currentElem.is(':visible')){_hide();}}
|
||||
function _getContent(elem,options){elem=$(elem);if(elem.data('_tooltip')){return elem.data('_tooltip');}
|
||||
@@ -1580,8 +1582,8 @@ return[hexToRGB(hex.slice(0,2))/255,hexToRGB(hex.slice(2,4))/255,hexToRGB(hex.sl
|
||||
iroCallbacks.add([resolve,reject]);if(iroState==='loading'){return;}
|
||||
iroState='loading';function failed(e){if(iroState==='loading'){iroState='error';}
|
||||
iroCallbacks.forEach(cb=>cb[1](e||new Error('Could not load iro js dependency after 10s')));iroCallbacks.clear();}
|
||||
window.addEventListener('ips:iroLoaded',()=>{iroState='loaded';iroCallbacks.forEach(cb=>cb[0]());iroCallbacks.clear();},{once:true});if(document.querySelector('script[data-iro-loader]')){iroState='loading';}else{const manifestURL=ips.getSetting('baseURL').replace(/\/+$/,'')+'/applications/core/interface/iro/manifest.json';ips.fetch(manifestURL).then(response=>{for(const detail of Object.values(response)){if(detail.isEntry){const script=document.createElement('script');script.setAttribute('data-iro-loader','');script.setAttribute('type','module')
|
||||
document.body.appendChild(script);script.src=ips.getSetting('baseURL').replace(/\/+$/,'')+'/applications/core/interface/iro/'+detail.file;}}}).catch(failed);}
|
||||
window.addEventListener('ips:iroLoaded',()=>{iroState='loaded';Debug.log("Loaded color picker");iroCallbacks.forEach(cb=>cb[0]());iroCallbacks.clear();},{once:true});if(document.querySelector('script[data-iro-loader]')){iroState='loading';}else{const manifestURL=ips.getSetting('baseURL').replace(/\/+$/,'')+`/applications/core/interface/static/iro/manifest.json?antiCache=${encodeURIComponent(ips.getSetting('jsAntiCache'))}`;ips.fetch(manifestURL).then(response=>{for(const detail of Object.values(response)){if(detail.isEntry){const script=document.createElement('script');script.setAttribute('data-iro-loader','');script.setAttribute('type','module')
|
||||
document.body.appendChild(script);script.src=ips.getSetting('baseURL').replace(/\/+$/,'')+'/applications/core/interface/static/iro/'+detail.file+"?antiCache="+encodeURIComponent(ips.getSetting('jsAntiCache'));}}}).catch(failed);}
|
||||
setTimeout(()=>failed(),10000);});}};});}(jQuery,_));;
|
||||
(function($,_,undefined){"use strict";ips.createModule("ips.utils.contentViews",()=>({_viewsCache:{},_onRemoveCache:{},init(){},enabled(){let res=!!(ips.getSetting('memberID')&&ips.getSetting('socketEnabled')&&ips.getSetting('page_token'));return res;},registerEntity(key,isViewed=false,otherData={},force=false,onRemove=null){if(key in this._viewsCache){if(!force){throw new RangeError(`The key, '${key}' is already registered!`);}
|
||||
if(this._onRemoveCache[key]){this._onRemoveCache[key]();delete this._onRemoveCache[key];}}
|
||||
@@ -1697,9 +1699,10 @@ window.history.replaceState({..._state},'',url)
|
||||
ipsHistoryChange(e,'replace')}};});}(jQuery,_));;
|
||||
;(function($,_){"use strict";let backdrop;ips.createModule("ips.utils.iconpicker",function(){function setupBackdrop(){if(!backdrop){backdrop=document.createElement('div');backdrop.setAttribute('id','ipsIconPicker__backdrop');backdrop.ipsHide();}
|
||||
if(!document.body){document.addEventListener('load',setupBackdrop,{once:true});}else if(backdrop.documentElement!==document.documentElement){document.body.appendChild(backdrop);}}
|
||||
const fileToLoad='core/interface/fontawesome/js/fontawesome.js';let faLoaded=false;let faAvailable=false;let faLoadAttempts=0;function resolveWhenLoaded(){return new Promise(resolve=>{if(ips.utils.fontawesome?.searchIcons instanceof Function){resolve(true);}
|
||||
const fileToLoad='/applications/core/interface/static/fontawesome/js/fontawesome.js';let faLoaded='unloaded';let faAvailable=false;let faLoadAttempts=0;function resolveWhenLoaded(){return new Promise(resolve=>{if(ips.utils.fontawesome?.searchIcons instanceof Function){resolve(true);}
|
||||
else if(++faLoadAttempts>200){resolve(false)}else{setTimeout(()=>{resolveWhenLoaded().then(resolve);},100)}})}
|
||||
function loadFa6(){return new Promise(resolve=>{if(faLoaded||ips.utils.fontawesome?.searchIcons instanceof Function){faLoaded=true;resolve(true)}else{ips.loader.get([fileToLoad])?.then(()=>{faLoaded=true;resolveWhenLoaded().then(_loaded=>{if(_loaded){faLoaded=true;faAvailable=true;resolve(true)}else{faLoaded=true;faAvailable=false;resolve(true)}})})}})}
|
||||
function loadFa6(){return new Promise(resolve=>{if(faLoaded==='loaded'||ips.utils.fontawesome?.searchIcons instanceof Function){faLoaded='loaded';resolve(true)}else{if(faLoaded!=='loading'){faLoaded='loading';const script=document.createElement('script');script.type="module";script.src=ips.getSetting('baseURL').replace(/\/+$/,'')+fileToLoad;document.body.appendChild(script);}
|
||||
resolveWhenLoaded().then(_loaded=>{if(_loaded){faLoaded=true;faAvailable=true;resolve(true)}else{faLoaded=true;faAvailable=false;resolve(true)}})}})}
|
||||
async function faIconsEnabled(){return!!((await loadFa6())||faAvailable)}
|
||||
function getValuesFromOptions(options){const{defaultValue=null,defaultTab='fa',anchor,allowedTypes=['emoji','fa'],maxIcons=null,rootElement=null,svgIcons=false,panelMode,submitOnClick=false,afterOpen,afterHide,shortCodeFixer,container,}=options
|
||||
return{defaultValue,defaultTab,allowedTypes,maxIcons,rootElement,svgIcons,anchor,panelMode,submitOnClick,afterOpen,afterHide,shortCodeFixer,container};}
|
||||
@@ -1881,11 +1884,11 @@ return this[key];}
|
||||
static async search(key,custom=false){const instance=await this.instance(custom);const results=instance._search(key);const ret={"Search Results":{name:'Search Results',emojis:{}}}
|
||||
for(const result of results){ret['Search Results'].emojis[result]=this.emojiCodepointMap[result]||this.customEmojiCodepointMap[result];}
|
||||
return ret;}
|
||||
static emojiStore=undefined;static customEmojiStore=undefined;static customEmojiStoreMerged=undefined;static emojiCodepointMap={};static customEmojiCodepointMap={};static hairStyles={};static skinTones={};static async loadEmojiStore(loadCustom=false){if(this.emojiStore===undefined){try{this.emojiStore=await ips.fetch(ips.getSetting('baseURL')+'/applications/core/interface/emoji/emojiIndex.json');for(const[key,{emojis}]of Object.entries(this.emojiStore)){for(const unicode in emojis){const codebase=Number('0x'+unicode.split(/\s+/)[0])
|
||||
static emojiStore=undefined;static customEmojiStore=undefined;static customEmojiStoreMerged=undefined;static emojiCodepointMap={};static customEmojiCodepointMap={};static hairStyles={};static skinTones={};static async loadEmojiStore(loadCustom=false){if(this.emojiStore===undefined){try{this.emojiStore=await ips.fetch(ips.getSetting('baseURL')+'/applications/core/interface/static/emoji/emojiIndex.json');for(const[key,{emojis}]of Object.entries(this.emojiStore)){for(const unicode in emojis){const codebase=Number('0x'+unicode.split(/\s+/)[0])
|
||||
if(0x1f46b<=codebase&&0x1f46d>=codebase){delete this.emojiStore[key].emojis[unicode];continue;}
|
||||
this.emojiCodepointMap[unicode]=emojis[unicode];}}}catch(e){Debug.error(e)}
|
||||
try{const skinTones=await ips.fetch(ips.getSetting('baseURL')+'/applications/core/interface/emoji/skinTones.json');for(let code in skinTones){const numeric=this.hex2dec(code);this.skinTones[numeric]=skinTones[code];}}catch(e){Debug.error(e)}
|
||||
try{const hairStyles=await ips.fetch(ips.getSetting('baseURL')+'/applications/core/interface/emoji/hairStyles.json')
|
||||
try{const skinTones=await ips.fetch(ips.getSetting('baseURL')+'/applications/core/interface/static/emoji/skinTones.json');for(let code in skinTones){const numeric=this.hex2dec(code);this.skinTones[numeric]=skinTones[code];}}catch(e){Debug.error(e)}
|
||||
try{const hairStyles=await ips.fetch(ips.getSetting('baseURL')+'/applications/core/interface/static/emoji/hairStyles.json')
|
||||
for(let code in hairStyles){const numeric=this.hex2dec(code);this.hairStyles[numeric]=hairStyles[code];}}catch(e){Debug.error(e)}}
|
||||
if(loadCustom){await this.loadCustomEmojiStore()
|
||||
if(this.customEmojiStoreMerged===undefined){this.customEmojiStoreMerged={...this.emojiStore}
|
||||
@@ -1944,14 +1947,12 @@ this._options.body=_.unescape(this._options.body.replace(/'/g,"'").replace(
|
||||
show(){this._notification=new Notification(this._options.title,this._options);this._notification.addEventListener('show',this._options.onShow,false);this._notification.addEventListener('hide',this._options.onHide,false);this._notification.addEventListener('click',this._options.onClick,false);this._notification.addEventListener('error',this._options.onError,false);if(!Number.isNaN(this._options.timeout)){setTimeout(()=>this.hide(),Number(this._options.timeout)*1000);}}
|
||||
hide(){if(this._notification){this._notification.close();this._notification.removeEventListener('show',this._options.onShow,false);this._notification.removeEventListener('hide',this._options.onHide,false);this._notification.removeEventListener('click',this._options.onClick,false);this._notification.removeEventListener('error',this._options.onError,false);}}}
|
||||
$(document).on('requestPermission.notifications',requestPermission);$(document).on('permissionGranted.notifications',subscribeToPush);return{supported,subscribeToPush,hasPermission,getSubscription,needsPermission,permissionLevel,requestPermission,create};});}(jQuery,_));;
|
||||
;((($,_)=>{"use strict";ips.createModule('ips.utils.pagebuildericons',function(){const loadPagebuilder=async()=>{if(!ips.utils.pagebuilder){const url=ips.getSetting('baseURL')+`/applications/core/interface/pagebuilder/manifest.json?v=${ips.getSetting('pagebuilderKey')}`
|
||||
const data=await ips.fetch(url)
|
||||
const toLoad=[];for(const key in data){if(data[key].file?.match(/\.css$/i)){const href=ips.getSetting('baseURL')+'/applications/core/interface/pagebuilder/'+data[key].file
|
||||
if(!document.querySelector(`[href="${encodeURI(href)}"]`)){const style=document.createElement('link')
|
||||
;((($,_)=>{"use strict";ips.createModule('ips.utils.pagebuildericons',function(){const loadPagebuilder=async()=>{if(!ips.utils.pagebuilder){const url=ips.getSetting('baseURL')+`/applications/core/interface/static/pagebuilder/manifest.json?v=${ips.getSetting('pagebuilderKey')}&antiCache=${encodeURIComponent(ips.getSetting('jsAntiCache'))}`;const data=await ips.fetch(url)
|
||||
const toLoad=[];for(const key in data){if(data[key].file?.match(/\.css$/i)){const href=ips.getSetting('baseURL')+'/applications/core/interface/static/pagebuilder/'+data[key].file+`?antiCache=${encodeURIComponent(ips.getSetting('jsAntiCache'))}`;if(!document.querySelector(`[href="${encodeURI(href)}"]`)){const style=document.createElement('link')
|
||||
style.rel='stylesheet'
|
||||
style.href=href
|
||||
document.head.appendChild(style)}}else if(data[key].isEntry){toLoad.push(ips.getSetting('baseURL')+'/applications/core/interface/pagebuilder/'+data[key].file)}}
|
||||
if(toLoad.length){await ips.loader.get(toLoad)}}}
|
||||
document.head.appendChild(style)}}else if(data[key].isEntry){toLoad.push(ips.getSetting('baseURL')+'/applications/core/interface/static/pagebuilder/'+data[key].file)}}
|
||||
if(toLoad.length){await ips.loader.getStatic(toLoad)}}}
|
||||
const fillIcons=()=>{document.querySelectorAll('[for*="elCheckbox_dev_widget_layouts_"]').forEach(async label=>{if(!label.querySelector('svg.pagebuildericon')){await loadPagebuilder()
|
||||
const icon=label.getAttribute('for').match(/^elCheckbox_dev_widget_layouts_([a-z\-_]+)$/i)[1]
|
||||
ips.utils.pagebuilder.fillSemanticIcon(label,icon).then(()=>{label.querySelector('svg.pagebuildericon').dataset.ipstooltip=''
|
||||
|
||||
@@ -176,7 +176,7 @@ this._clearNotifications();}catch(e){Debug.warn(`Could not import new replies fo
|
||||
if($('#elFlashMessage').find('[data-role="newPostNotification"]').length){$('#elFlashMessage').find('[data-role="newPostNotification"]').trigger('closeFlashMsg.flashMsg');}},quickReply:function(e){const form=this.scope.find('[data-role="replyArea"] form');if(form.attr('data-noAjax')){return;}
|
||||
e.preventDefault();e.stopPropagation();const self=this;const replyArea=this.scope.find('[data-role="replyArea"]');const submit=form.find('[type="submit"]');const autoFollow=this.scope.find('input[name$="auto_follow_checkbox"]');const commentsOnThisPage=this.scope.find('[data-commentid]');const _lastSeenID=this._getLastSeenID(commentsOnThisPage);const submitButtons=[...submit];const submitRestorations=[];submitButtons.forEach(button=>{if(button.closest('.ipsIconPicker')){return;}
|
||||
const initialText=button.innerText;button.setAttribute('disabled','');button.innerText=ips.getString('saving');submitRestorations.push(()=>{button.removeAttribute('disabled');button.innerText=initialText;});});let page=ips.utils.url.getPageNumber(this._pageParam);if(!page){page=1;}
|
||||
this._clearNotifications();ips.getAjax()(form.attr('action'),{data:form.serialize()+'¤tPage='+page+'&_lastSeenID='+_lastSeenID,type:'post'}).done(function(response){if(response.type=='error'){if(response.form){if(replyArea.find('[data-ipseditorv5]')){ips.ui.editorv5.getObj(replyArea.find('[data-ipseditorv5]')).destruct();}
|
||||
this._clearNotifications();ips.getAjax()(form.attr('action'),{data:form.serialize()+'¤tPage='+page+'&_lastSeenID='+_lastSeenID,type:'post'}).done(function(response){if(response.type=='error'){Debug.error(response);Debug.error('Failed to submit content via quick reply');if(response.form){if(replyArea.find('[data-ipseditorv5]')){ips.ui.editorv5.getObj(replyArea.find('[data-ipseditorv5]')).destruct(false);}
|
||||
form.replaceWith($(response.form));$(document).trigger('contentChange',[self.scope]);}else{ips.ui.alert.show({type:'alert',icon:'warn',message:response.message,callbacks:{}});}}
|
||||
else if(response.type=='redirect'){self.paginationClick(e,{href:response.url,originalEvent:e});}else if(response.type=='merge'){var comment=$(self.findCommentInFeed(response.id));comment.find('[data-role="commentContent"]').html(response.content);if(comment.find('pre.prettyprint').length){comment.find('pre.prettyprint').each(function(){$(this).html(window.PR.prettyPrintOne(_.escape($(this).text())));});}
|
||||
self.scope.find('[data-role="replyArea"] [data-ipsEditorv5]').data('_editor').reset();if(self.scope.find('[data-role="replyArea"] input[name="guest_name"]').length){self.scope.find('[data-role="replyArea"] input[name="guest_name"]').val('');}
|
||||
|
||||
Reference in new issue
Block a user