Version 5.0.0 beta 4
This commit is contained in:
1 parent
e86153356a
commit
2f24f9de48
276 files changed
+8614
-6044
No files matched your search
@@ -32,7 +32,8 @@ for(const action of['quoteComment','multiQuoteComment','rateReview']){this.on('c
|
||||
this.on('submit','form',this.submitEdit);this.on('change','input[type="checkbox"][data-role="moderation"]',this.commentCheckbox);this.elem.addEventListener('ipsCalcQuote',()=>this.inlineQuote())
|
||||
this.on('click','[data-action="quoteSelection"]',this.quoteSelection);this.on('submitDialog','[data-action="recommendComment"]',this.recommendComment);this.on('click','[data-action="unrecommendComment"]',this.unrecommendComment);this.on('tabChanged',this.tabChanged);this.on('setMultiQuoteEnabled.comment setMultiQuoteDisabled.comment',this.setMultiQuote);this.on('disableQuoting.comment',this.disableQuoting);this.on(document,'getEditFormLoading.comment saveEditCommentLoading.comment '+
|
||||
'deleteCommentLoading.comment',this.commentLoading);this.on(document,'getEditFormDone.comment saveEditCommentDone.comment '+
|
||||
'deleteCommentDone.comment',this.commentDone);this.on(document,'getEditFormDone.comment',this.getEditFormDone);this.on(document,'getEditFormError.comment',this.getEditFormError);this.on(document,'saveEditCommentDone.comment',this.saveEditCommentDone);this.on(document,'saveEditCommentError.comment',this.saveEditCommentError);this.on(document,'deleteCommentDone.comment',this.deleteCommentDone);this.on(document,'deleteCommentError.comment',this.deleteCommentError);this.on(document,'unrecommendCommentDone.comment',this.unrecommendCommentDone);this.on(document,'unrecommendCommentError.comment',this.unrecommendCommentError);this.on(document,'approveCommentLoading.comment',this.approveCommentLoading);this.on(document,'approveCommentDone.comment',this.approveCommentDone);this.on(document,'approveCommentError.comment',this.approveCommentError);this.setup();},setup:function(){this._commentID=this.scope.attr('data-commentID');this._clickHandler=_.bind(this._hideQuoteTooltip,this);this._setupIntersectionObserver();this._setupShareCommentDialog();},destroy:function(){},tabChanged:function(e,data){this._menu=undefined;this.getMenu();},inlineQuote:function(){var self=this;var quoteButton=this.scope.find('[data-action="quoteComment"]');if(this._isEditing||this._quotingDisabled||!quoteButton.length){return;}
|
||||
'deleteCommentDone.comment',this.commentDone);this.on(document,'getEditFormDone.comment',this.getEditFormDone);this.on(document,'getEditFormError.comment',this.getEditFormError);this.on(document,'saveEditCommentDone.comment',this.saveEditCommentDone);this.on(document,'saveEditCommentError.comment',this.saveEditCommentError);this.on(document,'deleteCommentDone.comment',this.deleteCommentDone);this.on(document,'deleteCommentError.comment',this.deleteCommentError);this.on(document,'unrecommendCommentDone.comment',this.unrecommendCommentDone);this.on(document,'unrecommendCommentError.comment',this.unrecommendCommentError);this.on(document,'approveCommentLoading.comment',this.approveCommentLoading);this.on(document,'approveCommentDone.comment',this.approveCommentDone);this.on(document,'approveCommentError.comment',this.approveCommentError);this.setup();},setup:function(){this._commentID=this.scope.attr('data-commentID');this._clickHandler=_.bind(this._hideQuoteTooltip,this);this._setupIntersectionObserver();this._setupShareCommentDialog();const fragment=window.location.hash;const match=fragment.match(/#find(Review|Comment)-(\d+)/);if(match){const type=match[1]
|
||||
const commentId=match[2];const elementId=`find${type}-${commentId}`;const element=document.getElementById(elementId);if(!element){var currentUrl=new URL(window.location.href);currentUrl.searchParams.set('do',`find${type}`);currentUrl.searchParams.set(type.toLowerCase(),commentId);window.location.href=currentUrl;}}},destroy:function(){},tabChanged:function(e,data){this._menu=undefined;this.getMenu();},inlineQuote:function(){var self=this;var quoteButton=this.scope.find('[data-action="quoteComment"]');if(this._isEditing||this._quotingDisabled||!quoteButton.length){return;}
|
||||
clearInterval(this._quoteTimeout);this._quoteTimeout=setInterval(function(){self._checkQuoteStatus();},400);},recommendComment:function(e,data){var commentHtml=$('<div>'+data.response.comment+'</div>').find('[data-controller="core.front.core.comment"]').html();this.scope.html(commentHtml).closest('.ipsEntry').addClass('ipsEntry--popular');$(document).trigger('contentChange',[this.scope]);if(ips.utils.db.isEnabled()){this.scope.find('[data-action="multiQuoteComment"]').removeClass('ipsHide');}
|
||||
this.trigger('refreshRecommendedComments',{scroll:true,recommended:data.response.recommended});},unrecommendComment:function(e,data){e.preventDefault();var url=$(e.currentTarget).attr('href');this.trigger('unrecommendComment.comment',{url:url,commentID:this._commentID});},unrecommendCommentDone:function(e,data){if(data.commentID!=this._commentID){return;}
|
||||
var commentHtml=$('<div>'+data.comment+'</div>').find('[data-controller="core.front.core.comment"]').html();console.log(commentHtml);this.scope.html(commentHtml).closest('.ipsEntry').removeClass('ipsEntry--popular').find('.ipsEntry__popularFlag').remove();ips.ui.flashMsg.show(ips.getString('commentUnrecommended'));this.trigger('removeRecommendation',{commentID:data.unrecommended});},unrecommendCommentError:function(e,data){if(data.commentID!=this._commentID){return;}
|
||||
@@ -238,7 +239,7 @@ return notifyData;},_showNotification(notifyData,type){if(!document[ips.utils.ev
|
||||
if($('#elFlashMessage').is(':visible')&&$('#elFlashMessage').find('[data-role="newNotification"]').length){$('#elFlashMessage').find('[data-role="newNotification"]').replaceWith(html);}else{ips.ui.flashMsg.show(html,{timeout:8,position:'bottom',extraClasses:'cNotificationFlash',dismissable:function(){self._stopPolling();},escape:false});}},_updateTimestamp(){let storage=ips.utils.db.get('notifications',ips.getSetting('baseURL'));storage=_.extend(storage,{timestamp:ips.utils.time.timestamp()});ips.utils.db.set('notifications',ips.getSetting('baseURL'),storage);},_updateIcons(newData,oldData){const reportBadge=this.scope.find('[data-notificationType="reports"]');const reportCount=reportBadge.length?parseInt(reportBadge.text()):0;const notifyData={notifications:parseInt(newData.notifications),reports:reportCount};if(parseInt(newData.notifications)!==oldData.notifications){this._updateIcon('notify',newData.notifications);this.scope.trigger('clearUserbarCache',{type:'notify'});}
|
||||
if(this._messagesEnabled){if(parseInt(newData.messages)!==oldData.messages){this._updateIcon('inbox',newData.messages);this.scope.trigger('clearUserbarCache',{type:'inbox'});}
|
||||
notifyData.messages=parseInt(newData.messages);}},_updateIcon(type,count){const icon=this._getIcon(type);icon.attr('data-currentCount',count).text(count);if(parseInt(count)){ips.utils.anim.go((!icon.is(':visible'))?'zoomIn':'pulseOnce',icon.removeClass('ipsHide'));}else{icon.fadeOut();}},_getIcon(type){return $('body').find('[data-notificationType="'+type+'"]');},_getCurrentCounts(){const messages=this.scope.find('[data-notificationType="inbox"]');const notifications=this.scope.find('[data-notificationType="notify"]');return{notifications:parseInt(notifications.attr('data-currentCount')),messages:(messages.length)?parseInt(messages.attr('data-currentCount')):null};},_stopPolling(){Debug.info("Stopping instant notification polling");clearInterval(this._interval);this._paused=true;}});}(jQuery,_));;
|
||||
;(function($,_,undefined){"use strict";const IMAGE_EXTENSIONS=new Set(['gif','jpeg','jpe','jpg','png','svg','webp'])
|
||||
;(function($,_,undefined){"use strict";const IMAGE_EXTENSIONS=new Set(['gif','jpeg','jpe','jpg','png','svg','webp','avif'])
|
||||
ips.controller.register('core.front.core.lightboxedImages',{_random:null,initialize:function(){var self=this;this.on('initializeImages',this.refreshContent);this.on('refreshContent',this.refreshContent);this.on(document,'imageRotated',function(e,data){var attachment=$(self.scope).find('.ipsAttachLink_image img[data-fileId='+data.fileId+']');self._updateAttachmentImage(attachment,data);});this.setup();},setup:function(){this._random='g'+(Math.round(Math.random()*100000));this._initializeAttachments();this._initializeImages();},refreshContent:function(e){Debug.log("Refreshing content in lightboxedImages");this.scope.removeAttr('data-loaded');this._initializeAttachments();this._initializeImages();e.stopPropagation();},_initializeAttachments:function(){var fileIDsToFetch={};var self=this;var attachments=this.scope.find('[data-fileid]').not(function(idx,elem){var elem=$(elem);return elem.is('source, video')||elem.find('source, video').length;});if(!attachments.length){return;}
|
||||
attachments.each(function(){var attachment=$(this);if(!_.isUndefined(attachment.attr('data-loaded'))){return;}
|
||||
if(!(attachment.is('img, .ipsAttachLink_image'))){var parent=attachment.parent();var clone=parent.clone();clone.children().remove();clone.text(clone.text().replace(/\s/g,''));if(!clone.text().length&&attachment.parentsUntil(this.scope,'li').length===0){attachment.addClass('ipsAttachLink_block');if(attachment.children().length){return;}
|
||||
|
||||
Reference in new issue
Block a user