Jdlrobson has uploaded a new change for review. https://gerrit.wikimedia.org/r/157759
Change subject: Hygiene: Remove uninitialised variables to top ...................................................................... Hygiene: Remove uninitialised variables to top Change-Id: I85819a71da9038f449cf07c28d8337fb76678ed9 Bsitu: Let's get this documented somewhere if it isn't already... --- M modules/new/components/flow-board.js 1 file changed, 24 insertions(+), 26 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow refs/changes/59/157759/1 diff --git a/modules/new/components/flow-board.js b/modules/new/components/flow-board.js index cf19842..37d6cc2 100644 --- a/modules/new/components/flow-board.js +++ b/modules/new/components/flow-board.js @@ -579,9 +579,8 @@ * @param {jqXHR} jqxhr */ FlowBoardComponent.UI.events.apiHandlers.closeOpenTopic = function ( info, data ) { - var revision, + var revision, topicId, revisionId, $target = info.$target, $topicTitleBar, - topicId, revisionId, $topic = $target.parents( '.flow-topic' ), self = this, flowBoard = FlowBoardComponent.prototype.getInstanceByElement( $( this ) ), @@ -709,12 +708,12 @@ */ FlowBoardComponent.UI.events.apiHandlers.preview = function( info, data, jqxhr ) { var revision, creator, + $previewContainer, + templateParams, $button = $( this ), $form = $button.closest( 'form' ), flowBoard = FlowBoardComponent.prototype.getInstanceByElement( $form ), $titleField = $form.find( 'input' ).filter( '[data-role=title]' ), - $previewContainer, - templateParams, $target = info.$target, username = mw.user.getName(), id = Math.random(), @@ -870,15 +869,14 @@ * @param {jqXHR} jqxhr */ FlowBoardComponent.UI.events.apiHandlers.watchItem = function ( info, data, jqxhr ) { - var $target = $( this ), + var watchUrl, unwatchUrl, + watchType, watchLinkTemplate, $newLink, + $target = $( this ), $tooltipTarget = $target.closest( '.flow-watch-link' ), flowBoard = FlowBoardComponent.prototype.getInstanceByElement( $tooltipTarget ), isWatched = false, url = $( this ).prop( 'href' ), - watchUrl, unwatchUrl, - watchType, watchLinkTemplate, - links = {}, - $newLink; + links = {}; if ( info.status !== 'done' ) { // Error will be displayed by default, nothing else to wrap up @@ -999,9 +997,9 @@ * @param {jqXHR} jqxhr */ FlowBoardComponent.UI.events.apiHandlers.activateEditPost = function ( info, data, jqxhr ) { - var flowBoard = FlowBoardComponent.prototype.getInstanceByElement( $( this ) ), - $post = info.$target, - $rendered; + var $rendered, + flowBoard = FlowBoardComponent.prototype.getInstanceByElement( $( this ) ), + $post = info.$target; if ( info.status !== 'done' ) { // Error will be displayed by default, nothing else to wrap up @@ -1275,8 +1273,8 @@ * @param {Event} event */ FlowBoardComponent.UI.events.interactiveHandlers.collapserCollapsibleToggle = function ( event ) { - var $target = $( event.target ), - topicId, states, + var topicId, states, + $target = $( event.target ), $component = $( this ).closest( '.flow-component' ); // Make sure we didn't click on any interactive elements @@ -1329,11 +1327,10 @@ * @param {Event} event */ FlowBoardComponent.UI.events.interactiveHandlers.editTopicTitle = function( event ) { - var $link = $( this ), + var $title, flowBoard, $form, cancelCallback, linkParams, + $link = $( this ), $topic = $link.closest( '.flow-topic' ), - $topicTitleBar = $topic - .children( '.flow-topic-titlebar' ), - $title, flowBoard, $form, cancelCallback, linkParams; + $topicTitleBar = $topic.children( '.flow-topic-titlebar' ); $form = $topicTitleBar.find( 'form' ); @@ -1405,13 +1402,13 @@ */ FlowBoardComponent.UI.events.interactiveHandlers.apiRequest = function ( event ) { var $deferred, + $target, + preHandlerReturn, _this = this, $this = $( this ), flowBoard = FlowBoardComponent.prototype.getInstanceByElement( $this ), dataParams = $this.data(), handlerName = dataParams.flowApiHandler, - $target, - preHandlerReturn, preHandlerReturns = [], info = { $target: null, @@ -1501,9 +1498,10 @@ FlowBoardComponent.UI.events.apiHandlers[ handlerName ].apply( _this, args ); } ) .fail( function ( code, result ) { - var args = Array.prototype.slice.call( arguments, 0 ), - $form = $this.closest( 'form' ), - errorMsg; + var errorMsg, + args = Array.prototype.slice.call( arguments, 0 ), + $form = $this.closest( 'form' ); + info.status = 'fail'; args.unshift( info ); @@ -1538,14 +1536,14 @@ FlowBoardComponent.UI.events.interactiveHandlers.activateReplyPost = function ( event ) { event.preventDefault(); - var flowBoard = FlowBoardComponent.prototype.getInstanceByElement( $( this ) ), + var initialContent, $form, + flowBoard = FlowBoardComponent.prototype.getInstanceByElement( $( this ) ), $post = $( this ).closest( '.flow-post' ), $targetPost = $( this ).closest( '.flow-post:not([data-flow-post-max-depth])' ), postId = $targetPost.data( 'flow-id' ), topicTitle = $post.closest( '.flow-topic' ).find( '.flow-topic-title' ).text(), replyToContent = $post.find( '.flow-post-content' ).text() || topicTitle, - author = $.trim( $post.find( '.flow-author:first .mw-userlink' ).text() ), - initialContent, $form; + author = $.trim( $post.find( '.flow-author:first .mw-userlink' ).text() ); // Check if reply form has already been opened if ( $post.data( 'flow-replying' ) ) { -- To view, visit https://gerrit.wikimedia.org/r/157759 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I85819a71da9038f449cf07c28d8337fb76678ed9 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Flow Gerrit-Branch: master Gerrit-Owner: Jdlrobson <jrob...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits