{ const url = $(e.currentTarget).attr('href'); ips.getAjax()( url, { showLoading: true, bypassRedirect: true }) .done( () => { // Trigger event on the table to hide unread markets this.triggerOn( 'core.global.core.table', 'markTableRead' ); // Hide the link we've just clicked ips.utils.anim.go( 'fadeOut', $( e.currentTarget ) ); ips.ui.flashMsg.show( ips.getString('forumMarkedRead') ); }) .fail( function (jqXHR, textStatus, errorThrown) { window.location = url; }); } } }); } }); }(jQuery, _));]]> /** * Invision Community * (c) Invision Power Services, Inc. - https://www.invisioncommunity.com * * ips.forum.hovercard.js - Topic hovercard in forum view * * Author: Rikki Tissier */ ;( function($, _, undefined){ "use strict"; ips.controller.register('forums.front.forum.hovercard', { initialize: function () { this.on( 'click', '[data-action="markTopicRead"]', this.markTopicRead ); }, /** * Marks a topic read from inside a hovercard * * @param {event} e Event object * @returns {void} */ markTopicRead: function (e) { e.preventDefault(); // Ignore if we've already done this if( $( e.currentTarget ).attr('data-disabled') ){ return; } // Trigger event for table to mark the row this.trigger( 'markTableRowRead', { tableID: 'topics', rowID: this.scope.attr('data-topicID') }); // Let the user know ips.ui.flashMsg.show( ips.getString('topicMarkedRead') ); // And do the actual request ips.getAjax()( $( e.currentTarget ).attr('href'), { bypassRedirect: true }); // Hide the link $( e.currentTarget ).addClass('i-opacity_4').attr('data-disabled'); } }); }(jQuery, _)); /** * Invision Community * (c) Invision Power Services, Inc. - https://www.invisioncommunity.com * * ips.topic.activity.js - Topic activity controller * * Author: Rikki Tissier */ ;( 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, _)); /** * Invision Community * (c) Invision Power Services, Inc. - https://www.invisioncommunity.com * * ips.topic.reply.js - Topic reply controller for "Reply" button * * Author: Rikki Tissier */ ;( function($, _, undefined){ "use strict"; ips.controller.register('forums.front.topic.reply', { initialize: function () { this.on( 'click', '[data-action="replyToTopic"]', this.replyToTopic ); }, /** * Handles a click on the reply to topic button. Triggers an event caught by the main topic view controller. * * @param {event} e Event object * @returns {void} */ replyToTopic: function (e) { e.preventDefault(); $( document ).trigger( 'replyToTopic' ); } }); }(jQuery, _)); /** * Invision Community * (c) Invision Power Services, Inc. - https://www.invisioncommunity.com * * ips.topic.view.js - Topic view controller * * Author: Rikki Tissier */ ;( 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 ); }, /** * Hide any helpful filters on page one * * @param {event} e Event object * @param {object} data Data object * @returns {void} */ paginationClicked: function ( e, data ) { document.getElementById('ipsTopicView').dataset.ipsTopicFirstPage = ( data.pageNo == 1 ); }, /** * Opens up the activity box when placed under the first post * * @param {event} e Event object * @returns {void} */ 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(); }, /** * Closes the activity box when placed under the first post * * @param {event} e Event object * @returns {void} */ 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(); }, /** * Triggers the initialize event on the editor * * @param {event} e Event object * @returns {void} */ replyToTopic: function (e) { ips.ui.editorv5.getObjWithInit( this.scope.find('[data-role="replyArea"] [data-ipsEditorv5]'), function(editor){ editor.unminimize(function(){ editor.focus(); }); } ); } }); }(jQuery, _));