Version 5.0.0 beta 11.1

This commit is contained in:
Neo committed 2025-12-19 18:00:22 -08:00
1 parent 264eeb97e0
commit 90e8c7e903
466 files changed
+7796 -2394

No files matched your search

+41 -40
View File
@@ -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(/&#039;/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=''