Version 5.0.0 beta 5
This commit is contained in:
1 parent
2f24f9de48
commit
57d9db6ce2
218 files changed
+5331
-7416
No files matched your search
@@ -48,12 +48,12 @@ let bypassRedirect=!(elem.attr('data-accept-redirect'));ips.getAjax()(elem.attr(
|
||||
ips.utils.anim.go('fadeOut',row);}).fail(function(){window.location=elem.attr('href')+'&csrfKey='+ips.getSetting('csrfKey')+'&wasConfirmed=1';});}}});},confirmSomething:function(e){e.preventDefault();var elem=$(e.currentTarget);var customMessage=$(e.currentTarget).attr('data-confirmMessage');var customSubMessage=$(e.currentTarget).attr('data-confirmSubMessage');var type=$(e.currentTarget).attr('data-confirmType');var icon=$(e.currentTarget).attr('data-confirmIcon');var alert={type:(type)?type:'confirm',icon:(icon)?icon:'warn',message:(customMessage)?customMessage:ips.getString('generic_confirm'),subText:(customSubMessage)?customSubMessage:'',callbacks:{ok:function(){window.location=elem.attr('href')+'&wasConfirmed=1';},yes:function(){window.location=elem.attr('href')+'&prompt=1';},no:function(){window.location=elem.attr('href')+'&prompt=0';}}};if($(e.currentTarget).attr('data-confirmButtons')){alert.buttons=$.parseJSON($(e.currentTarget).attr('data-confirmButtons'));}
|
||||
ips.ui.alert.show(alert);},clickShow:function(e){e.preventDefault();var elems=ips.utils.getIDsFromList($(e.currentTarget).attr('data-clickshow'));this.scope.find(elems).show().removeClass('ipsHide');},clickHide:function(e){e.preventDefault();var elems=ips.utils.getIDsFromList($(e.currentTarget).attr('data-clickhide'));this.scope.find(elems).hide().addClass('ipsHide');},clickEmpty:function(e){e.preventDefault();var elems=ips.utils.getIDsFromList($(e.currentTarget).attr('data-clickempty'));this.scope.find(elems).val('');}});}(jQuery,_));;
|
||||
;(function($,_,undefined){"use strict";ips.controller.register('core.admin.core.dynamicChart',{storedValues:{},identifier:'',type:'',initialize:function(){this.on('click','[data-timescale]',this.changeTimescale);this.on(document,'submit','[data-role="dateForm"]',this.changeDateRange);this.on(document,'click','[data-role="clearSearchTerm"]',this.resetSearch);this.on(document,'submit','[data-role="searchForm"]',this.changeSearch);this.scope.find('[data-role="clearSearchTerm"]').hide();this.on('menuItemSelected','[data-action="chartFilter"]',this.changeFilter);this.on('click','[data-type]',this.changeChartType);$('[data-role="filterMenu"] [data-role="selectAll"]').on('click',_.bind(this.selectAllFilters,this));$('[data-role="filterMenu"] [data-role="unselectAll"]').on('click',_.bind(this.unselectAllFilters,this));$('button[data-role="applyFilters"]').on('click',function(){$('[data-action="chartFilter"]').trigger('closeMenu');});this.on('click','[data-role="saveReport"]',_.bind(this.saveFilters,this));this.on('click','[data-role="renameChart"]',_.bind(this.renameFilters,this));this.setup();},selectAllFilters:function(e){$(e.currentTarget).closest('.ipsMenu').find('.ipsMenu_item:not(.ipsMenu_itemChecked) a:not(.ipsMenu_itemNonSelect)').trigger('click');$('button[data-role="applyFilters"]').prop('disabled',false);},unselectAllFilters:function(e){$(e.currentTarget).closest('.ipsMenu').find('.ipsMenu_item.ipsMenu_itemChecked a').trigger('click');$('button[data-role="applyFilters"]').prop('disabled',false);},setup:function(){var self=this;this.identifier=this.scope.attr('data-chart-identifier');this.storedValues.timescale=this.scope.find('[data-timescale][data-selected]').attr('data-timescale');this.storedValues.type=this.scope.find('[data-type][data-selected]').attr('data-type');if(this.scope.find('[data-role="searchForm"] input')){this.storedValues.term=null;}
|
||||
this.storedValues.filters=[];this.storedValues.dates={start:'',end:''};this.type=this.scope.attr('data-chart-type');this.timescale=this.scope.attr('data-chart-timescale');$('#el'+this.identifier+'Filter_menu').find('.ipsMenu_itemChecked').each(function(){self.storedValues.filters.push($(this).attr('data-ipsMenuValue'));});this.checkType();},changeTimescale:function(e){this.timescale=$(e.currentTarget).attr('data-timescale');this._toggleButtonRow(e,'timescale');},changeChartType:function(e){this.type=$(e.currentTarget).attr('data-type');this._toggleButtonRow(e,'type');this.checkType();},checkType:function(){if(this.type=='Table'||this.type=='PieChart'||this.type=='GeoChart'){$(this.scope).find('[data-role="groupingButtons"] a.ipsButton').addClass('ipsButton--disabled ipsButton--inherit').removeClass('ipsButton--primary');}else{$(this.scope).find('[data-role="groupingButtons"] a.ipsButton').removeClass('ipsButton--disabled');$(this.scope).find('a.ipsButton[data-timescale="'+this.timescale+'"]').removeClass('ipsButton--inherit').addClass('ipsButton--primary');}},updateUrlBound:false,changeFilter:function(e,data){data.originalEvent.preventDefault();this._resetFilters();if(this.updateUrlBound===false){$('[data-action="chartFilter"]').one('menuClosed',_.bind(this.fetchNewResults,this));this.updateUrlBound=true;}
|
||||
this.storedValues.filters=[];this.storedValues.dates={start:'',end:''};this.type=this.scope.attr('data-chart-type');this.timescale=this.scope.attr('data-chart-timescale');$('#el'+this.identifier+'Filter_menu').find('.ipsMenu_itemChecked').each(function(){self.storedValues.filters.push($(this).attr('data-ipsMenuValue'));});this.checkType();},changeTimescale:function(e){this.timescale=$(e.currentTarget).attr('data-timescale');this._toggleButtonRow(e,'timescale');},changeChartType:function(e){this.type=$(e.currentTarget).attr('data-type');this._toggleButtonRow(e,'type');this.checkType();},checkType:function(){if(this.type=='Table'||this.type=='PieChart'||this.type=='GeoChart'){$(this.scope).find('[data-role="groupingButtons"] a.ipsButton').addClass('ipsButton--disabled');}else{$(this.scope).find('[data-role="groupingButtons"] a.ipsButton').removeClass('ipsButton--disabled');}},updateUrlBound:false,changeFilter:function(e,data){data.originalEvent.preventDefault();this._resetFilters();if(this.updateUrlBound===false){$('[data-action="chartFilter"]').one('menuClosed',_.bind(this.fetchNewResults,this));this.updateUrlBound=true;}
|
||||
$('button[data-role="applyFilters"]').prop('disabled',false);},fetchNewResults:function(e){this._updateURL();this.updateUrlBound=false;},saveFilters:function(event){var identifier=this.scope.closest('.ipsTabs__panel').closest('section').attr('id');var self=this;var pieces=[];_.each(this.storedValues.filters,function(value,idx){pieces.push("chartFilters["+idx+"]="+value);});$('#el'+this.identifier+'CustomFiltersForm input[data-role="nodeValue"]').each(function(){pieces.push('customform_'+$(this).attr('name')+"="+$(this).val());});var newFilters=pieces.join('&');if(this.timescale){newFilters=newFilters+"×cale="+this.timescale;}
|
||||
if(!$(event.currentTarget).attr('data-chartId')){this._skipUpdate=true;$('#el'+this.identifier+'FilterSave_menu').one('submit','form',function(e){if($(this).attr('data-bypassValidation')){return false;}
|
||||
$(this).trigger('closeMenu');var tabTitle=$(this).find('[name="custom_chart_title"]').val();e.preventDefault();ips.getAjax()($(this).attr('action'),{data:$(this).serialize()+'&'+newFilters,type:'post'}).done(function(response,status,jqXHR){$('[data-ipsTabBar-contentArea="#'+identifier+'"]').find('ul[role="tablist"]').append("<li><a href='"+response.tabHref+"' id='"+response.tabId+"_tab_"+response.chartId+"' class='ipsTabs__tab' title='"+tabTitle+"' role='tab' aria-selected='true'>"+tabTitle+"</a></li>");$('#'+identifier).append("<div id='ipsTabs_elTabs_"+response.tabId+"_"+response.tabId+"_tab_"+response.chartId+"_panel' class='ipsTabs__panel' aria-labelledby='"+response.tabId+"_tab_"+response.chartId+"' aria-hidden='true'></div>");self._skipUpdate=false;$(document).trigger('contentChange',[self.scope]);$('#el'+self.identifier+'FilterSave_menu').find('[name="custom_chart_title"]').val('');$('#'+response.tabId+"_tab_"+response.chartId).click();ips.ui.flashMsg.show(ips.getString('saved'));}).fail(function(){$(this).attr('data-bypassValidation',true).submit();});});}
|
||||
$(this).trigger('closeMenu');var tabTitle=$(this).find('[name="custom_chart_title"]').val();e.preventDefault();ips.getAjax()($(this).attr('action'),{data:$(this).serialize()+'&'+newFilters,type:'post'}).done(function(response,status,jqXHR){$('[data-ipsTabBar-contentArea="#'+identifier+'"]').find('[role="tablist"]').append("<a href='"+response.tabHref+"' id='ipsTabs_"+response.tabId+"_"+response.chartId+"' class='ipsTabs__tab' title='"+tabTitle+"' role='tab' aria-controls='ipsTabs_"+response.tabId+"_"+response.chartId+"_panel' aria-selected='false'>"+tabTitle+"</a>");$('#'+identifier).append("<div id='ipsTabs_"+response.tabId+"_"+response.chartId+"_panel' class='ipsTabs__panel' role'tabpanel' aria-labelledby='ipsTabs_"+response.tabId+"_"+response.chartId+"' hidden></div>");self._skipUpdate=false;$(document).trigger('contentChange',[self.scope]);$('#el'+self.identifier+'FilterSave_menu').find('[name="custom_chart_title"]').val('');$('#'+response.tabId+"_"+response.chartId).click();ips.ui.flashMsg.show(ips.getString('saved'));}).fail(function(){$(this).attr('data-bypassValidation',true).submit();});});}
|
||||
else
|
||||
{ips.getAjax()(this.scope.attr('data-chart-url')+'&saveFilters=1&chartId='+$(event.currentTarget).attr('data-chartId'),{data:newFilters,type:'post'});this._updateURL();ips.ui.flashMsg.show(ips.getString('saved'));}},renameFilters(){const identifier=this.scope.closest('.ipsTabs__panel').closest('section').attr('id');const titlefield=()=>identifier?$(`[data-ipsTabBar-contentArea="#${identifier}"] ul[role="tablist"] .ipsTabs__tab--active`):this.scope.find('.ipsTitle');$('#el'+this.identifier+'FilterRename_menu').on('submit','form',async function(e){if($(this).attr('data-bypassValidation')){return false;}
|
||||
{ips.getAjax()(this.scope.attr('data-chart-url')+'&saveFilters=1&chartId='+$(event.currentTarget).attr('data-chartId'),{data:newFilters,type:'post'});this._updateURL();ips.ui.flashMsg.show(ips.getString('saved'));}},renameFilters(){const identifier=this.scope.closest('.ipsTabs__panel').closest('section').attr('id');const titlefield=()=>identifier?$(`[data-ipsTabBar-contentArea="#${identifier}"] [role="tablist"] [aria-selected="true"]`):this.scope.find('.ipsTitle');$('#el'+this.identifier+'FilterRename_menu').on('submit','form',async function(e){if($(this).attr('data-bypassValidation')){return false;}
|
||||
$(this).trigger('closeMenu');e.preventDefault();try{const{title}=await ips.fetch($(this).attr('action'),{data:$(this).serialize(),type:'post'});titlefield().text(title);}catch(e){console.log(e)
|
||||
$(this).attr('data-bypassValidation',true).submit();}});},changeSearch:function(e){e.preventDefault();var form=$('#el'+this.identifier+'Search_menu');this.storedValues.term=form.find('[name="search"]').val();this.scope.find('[data-role="searchSummary"]').text(this.storedValues.term);if(this.storedValues.term){Debug.log(this.scope.find('[data-role="clearSearchTerm"]'));form.find('[data-role="clearSearchTerm"]').show();}
|
||||
else
|
||||
|
||||
@@ -771,13 +771,9 @@ const fileId=parseInt(data?.fileElem?.attr?.('data-fileid'));if(!fileId||Number.
|
||||
try{instance.chain().removeAttachment(fileId).focus().run();}catch(e){Debug.warn(e);}}
|
||||
return{init,focus,unminimize,minimize,insertQuotes,insertHtml,reset,destruct,saveAndClearAutosave,getInstance,getInstanceHTML,scrollIntoView};}}(jQuery,_));;
|
||||
;(function($,_,undefined){"use strict";ips.createModule('ips.ui.filterBar',function(){var defaults={on:'phone,tablet',viewDefault:'filterContent'};var respond=function(elem,options){if(!$(elem).data('_filterBar')){$(elem).data('_filterBar',filterBarObj(elem,_.defaults(options,defaults)));}},getObj=function(elem){if($(elem).data('_filterBar')){return $(elem).data('_filterBar');}
|
||||
return undefined;},destruct=function(elem){var obj=getObj(elem);if(!_.isUndefined(obj)){obj.destruct();}};ips.ui.registerWidget('filterBar',ips.ui.filterBar,['on','viewDefault']);return{respond:respond,destruct:destruct,getObj:getObj};});var filterBarObj=function(elem,options){var filterBar=null;var filterContent=null;var workOn=[];var currentBreak;var currentlyShowing=null;var init=function(){if(!ips.utils.responsive.enabled()){return;}
|
||||
filterBar=elem.find('[data-role="filterBar"]');filterContent=elem.find('[data-role="filterContent"]');workOn=options.on.split(',');currentBreak=ips.utils.responsive.getCurrentKey();$(document).on('breakpointChange',_breakpointChange);elem.on('switchTo.filterBar',function(e,data){if(_.indexOf(workOn,ips.utils.responsive.getCurrentKey())===-1){return;}
|
||||
_switchView(data.switchTo);}).on('click','[data-action="filterBarSwitch"]',_switchToggle);if(_.indexOf(workOn,currentBreak)!==-1){_setUpBar();}},destruct=function(){$(document).off('breakpointChange',_breakpointChange);},_setUpBar=function(){if(options.viewDefault=='filterBar'){filterContent.attr('hidden','');currentlyShowing='filterBar';}else{filterBar.attr('hidden','');currentlyShowing='filterContent';}},_switchToggle=function(e){e.preventDefault();if(_.indexOf(workOn,ips.utils.responsive.getCurrentKey())===-1){return;}
|
||||
_switchView($(e.currentTarget).attr('data-switchTo')=='filterBar'?'filterBar':'filterContent');},_switchView=function(switchTo){if(switchTo==currentlyShowing){return;}
|
||||
elem.css({height:(currentlyShowing=='filterBar')?filterBar.outerHeight():filterContent.outerHeight()+'px'});filterBar.addClass('ipsFilter_layout');filterContent.addClass('ipsFilter_layout');var done=function(){filterBar.removeClass('ipsFilter_layout');filterContent.removeClass('ipsFilter_layout');elem.css({height:'auto'});currentlyShowing=switchTo;};if(switchTo=='filterBar'){filterBar.css({left:'-100%'}).removeAttr('hidden').animate({left:'0%'},{duration:300});filterContent.css({left:'0%'}).animate({left:'100%'},{duration:300,complete:function(){$(this).attr('hidden','')
|
||||
done();}});}else{filterBar.css({left:'0%'}).animate({left:'-100%'},{duration:300,complete:function(){$(this).attr('hidden','')
|
||||
done();}});filterContent.css({left:'100%'}).removeAttr('hidden').animate({left:'0%'},{duration:300});}},_cancel=function(){elem.find('[data-role="filterBar"], [data-role="filterContent"]').removeClass('ipsFilter_layout').css({left:'auto'}).removeAttr('hidden');elem.css({height:'auto'});currentlyShowing=null;},_breakpointChange=function(e,data){currentBreak=data.curBreakName;if(_.indexOf(workOn,currentBreak)!==-1){_switchView(options.viewDefault);}else{_cancel();}};init();return{init:init,destruct:destruct};};}(jQuery,_));;
|
||||
return undefined;},destruct=function(elem){var obj=getObj(elem);if(!_.isUndefined(obj)){obj.destruct();}};ips.ui.registerWidget('filterBar',ips.ui.filterBar,['on','viewDefault']);return{respond:respond,destruct:destruct,getObj:getObj};});var filterBarObj=function(elem,options){var filterBar=null;var filterContent=null;var currentlyShowing=null;var init=function(){filterBar=elem.find('[data-role="filterBar"]');filterContent=elem.find('[data-role="filterContent"]');elem.on('switchTo.filterBar',function(e,data){_switchView(data.switchTo);}).on('click','[data-action="filterBarSwitch"]',_switchToggle);_setUpBar();},destruct=function(){},_setUpBar=function(){if(options.viewDefault=='filterBar'){currentlyShowing='filterBar';}else{currentlyShowing='filterContent';}},_switchToggle=function(e){e.preventDefault();_switchView($(e.currentTarget).attr('data-switchTo')=='filterBar'?'filterBar':'filterContent');},_switchView=function(switchTo){if(switchTo==currentlyShowing){return;}
|
||||
if(document.startViewTransition){document.startViewTransition(()=>{elem.attr('data-ipsfilterbar-viewing',switchTo);});}else{elem.attr('data-ipsfilterbar-viewing',switchTo);}
|
||||
currentlyShowing=switchTo;};init();return{init:init,destruct:destruct};};}(jQuery,_));;
|
||||
;(function($,_,undefined){"use strict";ips.createModule('ips.ui.flashMsg',function(){var _queue=[],_doneInit=false,_box,_content,_isShowing=false,_currentDismissHandler=null;var defaults={timeout:2,extraClasses:'',location:'top',sticky:false,escape:true};var respond=function(elem,options){if(options.text){show(options.text,options);}},init=function(){$(document).ready(function(){if($('body').attr('data-message')){show($('body').attr('data-message'));}
|
||||
if(ips.utils.url.getParam('flmsg')){show(_.escape(decodeURIComponent(ips.utils.url.getParam('flmsg'))));}
|
||||
if(ips.utils.cookie.get('flmsg')){show(_.escape(ips.utils.cookie.get('flmsg')));ips.utils.cookie.unset('flmsg');}});$(document).on('closeFlashMsg.flashMsg',hide);},show=function(message,options,update){if(!_doneInit){_initElement();}
|
||||
@@ -1500,31 +1496,31 @@ var responseDiv=$('<div>'+response+'</div>');var responseWizard=responseDiv.find
|
||||
responseDiv.find("link","script").appendTo('head');ips.controller.cleanContentsOf(elem);elem.html(responseWizard);$(document).trigger('contentChange',[elem]);elem.trigger('wizardStepChanged');},_showLoading=function(elem){var loading=elem.find('[data-role="loading"]');var formContainer=elem.find('[data-role="wizardContent"]');if(!formContainer.is(':visible')){return;}
|
||||
if(!loading.length){loading=$('<div/>').attr('data-role','loading').addClass('ipsLoading').hide();elem.append(loading);}
|
||||
var dims={width:formContainer.outerWidth(),height:formContainer.outerHeight()};loading.css({width:dims.width+'px',height:dims.height+'px'}).show();formContainer.hide().after(loading.show());},_hideLoading=function(){var loading=elem.find('[data-role="loading"]');var formContainer=elem.find('[data-role="registerForm"]');loading.remove();formContainer.show();};ips.ui.registerWidget('wizard',ips.ui.wizard);return{respond:respond};});}(jQuery,_));;
|
||||
;(function($,_){"use strict";ips.createModule('ips.ui.tabbar',function(){const defaults={itemSelector:'.ipsTabs__tab',activeClass:'ipsTabs__tab--active',loadingClass:'ipsLoading ipsTabs_loadingContent',panelClass:'ipsTabs__panel',panelPrefix:'ipsTabs',updateURL:true,updateTitle:false,disableNav:false};ips.ui.registerWidget('tabbar',ips.ui.tabbar,['contentArea','itemSelector','activeClass','loadingClass','disableNav','panelClass','updateURL','updateTitle','panelPrefix','defaultTab']);return{respond(elem,options){if(!$(elem).data('_tabbar')){$(elem).data('_tabbar',tabBarObj(elem,_.defaults(options,defaults)));}}};});function tabBarObj(elem,options){const rawElem=$(elem).get(0);const tabs=$(elem).find(options.itemSelector);let barId=rawElem.id;let active;let ajaxObj;function init(){if(!barId){barId=$(rawElem).identify().attr('id');}
|
||||
;(function($,_){"use strict";ips.createModule('ips.ui.tabbar',function(){const defaults={itemSelector:'.ipsTabs__tab',activeClass:false,loadingClass:'ipsLoading ipsTabs_loadingContent',panelClass:'ipsTabs__panel',updateURL:true,updateTitle:false,disableNav:false};ips.ui.registerWidget('tabbar',ips.ui.tabbar,['contentArea','itemSelector','activeClass','loadingClass','disableNav','panelClass','updateURL','updateTitle']);return{respond(elem,options){if(!$(elem).data('_tabbar')){$(elem).data('_tabbar',tabBarObj(elem,_.defaults(options,defaults)));}}};});function tabBarObj(elem,options){const rawElem=$(elem).get(0);const tabs=$(elem).find(options.itemSelector);let barId=rawElem.id;let active;let ajaxObj;function init(){if(!barId){barId=$(rawElem).identify().attr('id');}
|
||||
if(!options.contentArea||!$(options.contentArea).length){options.contentArea='#'+$(rawElem).next().identify().attr('id');}
|
||||
if(!tabs.length){Debug.warn("No tabs found in tab bar"+barId);return;}
|
||||
active=_getActiveTab();_initializeActive();$(elem).on('click',options.itemSelector,_handleTabClick);let tabbar=elem[0],tablist=tabbar.querySelector('[role="tablist"]'),scrollers=tabbar.querySelector('[data-role="tabScrollers"]');if(scrollers){scrollers.addEventListener("click",e=>_handleScrollerClick(e,tablist));let scrollerObserver=new IntersectionObserver(tabs=>tabs.forEach(tab=>tabbar.querySelector(`[data-direction="${tab.target.matches(':first-child') ? 'prev' : 'next'}"]`).hidden=tab.intersectionRatio>.99),{root:tablist,threshold:0.99});tablist.querySelectorAll(':scope > li:first-child, :scope > li:last-child').forEach(li=>{scrollerObserver.observe(li)});}}
|
||||
active=_getActiveTab();_initializeActive();$(elem).on('click',options.itemSelector,_handleTabClick);let tabbar=elem[0],tablist=tabbar.querySelector('[role="tablist"]'),scrollers=tabbar.querySelector('[data-role="tabScrollers"]');if(scrollers){scrollers.addEventListener("click",e=>_handleScrollerClick(e,tablist));let scrollerObserver=new IntersectionObserver(tabs=>tabs.forEach(tab=>tabbar.querySelector(`[data-direction="${tab.target.matches(':first-child') ? 'prev' : 'next'}"]`).hidden=tab.intersectionRatio>.99),{root:tablist,threshold:0.99});tablist.querySelectorAll(':scope > :first-child, :scope > :last-child').forEach(el=>{scrollerObserver.observe(el)});}}
|
||||
function _handleScrollerClick(e,tablist){let direction=e.target.closest('button').getAttribute("data-direction"),currentScroll=tablist.scrollLeft,listWidth=tablist.offsetWidth/2;if(direction==="prev"){listWidth=-listWidth;}
|
||||
tablist.scrollTo({left:currentScroll+listWidth,behavior:"smooth"})}
|
||||
function _handleTabClick(e){if(options.disableNav){return;}
|
||||
e.preventDefault();if($(this).hasClass(options.activeClass)){return;}
|
||||
let thisId=$(this).identify().attr('id'),thisContent=$('#'+options.panelPrefix+'_'+barId+'_'+thisId+'_panel');if(!thisContent.length){thisContent=_createTabPanel(thisId);_loadContent(this,thisContent).done(()=>_switchTab(thisId)).fail(()=>Debug.log('failed'));}else{_hideAllPanels();_switchTab(thisId);}
|
||||
e.preventDefault();if($(this).attr('aria-selected')==='true'){return;}
|
||||
let thisId=$(this).identify().attr('id'),thisContent=$('#'+$(this).attr('aria-controls'));if(!thisContent.length){thisContent=$('#'+thisId+'_panel');}
|
||||
if(!thisContent.length){thisContent=_createTabPanel(thisId);_loadContent(this,thisContent).done(()=>_switchTab(thisId)).fail(()=>Debug.log('failed'));}else{_hideAllPanels();_switchTab(thisId);}
|
||||
_updateURL(thisId);}
|
||||
function _switchTab(tabId,immediate=false){_hideAllPanels();const thisContent=$('#'+options.panelPrefix+'_'+barId+'_'+tabId+'_panel'),thisContentParent=document.querySelector(elem[0].getAttribute("data-ipstabbar-contentarea"));if(!immediate){ips.utils.anim.go('fadeIn',thisContent).done(function(){thisContent.attr('aria-hidden','false');$(elem).trigger('tabShown',{barID:barId,tabID:tabId,tab:active,panel:thisContent});$(document).trigger('contentChange',[thisContent]);});}else{thisContent.show().attr('aria-hidden','false');$(elem).trigger('tabShown',{barID:barId,tabID:tabId,tab:active,panel:thisContent});$(document).trigger('contentChange',[thisContent]);}
|
||||
if(elem[0].matches(".ipsTabs--sticky")&&thisContentParent&&window.scrollY>thisContentParent.offsetTop){thisContentParent.scrollIntoView({behavior:"smooth"});}
|
||||
function _switchTab(tabId){_hideAllPanels();const thisContent=$('#'+tabId+'_panel'),thisContentParent=document.querySelector(elem[0].getAttribute("data-ipstabbar-contentarea"));thisContent.removeAttr('hidden');$(elem).trigger('tabShown',{barID:barId,tabID:tabId,tab:active,panel:thisContent});$(document).trigger('contentChange',[thisContent]);if(elem[0].matches(".ipsTabs--sticky")&&thisContentParent&&window.scrollY>thisContentParent.offsetTop){thisContentParent.scrollIntoView({behavior:"smooth"});}
|
||||
active=$('#'+tabId);_makeTabActive(active);$(elem).trigger('tabChanged',{barID:barId,tabID:tabId,tab:active,panel:thisContent});}
|
||||
function _updateURL(tabId){if(!options.updateURL){return;}
|
||||
const tabLink=$(`#${tabId}`);const href=tabLink.attr('href');const title=(options.updateTitle&&tabLink.attr('title'))?tabLink.attr('title'):document.title;if(!_.isEmpty(href)&&!href.startsWith('#')){ips.utils.history.replaceState({},'ips.ui.tabbar',href);document.title=title
|
||||
ips.utils.analytics.trackPageView(href);}}
|
||||
function _getActiveTab(){const activeTab=elem.find('.'+options.activeClass);if(activeTab.length){return activeTab.get(0);}
|
||||
if(options.defaultTab&&$(elem).find(options.defaultTab)){return $(elem).find(options.defaultTab).get(0);}
|
||||
function _getActiveTab(){const activeTab=elem.find('[aria-selected="true"]');if(activeTab.length){return activeTab.get(0);}
|
||||
return $(elem).find(options.itemSelector).first();}
|
||||
function _initializeActive(){const activeId=$(active).identify().attr('id');if(!$('#'+options.panelPrefix+'_'+barId+'_'+activeId+'_panel').length){if($(options.contentArea).children().length){$(options.contentArea).wrapInner(_createTabPanel(activeId,true));_switchTab(activeId,true);}else{var newPanel=_createTabPanel(activeId);_loadContent(active,newPanel).done(function(){_switchTab(activeId);});}}else{_switchTab(activeId,true);}}
|
||||
function _makeTabActive(activeTab){$(elem).find(options.itemSelector).removeClass(options.activeClass).removeAttr('aria-selected');$(activeTab).addClass(options.activeClass).attr('aria-selected','true');}
|
||||
function _initializeActive(){const activeId=$(active).identify().attr('id');if(!$('#'+activeId+'_panel').length){if($(options.contentArea).children().length){$(options.contentArea).wrapInner(_createTabPanel(activeId,true));_switchTab(activeId);}else{var newPanel=_createTabPanel(activeId);_loadContent(active,newPanel).done(function(){_switchTab(activeId);});}}else{_switchTab(activeId);}}
|
||||
function _makeTabActive(activeTab){$(elem).find(options.itemSelector).attr('aria-selected','false');if(options.activeClass){$(elem).find(options.itemSelector).removeClass(options.activeClass);}
|
||||
$(activeTab).attr('aria-selected','true');if(options.activeClass){$(activeTab).addClass(options.activeClass);}}
|
||||
function _loadContent(tab,container){let url;const deferred=$.Deferred();_hideAllPanels();if($(tab).attr('data-tabURL')){url=$(tab).attr('data-tabURL');}else{url=$(tab).attr('href');}
|
||||
$(options.contentArea).addClass(options.loadingClass);ajaxObj=ips.getAjax();ajaxObj(url).done(response=>{$(container).html(response);deferred.resolve();}).fail(()=>window.location=$(tab).attr('href')).always(()=>$(options.contentArea).removeClass(options.loadingClass));return deferred.promise();}
|
||||
function _hideAllPanels(){$(options.contentArea).find('> .'+options.panelClass).hide().attr('aria-hidden','true');}
|
||||
function _createTabPanel(tabId,noAppend=false){const newPanel=$('<div/>').attr({'id':options.panelPrefix+'_'+barId+'_'+tabId+'_panel'}).addClass(options.panelClass).attr({'aria-labelledby':tabId});if(!noAppend){$(options.contentArea).append(newPanel);}
|
||||
function _hideAllPanels(){$(options.contentArea).find('> .'+options.panelClass).attr('hidden','');}
|
||||
function _createTabPanel(tabId,noAppend=false){const newPanel=$('<div/>').attr({'id':tabId+'_panel'}).addClass(options.panelClass).attr({'role':'tabpanel'}).attr({'aria-labelledby':tabId});if(!noAppend){$(options.contentArea).append(newPanel);}
|
||||
return newPanel;}
|
||||
init();return{init};}}(jQuery,_));;
|
||||
;(function($,_,undefined){"use strict";ips.createModule('ips.utils',function(options){var argsToArray=function(obj){return Array.prototype.slice.call(obj);},uppercaseFirst=function(fromString){return fromString.charAt(0).toUpperCase()+fromString.slice(1);},getIDsFromList=function(list){if(!list){return'';}
|
||||
@@ -1890,11 +1886,10 @@ var item=queue.shift();if(item.run=='anim'){elem.animationComplete(function(){el
|
||||
item.deferred.resolve();},cleanClasses=function(elem){$(elem).removeClass('ipsAnim').removeClass(function(index,css){return(css.match(/ipsAnim[0-9a-z_\-]+/gi)||[]).join(' ');});return elem;},isTransition=function(name){return!_.isUndefined(_transitions[name]);},addTransition=function(name,cssAnimation,fallbackAnimation){if(_transitions[name]){Debug.warn("A transition with the name '"+name+"' already exists");return;}
|
||||
_transitions[name]={anim:cssAnimation,fallback:fallbackAnimation};},scrollTo=function(elem,options){};return{init:init,cleanClasses:cleanClasses,animationSupport:animationSupport,isTransition:isTransition,addTransition:addTransition,go:go,cancel:cleanClasses};});}(jQuery,_));;
|
||||
;(function($,_){"use strict";ips.createModule("ips.utils.lazyload",function(){const fixedElements=new WeakSet();const imgDimsCache={_cache:new Map(),get(key){let value;if(!this._cache.has(key)){try{value=ips.utils.db.get('ips.utils.lazyloadImgDims',key);}catch(e){}}else{value=this._cache.get(key);}
|
||||
return value;},set(key,value){ips.utils.db.set('ips.utils.lazyloadImgDims',key,value,false,Math.round(Date.now()/1000)+86400);return this._cache.set(key,value);},has(key){return this._cache.has(key);},delete(key){ips.utils.db.remove('ips.utils.lazyloadImgDims',key);return this._cache.delete(key);}};return{init(){this.parseLazyLoadElements();$(document).on('contentChange',function(changedElement){try{$(changedElement).each(function(){ips.utils.lazyload.parseLazyLoadElements(this);});}catch(e){Debug.warn(`Something went wrong when processing lazy load images`);Debug.warn(e);}})},parseLazyLoadElements(root){root=root instanceof Element?root:document.body;root.querySelectorAll("[data-src]:is(img, audio, video, iframe, object, embed)").forEach(element=>{if(fixedElements.has(element)){return;}
|
||||
return value;},set(key,value){ips.utils.db.set('ips.utils.lazyloadImgDims',key,value,false,Math.round(Date.now()/1000)+86400);return this._cache.set(key,value);},has(key){return this._cache.has(key);},delete(key){ips.utils.db.remove('ips.utils.lazyloadImgDims',key);return this._cache.delete(key);}};return{init(){this.parseLazyLoadElements();$(document).on('contentChange',function(changedElement){try{$(changedElement).each(function(){ips.utils.lazyload.parseLazyLoadElements(this);});}catch(e){Debug.warn(`Something went wrong when processing lazy load images`);Debug.warn(e);}})},parseLazyLoadElements(root){root=root instanceof Element?root:document.body;root.querySelectorAll(":is([data-src], [data-embed-src]):is(img, audio, video, iframe, object, embed)").forEach(element=>{if(fixedElements.has(element)){return;}
|
||||
element.dataset.ipsLazyloadProcessed='1'
|
||||
fixedElements.add(element);if(element.getAttribute('src')===element.dataset.src){delete element.dataset.src
|
||||
return;}
|
||||
element.setAttribute('loading','lazy');element.setAttribute('src',element.dataset.src);delete element.dataset.src;if(element.matches('img')){let width=parseFloat(element.getAttribute('width')||'');let height=parseFloat(element.getAttribute('height')||'');if(width&&height&&!Number.isNaN(width)&&!Number.isNaN(height)){return;}else if(element.style.height||element.style.width){return;}else if(parseFloat(width?.toString()||element.dataset.width||'')&&parseFloat(height?.toString()||element.dataset.height||'')){width=Math.round(parseFloat(width?.toString()||element.dataset.width)*100)/100;height=Math.round(parseFloat(height?.toString()||element.dataset.height)*100)/100;}else if(parseFloat(width?.toString()||element.dataset.width||'')&&parseFloat(element.dataset.ratio||'')){width=Math.round(parseFloat(width?.toString()||element.dataset.width)*100)/100;height=Math.round((width/parseFloat(element.dataset.ratio))*100)/100;}else if(parseFloat(height?.toString()||element.dataset.height||'')&&parseFloat(element.dataset.ratio||'')){height=Math.round(parseFloat(height?.toString()||element.dataset.height)*100)/100;width=Math.round(height*parseFloat(element.dataset.ratio)*100)/100;}
|
||||
fixedElements.add(element);const dataSrc=(element.dataset.src||element.dataset.embedSrc)?.trim();if(element.getAttribute('src')?.trim()===dataSrc){delete element.dataset.src;delete element.dataset.embedSrc;return;}
|
||||
Debug.log(`Found legacy lazy loading ${element.tagName.toLowerCase()}. src: ${dataSrc}`);element.setAttribute('loading','lazy');element.setAttribute('src',dataSrc);delete element.dataset.src;delete element.dataset.embedSrc;if(element.matches('img')){let width=parseFloat(element.getAttribute('width')||'');let height=parseFloat(element.getAttribute('height')||'');if(width&&height&&!Number.isNaN(width)&&!Number.isNaN(height)){return;}else if(element.style.height||element.style.width){return;}else if(parseFloat(width?.toString()||element.dataset.width||'')&&parseFloat(height?.toString()||element.dataset.height||'')){width=Math.round(parseFloat(width?.toString()||element.dataset.width)*100)/100;height=Math.round(parseFloat(height?.toString()||element.dataset.height)*100)/100;}else if(parseFloat(width?.toString()||element.dataset.width||'')&&parseFloat(element.dataset.ratio||'')){width=Math.round(parseFloat(width?.toString()||element.dataset.width)*100)/100;height=Math.round((width/parseFloat(element.dataset.ratio))*100)/100;}else if(parseFloat(height?.toString()||element.dataset.height||'')&&parseFloat(element.dataset.ratio||'')){height=Math.round(parseFloat(height?.toString()||element.dataset.height)*100)/100;width=Math.round(height*parseFloat(element.dataset.ratio)*100)/100;}
|
||||
if(typeof height==="number"&&typeof width==="number"&&height>0&&width>0){Debug.log(`Determined the width and height from data- attributes`);element.setAttribute('width',width.toString());element.setAttribute('height',height.toString());}else{this.getNativeImgDims(element.getAttribute('src')).then(dims=>{if(dims){Debug.log(`Determined the width and height from the URL`);element.setAttribute('width',dims.width.toString());element.setAttribute('height',dims.height.toString());}}).catch(err=>{Debug.warn(`Failed to determine the native dims of the image at the URL ${element.getAttribute('url')}`);Debug.warn(err);})}}});},getNativeImgDims(url){return new Promise(_resolve=>{let done=false;let timeout;const resolve=val=>{if(timeout!==undefined){clearTimeout(timeout);}
|
||||
if(done){return;}
|
||||
done=true;_resolve(val);};try{let output={width:0,height:0};url=new URL(url);if(imgDimsCache.has(url.toString())){resolve(imgDimsCache.get(url.toString()));return;}
|
||||
|
||||
@@ -47,8 +47,7 @@ var tooltipSize={width:tooltip.show().outerWidth(),height:tooltip.show().outerHe
|
||||
const feed=document.querySelector(`[data-feedid=${this.elem.dataset.feedid}][data-controller*="core.front.core.commentFeed"]`);if(feed){return $(feed);}
|
||||
Debug.warn(`The comment feed for a comment could not be identified. This can be prevented by ensuring the comment and its feed have macthing data-feedid attributes (comment's feedid: ${this.elem.dataset.feedid})`);}else{Debug.warn(`A comment is missing its data-feedid attribute, so its comment feed could not be identified. This can be prevented by ensuring the comment and its feed have macthing data-feedid attributes`);}
|
||||
Debug.warn(this.elem);return $(this.elem.closest(`[data-controller*="core.front.core.commentFeed"]`)||this.elem);},quoteSelection:function(e){e.preventDefault();this._getQuoteData();if(this._selectedText){this.feedJQ().trigger('quoteComment.comment',{userid:this._quoteData.userid,username:this._quoteData.username,timestamp:this._quoteData.timestamp,contentapp:this._quoteData.contentapp,contenttype:this._quoteData.contenttype,contentclass:this._quoteData.contentclass,contentid:this._quoteData.contentid,contentcommentid:this._quoteData.contentcommentid,quoteHtml:this._selectedText,citeurl:$(this.elem).get(0).querySelector(".ipsEntry__date[href]")?.getAttribute('href')});}
|
||||
this._hideQuoteTooltip();},commentCheckbox:function(e){var checked=$(e.currentTarget).is(':checked');this.scope.closest('.js-ipsEntry').toggleClass('ipsEntry--selected',checked);this.scope.closest('.js-ipsEntry').find('label[for='+$(e.currentTarget).attr('id')+']').toggleClass('ipsInput--pseudoChecked',checked);this.feedJQ().trigger('checkedComment.comment',{commentID:this._commentID,actions:$(e.currentTarget).attr('data-actions'),checked:checked});},disableQuoting:function(){this._quotingDisabled=true;this.scope.find('[data-ipsQuote-editor]').remove();},rateReview:function(e){e.preventDefault();var self=this;ips.getAjax()($(e.currentTarget).attr('href')).done(function(response){var content=$("<div>"+response+"</div>");self.scope.html(content.find('[data-controller="core.front.core.comment"]').contents());$(document).trigger('contentChange',[self.scope]);}).fail(function(err){window.location=$(e.currentTarget).attr('href');});},_menu:undefined,getMenu(){if(!this._menu){const tablist=document.querySelector('[role="tablist"]');let activeTab=tablist?.querySelector('.ipsTabs__tab--active');let activeTabId='elComment';if(activeTab){const parts=activeTab.getAttribute('id').split('_');if(parts.length>=2){activeTabId=parts[parts.length-1]==='comments'?'elComment':'elReview';Debug.log(activeTabId);}else{Debug.log("Invalid object ID format");}}
|
||||
let commentFeed=this.scope.get(0)?.closest('[data-controller]')
|
||||
this._hideQuoteTooltip();},commentCheckbox:function(e){var checked=$(e.currentTarget).is(':checked');this.scope.closest('.js-ipsEntry').toggleClass('ipsEntry--selected',checked);this.scope.closest('.js-ipsEntry').find('label[for='+$(e.currentTarget).attr('id')+']').toggleClass('ipsInput--pseudoChecked',checked);this.feedJQ().trigger('checkedComment.comment',{commentID:this._commentID,actions:$(e.currentTarget).attr('data-actions'),checked:checked});},disableQuoting:function(){this._quotingDisabled=true;this.scope.find('[data-ipsQuote-editor]').remove();},rateReview:function(e){e.preventDefault();var self=this;ips.getAjax()($(e.currentTarget).attr('href')).done(function(response){var content=$("<div>"+response+"</div>");self.scope.html(content.find('[data-controller="core.front.core.comment"]').contents());$(document).trigger('contentChange',[self.scope]);}).fail(function(err){window.location=$(e.currentTarget).attr('href');});},_menu:undefined,getMenu(){if(!this._menu){let activeTabId=this.elem.closest(`[data-commentstype="reviews"]`)?'elReview':'elComment';Debug.log(activeTabId);let commentFeed=this.scope.get(0)?.closest('[data-controller]')
|
||||
while(commentFeed&&!commentFeed.dataset.controller?.includes('core.front.core.commentFeed')){commentFeed=commentFeed.parentElement?.closest('[data-controller]')}
|
||||
const menuLink=(commentFeed||document).querySelector('#'+activeTabId+`_${this.scope.get(0)?.dataset['commentid']} [href][data-ipsmenu]`);this._menu=menuLink?document.querySelector(menuLink.getAttribute('href')):null;}
|
||||
return this._menu;},_setupShareCommentDialog(){const shareButton=this.getMenu()?.querySelector('[data-role="shareComment"], [data-role="shareReview"]');const shareMenu=shareButton?.dataset.ipsdialogContent?document.querySelector(shareButton.dataset.ipsdialogContent):null;const copyToClipboard=shareMenu?.querySelector('[data-role="shareButton"]');let shared=false;if(window.isSecureContext&©ToClipboard){copyToClipboard.onclick=e=>e.preventDefault()
|
||||
@@ -174,17 +173,18 @@ if($('#elFlashMessage').find('[data-role="newPostNotification"]').length){$('#el
|
||||
e.preventDefault();e.stopPropagation();var self=this;var replyArea=this.scope.find('[data-role="replyArea"]');var submit=form.find('[type="submit"]');var autoFollow=this.scope.find('input[name$="auto_follow_checkbox"]');var commentsOnThisPage=this.scope.find('[data-commentid]');var _lastSeenID=this._getLastSeenID(commentsOnThisPage);var initialText=submit.text();submit.prop('disabled',true).text(ips.getString('saving'));var 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();}
|
||||
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.scope.find('[data-commentid="'+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())));});}
|
||||
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('');}
|
||||
form.find("[data-role='commentFormError']").each(function(){$(this).remove();});const container=comment.closest('.js-ipsEntry');if(container.length){ips.utils.anim.go('pulseOnce',container);}else{ips.utils.anim.go('pulseOnce',comment);}
|
||||
ips.ui.flashMsg.show(ips.getString('mergedConncurrentPosts'));$(document).trigger('contentChange',[self.scope]);}else{if(response.postedByLoggedInMember){self.trigger('ipsDataLayer',{_key:'content_comment',_properties:response.dataLayer});}
|
||||
self.trigger('addToCommentFeed',{content:response.content,totalItems:response.total,feedID:self._commentFeedID,scrollToItem:true});if(response.message){ips.ui.flashMsg.show(response.message);}
|
||||
if(self.scope.find('[data-role="replyArea"] input[name="guest_name"]').length){self.scope.find('[data-role="replyArea"] input[name="guest_name"]').val('');self.scope.find('[data-role="replyArea"] [data-ipsEditorv5]').find('.ipsComposeArea_dummy').hide().end().find('[data-role="mainEditorArea"]').show().end().closest('.ipsComposeArea').removeClass('ipsComposeArea_minimized').find('[data-ipsEditor-toolList]').show();}
|
||||
form.find("[data-role='commentFormError']").each(function(){$(this).remove();});if(autoFollow.length){self.trigger('followingItem',{feedID:self.scope.attr('data-feedID'),following:autoFollow.is(':checked')});}}
|
||||
self._clearNotifications();}).fail(function(jqXHR,textStatus,errorThrown){if(Debug.isEnabled()){Debug.error("Posting new reply failed: "+textStatus);Debug.log(jqXHR);Debug.log(errorThrown);}else{form.attr('data-noAjax','true');form.attr('action',form.attr('action')+((!form.attr('action').match(/\?/))?'?failedReply=1':'&failedReply=1'));form.submit();}}).always(function(){submit.prop('disabled',false).text(initialText?initialText:ips.getString('submit_reply'));});},loadNewPosts:function(e){e?.preventDefault?.();this._importNewReplies();},addToCommentFeed(e,data){if(typeof data?.content!=="string"||data.feedID!==this._commentFeedID){return;}
|
||||
self._clearNotifications();}).fail(function(jqXHR,textStatus,errorThrown){if(Debug.isEnabled()){Debug.error("Posting new reply failed: "+textStatus);Debug.log(jqXHR);Debug.log(errorThrown);}else{form.attr('data-noAjax','true');form.attr('action',form.attr('action')+((!form.attr('action').match(/\?/))?'?failedReply=1':'&failedReply=1'));form.submit();}}).always(function(){submit.prop('disabled',false).text(initialText?initialText:ips.getString('submit_reply'));});},loadNewPosts:function(e){e?.preventDefault?.();this._importNewReplies();},findCommentInFeed(commentId){const commentSelector=`[data-commentid="${commentId}"]`;const comment=this.elem.querySelector(`[data-role="commentFeed"] ${commentSelector}`);if(comment){return comment;}else if(this.elem.dataset.feedid){const feedSelector=`[data-feedid="${this.elem.dataset.feedid}"]`;return document.querySelector(`${feedSelector}${commentSelector}, ${feedSelector} ${commentSelector}`)||null;}
|
||||
return null;},addToCommentFeed(e,data){if(typeof data?.content!=="string"||data.feedID!==this._commentFeedID){return;}
|
||||
const content=$('<div/>').append(data.content);const div=content.get(0);const comment=content.find('.js-ipsEntry');let commentFeed=this.scope.find('[data-role="commentFeed"]');if(commentFeed.find('[data-role="moderationTools"]').length){commentFeed=commentFeed.find('[data-role="moderationTools"]');}
|
||||
this.scope.find('[data-role="noComments"]').remove();const actualContent=div.querySelector(`[data-ips-hook="postWrapper"]`)
|
||||
const id=parseInt(actualContent?.querySelector(`[data-commentid]`)?.dataset.commentid);const existing=Number.isInteger(id)&&(this.elem.querySelector(`[data-role="commentFeed"] [data-commentid="${id}"]`)?.closest(`[data-ips-hook="postWrapper"]`)||null);if(existing&&existing.parentElement){existing.parentElement.replaceChild(existing,actualContent);}else{commentFeed.append(comment.css({opacity:"0.001"}));const newItemTop=comment.offset().top;const windowScroll=$(window).scrollTop();const viewHeight=$(window).height();function _showComment(){comment.css({opacity:"1"});ips.utils.anim.go('fadeInDown',comment.filter(':not(.ipsHide)'));}
|
||||
const id=parseInt(actualContent?.querySelector(`[data-commentid]`)?.dataset.commentid);const existing=Number.isInteger(id)&&this.findCommentInFeed(id);if(existing&&existing.parentElement){existing.parentElement.replaceChild(existing,actualContent);}else{commentFeed.append(comment.css({opacity:"0.001"}));const newItemTop=comment.offset().top;const windowScroll=$(window).scrollTop();const viewHeight=$(window).height();function _showComment(){comment.css({opacity:"1"});ips.utils.anim.go('fadeInDown',comment.filter(':not(.ipsHide)'));}
|
||||
if(data.scrollToItem&&(newItemTop<windowScroll||newItemTop>(windowScroll+viewHeight))){$('html, body').animate({scrollTop:newItemTop+'px'},'fast',function(){setTimeout(_showComment,100);});}else{_showComment();}
|
||||
if(!('resetEditor'in data)||data.resetEditor!==false){this.scope.find('[data-role="replyArea"] [data-ipsEditorv5]').data('_editor').reset();}
|
||||
if(ips.utils.db.isEnabled()){const buttons=comment.find('[data-action="multiQuoteComment"]');buttons.hide().removeClass('ipsHide');ips.utils.anim.go('fadeIn',buttons);}}
|
||||
@@ -250,7 +250,7 @@ attachment.attr('data-loaded',true);},_updateAttachmentImage:function(attachment
|
||||
if(!_.isUndefined(response.rotate)&&response.rotate!==null){attachment.attr('data-rotate',response.rotate).css('transform','');attachment.parents('a.ipsAttachLink_image').css({'transform':'rotate('+response.rotate+'deg)','position':'absolute','top':0});if(response.rotate==90||response.rotate==-270){if(attachment.width()>attachment.height()){attachment.parents('a.ipsAttachLink_image').css({'right':'40%','height':'100%'});}else{attachment.parents('a.ipsAttachLink_image').css({'left':'5%','transform-origin':'right'});}}else if(response.rotate==-90||response.rotate==270){if(attachment.width()>attachment.height()){attachment.parents('a.ipsAttachLink_image').css({'right':'40%','height':'100%'});}else{attachment.parents('a.ipsAttachLink_image').css({'left':'40%','transform-origin':'left'});}}
|
||||
var containerHeight=attachment.height();if(response.rotate!=0&&response.rotate!=180&&response.rotate!=-180){containerHeight=attachment.width();}
|
||||
var parent=attachment.parents('p:first');if($(parent).height()<containerHeight){$(parent).css({'height':parseInt(containerHeight+5).toString()+'px','position':'relative'});}}},_updateAttachmentMetaDataError:function(attachment){if(attachment.hasClass('ipsAttachLink_block')){attachment.find('.ipsAttachLink_metaInfo').html(ips.getString('attachmentUnavailable'));}else{attachment.attr('title',ips.getString('attachmentUnavailable'));}
|
||||
attachment.attr('data-loaded',true);},async _addOrUpdateWrappingLink(image){const closestLink=image.closest('a');const imageSrc=image.attr('src');const fileId=image.attr('data-fileid');if(closestLink.length&&closestLink.hasClass('ipsAttachLink')&&closestLink.hasClass('ipsAttachLink_image')){const href=closestLink.attr('href');const ext=href?.includes('.')?href.split('.').pop():'';if(IMAGE_EXTENSIONS.has(ext)||(await ips.ui.lightbox.getImageDimensions(imageSrc)).solid){closestLink.attr('data-fileId',fileId).attr('data-ipsLightbox','').attr('data-ipsLightbox-group',this._random);if(href){closestLink.attr('data-fullurl',href)}}}else if(!closestLink.length){image.wrap($('<a href="'+imageSrc+'"'+" title='"+ips.getString('enlargeImage')+"' data-fileId='"+fileId+"'data-wrappedLink data-ipsLightbox data-ipsLightbox-group='"+this._random+"'></a>"));}},_initializeImages:function(){var self=this;var images=this.scope.find('img:not(.ipsEmoji *, .tiptap *, [data-emoticon] *)');if(images.length){_.each(images,function(image,i){let rawImage
|
||||
attachment.attr('data-loaded',true);},async _addOrUpdateWrappingLink(image){const closestLink=image.closest('a');const imageSrc=image.attr('src');const fileId=image.attr('data-fileid');if(closestLink.length&&closestLink.hasClass('ipsAttachLink')&&closestLink.hasClass('ipsAttachLink_image')){const href=closestLink.attr('href');const ext=href?.includes('.')?href.split('.').pop():'';if(IMAGE_EXTENSIONS.has(ext)||(await ips.ui.lightbox.getImageDimensions(imageSrc)).solid){closestLink.attr('data-fileId',fileId).attr('data-ipsLightbox','').attr('data-ipsLightbox-group',this._random);if(href){closestLink.attr('data-fullurl',href)}}}else if(!closestLink.length){let link=$('<a data-wrappedLink data-ipslightbox>').attr('href',imageSrc).attr('title',ips.getString('enlargeImage')).attr('data-fileid',fileId).attr('data-lightbox-group',this._random);image.wrap(link);}},_initializeImages:function(){var self=this;var images=this.scope.find('img:not(.ipsEmoji *, .tiptap *, [data-emoticon] *)');if(images.length){_.each(images,function(image,i){let rawImage
|
||||
if(image instanceof $){rawImage=image.get(0);}else{rawImage=image;image=$(image);}
|
||||
const embedAncestor=rawImage?.closest('.ipsEmbedded_og[data-og-url]')
|
||||
if(embedAncestor){if(!('linkified'in embedAncestor.dataset)){const toLink=embedAncestor.querySelector(`.ipsEmbedded_og__title`)||rawImage
|
||||
|
||||
Reference in new issue
Block a user