MarkTraceur has uploaded a new change for review. https://gerrit.wikimedia.org/r/160041
Change subject: [wip] Make the reuse button part of the canvas ...................................................................... [wip] Make the reuse button part of the canvas Moves it out of stripeButtons and into canvasButtons. Will move download to its own thing later. Change-Id: Iaf18914b29a6283c3bade954f1adb3f206c9c911 Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/834 --- M resources/mmv/ui/mmv.ui.canvasButtons.js M resources/mmv/ui/mmv.ui.stripeButtons.js 2 files changed, 37 insertions(+), 37 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MultimediaViewer refs/changes/41/160041/1 diff --git a/resources/mmv/ui/mmv.ui.canvasButtons.js b/resources/mmv/ui/mmv.ui.canvasButtons.js index f99e97b..acba1d9 100644 --- a/resources/mmv/ui/mmv.ui.canvasButtons.js +++ b/resources/mmv/ui/mmv.ui.canvasButtons.js @@ -36,6 +36,15 @@ this.$close = $closeButton; this.$fullscreen = $fullscreenButton; + this.$reuse = $( '<div>' ) + .addClass( 'mw-mmv-stripe-button-reuse' ) + .html( ' ' ) + .prop( 'title', mw.message( 'multimediaviewer-reuse-link' ).text() ) + .tipsy( { + delayIn: mw.config.get( 'wgMultimediaViewer' ).tooltipDelay, + gravity: $( document.body ).hasClass( 'rtl' ) ? 'sw' : 'se' + } ); + this.$next = $( '<div>' ) .addClass( 'mw-mmv-next-image disabled' ) .html( ' ' ); @@ -48,6 +57,7 @@ .add( this.$prev ); this.$buttons = this.$close + .add( this.$reuse ) .add( this.$fullscreen ) .add( this.$next ) .add( this.$prev ); @@ -168,12 +178,39 @@ }; /** + * @event mmv-reuse-open + * Fired when the button to open the reuse dialog is clicked. + */ + /** + * Registers listeners. + */ + CBP.attach = function () { + var buttons = this; + + this.$reuse.on( 'click.mmv-stripeButtons', function ( e ) { + $( document ).trigger( 'mmv-reuse-open' ); + e.stopPropagation(); // the dialog would take it as an outside click and close + } ); + this.handleEvent( 'mmv-reuse-opened', function () { + buttons.$reuse.addClass( 'open' ); + } ); + this.handleEvent( 'mmv-reuse-closed', function () { + buttons.$reuse.removeClass( 'open' ); + } ); + }; + + /** * Removes all UI things from the DOM, or hides them */ CBP.unattach = function () { + this.$reuse.off( 'click.mmv-stripeButtons' ).tipsy( 'hide' ); this.$close.tipsy( 'hide' ); this.$fullscreen.tipsy( 'hide' ); }; + CBP.empty = function () { + this.$reuse.removeClass( 'open' ); + }; + mw.mmv.ui.CanvasButtons = CanvasButtons; }( mediaWiki, jQuery, OO ) ); diff --git a/resources/mmv/ui/mmv.ui.stripeButtons.js b/resources/mmv/ui/mmv.ui.stripeButtons.js index 537f475..1f7190b 100644 --- a/resources/mmv/ui/mmv.ui.stripeButtons.js +++ b/resources/mmv/ui/mmv.ui.stripeButtons.js @@ -40,7 +40,6 @@ */ this.buttons = {}; - this.initReuseButton(); this.initDescriptionPageButton(); } oo.inheritClass( StripeButtons, mw.mmv.ui.Element ); @@ -75,17 +74,6 @@ } return $button; - }; - - /** - * @protected - * Creates the reuse button. - */ - SBP.initReuseButton = function() { - this.buttons.$reuse = this.createButton( - 'mw-mmv-stripe-button-reuse', - mw.message( 'multimediaviewer-reuse-link' ).text() - ); }; /** @@ -169,33 +157,9 @@ $button.addClass( 'empty' ); } ); - this.buttons.$reuse.removeClass( 'open' ); - this.buttons.$descriptionPage.attr( { href: null, title: null, 'original-title': null } ) .removeClass( 'mw-mmv-repo-button-dynamic mw-mmv-repo-button-commons' ); this.setInlineStyle( 'repo-button-description-page', null ); - }; - - /** - * @event mmv-reuse-open - * Fired when the buttonto open the reuse dialog is clicked. - */ - /** - * Registers listeners. - */ - SBP.attach = function () { - var buttons = this.buttons; - - buttons.$reuse.on( 'click.mmv-stripeButtons', function ( e ) { - $( document ).trigger( 'mmv-reuse-open' ); - e.stopPropagation(); // the dialog would take it as an outside click and close - } ); - this.handleEvent( 'mmv-reuse-opened', function () { - buttons.$reuse.addClass( 'open' ); - } ); - this.handleEvent( 'mmv-reuse-closed', function () { - buttons.$reuse.removeClass( 'open' ); - } ); }; /** @@ -203,7 +167,6 @@ */ SBP.unattach = function () { this.constructor['super'].prototype.unattach.call( this ); - this.buttons.$reuse.off( 'click.mmv-stripeButtons' ); this.clearTimer( 'feedbackTooltip.show' ); -- To view, visit https://gerrit.wikimedia.org/r/160041 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iaf18914b29a6283c3bade954f1adb3f206c9c911 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MultimediaViewer Gerrit-Branch: master Gerrit-Owner: MarkTraceur <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
