Version 5.0.0 beta 8
This commit is contained in:
1 parent
54d5dcd0a0
commit
214f649f1d
483 files changed
+35354
-33568
No files matched your search
@@ -18,12 +18,12 @@ this.scope.find('[data-role="pollContainer"]').append(ips.templates.render('core
|
||||
;(function($,_,undefined){"use strict";ips.controller.register('core.front.core.reviewForm',{initialize:function(){this.on('click','[data-action="writeReview"]',this.toggleReview);},toggleReview:function(e){this.scope.find('[data-role="reviewIntro"]').attr('hidden','');this.scope.find('[data-role="reviewForm"]').removeAttr('hidden');}});}(jQuery,_));;
|
||||
;(function($,_,undefined){"use strict";ips.controller.register('core.front.core.tagEditor',{_minTags:null,_maxTags:null,_count:0,_tagEditID:'',initialize:function(){this.on('click','[data-action="removeTag"]',this.removeTag);this.on(document,'tagsUpdated',this.tagsUpdated);this.setup();},setup:function(){this._tagEditID=this.scope.attr('data-tagEditID');this._minTags=this.scope.attr('data-minTags')||null;this._maxTags=this.scope.attr('data-maxTags')||null;this._setCount();this._checkMinMax();},_destroy:function(){if($('#elTagEditor_'+this._tagEditID+'_menu').length){$('#elTagEditor_'+this._tagEditID+'_menu').remove();}},tagsUpdated:function(e,data){if(data.tagEditID!==this._tagEditID){return;}
|
||||
this.scope.find('.ipsTags__item:not(.ipsTags__item--edit)').remove();this.scope.prepend(data.tags);var editablePrefix=$('body').find('[data-editablePrefix]');if(editablePrefix.length){if(data.prefix){editablePrefix.html(data.prefix).removeClass('ipsHide');}else{editablePrefix.html('').addClass('ipsHide');}}else if(data.prefix.length){this.scope.prepend(data.prefix);}
|
||||
this._setCount();this._checkMinMax();ips.ui.flashMsg.show(ips.getString('tagsUpdated'));},removeTag:function(e){e.preventDefault();var self=this;var remove=$(e.currentTarget);var url=remove.attr('href');var tagContainer=remove.closest('.ipsTags__item');var tag=tagContainer.find('.ipsTags__tag');tagContainer.fadeOut('fast');this._count--;this._checkMinMax();ips.getAjax()(url,{bypassRedirect:true}).done(function(){ips.ui.flashMsg.show(ips.getString('tagRemoved'));setTimeout(function(){tagContainer.remove();},200);}).fail(function(jqXHR,textStatus,errorThrown){tagContainer.stop().show().css({opacity:"1"});self._count++;if(jqXHR.responseJSON){ips.ui.alert.show({type:'alert',icon:'warn',message:jqXHR.responseJSON,callbacks:{}});}});},_checkMinMax:function(){var allowRemove=!(this._minTags&&this._count<=this._minTags);this.scope.find('[data-action="removeTag"]').toggle(allowRemove).end().find('.ipsTags__item--deletable').toggleClass('ipsTags__item--deletable',allowRemove);this.scope.find('.ipsTags__item--edit').toggle(!(this._maxTags&&this._count>=this._maxTags));},_setCount:function(){var prefix=this._getPrefix();var count=this.scope.find('.ipsTags__item').length;if(prefix.length&&prefix.is(':visible')){count++;}
|
||||
this._setCount();this._checkMinMax();if(data.tagsChanged==1){ips.ui.flashMsg.show(ips.getString('tagsUpdated'));}},removeTag:function(e){e.preventDefault();var self=this;var remove=$(e.currentTarget);var url=remove.attr('href');var tagContainer=remove.closest('.ipsTags__item');var tag=tagContainer.find('.ipsTags__tag');tagContainer.fadeOut('fast');this._count--;this._checkMinMax();ips.getAjax()(url,{bypassRedirect:true}).done(function(){ips.ui.flashMsg.show(ips.getString('tagRemoved'));setTimeout(function(){tagContainer.remove();},200);}).fail(function(jqXHR,textStatus,errorThrown){tagContainer.stop().show().css({opacity:"1"});self._count++;if(jqXHR.responseJSON){ips.ui.alert.show({type:'alert',icon:'warn',message:jqXHR.responseJSON,callbacks:{}});}});},_checkMinMax:function(){var allowRemove=!(this._minTags&&this._count<=this._minTags);this.scope.find('[data-action="removeTag"]').toggle(allowRemove).end().find('.ipsTags__item--deletable').toggleClass('ipsTags__item--deletable',allowRemove);this.scope.find('.ipsTags__item--edit').toggle(!(this._maxTags&&this._count>=this._maxTags));},_setCount:function(){var prefix=this._getPrefix();var count=this.scope.find('.ipsTags__item').length;if(prefix.length&&prefix.is(':visible')){count++;}
|
||||
this._count=count;},_getPrefix:function(){return $('body').find('[data-editablePrefix]');}});}(jQuery,_));;
|
||||
;(function($,_,undefined){"use strict";ips.controller.register('core.front.core.tagEditorForm',{_placeholder:null,_menuID:'',_tagEditID:'',initialize:function(){this.on(document,'menuOpened',this.menuOpened);this.on(document,'menuClosed',this.menuClosed);this.on('submit','form',this.submitForm);this.setup();},setup:function(){this._menuID=this.scope.closest('.ipsMenu').attr('id').replace('_menu','');this._tagEditID=this._menuID.replace('elTagEditor_','');},menuClosed:function(e,data){if(data.elemID!=this._menuID){return;}
|
||||
this.scope.html(ips.templates.render('core.edittags.default'));},menuOpened:function(e,data){if(data.elemID!=this._menuID){return;}
|
||||
var self=this;var url=$(data.originalEvent.currentTarget).attr('href');ips.getAjax()(url).done(function(response){self._setLoading(false);self.scope.html(response);$(document).trigger('contentChange',[self.scope]);}).fail(function(){window.location=url;});},submitForm:function(e){e.preventDefault();var self=this;var form=$(e.currentTarget);var autoComplete=this.scope.find('[data-ipsAutocomplete]');autoComplete.trigger('blur');setTimeout(function(){if(ips.ui.autocomplete.getObj(autoComplete).hasErrors()){e.preventDefault();return;}
|
||||
self._setLoading(true);ips.getAjax()(form.attr('action'),{type:'post',data:form.serialize(),dataType:'json'}).done(function(response){self.scope.trigger('tagsUpdated',{tagEditID:self._tagEditID,tags:response.tags,prefix:response.prefix});self.scope.trigger('closeMenu');setTimeout(function(){self._setLoading(false);},200);}).fail(function(jqXHR,textStatus,errorThrown){if(jqXHR.responseJSON){ips.ui.alert.show({type:'alert',icon:'warn',message:jqXHR.responseJSON,callbacks:{}});}});},500);},_setLoading:function(loading){if(loading){if(!this._placeholder){this._buildPlaceholder();}
|
||||
self._setLoading(true);ips.getAjax()(form.attr('action'),{type:'post',data:form.serialize(),dataType:'json'}).done(function(response){self.scope.trigger('tagsUpdated',{tagEditID:self._tagEditID,tags:response.tags,prefix:response.prefix,tagsChanged:response.tagsChanged});self.scope.trigger('closeMenu');setTimeout(function(){self._setLoading(false);},200);}).fail(function(jqXHR,textStatus,errorThrown){if(jqXHR.responseJSON){ips.ui.alert.show({type:'alert',icon:'warn',message:jqXHR.responseJSON,callbacks:{}});}});},500);},_setLoading:function(loading){if(loading){if(!this._placeholder){this._buildPlaceholder();}
|
||||
var width=this.scope.outerWidth();var height=this.scope.outerHeight();this.scope.hide();this._placeholder.show().css({width:width+'px',height:height+'px'});}else{if(this._placeholder){this._placeholder.hide();this.scope.show();}}},_buildPlaceholder:function(){this._placeholder=$('<div/>').addClass('ipsLoading').hide();this.scope.after(this._placeholder);}});}(jQuery,_));;
|
||||
;(function($,_,undefined){"use strict";ips.controller.register('core.front.core.announcementBanner',{initialize:function(){this.setup();this.on('click','[data-role="dismissAnnouncement"]',this.dismissAnnouncement);},setup:function(){this.scope.find('[data-announcementId]').each(function(){var announcement=$(this);if(ips.utils.cookie.get('announcement_'+announcement.attr('data-announcementId'))){announcement.hide();}});},dismissAnnouncement:function(e){var element=$(e.target).closest('[data-announcementId]');var id=element.attr('data-announcementId');var date=new Date();date.setTime(date.getTime()+(7*86400000));ips.utils.cookie.set('announcement_'+id,true,date.toUTCString());element.slideUp({duration:400,complete:function(){$(this).remove();}});}});}(jQuery,_));;
|
||||
;(function($,_,undefined){"use strict";ips.controller.register('core.front.core.articlePages',{_currentPage:1,_pages:null,_articleID:'',initialize(){this.on('paginationClicked',this.paginationClicked);this.setup();},setup(){this._articleID=this._getArticleID();this.on(window,`historychange:article-${this._articleID}`,this.stateChange);this._setupPages();},stateChange(){if(!(('article-'+this._articleID)in ips.utils.history.getState())){return;}
|
||||
|
||||
@@ -83,8 +83,8 @@ this._getTextarea().innerText=JSON.stringify(restrictionSetting);this._getTextar
|
||||
e.preventDefault();var dialog=this.scope.closest('.ipsDialog');if(!dialog.length){return;}
|
||||
var elemId=dialog.attr('id').replace(/_dialog$/,'');var dialogObj=ips.ui.dialog.getObj($('#'+elemId));if(!dialogObj){return;}
|
||||
dialogObj.setLoading(true);ips.getAjax()($(e.currentTarget).attr('action')+'&ajaxValidate=1',{data:$(e.currentTarget).serialize(),type:'post'}).done(function(response,textStatus,jqXHR){if(jqXHR.getAllResponseHeaders().indexOf('X-IPS-FormError: true')!==-1||jqXHR.getAllResponseHeaders().indexOf('x-ips-formerror: true')!==-1){dialogObj.updateContent(jqXHR.responseText);$(document).trigger('contentChange',[$('#'+elemId)]);dialogObj.setLoading(false);}else if(jqXHR.getAllResponseHeaders().indexOf('X-IPS-FormNoSubmit: true')!==-1||jqXHR.getAllResponseHeaders().indexOf('x-ips-formnosubmit: true')!==-1){dialogObj.updateContent(jqXHR.responseText);$(document).trigger('contentChange',[$('#'+elemId)]);dialogObj.setLoading(false);}else{$(e.currentTarget).attr('data-bypassValidation',true).submit();}}).fail(function(jqXHR,textStatus,errorThrown){if(Debug.isEnabled()){Debug.error("Ajax request failed ("+status+"): "+errorThrown);Debug.error(jqXHR.responseText);}else{$(e.currentTarget).attr('data-bypassValidation',true).submit();}});},dismissDialog:function(e){var elemId=$('.ipsDialog').attr('id').replace(/_dialog$/,'');var dialogObj=ips.ui.dialog.getObj($('#'+elemId));dialogObj.hide();$('#'+elemId).data('_dialog','')}});}(jQuery,_));;
|
||||
;(function($,_,undefined){"use strict";ips.controller.register('core.admin.core.liveSearch',{_textField:null,_searchMenu:null,_resultsContainer:null,_lastValue:'',_results:{},_timers:{},_modal:null,_activePanel:null,_ajax:{},_defaultTab:null,initialize:function(){this.setup();this.on(document,'focus','#acpSearchKeyword',this.fieldFocus);this.on(document,'blur','#acpLiveSearch',this.fieldBlur);this.on(document,'click','.ipsModal',this.clickModal);this.on('itemClicked.sideMenu',this.changeSection);},setup:function(){this._searchMenu=this.scope.find('[data-role="searchMenu"]');this._resultsContainer=this.scope.find('[data-role="searchResults"]');this._defaultTab=this.scope.find('[data-role="defaultTab"]').attr('data-ipsMenuValue');this._textField=$('#acpSearchKeyword');this._textField.prop('autocomplete','off').prop('spellcheck',false).attr('aria-autocomplete','list').attr('aria-haspopup','true');this._activePanel=this._searchMenu.find('.ipsSideMenu_itemActive').attr('data-ipsMenuValue');},changeSection:function(e,data){this._activePanel=data.selectedItemID;this._showResultsInPanel(this._activePanel,this._results[this._activePanel]);},fieldFocus:function(e){this._timers.focus=setInterval(_.bind(this._timerFocus,this),700);if(this._textField.val()&&this._textField.val().length>=3){this._showResults();}},fieldBlur:function(e){clearInterval(this._timers);},clickModal:function(e){if(this._modal==null||$(e.currentTarget).attr('id')!=this._modal.attr('id')){return;}
|
||||
this._hideResults();},_timerFocus:function(){var currentValue=this._textField.val().trim();if(currentValue==this._lastValue||this._textField.val().trim().length<3){return;}
|
||||
;(function($,_,undefined){"use strict";ips.controller.register('core.admin.core.liveSearch',{_textField:null,_searchMenu:null,_resultsContainer:null,_lastValue:'',_results:{},_timers:{},_modal:null,_activePanel:null,_ajax:{},_defaultTab:null,initialize:function(){this.setup();this.on(document,'focus','#acpSearchKeyword',this.fieldFocus);this.on(document,'blur','#acpLiveSearch',this.fieldBlur);this.on(document,'click','.ipsModal',this.clickModal);this.on(document,'click','[data-role="closeLiveSearch"]',this.clickCloseButton);this.on('itemClicked.sideMenu',this.changeSection);},setup:function(){this._searchMenu=this.scope.find('[data-role="searchMenu"]');this._resultsContainer=this.scope.find('[data-role="searchResults"]');this._defaultTab=this.scope.find('[data-role="defaultTab"]').attr('data-ipsMenuValue');this._textField=$('#acpSearchKeyword');this._textField.prop('autocomplete','off').prop('spellcheck',false).attr('aria-autocomplete','list').attr('aria-haspopup','true');this._activePanel=this._searchMenu.find('.ipsSideMenu_itemActive').attr('data-ipsMenuValue');},changeSection:function(e,data){this._activePanel=data.selectedItemID;this._showResultsInPanel(this._activePanel,this._results[this._activePanel]);},fieldFocus:function(e){this._timers.focus=setInterval(_.bind(this._timerFocus,this),700);if(this._textField.val()&&this._textField.val().length>=3){this._showResults();}},fieldBlur:function(e){clearInterval(this._timers);},clickModal:function(e){if(this._modal==null||$(e.currentTarget).attr('id')!=this._modal.attr('id')){return;}
|
||||
this._hideResults();},clickCloseButton:function(e){this._hideResults();},_timerFocus:function(){var currentValue=this._textField.val().trim();if(currentValue==this._lastValue||this._textField.val().trim().length<3){return;}
|
||||
this._lastValue=currentValue;this._showResults();this._loadResults();},_hideResults:function(){ips.utils.anim.go('fadeOut fast',this._modal);ips.utils.anim.go('fadeOut',this.scope);},_showResults:function(){if(!this._modal){this._buildModal();}
|
||||
this._modal.css({zIndex:ips.ui.zIndex()});$('#ipsLayout_header').css({zIndex:ips.ui.zIndex()});this.scope.css({zIndex:ips.ui.zIndex()});if(!this.scope.is(':visible')){ips.utils.anim.go('fadeIn fast',this.scope);}
|
||||
if(!this._modal.is(':visible')){ips.utils.anim.go('fadeIn fast',this._modal);}},_loadResults:function(){var self=this;if(_.size(this._ajax)){_.each(this._ajax,function(ajax){try{if(_.isFunction(ajax.abort)){ajax.abort();Debug.log('aborted ajax');}}catch(err){}});}
|
||||
@@ -92,7 +92,7 @@ this.scope.find('[data-ipsMenuValue] [data-role="resultCount"]').addClass('ipsLo
|
||||
if(!self._searchMenu.find('[data-ipsMenuValue].ipsSideMenu_itemActive:not( .ipsSideMenu_itemDisabled )').length){self._selectFirstResultsTab();}
|
||||
if(response.length>0&&key==self._defaultTab&&self._activePanel==self._defaultTab){tab.click();}}).fail(function(err){});});},_selectFirstResultsTab:function(){var first=this._searchMenu.find('[data-ipsMenuValue]:not( .ipsSideMenu_itemDisabled )').first();first.click();},_setPanelToLoading:function(panel){var panelContainer=this._resultsContainer.find('[data-resultsSection="'+panel+'"]');panelContainer.addClass('ipsLoading').find('> ol').hide();},_showResultsInPanel:function(panel,results,animate){this._resultsContainer.find('[data-resultsSection]').hide();var panelContainer=this._resultsContainer.find('[data-resultsSection="'+panel+'"]');var panelList=panelContainer.find('> ol');if(!panelContainer.length){this._buildResultsContainer(panel);panelContainer=this._resultsContainer.find('[data-resultsSection="'+panel+'"]');panelList=panelContainer.find('> ol');}
|
||||
panelContainer.removeClass('ipsLoading');panelList.hide().html('');if(_.isUndefined(results)||_.isUndefined(results)||_.size(results)==0){panelList.html(ips.templates.render('core.livesearch.noResults')).show();return;}
|
||||
_.each(results,function(val){panelList.append(val);});var resultItems=panelList.find('[data-role="result"]').hide();var delay=25;panelList.show();panelContainer.show();if(animate==true){resultItems.each(function(){var item=$(this);setTimeout(function(){ips.utils.anim.go('fadeIn fast',item);},delay);delay+=25;});}else{resultItems.show();}},_buildResultsContainer:function(panel){this._resultsContainer.append($('<div/>').attr('data-resultsSection',panel).addClass('ipsScrollbar').append($('<ol/>')));},_buildModal:function(){this._modal=ips.ui.getModal();}});}(jQuery,_));;
|
||||
_.each(results,function(val){panelList.prepend(val);});var resultItems=panelList.find('[data-role="result"]').hide();var delay=25;panelList.show();panelContainer.show();if(animate==true){resultItems.each(function(){var item=$(this);setTimeout(function(){ips.utils.anim.go('fadeIn fast',item);},delay);delay+=25;});}else{resultItems.show();}},_buildResultsContainer:function(panel){this._resultsContainer.prepend($('<div/>').attr('data-resultsSection',panel).addClass('ipsScrollbar').append($('<ol/>')));},_buildModal:function(){this._modal=ips.ui.getModal();}});}(jQuery,_));;
|
||||
;(function($,_){"use strict";ips.controller.register('core.admin.core.nav',{_reordering:false,_orderChanged:false,_currentMenu:null,_menuTimer:null,initialize:function(){this.setup();this.on(document,'click','#acpMainArea',this.clickMainArea);this.on('click','[data-action="reorder"]',this.startReorder);this.on('click','[data-action="saveOrder"]',this.saveOrder);},setup:function(){const self=this;let activating;this._currentMenu=this.scope.find('.acpAppList_active');if(ips.utils.responsive.enabled()&&ips.utils.events.isTouchDevice()&&ips.utils.responsive.currentIs('tablet')){this.on('click','> li > a',this.handleTouchMenu);}else{$('#acpAppMenu').menuAim({rowSelector:"> #acpAppList > li:not( #elLogo )",enter:function(row){if($(row).attr('id')==='elReorderAppMenu'||$(row).attr('id')==='elHideMenu'){activating=self.scope.find('.acpAppList_active');}
|
||||
if(self._menuTimer){clearTimeout(self._menuTimer);}},activate:function(row){if($(row).attr('id')==='elReorderAppMenu'||$(row).attr('id')==='elHideMenu'){activating.addClass('acpAppList_active');}else{$(row).addClass('acpAppList_active');}},deactivate:function(row){$(row).removeClass('acpAppList_active');},exitMenu:function(){self._menuTimer=setTimeout(function(){self.scope.find('.acpAppList_active').removeClass('acpAppList_active');self._currentMenu.addClass('acpAppList_active');},2000);return false;}});}},handleTouchMenu(e){if($(e.currentTarget).hasClass('acpAppList_active')&&$(e.currentTarget).find('> .acpAppList__sub:visible').length){return;}
|
||||
e.preventDefault();this.scope.find('.acpAppList_active').removeClass('acpAppList_active').find('> .acpAppList__sub').hide();$(e.currentTarget).closest('li').addClass('acpAppList_active').find('> .acpAppList__sub').show();},clickMainArea(){if(ips.utils.responsive.enabled()&&ips.utils.events.isTouchDevice()&&ips.utils.responsive.currentIs('tablet')){this.scope.find('.acpAppList_active .acpAppList__sub').hide();}else{if(!this._reordering){$('#acpAppList').removeClass('acpAppList_childHovering').find('> li').trigger('mouseleave');}}},startReorder(){const self=this;this.scope.find('> li:not( #elReorderAppMenu ):not( #elHideMenu ) > a').each(function(){$(this).append(ips.templates.render('core.appMenu.reorder'));});this.scope.find('> li > ul > li h3').each(function(){$(this).prepend(ips.templates.render('core.appMenu.reorder'));});ips.utils.anim.go('zoomIn',this.scope.find('[data-role="reorder"]'));this.scope.addClass('acpAppList_reordering').sortable({start(e,ui){ui.item.addClass('acpAppList_dragging');},stop(e,ui){ui.item.removeClass('acpAppList_dragging');},update(){self._orderChanged=true;}}).find('#elReorderAppMenu').find('[data-action="reorder"]').addClass('ipsHide').end().find('[data-action="saveOrder"]').removeClass('ipsHide');this.getSubMenus().sortable({start(e,ui){ui.item.addClass('acpAppList_dragging');},stop(e,ui){ui.item.removeClass('acpAppList_dragging');},update(){self._orderChanged=true;}});this._reordering=true;this._orderChanged=false;},getSubMenus(tab){return this.scope.find('> li[data-tab'+(tab?`="${tab}"`:``)+']').find("> ul, > .acpAppList__sub > ul");},saveOrder(){this.scope.find('[data-role="reorder"]').remove();const tabOrder=this.scope.sortable('toArray',{attribute:'data-tab'}).filter(i=>!!i);const menuOrder={};const self=this;_.each(tabOrder,function(val){if(val){menuOrder[val]=self.getSubMenus(val).sortable('toArray',{attribute:'data-menuKey'})?.filter(i=>!!i);if(!Array.isArray(menuOrder[val])){ips.ui.alert.show({icon:'warning',message:ips.getString('tab_order_not_saved')});throw new TypeError(`Couldn't get the submenu sortable`);}}});this.scope.removeClass('acpAppList_reordering').find('#elReorderAppMenu').find('[data-action="reorder"]').removeClass('ipsHide').end().find('[data-action="saveOrder"]').addClass('ipsHide');if(this._orderChanged){ips.getAjax()('?app=core&module=system&controller=ajax&do=saveTabs',{data:{tabOrder,menuOrder},dataType:'json',type:'post'}).done(function(){ips.ui.flashMsg.show(ips.getString('tab_order_saved'));}).fail(function(){ips.ui.alert.show({icon:'warning',message:ips.getString('tab_order_not_saved')});});}
|
||||
|
||||
@@ -809,7 +809,21 @@ buildIro();wrap?.addEventListener('pointerdown',e=>{if(e.target.closest('[data-r
|
||||
e.stopPropagation();if(unlimited){const sel=document.getSelection();const activeElement=document.activeElement;const wasFocused=controller==='label'&&((activeElement===label)||(activeElement.parentElement?.closest?.('.ipsInput__color-label')===label));const ranges=[];for(let i=0;i<sel.rangeCount;i++){ranges.push(sel.getRangeAt(i));}
|
||||
let currentText=label.innerText;unlimited.checked=false;updateColor(e);if(label.innerText!==currentText){e.preventDefault();let sel=document.getSelection();if(!wasFocused||(e instanceof PointerEvent&&e.detail>=2)){sel.removeAllRanges();const range=document.createRange();range.selectNodeContents(label);if(!(e instanceof PointerEvent&&e.detail>2)&&label.innerText.startsWith('#')){const st=document.createTextNode('#');const textNode=document.createTextNode(label.innerText.slice(1));label.innerHTML="";label.appendChild(st);label.appendChild(textNode);range.selectNodeContents(textNode);}else{const text=document.createTextNode(label.innerText);label.innerHTML="";label.append(text);range.selectNodeContents(text);}
|
||||
sel.addRange(range);}else if(wasFocused){sel.removeAllRanges();ranges.forEach(range=>{sel.addRange(range);})}}}
|
||||
iroWrap.classList.add('ipsInput__color-iro-container--open');});label.addEventListener('input',e=>{controller='label';const text=label.innerText;try{input.value=(new ips.utils.iro.Color(text)).hexString;buildIro();updateColor({target:input},true);}catch(e){}});document.addEventListener('pointerdown',e=>{if(e.target.closest('.ipsInput__color-wrap-inner')!==wrap&&iroWrap.classList.contains('ipsInput__color-iro-container--open')){iroWrap.classList.remove('ipsInput__color-iro-container--open');}});});const updateColor=(e,skipLabel=false)=>{if(unlimited&&e?.target===input){unlimited.checked=false;}
|
||||
iroWrap.classList.add('ipsInput__color-iro-container--open');});label.addEventListener('input',e=>{controller='label';const text=label.innerText;try{input.value=(new ips.utils.iro.Color(text)).hexString;buildIro();updateColor({target:input},true);}catch(e){Debug.error(e);}});function handleDataTransfer(e){const dt=e instanceof ClipboardEvent?e.clipboardData:e.dataTransfer;if(dt instanceof DataTransfer){e.preventDefault();e.stopPropagation();const allTypes=[...dt.types];let textFound;if(allTypes.includes('text/plain')){Debug.log("Using plain text from paste or drop event");textFound=dt.getData('text/plain');}else if(allTypes.includes('text/html')){Debug.log("Using html from paste or drop event");const cleanText=(new DOMParser()).parseFromString(dt.getData('text/html'),'text/html').body.innerText;if(cleanText){textFound=cleanText;}}
|
||||
if(textFound){textFound=textFound.replaceAll(/\s+/g,' ').trim().slice(0,30).trim();const selection=document.getSelection();const text=document.createTextNode(textFound);let usingExistingRange=false;for(let i=0;i<selection.rangeCount;i++){const existingRange=selection.getRangeAt(i);if(existingRange.intersectsNode(label)){const isDescendant=(descendant,ancestor)=>{while(descendant){if(descendant===ancestor){return true;}
|
||||
descendant=descendant.parentNode;}
|
||||
return false;}
|
||||
if(!isDescendant(existingRange.startContainer,label)){existingRange.setStart(label,0);}
|
||||
if(!isDescendant(existingRange.endContainer,label)){existingRange.setEnd(label,label.childNodes.length);}
|
||||
usingExistingRange=true;existingRange.deleteContents();existingRange.insertNode(text);existingRange.collapse(false);break;}}
|
||||
selection.removeAllRanges();const newRange=document.createRange();if(!usingExistingRange){label.innerHTML="";label.appendChild(text);}
|
||||
newRange.setStartAfter(text);newRange.setEndAfter(text);selection.addRange(newRange);if(label.innerText.trim().length>30){let precedingTextLength=0;for(let node of label.childNodes){if(node===text){break;}
|
||||
if(node instanceof Text){precedingTextLength+=node.wholeText.length;}else if(node instanceof Element){precedingTextLength+=node.innerText.length;}}
|
||||
const replacementTextNode=document.createTextNode(label.innerText.trim().slice(0,30));label.innerHTML="";label.appendChild(replacementTextNode);if(precedingTextLength){const correctedRange=document.createRange();correctedRange.setStart(replacementTextNode,Math.min(30,precedingTextLength));correctedRange.setEnd(replacementTextNode,Math.min(30,precedingTextLength));selection.removeAllRanges();selection.addRange(correctedRange);}}
|
||||
controller='label';try{input.value=(new ips.utils.iro.Color(label.innerText)).hexString;buildIro();updateColor({target:input},true);}catch(e){Debug.error(e);}
|
||||
return;}
|
||||
ips.ui.flashMsg.show(ips.getString('form_color_datatransfer_fail'));}}
|
||||
label.addEventListener('drop',handleDataTransfer);label.addEventListener('paste',handleDataTransfer);document.addEventListener('pointerdown',e=>{if(e.target.closest('.ipsInput__color-wrap-inner')!==wrap&&iroWrap.classList.contains('ipsInput__color-iro-container--open')){iroWrap.classList.remove('ipsInput__color-iro-container--open');}});});const updateColor=(e,skipLabel=false)=>{if(unlimited&&e?.target===input){unlimited.checked=false;}
|
||||
if(unlimited?.checked){wrap?.classList.add('ipsInput--color-disabled');if(label){label.innerHTML="";}
|
||||
return;}
|
||||
wrap?.classList.remove('ipsInput--color-disabled');let textColor;if(ips.utils.iro?.colorPackage){const color=new ips.utils.iro.colorPackage(input.value);if(color.to('oklab').toGamut().l<0.71){textColor="#fff";}else{textColor="#000";}}else{const[_,__,l]=input.value.match(/#[0-9a-f]{3,8}/i)?ips.utils.color.RGBtoHSL(...ips.utils.color.hexToRGB(input.value.match(/#([0-9a-f]{3,8})/i)[1])):[null,null,null];textColor=typeof l==="number"?(l<0.6?"#fff":"#000"):initialColor;}
|
||||
|
||||
@@ -119,7 +119,8 @@ document.addEventListener('mouseup',clearMouseUpResolvers,{capture:true})
|
||||
document.addEventListener('selectionchange',_.debounce(()=>{const selection=document.getSelection();for(let i=0;i<selection.rangeCount;i++){const range=selection.getRangeAt(i);const quoteBox=range.commonAncestorContainer instanceof Text?range.commonAncestorContainer.parentElement.closest('[data-role="commentContent"]'):range.commonAncestorContainer.closest('[data-role="commentContent"]')
|
||||
if(quoteBox instanceof Element){mouseUp().then(()=>quoteBox.dispatchEvent(new CustomEvent('ipsCalcQuote',{bubbles:true})))
|
||||
break;}}},400))}(jQuery,_));;
|
||||
;(function($,_,undefined){"use strict";ips.controller.register('core.front.core.commentFeed',{_overlay:null,_commentFeedID:0,_newRepliesFlash:null,_maximumMultiQuote:50,_pageParam:'page',_seoPagination:false,_urlParams:{},_baseURL:'',_doneInitialState:false,_initialURL:'',_pollingEnabled:true,_pollingActive:false,_pollingPaused:false,_initialPoll:10000,_currentPoll:10000,_decay:20000,_maxInterval:(30*60)*1000,_pollingTimeout:null,_pollAjax:null,_pollOnUnpaused:false,_notification:null,_lastSeenTotal:0,initialize(){this._containerID=this.scope.closest('[data-commentsContainer]').length?this.scope.closest('[data-commentsContainer]').attr('data-commentsContainer'):this.scope.identify().attr('id');this.on('submit','[data-role="replyArea"]',this.quickReply);this.on('quoteComment.comment',this.quoteComment);this.on('addMultiQuote.comment',this.addMultiQuote);this.on('removeMultiQuote.comment deleteComment.comment',this.removeMultiQuote);this.on('click','[data-action="filterClick"]',this.filterClick);this.on('menuItemSelected','[data-role="signatureOptions"]',this.signatureOptions);this.on('editorCompatibility',this.editorCompatibility);this.on('checkedComment.comment',this.checkedComment);this._boundMQ=_.bind(this.doMultiQuote,this);this._boundCMQ=_.bind(this.clearMultiQuote,this);$(document).on('click','[data-role="multiQuote_'+this._containerID+'"]',this._boundMQ);$(document).on('click','[data-action="clearQuoted_'+this._containerID+'"]',this._boundCMQ);$(document).on('moderationSubmitted',this.clearLocalStorage);this.on('paginationClicked paginationJump',this.paginationClick);this.on(document,'addToCommentFeed',this.addToCommentFeed);this.on('deletedComment.comment',this.deletedComment);this.on(document,'click','[data-action="loadNewPosts"]',this.loadNewPosts);this.on(window,'historychange',this.stateChange);this.on(document,"socket.new_comment",this.handleSocketCommentTrigger);this.setup();},setup:function(){const replyForm=this.scope.find('[data-role="replyArea"] form');this._commentFeedID=this.scope.attr('data-feedID');this._urlParams=this._getUrlParams();this._baseURL=this.scope.attr('data-baseURL');this._initialURL=window.location.href;this._currentPage=ips.utils.url.getPageNumber(this._pageParam);this._urlParams[this._pageParam]=this._currentPage;if(this._baseURL.match(/\?[^?]+$/)){this._baseURL+='&';}else{this._baseURL+='?';}
|
||||
;(function($,_,undefined){"use strict";ips.controller.register('core.front.core.commentFeed',{_overlay:null,_commentFeedID:0,_newRepliesFlash:null,_maximumMultiQuote:50,_pageParam:'page',_seoPagination:false,_urlParams:{},_baseURL:'',_doneInitialState:false,_initialURL:'',_pollingEnabled:true,_pollingActive:false,_pollingPaused:false,_initialPoll:10000,_currentPoll:10000,_decay:20000,_maxInterval:(30*60)*1000,_pollingTimeout:null,_pollAjax:null,_pollOnUnpaused:false,_notification:null,_lastSeenTotal:0,initialize(){this._containerID=this.scope.closest('[data-commentsContainer]').length?this.scope.closest('[data-commentsContainer]').attr('data-commentsContainer'):this.scope.identify().attr('id');this.on('submit','[data-role="replyArea"]',this.quickReply);this.on('quoteComment.comment',this.quoteComment);this.on('addMultiQuote.comment',this.addMultiQuote);this.on('removeMultiQuote.comment deleteComment.comment',this.removeMultiQuote);this.on('click','[data-action="filterClick"]',this.filterClick);this.on('menuItemSelected','[data-role="signatureOptions"]',this.signatureOptions);this.on('editorCompatibility',this.editorCompatibility);this.on('checkedComment.comment',this.checkedComment);if(this.elem?.dataset.pageParam){this._pageParam=this.elem.dataset.pageParam;}
|
||||
this._boundMQ=_.bind(this.doMultiQuote,this);this._boundCMQ=_.bind(this.clearMultiQuote,this);$(document).on('click','[data-role="multiQuote_'+this._containerID+'"]',this._boundMQ);$(document).on('click','[data-action="clearQuoted_'+this._containerID+'"]',this._boundCMQ);$(document).on('moderationSubmitted',this.clearLocalStorage);this.on('paginationClicked paginationJump',this.paginationClick);this.on(document,'addToCommentFeed',this.addToCommentFeed);this.on('deletedComment.comment',this.deletedComment);this.on(document,'click','[data-action="loadNewPosts"]',this.loadNewPosts);this.on(window,'historychange',this.stateChange);this.on(document,"socket.new_comment",this.handleSocketCommentTrigger);this.setup();},setup:function(){const replyForm=this.scope.find('[data-role="replyArea"] form');this._commentFeedID=this.scope.attr('data-feedID');this._urlParams=this._getUrlParams();this._baseURL=this.scope.attr('data-baseURL');this._initialURL=window.location.href;this._currentPage=ips.utils.url.getPageNumber(this._pageParam);this._urlParams[this._pageParam]=this._currentPage;if(this._baseURL.match(/\?[^?]+$/)){this._baseURL+='&';}else{this._baseURL+='?';}
|
||||
if(replyForm.attr('data-noAjax')){this._pollingEnabled=false;}
|
||||
if(!('commentFeed'in ips.utils.history.getState())){this._updateState({})
|
||||
ips.utils.history.replaceState(this.historyState,'commentFeed',window.location.href)}
|
||||
|
||||
Reference in new issue
Block a user