Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
@@ -0,0 +1 @@
|
||||
;(function($,_,undefined){"use strict";ips.controller.register('forums.admin.settings.archiveRules',{initialize:function(){this.on('change','input,select',this.changeField);this.on('nodeSelectedChanged','.ipsSelectTree',this.changeField);this.on('tokenAdded','[data-ipsAutocomplete]',this.changeField);this.on('tokenDeleted','[data-ipsAutocomplete]',this.changeField);this.setup();},setup:function(){var currentPercentage=parseInt(this.scope.find('[data-role="percentage"]').text());this.scope.find('.ipsProgress').toggleClass('i-opacity_4',!currentPercentage);},changeField:function(e){var form=$(e.currentTarget).closest('form');var self=this;ips.getAjax()(form.attr('action')+'&getCount=1',{data:form.serialize(),type:'post'}).done(function(response){var currentPercentage=parseInt(self.scope.find('[data-role="percentage"]').text());self.scope.find('.ipsProgress').toggleClass('i-opacity_4',!parseInt(response.percentage)).end().find('[data-role="percentage"]').text(response.percentage).end().find('[data-role="number"]').text(response.count).end().find('[data-role="percentageBar"]').animate({'width':response.percentage+'%'},'fast');}).fail(function(err){});},});}(jQuery,_));;
|
||||
@@ -0,0 +1,17 @@
|
||||
;(function($,_,undefined){"use strict";ips.controller.register('forums.front.forum.flow',{_ids:[],_button:null,_rootForum:null,urlParam:'forumId',initialize:function(){this.on('click','[data-node-id]',this.toggleFilters);this.setup();},setup:function(){var self=this;if(!_.isUndefined(this.scope.attr('data-rootForum'))){this._rootForum=this.scope.attr('data-rootForum');}
|
||||
if(this._rootForum){this.urlParam='forumId'+this._rootForum;}
|
||||
var _ids=ips.utils.url.getParam(this.urlParam);if(!_.isUndefined(_ids)){this._ids=decodeURIComponent(_ids).split(',');}else if(this._rootForum){var found=false;if(!_.isUndefined(ips.utils.cookie.get('forums_flowIdsRoots'))){try{var _jsonIds=JSON.parse(ips.utils.cookie.get('forums_flowIdsRoots'))[this._rootForum];found=true;if(!_.isUndefined(_jsonIds)){this._ids=_jsonIds;}}catch(exc){}}
|
||||
if(!found){this.scope.find('[data-node-id]').each(function(i,node){var id=$(node).attr('data-node-id');self._ids.push(id);});}}else if(!_.isUndefined(ips.utils.cookie.get('forums_flowIds'))){this._ids=ips.utils.cookie.get('forums_flowIds').split(',');}
|
||||
if(_.isObject(this._ids)&&_.size(this._ids)){_.each(this._ids,function(val,key){if(val){self.childSelect(val,true);}});}
|
||||
if(_.isUndefined(_ids)&&this._ids.length&&this._rootForum===null){$(document).trigger('updateTableURL',{[this.urlParam]:_.uniq(_.values(this._ids)).join(',')});}
|
||||
this._button=$('body').find('[data-role="fluidForumMobileDesc"]');this._updateButtonText();},toggleFilters:function(e){e.preventDefault();var link=$(e.currentTarget);var id=link.attr('data-node-id');var parentId=link.attr('data-parent-id');var hasChildren=link.attr('data-has-children');if(_.indexOf(this._ids,id)==-1){this.childSelect(id,false);}else{this.childUnselect(id);}
|
||||
this._updateButtonText();$(document).trigger('updateTableURL',{[this.urlParam]:_.uniq(_.values(this._ids)).join(',')});},isSelected:function(id){return this.scope.find('[data-node-id="'+id+'"]').hasClass('cForumMiniList__selected')?true:false;},childSelect:function(id,skipChildren){Debug.log("Select child: "+id);this._ids.push(id);var node=this.scope.find('[data-node-id="'+id+'"]');node.addClass('cForumMiniList__selected');var parentId=node.attr('data-parent-id');if(skipChildren===false&&(node.attr('data-has-children')||id==parentId)){var self=this;_.each(this.scope.find('[data-parent-id="'+id+'"]'),function(v,k){var _cId=$(v).attr('data-node-id');if(_cId!=id){self.childSelect(_cId,false);}});}
|
||||
this.updateCookie();},childUnselect:function(id){Debug.log("UNselect child: "+id);this.scope.find('[data-node-id="'+id+'"]').removeClass('cForumMiniList__selected');this._ids=_.without(this._ids,id);this.updateCookie();if(this._rootForum===null){var self=this;_.each(this.scope.find('[data-parent-id="'+id+'"]'),function(v,k){var _cId=$(v).attr('data-node-id');if(_cId!=id){self.childUnselect(_cId);}});this.parentUnselect(this.scope.find('[data-node-id="'+id+'"]').closest('[data-category]').find('[data-node-id]').first().attr('data-node-id'));}},parentSelect:function(parentId){Debug.log("Select parent: "+parentId);this.scope.find('[data-node-id="'+parentId+'"]').addClass('cForumMiniList__selected');if(this._rootForum===null){var self=this;_.each(this.scope.find('[data-parent-id="'+parentId+'"]'),function(v,k){var _cId=$(v).attr('data-node-id');if(_cId!=parentId){self.childUnselect(_cId);}});}else{this.updateCookie();}},parentUnselect:function(parentId){Debug.log("UNselect parent: "+parentId);var node=this.scope.find('[data-node-id="'+parentId+'"]');node.removeClass('cForumMiniList__selected');this._ids=_.without(this._ids,parentId);this.updateCookie();Debug.log("Looking for parent ID "+node.attr('data-parent-id'));if(this._rootForum===null){var self=this;_.each(this.scope.find('[data-node-id="'+node.attr('data-parent-id')+'"]'),function(v,k){var _cId=$(v).attr('data-node-id');if(_cId!=parentId){Debug.log("Found "+_cId);self.parentUnselect(_cId);}});}},updateCookie:function(id){var cookie=_.uniq(_.values(this._ids)).join(',');Debug.log("Updating cookie: "+cookie);if(!this._rootForum){ips.utils.cookie.set('forums_flowIds',cookie,true);}else{var _json={};if(!_.isUndefined(ips.utils.cookie.get('forums_flowIdsRoots'))){_json=JSON.parse(ips.utils.cookie.get('forums_flowIdsRoots'));}
|
||||
_json[this._rootForum]=_.uniq(_.values(this._ids));ips.utils.cookie.set('forums_flowIdsRoots',JSON.stringify(_json),true);Debug.log("Updating cookie: "+JSON.stringify(_json));}},_updateButtonText:function(){var blobs=this.scope.find('.cForumMiniList__blob');var selectedBlobRows=blobs.filter(function(){if($(this).closest('.cForumMiniList__selected').length){return true;}
|
||||
return false;});var text='';if(blobs.length==selectedBlobRows.length||selectedBlobRows.length===0){text=ips.getString('topicsFromAllForums');}else{text=ips.pluralize(ips.getString('topicsFromXForums'),selectedBlobRows.length);}
|
||||
this._button.text(text);}});}(jQuery,_));;
|
||||
;(function($,_){"use strict";ips.controller.register('forums.front.forum.forumList',{initialize(){this.on('ips:toggleForumCategory',this.toggleCategory);this.setup();},setup(){let hiddenCategories=ips.utils.db.get('hiddenCategories');if(_.isObject(hiddenCategories)&&_.size(hiddenCategories)){_.each(hiddenCategories,function(val,key){document.querySelector("[aria-controls='forum-category_"+key+"']")?.setAttribute('aria-expanded','false');document.getElementById('forum-category_'+key)?.setAttribute('hidden','');});}},toggleCategory(e){const category=e.target;const categoryID=category.closest('[data-categoryID]')?.dataset.categoryid;if(!category||!categoryID){Debug.warn(`The forum list got a category hidden toggle event but couldn't determine which category was toggled`);return;}
|
||||
if(e.detail.hidden){ips.utils.db.set('hiddenCategories',categoryID,true);}else{ips.utils.db.remove('hiddenCategories',categoryID);}}});}(jQuery,_));;
|
||||
;(function($,_,undefined){"use strict";ips.controller.register('forums.front.forum.forumPage',{initialize:function(){this.on('click','[data-action="markForumRead"]',this.markForumRead);},markForumRead(e){e.preventDefault();ips.ui.alert.show({type:'confirm',icon:'question',message:ips.getString('markForumAsReadConfirm'),subText:'',callbacks:{ok:()=>{const url=$(e.currentTarget).attr('href');ips.getAjax()(url,{showLoading:true,bypassRedirect:true}).done(()=>{this.triggerOn('core.global.core.table','markTableRead');ips.utils.anim.go('fadeOut',$(e.currentTarget));ips.ui.flashMsg.show(ips.getString('forumMarkedRead'));}).fail(function(jqXHR,textStatus,errorThrown){window.location=url;});}}});}});}(jQuery,_));;
|
||||
;(function($,_,undefined){"use strict";ips.controller.register('forums.front.forum.hovercard',{initialize:function(){this.on('click','[data-action="markTopicRead"]',this.markTopicRead);},markTopicRead:function(e){e.preventDefault();if($(e.currentTarget).attr('data-disabled')){return;}
|
||||
this.trigger('markTableRowRead',{tableID:'topics',rowID:this.scope.attr('data-topicID')});ips.ui.flashMsg.show(ips.getString('topicMarkedRead'));ips.getAjax()($(e.currentTarget).attr('href'),{bypassRedirect:true});$(e.currentTarget).addClass('i-opacity_4').attr('data-disabled');}});}(jQuery,_));;
|
||||
@@ -0,0 +1,18 @@
|
||||
;(function($,_,undefined){"use strict";ips.controller.register('forums.front.topic.activity',{initialize:function(){this.on('click','[data-action="toggleOverview"]',this.toggleOverview);},toggleOverview:function(e){e.preventDefault();if(this.scope.hasClass('cTopicOverview--expanded')){this.scope.find('[data-role="preview"]').removeClass('ipsHide');this.scope.find('[data-role="overview"]').addClass('ipsHide');this.scope.removeClass('cTopicOverview--expanded');}else{this.scope.find('[data-role="preview"]').addClass('ipsHide');this.scope.find('[data-role="overview"]').removeClass('ipsHide');this.scope.addClass('cTopicOverview--expanded');}}});}(jQuery,_));;
|
||||
;(function($,_,undefined){"use strict";ips.controller.register('forums.front.topic.answers',{ajaxObj:null,initialize:function(){this.on('click','a.cAnswerRate',this.rate);},rate:function(e){e.preventDefault();var self=this;var clicked=$(e.currentTarget);if(this.scope.find('.cAnswerRate_up').is('.i-color_positive')){var currentVote='positive';}
|
||||
else if(this.scope.find('.cAnswerRate_down').is('.i-color_negative')){var currentVote='negative';}
|
||||
else{var currentVote=false;}
|
||||
var positive=clicked.hasClass('cAnswerRate_up');var voteCount=this.scope.find('[data-role="voteCount"]');var currentVotes=parseInt(voteCount.attr('data-voteCount'));var newVoteCount=0;var setPositive=false;var setNegative=false;if(currentVote!==false){if(positive&¤tVote=='positive'){newVoteCount=currentVotes-1;}
|
||||
else if(!positive&¤tVote=='negative'){newVoteCount=currentVotes+1;}
|
||||
else if(!positive&¤tVote=='positive'){newVoteCount=currentVotes-2;setNegative=true;}
|
||||
else if(positive&¤tVote=='negative'){newVoteCount=currentVotes+2;setPositive=true;}}
|
||||
else if(positive){newVoteCount=currentVotes+1;setPositive=true;}
|
||||
else{newVoteCount=currentVotes-1;setNegative=true;}
|
||||
this.setStyles(setPositive,setNegative);voteCount.toggleClass('i-color_positive',setPositive).toggleClass('i-color_negative',setNegative).text(newVoteCount).attr('data-voteCount',newVoteCount);if(this.ajaxObj&&_.isFunction(this.ajaxObj.abort)){this.ajaxObj.abort();}
|
||||
this.ajaxObj=ips.getAjax()(clicked.attr('href')).done(function(response){Debug.log(response);voteCount.text(response.votes);self.scope.find('.i-color_soft').text(ips.pluralize(ips.getString('votes_no_number'),response.votes));});},setStyles:function(setPositive,setNegative){this.scope.find('.cAnswerRate_up').toggleClass('i-color_positive',setPositive);this.scope.find('.cAnswerRate_down').toggleClass('i-color_negative',setNegative);this.scope.toggleClass('cRatingColumn_up',setPositive).toggleClass('cRatingColumn_down',setNegative);this.scope.find('a.cAnswerRate_up').removeAttr('_title');this.scope.find('a.cAnswerRate_down').removeAttr('_title');if(setPositive){this.scope.find('a.cAnswerRate_up').attr('title',ips.getString('js_remove_your_vote'));}
|
||||
else{this.scope.find('a.cAnswerRate_up').attr('title',ips.getString('js_vote_answer_up'));}
|
||||
if(setNegative){this.scope.find('a.cAnswerRate_down').attr('title',ips.getString('js_remove_your_vote'));}
|
||||
else{this.scope.find('a.cAnswerRate_down').attr('title',ips.getString('js_vote_answer_down'));}}});}(jQuery,_));;
|
||||
;(function($,_,undefined){"use strict";ips.controller.register('forums.front.topic.reply',{initialize:function(){this.on('click','[data-action="replyToTopic"]',this.replyToTopic);},replyToTopic:function(e){e.preventDefault();$(document).trigger('replyToTopic');}});}(jQuery,_));;
|
||||
;(function($,_,undefined){"use strict";ips.controller.register('forums.front.topic.solved',{initialize:function(){this.on('click','[data-action="mailSolvedReminders"]',this.mailSolvedReminders);},mailSolvedReminders:function(e){e.preventDefault();var _self=this;ips.getAjax()(ips.getSetting('baseURL')+'index.php?app=core&module=system&controller=ajax&do=subscribeToSolved').done(function(response){var elem=_self.scope.find('[data-action="mailSolvedReminders"]');ips.utils.anim.go('fadeOutDown',elem);ips.ui.flashMsg.show(response.message,{timeout:5});});}});}(jQuery,_));;
|
||||
;(function($,_,undefined){"use strict";ips.controller.register('forums.front.topic.view',{initialize:function(){$(document).on('replyToTopic',_.bind(this.replyToTopic,this));this.on('paginationClicked',this.paginationClicked);this.on('click','[data-action="showMoreActivity"]',this.showActivity);this.on('click','[data-action="closeMoreActivity"]',this.hideActivity);},paginationClicked:function(e,data){document.getElementById('ipsTopicView').dataset.ipsTopicFirstPage=(data.pageNo==1);},showActivity:function(e){e.preventDefault();this.scope.find('[data-role="moreActivity"]').show();this.scope.find('[data-action="showMoreActivity"]').hide();this.scope.find('[data-action="closeMoreActivity"]').show();},hideActivity:function(e){e.preventDefault();this.scope.find('[data-role="moreActivity"]').hide();this.scope.find('[data-action="showMoreActivity"]').show();this.scope.find('[data-action="closeMoreActivity"]').hide();},replyToTopic:function(e){ips.ui.editorv5.getObjWithInit(this.scope.find('[data-role="replyArea"] [data-ipsEditorv5]'),function(editor){editor.unminimize(function(){editor.focus();});});}});}(jQuery,_));;
|
||||
Reference in new issue
Block a user