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
@@ -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,_));;
|
||||
|
||||
Reference in new issue
Block a user