r106768 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106767‎ | r106768 | r106769 >
Date:08:21, 20 December 2011
Author:siebrand
Status:ok
Tags:
Comment:
Remove trailing whitespace and a few superfluous empty lines.
Modified paths:
  • /trunk/phase3/resources/mediawiki/mediawiki.feedback.js (modified) (history)

Diff [purge]

Index: trunk/phase3/resources/mediawiki/mediawiki.feedback.js
@@ -1,4 +1,4 @@
2 -/**
 2+/**
33 * mediawiki.Feedback
44 *
55 * @author Ryan Kaldari, 2010
@@ -6,40 +6,38 @@
77 * @since 1.19
88 *
99 * This is a way of getting simple feedback from users. It's useful
10 - * for testing new features -- users can give you feedback without
 10+ * for testing new features -- users can give you feedback without
1111 * the difficulty of opening a whole new talk page. For this reason,
1212 * it also tends to collect a wider range of both positive and negative
13 - * comments. However you do need to tend to the feedback page. It will
14 - * get long relatively quickly, and you often get multiple messages
 13+ * comments. However you do need to tend to the feedback page. It will
 14+ * get long relatively quickly, and you often get multiple messages
1515 * reporting the same issue.
1616 *
1717 * It takes the form of thing on your page which, when clicked, opens a small
18 - * dialog box. Submitting that dialog box appends its contents to a
 18+ * dialog box. Submitting that dialog box appends its contents to a
1919 * wiki page that you specify, as a new section.
2020 *
2121 * Not compatible with LiquidThreads.
22 - *
 22+ *
2323 * Minimal example in how to use it:
24 - *
 24+ *
2525 * var feedback = new mw.Feedback();
26 - * $( '#myButton' ).click( function() { feedback.launch(); } );
27 - *
28 - * You can also launch the feedback form with a prefilled subject and body.
29 - * See the docs for the launch() method.
 26+ * $( '#myButton' ).click( function() { feedback.launch(); } );
 27+ *
 28+ * You can also launch the feedback form with a prefilled subject and body.
 29+ * See the docs for the launch() method.
3030 */
3131 ( function( mw, $, undefined ) {
32 -
3332 /**
3433 * Thingy for collecting user feedback on a wiki page
3534 * @param {Array} options -- optional, all properties optional.
36 - * api: {mw.Api} if omitted, will just create a standard API
 35+ * api: {mw.Api} if omitted, will just create a standard API
3736 * title: {mw.Title} the title of the page where you collect feedback. Defaults to "Feedback".
3837 * dialogTitleMessageKey: {String} message key for the title of the dialog box
3938 * bugsLink: {mw.Uri|String} url where bugs can be posted
4039 * bugsListLink: {mw.Uri|String} url where bugs can be listed
4140 */
4241 mw.Feedback = function( options ) {
43 -
4442 if ( options === undefined ) {
4543 options = {};
4644 }
@@ -72,7 +70,6 @@
7371 setup: function() {
7472 var _this = this;
7573
76 -
7774 var $feedbackPageLink = $( '<a></a>' )
7875 .attr( { 'href': _this.title.getUrl(), 'target': '_blank' } )
7976 .css( { 'white-space': 'nowrap' } );
@@ -81,40 +78,40 @@
8279
8380 var $bugsListLink = $( '<a></a>' ).attr( { 'href': _this.bugsListLink, 'target': '_blank' } );
8481
85 - this.$dialog =
86 - $( '<div style="position:relative;"></div>' ).append(
 82+ this.$dialog =
 83+ $( '<div style="position:relative;"></div>' ).append(
8784 $( '<div class="feedback-mode feedback-form"></div>' ).append(
88 - $( '<small></small>' ).append(
89 - $( '<p></p>' ).msg(
90 - 'feedback-bugornote',
 85+ $( '<small></small>' ).append(
 86+ $( '<p></p>' ).msg(
 87+ 'feedback-bugornote',
9188 $bugNoteLink,
92 - _this.title.getNameText(),
93 - $feedbackPageLink.clone()
 89+ _this.title.getNameText(),
 90+ $feedbackPageLink.clone()
9491 )
9592 ),
96 - $( '<div style="margin-top:1em;"></div>' ).append(
97 - mw.msg( 'feedback-subject' ),
98 - $( '<br/>' ),
99 - $( '<input type="text" class="feedback-subject" name="subject" maxlength="60" style="width:99%;"/>' )
 93+ $( '<div style="margin-top:1em;"></div>' ).append(
 94+ mw.msg( 'feedback-subject' ),
 95+ $( '<br/>' ),
 96+ $( '<input type="text" class="feedback-subject" name="subject" maxlength="60" style="width:99%;"/>' )
10097 ),
101 - $( '<div style="margin-top:0.4em;"></div>' ).append(
102 - mw.msg( 'feedback-message' ),
103 - $( '<br/>' ),
104 - $( '<textarea name="message" class="feedback-message" style="width:99%;" rows="5" cols="60"></textarea>' )
 98+ $( '<div style="margin-top:0.4em;"></div>' ).append(
 99+ mw.msg( 'feedback-message' ),
 100+ $( '<br/>' ),
 101+ $( '<textarea name="message" class="feedback-message" style="width:99%;" rows="5" cols="60"></textarea>' )
105102 )
106103 ),
107 - $( '<div class="feedback-mode feedback-bugs"></div>' ).append(
 104+ $( '<div class="feedback-mode feedback-bugs"></div>' ).append(
108105 $( '<p>' ).msg( 'feedback-bugcheck', $bugsListLink )
109106 ),
110 - $( '<div class="feedback-mode feedback-submitting" style="text-align:center;margin:3em 0;"></div>' ).append(
111 - mw.msg( 'feedback-adding' ),
112 - $( '<br/>' ),
113 - $( '<img src="http://upload.wikimedia.org/wikipedia/commons/4/42/Loading.gif" />' )
 107+ $( '<div class="feedback-mode feedback-submitting" style="text-align:center;margin:3em 0;"></div>' ).append(
 108+ mw.msg( 'feedback-adding' ),
 109+ $( '<br/>' ),
 110+ $( '<img src="http://upload.wikimedia.org/wikipedia/commons/4/42/Loading.gif" />' )
114111 ),
115112 $( '<div class="feedback-mode feedback-thanks" style="text-align:center;margin:1em"></div>' ).msg(
116 - 'feedback-thanks', _this.title.getNameText(), $feedbackPageLink.clone()
 113+ 'feedback-thanks', _this.title.getNameText(), $feedbackPageLink.clone()
117114 ),
118 - $( '<div class="feedback-mode feedback-error" style="position:relative;"></div>' ).append(
 115+ $( '<div class="feedback-mode feedback-error" style="position:relative;"></div>' ).append(
119116 $( '<div class="feedback-error-msg style="color:#990000;margin-top:0.4em;"></div>' )
120117 )
121118 );
@@ -128,7 +125,7 @@
129126 title: mw.msg( this.dialogTitleMessageKey ),
130127 modal: true,
131128 buttons: _this.buttons
132 - });
 129+ });
133130
134131 this.subjectInput = this.$dialog.find( 'input.feedback-subject' ).get(0);
135132 this.messageInput = this.$dialog.find( 'textarea.feedback-message' ).get(0);
@@ -138,10 +135,10 @@
139136 display: function( s ) {
140137 this.$dialog.dialog( { buttons:{} } ); // hide the buttons
141138 this.$dialog.find( '.feedback-mode' ).hide(); // hide everything
142 - this.$dialog.find( '.feedback-' + s ).show(); // show the desired div
 139+ this.$dialog.find( '.feedback-' + s ).show(); // show the desired div
143140 },
144141
145 - displaySubmitting: function() {
 142+ displaySubmitting: function() {
146143 this.display( 'submitting' );
147144 },
148145
@@ -158,7 +155,7 @@
159156 var _this = this;
160157 this.display( 'thanks' );
161158 var closeButton = {};
162 - closeButton[ mw.msg( 'feedback-close' ) ] = function() { _this.$dialog.dialog( 'close' ); };
 159+ closeButton[ mw.msg( 'feedback-close' ) ] = function() { _this.$dialog.dialog( 'close' ); };
163160 this.$dialog.dialog( { buttons: closeButton } );
164161 },
165162
@@ -172,9 +169,9 @@
173170 var _this = this;
174171 this.subjectInput.value = (contents && contents.subject) ? contents.subject : '';
175172 this.messageInput.value = (contents && contents.message) ? contents.message : '';
176 -
177 - this.display( 'form' );
178173
 174+ this.display( 'form' );
 175+
179176 // Set up buttons for dialog box. We have to do it the hard way since the json keys are localized
180177 var formButtons = {};
181178 formButtons[ mw.msg( 'feedback-submit' ) ] = function() { _this.submit(); };
@@ -184,10 +181,10 @@
185182
186183 displayError: function( message ) {
187184 this.display( 'error' );
188 - this.$dialog.find( '.feedback-error-msg' ).msg( message );
 185+ this.$dialog.find( '.feedback-error-msg' ).msg( message );
189186 },
190187
191 - cancel: function() {
 188+ cancel: function() {
192189 this.$dialog.dialog( 'close' );
193190 },
194191
@@ -220,12 +217,10 @@
221218 var err = function( code, info ) {
222219 displayError( 'feedback-error3' ); // ajax request failed
223220 };
224 -
225 - this.api.newSection( this.title, subject, message, ok, err );
226221
 222+ this.api.newSection( this.title, subject, message, ok, err );
227223 }, // close submit button function
228224
229 -
230225 /**
231226 * Modify the display form, and then open it, focusing interface on the subject.
232227 * @param {Object} optional prefilled contents for the feedback form. Object with properties:
@@ -236,9 +231,8 @@
237232 this.displayForm( contents );
238233 this.$dialog.dialog( 'open' );
239234 this.subjectInput.focus();
240 - }
 235+ }
241236
242237 };
243238
244 -
245239 } )( window.mediaWiki, jQuery );

Status & tagging log