jenkins-bot has submitted this change and it was merged.

Change subject: Make survey open in popup window instead of normal one
......................................................................


Make survey open in popup window instead of normal one

Change-Id: If971f7607bd3fc33080b903e07bd53ae3d3407cf
---
M resources/mmv/ui/mmv.ui.stripeButtons.js
M resources/mmv/ui/mmv.ui.stripeButtons.less
2 files changed, 53 insertions(+), 2 deletions(-)

Approvals:
  Gilles: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/resources/mmv/ui/mmv.ui.stripeButtons.js 
b/resources/mmv/ui/mmv.ui.stripeButtons.js
index c385056..072c8ec 100644
--- a/resources/mmv/ui/mmv.ui.stripeButtons.js
+++ b/resources/mmv/ui/mmv.ui.stripeButtons.js
@@ -77,16 +77,66 @@
         * Creates the feedback button.
         */
        SBP.initFeedbackButton = function() {
+               var buttons = this;
+
                this.buttons.$feedback = this.createButton(
                        'mw-mmv-stripe-button-feedback',
                        mw.message( 'multimediaviewer-feedback-button-text' 
).plain(),
                        mw.message( 'multimediaviewer-feedback-popup-text' 
).plain()
                ).prop( {
                        target: '_blank',
-                       href: 
'https://www.surveymonkey.com/s/media-viewer-1?c=mediaviewer'
+                       href: this.getFeedbackSurveyUrl()
+               } ).click( function ( e ) {
+                       buttons.openSurveyInNewWindow();
+                       e.preventDefault();
                } );
        };
 
+       SBP.getFeedbackSurveyUrl = function () {
+               return 
'https://www.surveymonkey.com/s/media-viewer-1?c=mediaviewer';
+       };
+
+       /**
+        * Opens the survey in a new window, or brings it up if it is already 
opened.
+        */
+       SBP.openSurveyInNewWindow = function () {
+               var surveyWindowWidth = screen.width * 0.85,
+                       surveyWindowHeight = screen.height * 0.85,
+                       feedbackSurveyWindowProperties = {
+                               left: ( screen.width - surveyWindowWidth ) / 2,
+                               top: ( screen.height - surveyWindowHeight ) / 2,
+                               width: surveyWindowWidth,
+                               height: surveyWindowHeight,
+                               menubar: 0,
+                               toolbar: 0,
+                               location: 0,
+                               personalbar: 0,
+                               status: 0
+                       };
+
+               if ( !this.surveyWindow || this.surveyWindow.closed ) {
+                       this.surveyWindow = window.open( 
this.getFeedbackSurveyUrl(), 'mmv-survey',
+                               this.createWindowOpenPropertyString( 
feedbackSurveyWindowProperties ) );
+               } else {
+                       this.surveyWindow.focus();
+               }
+       };
+
+       /**
+        * @protected
+        * Takes a property object and turns it into a string suitable for the 
last parameter
+        * of window.open.
+        * @param {Object} properties
+        * @return {string}
+        */
+       SBP.createWindowOpenPropertyString = function ( properties ) {
+               var propertyArray = [];
+               $.each( properties, function ( key, value ) {
+                       propertyArray.push( key + '=' + value );
+               } );
+               return propertyArray.join( ',' );
+       };
+
        /**
         * @protected
         * Runs code for each button, similarly to $.each.
diff --git a/resources/mmv/ui/mmv.ui.stripeButtons.less 
b/resources/mmv/ui/mmv.ui.stripeButtons.less
index b63e0af..8928bf8 100644
--- a/resources/mmv/ui/mmv.ui.stripeButtons.less
+++ b/resources/mmv/ui/mmv.ui.stripeButtons.less
@@ -44,7 +44,7 @@
                position: relative;
                top: 0.1em;
 
-               background-size: 1em 1em;
+               background-size: 100% 100%;
                margin-right: 0.25em;
                content: ' ';
                vertical-align: baseline;
@@ -59,4 +59,5 @@
 .mw-mmv-stripe-button-feedback:before {
        /* @embed */
        background-image: url(img/horn_grey.svg);
+       background-size: 100%;
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/123109
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If971f7607bd3fc33080b903e07bd53ae3d3407cf
Gerrit-PatchSet: 9
Gerrit-Project: mediawiki/extensions/MultimediaViewer
Gerrit-Branch: master
Gerrit-Owner: Gergő Tisza <gti...@wikimedia.org>
Gerrit-Reviewer: Aarcos <aarcos.w...@gmail.com>
Gerrit-Reviewer: Gergő Tisza <gti...@wikimedia.org>
Gerrit-Reviewer: Gilles <gdu...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to