Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedback/jquery.articleFeedback.js |
— | — | @@ -13,21 +13,27 @@ |
14 | 14 | * This plugin supports a choice of forms and CTAs. Each form option is called |
15 | 15 | * a "bucket" because users are sorted into buckets and each bucket gets a |
16 | 16 | * different form option. Right now, these buckets are: |
17 | | - * 1. Share Your Feedback |
| 17 | + * 1. Share Your Feedback - NOT implemented |
18 | 18 | * Has a yes/no toggle on "Did you find what you were looking for?" and a |
19 | 19 | * text area for comments. |
20 | | - * 2. Make A Suggestion |
| 20 | + * 2. Make A Suggestion - NOT implemented |
21 | 21 | * Modeled after getsatisfaction.com; users can say that their comment is a |
22 | 22 | * suggestion, question, problem, or praise. |
23 | | - * 3. Review This Page |
| 23 | + * 3. Review This Page - NOT implemented |
24 | 24 | * Has a single star rating field and a comment box. |
25 | | - * 4. Help Edit This Page |
| 25 | + * 4. Help Edit This Page - NOT implemented |
26 | 26 | * Has no input fields; just links to the Edit page. |
27 | 27 | * 5. Rate This Page |
28 | 28 | * The existing article feedback tool, except that it can use any of the |
29 | 29 | * CTA types. |
30 | 30 | * 6. No Feedback |
31 | 31 | * Shows nothing at all. |
| 32 | + * The available CTAs are: |
| 33 | + * 1. Edit this page |
| 34 | + * Just a big glossy button to send the user to the edit page. |
| 35 | + * 2. Take a survey - NOT implemented |
| 36 | + * Asks the user to take a survey, which will probably pop up in a new |
| 37 | + * window. |
32 | 38 | * |
33 | 39 | * This file is really long, so it's commented with manual fold markers. To use |
34 | 40 | * folds this way in vim: |
— | — | @@ -43,16 +49,16 @@ |
44 | 50 | |
45 | 51 | ( function ( $ ) { |
46 | 52 | |
47 | | -// {{{ articleFeedback definition |
| 53 | +// {{{ articleFeedbackv5 definition |
48 | 54 | |
49 | | - $.articleFeedback = {}; |
| 55 | + $.articleFeedbackv5 = {}; |
50 | 56 | |
51 | 57 | // {{{ Properties |
52 | 58 | |
53 | 59 | /** |
54 | 60 | * Temporary -- this will need to come from the config. |
55 | 61 | */ |
56 | | - $.articleFeedback.debug = true; |
| 62 | + $.articleFeedbackv5.debug = true; |
57 | 63 | |
58 | 64 | /** |
59 | 65 | * The bucket ID is the variation of the Article Feedback form chosen for this |
— | — | @@ -61,7 +67,7 @@ |
62 | 68 | * |
63 | 69 | * @see http://www.mediawiki.org/wiki/Article_feedback/Version_5/Feature_Requirements#Feedback_form_interface |
64 | 70 | */ |
65 | | - $.articleFeedback.bucketId = 6; |
| 71 | + $.articleFeedbackv5.bucketId = 6; |
66 | 72 | |
67 | 73 | /** |
68 | 74 | * The CTA is the view presented to a user who has successfully submitted |
— | — | @@ -69,33 +75,33 @@ |
70 | 76 | * |
71 | 77 | * @see http://www.mediawiki.org/wiki/Article_feedback/Version_5/Feature_Requirements#Calls_to_Action |
72 | 78 | */ |
73 | | - $.articleFeedback.ctaId = 1; |
| 79 | + $.articleFeedbackv5.ctaId = 1; |
74 | 80 | |
75 | 81 | /** |
76 | 82 | * Use the mediawiki util resource's config method to find the correct url to |
77 | 83 | * call for all ajax requests. |
78 | 84 | */ |
79 | | - $.articleFeedback.apiUrl = mw.config.get( 'wgScriptPath' ) + '/api.php'; |
| 85 | + $.articleFeedbackv5.apiUrl = mw.config.get( 'wgScriptPath' ) + '/api.php'; |
80 | 86 | |
81 | 87 | /** |
82 | 88 | * Is this an anonymous user? |
83 | 89 | */ |
84 | | - $.articleFeedback.anonymous = mw.user.anonymous(); |
| 90 | + $.articleFeedbackv5.anonymous = mw.user.anonymous(); |
85 | 91 | |
86 | 92 | /** |
87 | 93 | * If not, what's their user id? |
88 | 94 | */ |
89 | | - $.articleFeedback.userId = mw.user.id(); |
| 95 | + $.articleFeedbackv5.userId = mw.user.id(); |
90 | 96 | |
91 | 97 | /** |
92 | 98 | * The page ID |
93 | 99 | */ |
94 | | - $.articleFeedback.pageId = mw.config.get( 'wgArticleId' ); |
| 100 | + $.articleFeedbackv5.pageId = mw.config.get( 'wgArticleId' ); |
95 | 101 | |
96 | 102 | /** |
97 | 103 | * The revision ID |
98 | 104 | */ |
99 | | - $.articleFeedback.revisionId = mw.config.get( 'wgCurRevisionId' ); |
| 105 | + $.articleFeedbackv5.revisionId = mw.config.get( 'wgCurRevisionId' ); |
100 | 106 | |
101 | 107 | // }}} |
102 | 108 | // {{{ Bucket UI objects |
— | — | @@ -103,7 +109,7 @@ |
104 | 110 | /** |
105 | 111 | * Set up the buckets' UI objects |
106 | 112 | */ |
107 | | - $.articleFeedback.buckets = { |
| 113 | + $.articleFeedbackv5.buckets = { |
108 | 114 | |
109 | 115 | // {{{ Bucket 5 |
110 | 116 | |
— | — | @@ -137,74 +143,71 @@ |
138 | 144 | |
139 | 145 | // The overall template |
140 | 146 | var block_tpl = '\ |
141 | | - <form>\ |
142 | | - <div class="articleFeedback-panel">\ |
143 | | - <div class="articleFeedback-buffer articleFeedback-ui">\ |
144 | | - <div class="articleFeedback-switch articleFeedback-switch-report articleFeedback-visibleWith-form" rel="report"><html:msg key="report-switch-label" /></div>\ |
145 | | - <div class="articleFeedback-switch articleFeedback-switch-form articleFeedback-visibleWith-report" rel="form"><html:msg key="form-switch-label" /></div>\ |
146 | | - <div class="articleFeedback-title articleFeedback-visibleWith-form"><html:msg key="form-panel-title" /></div>\ |
147 | | - <div class="articleFeedback-title articleFeedback-visibleWith-report"><html:msg key="report-panel-title" /></div>\ |
148 | | - <div class="articleFeedback-explanation articleFeedback-visibleWith-form"><a class="articleFeedback-explanation-link"><html:msg key="form-panel-explanation" /></a></div>\ |
149 | | - <div class="articleFeedback-description articleFeedback-visibleWith-report"><html:msg key="report-panel-description" /></div>\ |
150 | | - <div style="clear:both;"></div>\ |
151 | | - <div class="articleFeedback-ratings"></div>\ |
152 | | - <div style="clear:both;"></div>\ |
153 | | - <div class="articleFeedback-options">\ |
154 | | - <div class="articleFeedback-expertise articleFeedback-visibleWith-form" >\ |
155 | | - <input type="checkbox" value="general" disabled="disabled" /><label class="articleFeedback-expertise-disabled"><html:msg key="form-panel-expertise" /></label>\ |
156 | | - <div class="articleFeedback-expertise-options">\ |
157 | | - <div><input type="checkbox" value="studies" /><label><html:msg key="form-panel-expertise-studies" /></label></div>\ |
158 | | - <div><input type="checkbox" value="profession" /><label><html:msg key="form-panel-expertise-profession" /></label></div>\ |
159 | | - <div><input type="checkbox" value="hobby" /><label><html:msg key="form-panel-expertise-hobby" /></label></div>\ |
160 | | - <div><input type="checkbox" value="other" /><label><html:msg key="form-panel-expertise-other" /></label></div>\ |
161 | | - <div class="articleFeedback-helpimprove">\ |
162 | | - <input type="checkbox" value="helpimprove-email" />\ |
163 | | - <label><html:msg key="form-panel-helpimprove" /></label>\ |
164 | | - <input type="text" placeholder="" class="articleFeedback-helpimprove-email" />\ |
165 | | - <div class="articleFeedback-helpimprove-note"></div>\ |
166 | | - </div>\ |
| 147 | + <div class="articleFeedbackv5-panel">\ |
| 148 | + <div class="articleFeedbackv5-buffer articleFeedbackv5-ui">\ |
| 149 | + <div class="articleFeedbackv5-switch articleFeedbackv5-switch-report articleFeedbackv5-visibleWith-form" rel="report"><html:msg key="report-switch-label" /></div>\ |
| 150 | + <div class="articleFeedbackv5-switch articleFeedbackv5-switch-form articleFeedbackv5-visibleWith-report" rel="form"><html:msg key="form-switch-label" /></div>\ |
| 151 | + <div class="articleFeedbackv5-title articleFeedbackv5-visibleWith-form"><html:msg key="form-panel-title" /></div>\ |
| 152 | + <div class="articleFeedbackv5-title articleFeedbackv5-visibleWith-report"><html:msg key="report-panel-title" /></div>\ |
| 153 | + <div class="articleFeedbackv5-explanation articleFeedbackv5-visibleWith-form"><a class="articleFeedbackv5-explanation-link"><html:msg key="form-panel-explanation" /></a></div>\ |
| 154 | + <div class="articleFeedbackv5-description articleFeedbackv5-visibleWith-report"><html:msg key="report-panel-description" /></div>\ |
| 155 | + <div style="clear:both;"></div>\ |
| 156 | + <div class="articleFeedbackv5-ratings"></div>\ |
| 157 | + <div style="clear:both;"></div>\ |
| 158 | + <div class="articleFeedbackv5-options">\ |
| 159 | + <div class="articleFeedbackv5-expertise articleFeedbackv5-visibleWith-form" >\ |
| 160 | + <input type="checkbox" value="general" disabled="disabled" /><label class="articleFeedbackv5-expertise-disabled"><html:msg key="form-panel-expertise" /></label>\ |
| 161 | + <div class="articleFeedbackv5-expertise-options">\ |
| 162 | + <div><input type="checkbox" value="studies" /><label><html:msg key="form-panel-expertise-studies" /></label></div>\ |
| 163 | + <div><input type="checkbox" value="profession" /><label><html:msg key="form-panel-expertise-profession" /></label></div>\ |
| 164 | + <div><input type="checkbox" value="hobby" /><label><html:msg key="form-panel-expertise-hobby" /></label></div>\ |
| 165 | + <div><input type="checkbox" value="other" /><label><html:msg key="form-panel-expertise-other" /></label></div>\ |
| 166 | + <div class="articleFeedbackv5-helpimprove">\ |
| 167 | + <input type="checkbox" value="helpimprove-email" />\ |
| 168 | + <label><html:msg key="form-panel-helpimprove" /></label>\ |
| 169 | + <input type="text" placeholder="" class="articleFeedbackv5-helpimprove-email" />\ |
| 170 | + <div class="articleFeedbackv5-helpimprove-note"></div>\ |
167 | 171 | </div>\ |
168 | 172 | </div>\ |
169 | | - <div style="clear:both;"></div>\ |
170 | 173 | </div>\ |
171 | | - <button class="articleFeedback-submit articleFeedback-visibleWith-form" type="submit" disabled="disabled"><html:msg key="form-panel-submit" /></button>\ |
172 | | - <div class="articleFeedback-success articleFeedback-visibleWith-form"><span><html:msg key="form-panel-success" /></span></div>\ |
173 | | - <div class="articleFeedback-pending articleFeedback-visibleWith-form"><span><html:msg key="form-panel-pending" /></span></div>\ |
174 | 174 | <div style="clear:both;"></div>\ |
175 | | - <div class="articleFeedback-notices articleFeedback-visibleWith-form">\ |
176 | | - <div class="articleFeedback-expiry">\ |
177 | | - <div class="articleFeedback-expiry-title"><html:msg key="form-panel-expiry-title" /></div>\ |
178 | | - <div class="articleFeedback-expiry-message"><html:msg key="form-panel-expiry-message" /></div>\ |
179 | | - </div>\ |
| 175 | + </div>\ |
| 176 | + <button class="articleFeedbackv5-submit articleFeedbackv5-visibleWith-form" type="submit" disabled="disabled"><html:msg key="form-panel-submit" /></button>\ |
| 177 | + <div class="articleFeedbackv5-success articleFeedbackv5-visibleWith-form"><span><html:msg key="form-panel-success" /></span></div>\ |
| 178 | + <div class="articleFeedbackv5-pending articleFeedbackv5-visibleWith-form"><span><html:msg key="form-panel-pending" /></span></div>\ |
| 179 | + <div style="clear:both;"></div>\ |
| 180 | + <div class="articleFeedbackv5-notices articleFeedbackv5-visibleWith-form">\ |
| 181 | + <div class="articleFeedbackv5-expiry">\ |
| 182 | + <div class="articleFeedbackv5-expiry-title"><html:msg key="form-panel-expiry-title" /></div>\ |
| 183 | + <div class="articleFeedbackv5-expiry-message"><html:msg key="form-panel-expiry-message" /></div>\ |
180 | 184 | </div>\ |
181 | 185 | </div>\ |
182 | | - <div class="articleFeedback-error"><div class="articleFeedback-error-message"><html:msg key="error" /></div></div>\ |
183 | | - <div class="articleFeedback-pitches"></div>\ |
184 | | - <div style="clear:both;"></div>\ |
185 | 186 | </div>\ |
186 | | - <input type="hidden" name="feedback_id" value="" />\ |
187 | | - </form>\ |
| 187 | + <div class="articleFeedbackv5-error"><div class="articleFeedbackv5-error-message"><html:msg key="error" /></div></div>\ |
| 188 | + <div class="articleFeedbackv5-pitches"></div>\ |
| 189 | + <div style="clear:both;"></div>\ |
| 190 | + </div>\ |
188 | 191 | '; |
189 | 192 | |
190 | 193 | // A single rating block |
191 | 194 | var rating_tpl = '\ |
192 | | - <div class="articleFeedback-rating">\ |
193 | | - <div class="articleFeedback-label"></div>\ |
| 195 | + <div class="articleFeedbackv5-rating">\ |
| 196 | + <div class="articleFeedbackv5-label"></div>\ |
194 | 197 | <input type="hidden" />\ |
195 | | - <div class="articleFeedback-rating-labels articleFeedback-visibleWith-form">\ |
196 | | - <div class="articleFeedback-rating-label" rel="1"></div>\ |
197 | | - <div class="articleFeedback-rating-label" rel="2"></div>\ |
198 | | - <div class="articleFeedback-rating-label" rel="3"></div>\ |
199 | | - <div class="articleFeedback-rating-label" rel="4"></div>\ |
200 | | - <div class="articleFeedback-rating-label" rel="5"></div>\ |
201 | | - <div class="articleFeedback-rating-clear"></div>\ |
| 198 | + <div class="articleFeedbackv5-rating-labels articleFeedbackv5-visibleWith-form">\ |
| 199 | + <div class="articleFeedbackv5-rating-label" rel="1"></div>\ |
| 200 | + <div class="articleFeedbackv5-rating-label" rel="2"></div>\ |
| 201 | + <div class="articleFeedbackv5-rating-label" rel="3"></div>\ |
| 202 | + <div class="articleFeedbackv5-rating-label" rel="4"></div>\ |
| 203 | + <div class="articleFeedbackv5-rating-label" rel="5"></div>\ |
| 204 | + <div class="articleFeedbackv5-rating-clear"></div>\ |
202 | 205 | </div>\ |
203 | | - <div class="articleFeedback-visibleWith-form">\ |
204 | | - <div class="articleFeedback-rating-tooltip"></div>\ |
| 206 | + <div class="articleFeedbackv5-visibleWith-form">\ |
| 207 | + <div class="articleFeedbackv5-rating-tooltip"></div>\ |
205 | 208 | </div>\ |
206 | | - <div class="articleFeedback-rating-average articleFeedback-visibleWith-report"></div>\ |
207 | | - <div class="articleFeedback-rating-meter articleFeedback-visibleWith-report"><div></div></div>\ |
208 | | - <div class="articleFeedback-rating-count articleFeedback-visibleWith-report"></div>\ |
| 209 | + <div class="articleFeedbackv5-rating-average articleFeedbackv5-visibleWith-report"></div>\ |
| 210 | + <div class="articleFeedbackv5-rating-meter articleFeedbackv5-visibleWith-report"><div></div></div>\ |
| 211 | + <div class="articleFeedbackv5-rating-count articleFeedbackv5-visibleWith-report"></div>\ |
209 | 212 | <div style="clear:both;"></div>\ |
210 | 213 | </div>\ |
211 | 214 | '; |
— | — | @@ -213,28 +216,28 @@ |
214 | 217 | var $block = $( block_tpl ); |
215 | 218 | |
216 | 219 | // Add the ratings from the options |
217 | | - $block.find( '.articleFeedback-ratings' ).each( function () { |
218 | | - for ( var key in $.articleFeedback.currentBucket().ratingInfo ) { |
| 220 | + $block.find( '.articleFeedbackv5-ratings' ).each( function () { |
| 221 | + for ( var key in $.articleFeedbackv5.currentBucket().ratingInfo ) { |
219 | 222 | var tip_msg = 'articlefeedbackv5-field-' + key + '-tip'; |
220 | 223 | var label_msg = 'articlefeedbackv5-field-' + key + '-label'; |
221 | 224 | var $rtg = $( rating_tpl ).attr( 'rel', key ); |
222 | | - $rtg.find( '.articleFeedback-label' ) |
| 225 | + $rtg.find( '.articleFeedbackv5-label' ) |
223 | 226 | .attr( 'title', mw.msg( tip_msg ) ) |
224 | 227 | .text( mw.msg( label_msg ) ); |
225 | | - $rtg.find( '.articleFeedback-rating-clear' ) |
| 228 | + $rtg.find( '.articleFeedbackv5-rating-clear' ) |
226 | 229 | .attr( 'title', mw.msg( 'articlefeedbackv5-form-panel-clear' ) ); |
227 | 230 | $rtg.appendTo( $(this) ); |
228 | 231 | } |
229 | 232 | } ); |
230 | 233 | |
231 | 234 | // Fill in the link to the What's This page |
232 | | - $block.find( '.articleFeedback-explanation-link' ) |
| 235 | + $block.find( '.articleFeedbackv5-explanation-link' ) |
233 | 236 | .attr( 'href', mw.config.get( 'wgArticlePath' ).replace( |
234 | 237 | '$1', mw.config.get( 'wgArticleFeedbackv5WhatsThisPage' ) |
235 | 238 | ) ); |
236 | 239 | |
237 | 240 | // Fill in the Help Improve message and links |
238 | | - $block.find( '.articleFeedback-helpimprove-note' ) |
| 241 | + $block.find( '.articleFeedbackv5-helpimprove-note' ) |
239 | 242 | // Can't use .text() with mw.message(, /* $1 */ link).toString(), |
240 | 243 | // because 'link' should not be re-escaped (which would happen if done by mw.message) |
241 | 244 | .html( function () { |
— | — | @@ -246,7 +249,7 @@ |
247 | 250 | return mw.html.escape( mw.msg( 'articlefeedbackv5-form-panel-helpimprove-note') ) |
248 | 251 | .replace( /\$1/, mw.message( 'parentheses', link ).toString() ); |
249 | 252 | }); |
250 | | - $block.find( '.articleFeedback-helpimprove-email' ) |
| 253 | + $block.find( '.articleFeedbackv5-helpimprove-email' ) |
251 | 254 | .attr( 'placeholder', mw.msg( 'articlefeedbackv5-form-panel-helpimprove-email-placeholder' ) ) |
252 | 255 | .placeholder(); // back. compat. for older browsers |
253 | 256 | |
— | — | @@ -264,42 +267,42 @@ |
265 | 268 | } ); |
266 | 269 | |
267 | 270 | // Set id and for on expertise checkboxes |
268 | | - $block.find( '.articleFeedback-expertise input:checkbox' ) |
| 271 | + $block.find( '.articleFeedbackv5-expertise input:checkbox' ) |
269 | 272 | .each( function () { |
270 | | - var id = 'articleFeedback-expertise-' + $(this).attr( 'value' ); |
| 273 | + var id = 'articleFeedbackv5-expertise-' + $(this).attr( 'value' ); |
271 | 274 | $(this).attr( 'id', id ); |
272 | 275 | $(this).next().attr( 'for', id ); |
273 | 276 | } ); |
274 | | - $block.find( '.articleFeedback-helpimprove > input:checkbox' ) |
| 277 | + $block.find( '.articleFeedbackv5-helpimprove > input:checkbox' ) |
275 | 278 | .each( function () { |
276 | | - var id = 'articleFeedback-expertise-' + $(this).attr( 'value' ); |
| 279 | + var id = 'articleFeedbackv5-expertise-' + $(this).attr( 'value' ); |
277 | 280 | $(this).attr( 'id', id ); |
278 | 281 | $(this).next().attr( 'for', id ); |
279 | 282 | }) |
280 | 283 | |
281 | 284 | // Turn the submit into a slick button |
282 | | - $block.find( '.articleFeedback-submit' ) |
| 285 | + $block.find( '.articleFeedbackv5-submit' ) |
283 | 286 | .button() |
284 | 287 | .addClass( 'ui-button-blue' ) |
285 | 288 | |
286 | 289 | // Hide report elements initially |
287 | | - $block.find( '.articleFeedback-visibleWith-report' ).hide(); |
| 290 | + $block.find( '.articleFeedbackv5-visibleWith-report' ).hide(); |
288 | 291 | |
289 | 292 | // Name the hidden rating fields |
290 | | - $block.find( '.articleFeedback-rating' ) |
| 293 | + $block.find( '.articleFeedbackv5-rating' ) |
291 | 294 | .each( function () { |
292 | | - var name = $.articleFeedback.currentBucket().ratingInfo[$(this).attr( 'rel' )]; |
| 295 | + var name = $.articleFeedbackv5.currentBucket().ratingInfo[$(this).attr( 'rel' )]; |
293 | 296 | $(this).find( 'input:hidden' ) .attr( 'name', 'r' + name ); |
294 | 297 | } ); |
295 | 298 | |
296 | 299 | // Hide the additional options, if the user's in a bucket that |
297 | 300 | // requires it |
298 | | - if ( !$.articleFeedback.currentBucket().showOptions ) { |
299 | | - $block.find( '.articleFeedback-options' ).hide(); |
| 301 | + if ( !$.articleFeedbackv5.currentBucket().showOptions ) { |
| 302 | + $block.find( '.articleFeedbackv5-options' ).hide(); |
300 | 303 | } |
301 | 304 | |
302 | 305 | // Grab the results in the background |
303 | | - $.articleFeedback.currentBucket().loadAggregateRatings(); |
| 306 | + $.articleFeedbackv5.currentBucket().loadAggregateRatings(); |
304 | 307 | |
305 | 308 | return $block; |
306 | 309 | }, |
— | — | @@ -315,10 +318,10 @@ |
316 | 319 | bindEvents: function ( $block ) { |
317 | 320 | |
318 | 321 | // On-blur validity check for Help Improve email field |
319 | | - $block.find( '.articleFeedback-helpimprove-email' ) |
| 322 | + $block.find( '.articleFeedbackv5-helpimprove-email' ) |
320 | 323 | .one( 'blur', function () { |
321 | 324 | var $el = $(this); |
322 | | - var bucket = $.articleFeedback.currentBucket(); |
| 325 | + var bucket = $.articleFeedbackv5.currentBucket(); |
323 | 326 | bucket.updateMailValidityLabel( $el.val() ); |
324 | 327 | $el.keyup( function () { |
325 | 328 | bucket.updateMailValidityLabel( $el.val() ); |
— | — | @@ -326,9 +329,9 @@ |
327 | 330 | } ); |
328 | 331 | |
329 | 332 | // Slide-down for the expertise checkboxes |
330 | | - $block.find( '.articleFeedback-expertise > input:checkbox' ) |
| 333 | + $block.find( '.articleFeedbackv5-expertise > input:checkbox' ) |
331 | 334 | .change( function () { |
332 | | - var $options = $.articleFeedback.$holder.find( '.articleFeedback-expertise-options' ); |
| 335 | + var $options = $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-expertise-options' ); |
333 | 336 | if ( $(this).is( ':checked' ) ) { |
334 | 337 | $options.slideDown( 'fast' ); |
335 | 338 | } else { |
— | — | @@ -339,101 +342,101 @@ |
340 | 343 | } ); |
341 | 344 | |
342 | 345 | // Enable submission when at least one rating is set |
343 | | - $block.find( '.articleFeedback-expertise input:checkbox' ) |
| 346 | + $block.find( '.articleFeedbackv5-expertise input:checkbox' ) |
344 | 347 | .each( function () { |
345 | | - var id = 'articleFeedback-expertise-' + $(this).attr( 'value' ); |
| 348 | + var id = 'articleFeedbackv5-expertise-' + $(this).attr( 'value' ); |
346 | 349 | $(this).click( function () { |
347 | | - $.articleFeedback.currentBucket().enableSubmission( true ); |
| 350 | + $.articleFeedbackv5.currentBucket().enableSubmission( true ); |
348 | 351 | } ); |
349 | 352 | } ); |
350 | 353 | |
351 | 354 | // Clicking on the email field checks the associted box |
352 | | - $block.find( '.articleFeedback-helpimprove-email' ) |
| 355 | + $block.find( '.articleFeedbackv5-helpimprove-email' ) |
353 | 356 | .bind( 'mousedown click', function ( e ) { |
354 | | - $(this).closest( '.articleFeedback-helpimprove' ) |
| 357 | + $(this).closest( '.articleFeedbackv5-helpimprove' ) |
355 | 358 | .find( 'input:checkbox' ) |
356 | 359 | .attr( 'checked', true ); |
357 | 360 | } ); |
358 | 361 | |
359 | 362 | // Attach the submit |
360 | | - $block.find( '.articleFeedback-submit' ) |
| 363 | + $block.find( '.articleFeedbackv5-submit' ) |
361 | 364 | .click( function ( e ) { |
362 | 365 | e.preventDefault(); |
363 | | - $.articleFeedback.submitForm(); |
| 366 | + $.articleFeedbackv5.submitForm(); |
364 | 367 | } ); |
365 | 368 | |
366 | 369 | // Set up form/report switch behavior |
367 | | - $block.find( '.articleFeedback-switch' ) |
| 370 | + $block.find( '.articleFeedbackv5-switch' ) |
368 | 371 | .click( function ( e ) { |
369 | | - $.articleFeedback.$holder.find( '.articleFeedback-visibleWith-' + $(this).attr( 'rel' ) ) |
| 372 | + $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-visibleWith-' + $(this).attr( 'rel' ) ) |
370 | 373 | .show(); |
371 | | - $.articleFeedback.$holder.find( '.articleFeedback-switch' ) |
| 374 | + $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-switch' ) |
372 | 375 | .not( $(this) ) |
373 | 376 | .each( function () { |
374 | | - $.articleFeedback.$holder.find( '.articleFeedback-visibleWith-' + $(this).attr( 'rel' ) ).hide(); |
| 377 | + $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-visibleWith-' + $(this).attr( 'rel' ) ).hide(); |
375 | 378 | } ); |
376 | 379 | e.preventDefault(); |
377 | 380 | return false; |
378 | 381 | } ); |
379 | 382 | |
380 | 383 | // Set up rating behavior |
381 | | - var rlabel = $block.find( '.articleFeedback-rating-label' ); |
| 384 | + var rlabel = $block.find( '.articleFeedbackv5-rating-label' ); |
382 | 385 | rlabel.hover( function () { |
383 | 386 | // mouse on |
384 | 387 | var $el = $( this ); |
385 | | - var $rating = $el.closest( '.articleFeedback-rating' ); |
386 | | - $el.addClass( 'articleFeedback-rating-label-hover-head' ); |
387 | | - $el.prevAll( '.articleFeedback-rating-label' ) |
388 | | - .addClass( 'articleFeedback-rating-label-hover-tail' ); |
389 | | - $rating.find( '.articleFeedback-rating-tooltip' ) |
| 388 | + var $rating = $el.closest( '.articleFeedbackv5-rating' ); |
| 389 | + $el.addClass( 'articleFeedbackv5-rating-label-hover-head' ); |
| 390 | + $el.prevAll( '.articleFeedbackv5-rating-label' ) |
| 391 | + .addClass( 'articleFeedbackv5-rating-label-hover-tail' ); |
| 392 | + $rating.find( '.articleFeedbackv5-rating-tooltip' ) |
390 | 393 | .text( mw.msg( 'articlefeedbackv5-field-' + $rating.attr( 'rel' ) + '-tooltip-' + $el.attr( 'rel' ) ) ) |
391 | 394 | .show(); |
392 | 395 | }, function () { |
393 | 396 | // mouse off |
394 | 397 | var $el = $( this ); |
395 | | - var $rating = $el.closest( '.articleFeedback-rating' ); |
396 | | - $el.removeClass( 'articleFeedback-rating-label-hover-head' ); |
397 | | - $el.prevAll( '.articleFeedback-rating-label' ) |
398 | | - .removeClass( 'articleFeedback-rating-label-hover-tail' ); |
399 | | - $rating.find( '.articleFeedback-rating-tooltip' ) |
| 398 | + var $rating = $el.closest( '.articleFeedbackv5-rating' ); |
| 399 | + $el.removeClass( 'articleFeedbackv5-rating-label-hover-head' ); |
| 400 | + $el.prevAll( '.articleFeedbackv5-rating-label' ) |
| 401 | + .removeClass( 'articleFeedbackv5-rating-label-hover-tail' ); |
| 402 | + $rating.find( '.articleFeedbackv5-rating-tooltip' ) |
400 | 403 | .hide(); |
401 | | - var bucket = $.articleFeedback.currentBucket(); |
| 404 | + var bucket = $.articleFeedbackv5.currentBucket(); |
402 | 405 | bucket.updateRating( $rating ); |
403 | 406 | }); |
404 | 407 | rlabel.mousedown( function () { |
405 | | - var bucket = $.articleFeedback.currentBucket(); |
| 408 | + var bucket = $.articleFeedbackv5.currentBucket(); |
406 | 409 | bucket.enableSubmission( true ); |
407 | | - var $h = $.articleFeedback.$holder; |
408 | | - if ( $h.hasClass( 'articleFeedback-expired' ) ) { |
| 410 | + var $h = $.articleFeedbackv5.$holder; |
| 411 | + if ( $h.hasClass( 'articleFeedbackv5-expired' ) ) { |
409 | 412 | // Changing one means the rest will get submitted too |
410 | | - $h.removeClass( 'articleFeedback-expired' ); |
411 | | - $h.find( '.articleFeedback-rating' ) |
412 | | - .addClass( 'articleFeedback-rating-new' ); |
| 413 | + $h.removeClass( 'articleFeedbackv5-expired' ); |
| 414 | + $h.find( '.articleFeedbackv5-rating' ) |
| 415 | + .addClass( 'articleFeedbackv5-rating-new' ); |
413 | 416 | } |
414 | | - $h.find( '.articleFeedback-expertise' ) |
| 417 | + $h.find( '.articleFeedbackv5-expertise' ) |
415 | 418 | .each( function () { |
416 | 419 | bucket.enableExpertise( $(this) ); |
417 | 420 | } ); |
418 | 421 | var $el = $( this ); |
419 | | - var $rating = $el.closest( '.articleFeedback-rating' ); |
420 | | - $rating.addClass( 'articleFeedback-rating-new' ); |
| 422 | + var $rating = $el.closest( '.articleFeedbackv5-rating' ); |
| 423 | + $rating.addClass( 'articleFeedbackv5-rating-new' ); |
421 | 424 | $rating.find( 'input:hidden' ).val( $el.attr( 'rel' ) ); |
422 | | - $el.addClass( 'articleFeedback-rating-label-down' ); |
| 425 | + $el.addClass( 'articleFeedbackv5-rating-label-down' ); |
423 | 426 | $el.nextAll() |
424 | | - .removeClass( 'articleFeedback-rating-label-full' ); |
425 | | - $el.parent().find( '.articleFeedback-rating-clear' ).show(); |
| 427 | + .removeClass( 'articleFeedbackv5-rating-label-full' ); |
| 428 | + $el.parent().find( '.articleFeedbackv5-rating-clear' ).show(); |
426 | 429 | } ); |
427 | 430 | rlabel.mouseup( function () { |
428 | | - $(this).removeClass( 'articleFeedback-rating-label-down' ); |
| 431 | + $(this).removeClass( 'articleFeedbackv5-rating-label-down' ); |
429 | 432 | } ); |
430 | 433 | |
431 | 434 | // Icon to clear out the ratings |
432 | | - $block.find( '.articleFeedback-rating-clear' ) |
| 435 | + $block.find( '.articleFeedbackv5-rating-clear' ) |
433 | 436 | .click( function () { |
434 | | - var bucket = $.articleFeedback.currentBucket(); |
| 437 | + var bucket = $.articleFeedbackv5.currentBucket(); |
435 | 438 | bucket.enableSubmission( true ); |
436 | 439 | $(this).hide(); |
437 | | - var $rating = $(this).closest( '.articleFeedback-rating' ); |
| 440 | + var $rating = $(this).closest( '.articleFeedbackv5-rating' ); |
438 | 441 | $rating.find( 'input:hidden' ).val( 0 ); |
439 | 442 | bucket.updateRating( $rating ); |
440 | 443 | } ); |
— | — | @@ -449,19 +452,19 @@ |
450 | 453 | * @param $rating the rating block |
451 | 454 | */ |
452 | 455 | updateRating: function ( $rating ) { |
453 | | - $rating.find( '.articleFeedback-rating-label' ) |
454 | | - .removeClass( 'articleFeedback-rating-label-full' ); |
| 456 | + $rating.find( '.articleFeedbackv5-rating-label' ) |
| 457 | + .removeClass( 'articleFeedbackv5-rating-label-full' ); |
455 | 458 | var val = $rating.find( 'input:hidden' ).val(); |
456 | | - var $label = $rating.find( '.articleFeedback-rating-label[rel="' + val + '"]' ); |
| 459 | + var $label = $rating.find( '.articleFeedbackv5-rating-label[rel="' + val + '"]' ); |
457 | 460 | if ( $label.length ) { |
458 | | - $label.prevAll( '.articleFeedback-rating-label' ) |
| 461 | + $label.prevAll( '.articleFeedbackv5-rating-label' ) |
459 | 462 | .add( $label ) |
460 | | - .addClass( 'articleFeedback-rating-label-full' ); |
461 | | - $label.nextAll( '.articleFeedback-rating-label' ) |
462 | | - .removeClass( 'articleFeedback-rating-label-full' ); |
463 | | - $rating.find( '.articleFeedback-rating-clear' ).show(); |
| 463 | + .addClass( 'articleFeedbackv5-rating-label-full' ); |
| 464 | + $label.nextAll( '.articleFeedbackv5-rating-label' ) |
| 465 | + .removeClass( 'articleFeedbackv5-rating-label-full' ); |
| 466 | + $rating.find( '.articleFeedbackv5-rating-clear' ).show(); |
464 | 467 | } else { |
465 | | - $rating.find( '.articleFeedback-rating-clear' ).hide(); |
| 468 | + $rating.find( '.articleFeedbackv5-rating-clear' ).hide(); |
466 | 469 | } |
467 | 470 | }, |
468 | 471 | |
— | — | @@ -474,17 +477,17 @@ |
475 | 478 | * @param state bool true to enable; false to disable |
476 | 479 | */ |
477 | 480 | enableSubmission: function ( state ) { |
478 | | - var $h = $.articleFeedback.$holder; |
| 481 | + var $h = $.articleFeedbackv5.$holder; |
479 | 482 | if ( state ) { |
480 | | - if ($.articleFeedback.successTimeout) { |
481 | | - clearTimeout( $.articleFeedback.successTimeout ); |
| 483 | + if ($.articleFeedbackv5.successTimeout) { |
| 484 | + clearTimeout( $.articleFeedbackv5.successTimeout ); |
482 | 485 | } |
483 | | - $h.find( '.articleFeedback-submit' ).button( { 'disabled': false } ); |
484 | | - $h.find( '.articleFeedback-success span' ).hide(); |
485 | | - $h.find( '.articleFeedback-pending span' ).fadeIn( 'fast' ); |
| 486 | + $h.find( '.articleFeedbackv5-submit' ).button( { 'disabled': false } ); |
| 487 | + $h.find( '.articleFeedbackv5-success span' ).hide(); |
| 488 | + $h.find( '.articleFeedbackv5-pending span' ).fadeIn( 'fast' ); |
486 | 489 | } else { |
487 | | - $h.find( '.articleFeedback-submit' ).button( { 'disabled': true } ); |
488 | | - $h.find( '.articleFeedback-pending span' ).hide(); |
| 490 | + $h.find( '.articleFeedbackv5-submit' ).button( { 'disabled': true } ); |
| 491 | + $h.find( '.articleFeedbackv5-pending span' ).hide(); |
489 | 492 | } |
490 | 493 | }, |
491 | 494 | |
— | — | @@ -499,8 +502,8 @@ |
500 | 503 | enableExpertise: function ( $el ) { |
501 | 504 | $el.find( 'input:checkbox[value=general]' ) |
502 | 505 | .attr( 'disabled', false ) |
503 | | - $el.find( '.articleFeedback-expertise-disabled' ) |
504 | | - .removeClass( 'articleFeedback-expertise-disabled' ); |
| 506 | + $el.find( '.articleFeedbackv5-expertise-disabled' ) |
| 507 | + .removeClass( 'articleFeedbackv5-expertise-disabled' ); |
505 | 508 | }, |
506 | 509 | |
507 | 510 | // }}} |
— | — | @@ -514,7 +517,7 @@ |
515 | 518 | */ |
516 | 519 | updateMailValidityLabel: function ( mail ) { |
517 | 520 | var isValid = mw.util.validateEmail( mail ); |
518 | | - var $label = $.articleFeedback.$holder.find( '.articleFeedback-helpimprove-email' ); |
| 521 | + var $label = $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-helpimprove-email' ); |
519 | 522 | if ( isValid === null ) { // empty address |
520 | 523 | $label.removeClass( 'valid invalid' ); |
521 | 524 | } else if ( isValid ) { |
— | — | @@ -532,10 +535,10 @@ |
533 | 536 | * the label's CSS class |
534 | 537 | */ |
535 | 538 | loadAggregateRatings: function () { |
536 | | - var usecache = !( !$.articleFeedback.anonymous || $.articleFeedback.alreadySubmitted ); |
| 539 | + var usecache = !( !$.articleFeedbackv5.anonymous || $.articleFeedbackv5.alreadySubmitted ); |
537 | 540 | |
538 | 541 | $.ajax( { |
539 | | - 'url': $.articleFeedback.apiUrl, |
| 542 | + 'url': $.articleFeedbackv5.apiUrl, |
540 | 543 | 'type': 'GET', |
541 | 544 | 'dataType': 'json', |
542 | 545 | 'cache': usecache, |
— | — | @@ -544,11 +547,11 @@ |
545 | 548 | 'format': 'json', |
546 | 549 | 'list': 'articlefeedbackv5', |
547 | 550 | 'afsubaction': 'showratings', |
548 | | - 'afpageid': $.articleFeedback.pageId, |
549 | | - 'afanontoken': usecache ? $.articleFeedback.userId : '', |
| 551 | + 'afpageid': $.articleFeedbackv5.pageId, |
| 552 | + 'afanontoken': usecache ? $.articleFeedbackv5.userId : '', |
550 | 553 | 'afuserrating': Number( !usecache ), |
551 | 554 | 'maxage': 0, |
552 | | - 'smaxage': usecache ? 0 : mw.config.get( 'wgArticleFeedbackv5SMaxage' ) |
| 555 | + 'smaxage': usecache ? 0 : mw.config.get( 'wgArticleFeedbackSMaxage' ) |
553 | 556 | }, |
554 | 557 | 'success': function ( data ) { |
555 | 558 | // Get data |
— | — | @@ -559,13 +562,14 @@ |
560 | 563 | || !data.query.articlefeedbackv5.length |
561 | 564 | ) { |
562 | 565 | mw.log( 'ArticleFeedback invalid response error.' ); |
563 | | - if ($.articleFeedback.debug && 'error' in data && 'info' in data.error) { |
| 566 | + if ($.articleFeedbackv5.debug && 'error' in data && 'info' in data.error) { |
564 | 567 | console.log( data.error.info ); |
565 | | - $.articleFeedback.$holder.find( '.articleFeedback-error-message' ).html( data.error.info.replace( "\n", '<br />' ) ); |
| 568 | + $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-error-message' ).html( data.error.info.replace( "\n", '<br />' ) ); |
566 | 569 | } |
567 | | - $.articleFeedback.$holder.find( '.articleFeedback-error' ).show(); |
| 570 | + $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-error' ).show(); |
568 | 571 | return; |
569 | 572 | } |
| 573 | + $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-error' ).show(); |
570 | 574 | var feedback = data.query.articlefeedbackv5[0]; |
571 | 575 | |
572 | 576 | // Index rating data by rating ID |
— | — | @@ -577,9 +581,9 @@ |
578 | 582 | } |
579 | 583 | |
580 | 584 | // Ratings |
581 | | - $.articleFeedback.$holder.find( '.articleFeedback-rating' ).each( function () { |
| 585 | + $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-rating' ).each( function () { |
582 | 586 | var name = $(this).attr( 'rel' ); |
583 | | - var info = $.articleFeedback.currentBucket().ratingInfo; |
| 587 | + var info = $.articleFeedbackv5.currentBucket().ratingInfo; |
584 | 588 | var rating = name in info && info[name] in ratings ? ratings[info[name]] : null; |
585 | 589 | if ( |
586 | 590 | rating !== null |
— | — | @@ -588,41 +592,41 @@ |
589 | 593 | && rating.total > 0 |
590 | 594 | ) { |
591 | 595 | var average = Math.round( ( rating.total / rating.count ) * 10 ) / 10; |
592 | | - $(this).find( '.articleFeedback-rating-average' ) |
| 596 | + $(this).find( '.articleFeedbackv5-rating-average' ) |
593 | 597 | .text( mw.language.convertNumber( average + ( average % 1 === 0 ? '.0' : '' ) , false ) ); |
594 | | - $(this).find( '.articleFeedback-rating-meter div' ) |
| 598 | + $(this).find( '.articleFeedbackv5-rating-meter div' ) |
595 | 599 | .css( 'width', Math.round( average * 21 ) + 'px' ); |
596 | | - $(this).find( '.articleFeedback-rating-count' ) |
| 600 | + $(this).find( '.articleFeedbackv5-rating-count' ) |
597 | 601 | .text( mw.msg( 'articlefeedbackv5-report-ratings', rating.countall ) ); |
598 | 602 | } else { |
599 | 603 | // Special case for no ratings |
600 | | - $(this).find( '.articleFeedback-rating-average' ) |
| 604 | + $(this).find( '.articleFeedbackv5-rating-average' ) |
601 | 605 | .html( ' ' ); |
602 | | - $(this).find( '.articleFeedback-rating-meter div' ) |
| 606 | + $(this).find( '.articleFeedbackv5-rating-meter div' ) |
603 | 607 | .css( 'width', 0 ); |
604 | | - $(this).find( '.articleFeedback-rating-count' ) |
| 608 | + $(this).find( '.articleFeedbackv5-rating-count' ) |
605 | 609 | .text( mw.msg( 'articlefeedbackv5-report-empty' ) ); |
606 | 610 | } |
607 | 611 | } ); |
608 | 612 | |
609 | 613 | // Expiration |
610 | 614 | if ( typeof feedback.status === 'string' && feedback.status === 'expired' ) { |
611 | | - $.articleFeedback.$holder.addClass( 'articleFeedback-expired' ); |
612 | | - $.articleFeedback.$holder.find( '.articleFeedback-expiry' ) |
| 615 | + $.articleFeedbackv5.$holder.addClass( 'articleFeedbackv5-expired' ); |
| 616 | + $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-expiry' ) |
613 | 617 | .slideDown( 'fast' ); |
614 | 618 | } else { |
615 | | - $.articleFeedback.$holder.removeClass( 'articleFeedback-expired' ) |
616 | | - $.articleFeedback.$holder.find( '.articleFeedback-expiry' ) |
| 619 | + $.articleFeedbackv5.$holder.removeClass( 'articleFeedbackv5-expired' ) |
| 620 | + $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-expiry' ) |
617 | 621 | .slideUp( 'fast' ); |
618 | 622 | } |
619 | 623 | |
620 | 624 | // Status change - un-new the rating controls |
621 | | - $.articleFeedback.$holder.find( '.articleFeedback-rating-new' ) |
622 | | - .removeClass( 'articleFeedback-rating-new' ); |
| 625 | + $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-rating-new' ) |
| 626 | + .removeClass( 'articleFeedbackv5-rating-new' ); |
623 | 627 | }, |
624 | 628 | 'error': function () { |
625 | 629 | mw.log( 'Report loading error' ); |
626 | | - $.articleFeedback.$holder.find( '.articleFeedback-error' ).show(); |
| 630 | + $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-error' ).show(); |
627 | 631 | } |
628 | 632 | } ); |
629 | 633 | |
— | — | @@ -638,13 +642,13 @@ |
639 | 643 | */ |
640 | 644 | getFormData: function () { |
641 | 645 | var data = {}; |
642 | | - var info = $.articleFeedback.currentBucket().ratingInfo; |
| 646 | + var info = $.articleFeedbackv5.currentBucket().ratingInfo; |
643 | 647 | for ( var key in info ) { |
644 | 648 | var id = info[key]; |
645 | | - data['r' + id] = $.articleFeedback.$holder.find( 'input[name="r' + id + '"]' ).val(); |
| 649 | + data['r' + id] = $.articleFeedbackv5.$holder.find( 'input[name="r' + id + '"]' ).val(); |
646 | 650 | } |
647 | 651 | var expertise = []; |
648 | | - $.articleFeedback.$holder.find( '.articleFeedback-expertise input:checked' ).each( function () { |
| 652 | + $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-expertise input:checked' ).each( function () { |
649 | 653 | expertise.push( $(this).val() ); |
650 | 654 | } ); |
651 | 655 | data.expertise = expertise.join( '|' ); |
— | — | @@ -663,8 +667,8 @@ |
664 | 668 | localValidation: function ( formdata ) { |
665 | 669 | var error = {}; |
666 | 670 | var ok = true; |
667 | | - if ( $.articleFeedback.$holder.find( '.articleFeedback-helpimprove input:checked' ).length > 0 ) { |
668 | | - var mail = $.articleFeedback.$holder.find( '.articleFeedback-helpimprove-email' ).val(); |
| 671 | + if ( $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-helpimprove input:checked' ).length > 0 ) { |
| 672 | + var mail = $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-helpimprove-email' ).val(); |
669 | 673 | if ( !mw.util.validateEmail( mail ) ) { |
670 | 674 | error.helpimprove_email = 'That email address is not valid'; |
671 | 675 | ok = false; |
— | — | @@ -680,8 +684,8 @@ |
681 | 685 | * Locks the form |
682 | 686 | */ |
683 | 687 | lockForm: function () { |
684 | | - $.articleFeedback.currentBucket().enableSubmission( false ); |
685 | | - $.articleFeedback.$holder.find( '.articleFeedback-lock' ).show(); |
| 688 | + $.articleFeedbackv5.currentBucket().enableSubmission( false ); |
| 689 | + $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-lock' ).show(); |
686 | 690 | }, |
687 | 691 | |
688 | 692 | // }}} |
— | — | @@ -691,8 +695,8 @@ |
692 | 696 | * Unlocks the form |
693 | 697 | */ |
694 | 698 | unlockForm: function () { |
695 | | - $.articleFeedback.currentBucket().enableSubmission( true ); |
696 | | - $.articleFeedback.$holder.find( '.articleFeedback-lock' ).hide(); |
| 699 | + $.articleFeedbackv5.currentBucket().enableSubmission( true ); |
| 700 | + $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-lock' ).hide(); |
697 | 701 | }, |
698 | 702 | |
699 | 703 | // }}} |
— | — | @@ -705,14 +709,14 @@ |
706 | 710 | */ |
707 | 711 | markFormError: function ( error ) { |
708 | 712 | if ( '_api' in error ) { |
709 | | - if ($.articleFeedback.debug) { |
710 | | - $.articleFeedback.$holder.find( '.articleFeedback-error-message' ) |
| 713 | + if ($.articleFeedbackv5.debug) { |
| 714 | + $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-error-message' ) |
711 | 715 | .html( error._api.info.replace( "\n", '<br />' ) ); |
712 | 716 | } |
713 | | - $.articleFeedback.$holder.find( '.articleFeedback-error' ).show(); |
| 717 | + $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-error' ).show(); |
714 | 718 | } else { |
715 | 719 | if ( 'helpimprove_email' in error ) { |
716 | | - $.articleFeedback.$holder.find( '.articleFeedback-helpimprove-email' ) |
| 720 | + $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-helpimprove-email' ) |
717 | 721 | .addClass( 'invalid' ) |
718 | 722 | .removeClass( 'valid' ); |
719 | 723 | } |
— | — | @@ -729,10 +733,10 @@ |
730 | 734 | * Sets the success state |
731 | 735 | */ |
732 | 736 | setSuccessState: function () { |
733 | | - var $h = $.articleFeedback.$holder; |
734 | | - $h.find( '.articleFeedback-success span' ).fadeIn( 'fast' ); |
735 | | - $.articleFeedback.successTimeout = setTimeout( function () { |
736 | | - $.articleFeedback.$holder.find( '.articleFeedback-success span' ) |
| 737 | + var $h = $.articleFeedbackv5.$holder; |
| 738 | + $h.find( '.articleFeedbackv5-success span' ).fadeIn( 'fast' ); |
| 739 | + $.articleFeedbackv5.successTimeout = setTimeout( function () { |
| 740 | + $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-success span' ) |
737 | 741 | .fadeOut( 'slow' ); |
738 | 742 | }, 5000 ); |
739 | 743 | }, |
— | — | @@ -840,7 +844,7 @@ |
841 | 845 | /** |
842 | 846 | * Set up the CTA options' UI objects |
843 | 847 | */ |
844 | | - $.articleFeedback.ctas = { |
| 848 | + $.articleFeedbackv5.ctas = { |
845 | 849 | |
846 | 850 | // {{{ CTA 1: Encticement to edit |
847 | 851 | |
— | — | @@ -857,10 +861,12 @@ |
858 | 862 | |
859 | 863 | // The overall template |
860 | 864 | var block_tpl = '\ |
861 | | - <div class="articleFeedback-cta-panel">\ |
862 | | - <h5>TODO: EDIT CTA</h5>\ |
863 | | - <p>Eventually this will have a pretty button and some nice messages. For now, though...</p>\ |
864 | | - <p><a href="" class="articleFeedback-edit-cta-link">EDIT THIS PAGE</a></p>\ |
| 865 | + <div class="articleFeedbackv5-panel">\ |
| 866 | + <div class="articleFeedbackv5-buffer">\ |
| 867 | + <h5 class="articleFeedbackv5-title">TODO: EDIT CTA</h5>\ |
| 868 | + <p>Eventually this will have a pretty button and some nice messages. For now, though...</p>\ |
| 869 | + <p><a href="" class="articleFeedbackv5-edit-cta-link">EDIT THIS PAGE</a></p>\ |
| 870 | + </div>\ |
865 | 871 | </div>\ |
866 | 872 | '; |
867 | 873 | |
— | — | @@ -868,7 +874,7 @@ |
869 | 875 | var $block = $( block_tpl ); |
870 | 876 | |
871 | 877 | // Fill in the link |
872 | | - $block.find( '.articleFeedback-edit-link' ) |
| 878 | + $block.find( '.articleFeedbackv5-edit-link' ) |
873 | 879 | .attr( 'href', mw.config.get( 'wgArticlePath' ).replace( |
874 | 880 | '$1', mw.config.get( 'wgArticleFeedbackv5WhatsThisPage' ) |
875 | 881 | ) ); |
— | — | @@ -898,15 +904,15 @@ |
899 | 905 | * jQuery-ized) |
900 | 906 | * @param config object the config object |
901 | 907 | */ |
902 | | - $.articleFeedback.init = function ( $el, config ) { |
903 | | - $.articleFeedback.$holder = $el; |
904 | | - $.articleFeedback.config = config; |
| 908 | + $.articleFeedbackv5.init = function ( $el, config ) { |
| 909 | + $.articleFeedbackv5.$holder = $el; |
| 910 | + $.articleFeedbackv5.config = config; |
905 | 911 | // Has the user already submitted ratings for this page at this revision? |
906 | | - $.articleFeedback.alreadySubmitted = $.cookie( $.articleFeedback.prefix( 'submitted' ) ) === 'true'; |
| 912 | + $.articleFeedbackv5.alreadySubmitted = $.cookie( $.articleFeedbackv5.prefix( 'submitted' ) ) === 'true'; |
907 | 913 | // Go ahead and load the form |
908 | 914 | // When the tool is visible, load the form |
909 | | - $.articleFeedback.$holder.appear( function () { |
910 | | - $.articleFeedback.loadForm(); |
| 915 | + $.articleFeedbackv5.$holder.appear( function () { |
| 916 | + $.articleFeedbackv5.loadForm(); |
911 | 917 | } ); |
912 | 918 | }; |
913 | 919 | |
— | — | @@ -920,9 +926,9 @@ |
921 | 927 | * @param key string name of event to prefix |
922 | 928 | * @return string prefixed event name |
923 | 929 | */ |
924 | | - $.articleFeedback.prefix = function ( key ) { |
| 930 | + $.articleFeedbackv5.prefix = function ( key ) { |
925 | 931 | var version = mw.config.get( 'wgArticleFeedbackv5Tracking' ).version || 0; |
926 | | - return 'ext.articleFeedback@' + version + '-' + key; |
| 932 | + return 'ext.articleFeedbackv5@' + version + '-' + key; |
927 | 933 | }; |
928 | 934 | |
929 | 935 | /** |
— | — | @@ -930,8 +936,8 @@ |
931 | 937 | * |
932 | 938 | * @return object the bucket |
933 | 939 | */ |
934 | | - $.articleFeedback.currentBucket = function () { |
935 | | - return $.articleFeedback.buckets[$.articleFeedback.bucketId]; |
| 940 | + $.articleFeedbackv5.currentBucket = function () { |
| 941 | + return $.articleFeedbackv5.buckets[$.articleFeedbackv5.bucketId]; |
936 | 942 | }; |
937 | 943 | |
938 | 944 | /** |
— | — | @@ -939,8 +945,8 @@ |
940 | 946 | * |
941 | 947 | * @return object the cta |
942 | 948 | */ |
943 | | - $.articleFeedback.currentCTA = function () { |
944 | | - return $.articleFeedback.ctas[$.articleFeedback.ctaId]; |
| 949 | + $.articleFeedbackv5.currentCTA = function () { |
| 950 | + return $.articleFeedbackv5.ctas[$.articleFeedbackv5.ctaId]; |
945 | 951 | }; |
946 | 952 | |
947 | 953 | // }}} |
— | — | @@ -952,9 +958,9 @@ |
953 | 959 | * The load method uses an ajax request to pull down the bucket ID, the |
954 | 960 | * feedback ID, and using those, build the form. |
955 | 961 | */ |
956 | | - $.articleFeedback.loadForm = function () { |
| 962 | + $.articleFeedbackv5.loadForm = function () { |
957 | 963 | $.ajax( { |
958 | | - 'url': $.articleFeedback.apiUrl, |
| 964 | + 'url': $.articleFeedbackv5.apiUrl, |
959 | 965 | 'type': 'GET', |
960 | 966 | 'dataType': 'json', |
961 | 967 | 'data': { |
— | — | @@ -962,9 +968,9 @@ |
963 | 969 | 'action': 'query', |
964 | 970 | 'format': 'json', |
965 | 971 | 'afsubaction': 'newform', |
966 | | - 'afanontoken': $.articleFeedback.userId, |
967 | | - 'afpageid': $.articleFeedback.pageId, |
968 | | - 'afrevid': $.articleFeedback.revisionId |
| 972 | + 'afanontoken': $.articleFeedbackv5.userId, |
| 973 | + 'afpageid': $.articleFeedbackv5.pageId, |
| 974 | + 'afrevid': $.articleFeedbackv5.revisionId |
969 | 975 | }, |
970 | 976 | 'success': function ( data ) { |
971 | 977 | if ( !( 'form' in data ) || !( 'bucketId' in data.form ) ) { |
— | — | @@ -974,15 +980,15 @@ |
975 | 981 | } else { |
976 | 982 | console.log(data); |
977 | 983 | } |
978 | | - $.articleFeedback.bucketId = 6; // No form |
| 984 | + $.articleFeedbackv5.bucketId = 6; // No form |
979 | 985 | } else { |
980 | | - $.articleFeedback.bucketId = data.form.bucketId; |
| 986 | + $.articleFeedbackv5.bucketId = data.form.bucketId; |
981 | 987 | } |
982 | | - $.articleFeedback.buildForm( 'form' in data ? data.form.response : null ); |
| 988 | + $.articleFeedbackv5.buildForm( 'form' in data ? data.form.response : null ); |
983 | 989 | }, |
984 | 990 | 'error': function () { |
985 | 991 | mw.log( 'Report loading error' ); |
986 | | - $.articleFeedback.buildForm(); |
| 992 | + $.articleFeedbackv5.buildForm(); |
987 | 993 | } |
988 | 994 | } ); |
989 | 995 | }; |
— | — | @@ -992,9 +998,9 @@ |
993 | 999 | * |
994 | 1000 | * @param response object any existing answers |
995 | 1001 | */ |
996 | | - $.articleFeedback.buildForm = function ( response ) { |
997 | | - $.articleFeedback.bucketId = 5; // For now, only use Option 5 |
998 | | - var bucket = $.articleFeedback.currentBucket(); |
| 1002 | + $.articleFeedbackv5.buildForm = function ( response ) { |
| 1003 | + $.articleFeedbackv5.bucketId = 5; // For now, only use Option 5 |
| 1004 | + var bucket = $.articleFeedbackv5.currentBucket(); |
999 | 1005 | if ( !( 'buildForm' in bucket ) ) { |
1000 | 1006 | return; |
1001 | 1007 | } |
— | — | @@ -1005,9 +1011,9 @@ |
1006 | 1012 | if ( 'fillForm' in bucket ) { |
1007 | 1013 | bucket.fillForm( $block, response ); |
1008 | 1014 | } |
1009 | | - $.articleFeedback.$holder |
| 1015 | + $.articleFeedbackv5.$holder |
1010 | 1016 | .html( $block ) |
1011 | | - .append( '<div class="articleFeedback-lock"></div>' ); |
| 1017 | + .append( '<div class="articleFeedbackv5-lock"></div>' ); |
1012 | 1018 | }; |
1013 | 1019 | |
1014 | 1020 | // }}} |
— | — | @@ -1021,15 +1027,15 @@ |
1022 | 1028 | * passes local validation. Local validation is defined by the bucket UI |
1023 | 1029 | * object. |
1024 | 1030 | */ |
1025 | | - $.articleFeedback.submitForm = function () { |
| 1031 | + $.articleFeedbackv5.submitForm = function () { |
1026 | 1032 | |
1027 | 1033 | // For anonymous users, keep a cookie around so we know they've rated before |
1028 | 1034 | if ( mw.user.anonymous() ) { |
1029 | | - $.cookie( $.articleFeedback.prefix( 'rated' ), 'true', { 'expires': 365, 'path': '/' } ); |
| 1035 | + $.cookie( $.articleFeedbackv5.prefix( 'rated' ), 'true', { 'expires': 365, 'path': '/' } ); |
1030 | 1036 | } |
1031 | 1037 | |
1032 | 1038 | // Get the form data |
1033 | | - var bucket = $.articleFeedback.currentBucket(); |
| 1039 | + var bucket = $.articleFeedbackv5.currentBucket(); |
1034 | 1040 | var formdata = {}; |
1035 | 1041 | if ( 'getFormData' in bucket ) { |
1036 | 1042 | formdata = bucket.getFormData(); |
— | — | @@ -1055,16 +1061,16 @@ |
1056 | 1062 | |
1057 | 1063 | // Send off the ajax request |
1058 | 1064 | $.ajax( { |
1059 | | - 'url': $.articleFeedback.apiUrl, |
| 1065 | + 'url': $.articleFeedbackv5.apiUrl, |
1060 | 1066 | 'type': 'POST', |
1061 | 1067 | 'dataType': 'json', |
1062 | 1068 | 'data': $.extend( formdata, { |
1063 | 1069 | 'action': 'articlefeedbackv5', |
1064 | 1070 | 'format': 'json', |
1065 | | - 'anontoken': $.articleFeedback.userId, |
1066 | | - 'pageid': $.articleFeedback.pageId, |
1067 | | - 'revid': $.articleFeedback.revisionId, |
1068 | | - 'bucket': $.articleFeedback.bucketId |
| 1071 | + 'anontoken': $.articleFeedbackv5.userId, |
| 1072 | + 'pageid': $.articleFeedbackv5.pageId, |
| 1073 | + 'revid': $.articleFeedbackv5.revisionId, |
| 1074 | + 'bucket': $.articleFeedbackv5.bucketId |
1069 | 1075 | } ), |
1070 | 1076 | 'success': function( data ) { |
1071 | 1077 | if ( 'error' in data ) { |
— | — | @@ -1080,7 +1086,7 @@ |
1081 | 1087 | if ( 'onSuccess' in bucket ) { |
1082 | 1088 | bucket.onSuccess( formdata ); |
1083 | 1089 | } |
1084 | | - $.articleFeedback.showCTA(); |
| 1090 | + $.articleFeedbackv5.showCTA(); |
1085 | 1091 | } |
1086 | 1092 | }, |
1087 | 1093 | 'error': function () { |
— | — | @@ -1104,9 +1110,9 @@ |
1105 | 1111 | * |
1106 | 1112 | * @param cta_name string the name of the CTA to display |
1107 | 1113 | */ |
1108 | | - $.articleFeedback.showCTA = function ( ctaId ) { |
1109 | | - $.articleFeedback.ctaId = 1; // For now, just use the edit CTA |
1110 | | - var cta = $.articleFeedback.currentCTA(); |
| 1114 | + $.articleFeedbackv5.showCTA = function ( ctaId ) { |
| 1115 | + $.articleFeedbackv5.ctaId = 1; // For now, just use the edit CTA |
| 1116 | + var cta = $.articleFeedbackv5.currentCTA(); |
1111 | 1117 | if ( !( 'build' in cta ) ) { |
1112 | 1118 | return; |
1113 | 1119 | } |
— | — | @@ -1114,18 +1120,18 @@ |
1115 | 1121 | if ( 'bindEvents' in cta ) { |
1116 | 1122 | cta.bindEvents( $block ); |
1117 | 1123 | } |
1118 | | - $.articleFeedback.$holder.html( $block ); |
| 1124 | + $.articleFeedbackv5.$holder.html( $block ); |
1119 | 1125 | }; |
1120 | 1126 | |
1121 | 1127 | // }}} |
1122 | 1128 | |
1123 | 1129 | // }}} |
1124 | | -// {{{ articleFeedback plugin |
| 1130 | +// {{{ articleFeedbackv5 plugin |
1125 | 1131 | |
1126 | 1132 | /** |
1127 | 1133 | * Can be called with an options object like... |
1128 | 1134 | * |
1129 | | - * $( ... ).articleFeedback( { |
| 1135 | + * $( ... ).articleFeedbackv5( { |
1130 | 1136 | * 'ratings': { |
1131 | 1137 | * 'rating-name': { |
1132 | 1138 | * 'id': 1, // Numeric identifier of the rating, same as the rating_id value in the db |
— | — | @@ -1138,9 +1144,9 @@ |
1139 | 1145 | * |
1140 | 1146 | * Rating IDs need to be included in $wgArticleFeedbackv5RatingTypes, which is an array mapping allowed IDs to rating names. |
1141 | 1147 | */ |
1142 | | -$.fn.articleFeedback = function ( opts ) { |
| 1148 | +$.fn.articleFeedbackv5 = function ( opts ) { |
1143 | 1149 | if ( typeof( opts ) == 'object' ) { |
1144 | | - $.articleFeedback.init( $( this ), opts ); |
| 1150 | + $.articleFeedbackv5.init( $( this ), opts ); |
1145 | 1151 | } |
1146 | 1152 | return $( this ); |
1147 | 1153 | }; |
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedback/jquery.articleFeedback.css |
— | — | @@ -2,30 +2,30 @@ |
3 | 3 | * Styles for Article Feedback Plugin |
4 | 4 | */ |
5 | 5 | |
6 | | -.articleFeedback { |
| 6 | +.articleFeedbackv5 { |
7 | 7 | position: relative; |
8 | 8 | display: inline-block; |
9 | 9 | margin-top: 1em; |
10 | 10 | } |
11 | 11 | |
12 | 12 | @media print { |
13 | | - .articleFeedback { |
| 13 | + .articleFeedbackv5 { |
14 | 14 | display:none; |
15 | 15 | } |
16 | 16 | } |
17 | 17 | |
18 | | -.articleFeedback-panel { |
| 18 | +.articleFeedbackv5-panel { |
19 | 19 | background-color: #f9f9f9; |
20 | 20 | border: 1px solid #cccccc; |
21 | 21 | padding-bottom: 1px; |
22 | 22 | } |
23 | 23 | |
24 | | -.articleFeedback-error-message { |
| 24 | +.articleFeedbackv5-error-message { |
25 | 25 | padding: 3em; |
26 | 26 | text-align: center; |
27 | 27 | } |
28 | 28 | |
29 | | -.articleFeedback-error { |
| 29 | +.articleFeedbackv5-error { |
30 | 30 | display: none; |
31 | 31 | position: absolute; |
32 | 32 | top: 0; |
— | — | @@ -37,7 +37,7 @@ |
38 | 38 | padding-bottom: 1px; |
39 | 39 | } |
40 | 40 | |
41 | | -.articleFeedback-lock { |
| 41 | +.articleFeedbackv5-lock { |
42 | 42 | display: none; |
43 | 43 | position: absolute; |
44 | 44 | top: 0; |
— | — | @@ -45,7 +45,7 @@ |
46 | 46 | right: 0; |
47 | 47 | } |
48 | 48 | |
49 | | -.articleFeedback-pitches { |
| 49 | +.articleFeedbackv5-pitches { |
50 | 50 | float: absolute; |
51 | 51 | top: 1; |
52 | 52 | left: 1; |
— | — | @@ -53,20 +53,20 @@ |
54 | 54 | background-color: #f9f9f9; |
55 | 55 | } |
56 | 56 | |
57 | | -.articleFeedback-pitch { |
| 57 | +.articleFeedbackv5-pitch { |
58 | 58 | display: none; |
59 | 59 | } |
60 | 60 | |
61 | | -.articleFeedback-lock { |
| 61 | +.articleFeedbackv5-lock { |
62 | 62 | background-color: transparent; |
63 | 63 | } |
64 | 64 | |
65 | | -.articleFeedback-pitch-or { |
| 65 | +.articleFeedbackv5-pitch-or { |
66 | 66 | margin-left: 0.75em; |
67 | 67 | margin-right: 0.25em; |
68 | 68 | } |
69 | 69 | |
70 | | -.articleFeedback-reject { |
| 70 | +.articleFeedbackv5-reject { |
71 | 71 | border: none; |
72 | 72 | background-color: transparent; |
73 | 73 | cursor: pointer; |
— | — | @@ -74,27 +74,27 @@ |
75 | 75 | line-height: 1.4em; |
76 | 76 | } |
77 | 77 | |
78 | | -.articleFeedback-reject:hover { |
| 78 | +.articleFeedbackv5-reject:hover { |
79 | 79 | text-decoration: underline; |
80 | 80 | } |
81 | 81 | |
82 | | -.articleFeedback-pitch .articleFeedback-buffer { |
| 82 | +.articleFeedbackv5-pitch .articleFeedbackv5-buffer { |
83 | 83 | padding: 0.75em 1em; |
84 | 84 | } |
85 | 85 | |
86 | | -.articleFeedback-panel { |
| 86 | +.articleFeedbackv5-panel { |
87 | 87 | float: left; |
88 | 88 | } |
89 | 89 | |
90 | | -.articleFeedback-panel .articleFeedback-buffer { |
| 90 | +.articleFeedbackv5-panel .articleFeedbackv5-buffer { |
91 | 91 | padding: 0.75em 1em; |
92 | 92 | } |
93 | 93 | |
94 | | -.articleFeedback-title { |
| 94 | +.articleFeedbackv5-title { |
95 | 95 | font-size: 1.4em; |
96 | 96 | } |
97 | 97 | |
98 | | -.articleFeedback-pitch .articleFeedback-title { |
| 98 | +.articleFeedbackv5-pitch .articleFeedbackv5-title { |
99 | 99 | font-size: 1em; |
100 | 100 | padding-left: 28px; |
101 | 101 | line-height: 32px; |
— | — | @@ -105,7 +105,7 @@ |
106 | 106 | margin-bottom: 0.5em; |
107 | 107 | } |
108 | 108 | |
109 | | -.articleFeedback-pitch .articleFeedback-pop { |
| 109 | +.articleFeedbackv5-pitch .articleFeedbackv5-pop { |
110 | 110 | padding: 1em; |
111 | 111 | margin: 0; |
112 | 112 | background-color: white; |
— | — | @@ -120,17 +120,17 @@ |
121 | 121 | border-radius: 5px; |
122 | 122 | } |
123 | 123 | |
124 | | -.articleFeedback-message { |
| 124 | +.articleFeedbackv5-message { |
125 | 125 | margin: 0.33em; |
126 | 126 | font-size: 1.5em; |
127 | 127 | } |
128 | 128 | |
129 | | -.articleFeedback-body { |
| 129 | +.articleFeedbackv5-body { |
130 | 130 | margin: 0.5em; |
131 | 131 | color: #333333; |
132 | 132 | } |
133 | 133 | |
134 | | -.articleFeedback-switch { |
| 134 | +.articleFeedbackv5-switch { |
135 | 135 | cursor: pointer; |
136 | 136 | color: #0645AD; |
137 | 137 | float: right; |
— | — | @@ -140,42 +140,42 @@ |
141 | 141 | padding-right: 22px; |
142 | 142 | } |
143 | 143 | |
144 | | -.articleFeedback-switch:hover { |
| 144 | +.articleFeedbackv5-switch:hover { |
145 | 145 | text-decoration: underline; |
146 | 146 | } |
147 | 147 | |
148 | | -.articleFeedback-switch-form { |
| 148 | +.articleFeedbackv5-switch-form { |
149 | 149 | /* @embed */ |
150 | 150 | background-image: url(images/form.png); |
151 | 151 | } |
152 | 152 | |
153 | | -.articleFeedback-switch-report { |
| 153 | +.articleFeedbackv5-switch-report { |
154 | 154 | /* @embed */ |
155 | 155 | background-image: url(images/report.png); |
156 | 156 | } |
157 | 157 | |
158 | | -.articleFeedback-switch-form:hover { |
| 158 | +.articleFeedbackv5-switch-form:hover { |
159 | 159 | /* @embed */ |
160 | 160 | background-image: url(images/form-hover.png); |
161 | 161 | } |
162 | 162 | |
163 | | -.articleFeedback-switch-report:hover { |
| 163 | +.articleFeedbackv5-switch-report:hover { |
164 | 164 | /* @embed */ |
165 | 165 | background-image: url(images/report-hover.png); |
166 | 166 | } |
167 | 167 | |
168 | | -.articleFeedback-explanation, .articleFeedback-description { |
| 168 | +.articleFeedbackv5-explanation, .articleFeedbackv5-description { |
169 | 169 | float: left; |
170 | 170 | font-weight: bold; |
171 | 171 | margin-bottom: 0.75em; |
172 | 172 | } |
173 | 173 | |
174 | | -.articleFeedback-rating-labels { |
| 174 | +.articleFeedbackv5-rating-labels { |
175 | 175 | margin-left: 10px; |
176 | 176 | } |
177 | 177 | |
178 | | -.articleFeedback-rating-label, |
179 | | -.articleFeedback-rating-clear { |
| 178 | +.articleFeedbackv5-rating-label, |
| 179 | +.articleFeedbackv5-rating-clear { |
180 | 180 | float: left; |
181 | 181 | height: 21px; |
182 | 182 | width: 21px; |
— | — | @@ -183,49 +183,49 @@ |
184 | 184 | background-position: center center; |
185 | 185 | cursor: pointer; |
186 | 186 | } |
187 | | -.articleFeedback-rating-label { |
| 187 | +.articleFeedbackv5-rating-label { |
188 | 188 | /* @embed */ |
189 | 189 | background-image: url(images/star-empty.png); |
190 | 190 | } |
191 | 191 | |
192 | | -.articleFeedback-rating-clear { |
| 192 | +.articleFeedbackv5-rating-clear { |
193 | 193 | /* @embed */ |
194 | 194 | background-image: url(images/trash.png); |
195 | 195 | display: none; |
196 | 196 | } |
197 | 197 | |
198 | | -.articleFeedback-rating-labels:hover .articleFeedback-rating-clear { |
| 198 | +.articleFeedbackv5-rating-labels:hover .articleFeedbackv5-rating-clear { |
199 | 199 | /* @embed */ |
200 | 200 | background-image: url(images/trash-hover.png); |
201 | 201 | } |
202 | 202 | |
203 | | -.articleFeedback-rating-label.articleFeedback-rating-label-full { |
| 203 | +.articleFeedbackv5-rating-label.articleFeedbackv5-rating-label-full { |
204 | 204 | /* @embed */ |
205 | 205 | background-image: url(images/star-full.png); |
206 | 206 | } |
207 | 207 | |
208 | | -.articleFeedback-expired .articleFeedback-rating-label.articleFeedback-rating-label-full { |
| 208 | +.articleFeedbackv5-expired .articleFeedbackv5-rating-label.articleFeedbackv5-rating-label-full { |
209 | 209 | /* @embed */ |
210 | 210 | background-image: url(images/star-full-expired.png); |
211 | 211 | } |
212 | 212 | |
213 | | -.articleFeedback-rating-new .articleFeedback-rating-label.articleFeedback-rating-label-full, |
214 | | -.articleFeedback-rating .articleFeedback-rating-label.articleFeedback-rating-label-hover-tail { |
| 213 | +.articleFeedbackv5-rating-new .articleFeedbackv5-rating-label.articleFeedbackv5-rating-label-full, |
| 214 | +.articleFeedbackv5-rating .articleFeedbackv5-rating-label.articleFeedbackv5-rating-label-hover-tail { |
215 | 215 | /* @embed */ |
216 | 216 | background-image: url(images/star-new.png); |
217 | 217 | } |
218 | 218 | |
219 | | -.articleFeedback-rating .articleFeedback-rating-label.articleFeedback-rating-label-hover-head { |
| 219 | +.articleFeedbackv5-rating .articleFeedbackv5-rating-label.articleFeedbackv5-rating-label-hover-head { |
220 | 220 | /* @embed */ |
221 | 221 | background-image: url(images/star-new-hover.png); |
222 | 222 | } |
223 | 223 | |
224 | | -.articleFeedback-rating-new .articleFeedback-rating-label.articleFeedback-rating-label-down { |
| 224 | +.articleFeedbackv5-rating-new .articleFeedbackv5-rating-label.articleFeedbackv5-rating-label-down { |
225 | 225 | /* @embed */ |
226 | 226 | background-image: url(images/star-new-down.png); |
227 | 227 | } |
228 | 228 | |
229 | | -.articleFeedback-rating-tooltip { |
| 229 | +.articleFeedbackv5-rating-tooltip { |
230 | 230 | float: left; |
231 | 231 | width: 12em; |
232 | 232 | margin-left: 12px; |
— | — | @@ -234,14 +234,14 @@ |
235 | 235 | display: none; |
236 | 236 | } |
237 | 237 | |
238 | | -.articleFeedback-rating { |
| 238 | +.articleFeedbackv5-rating { |
239 | 239 | float: left; |
240 | 240 | width: 11em; |
241 | 241 | height: 5em; |
242 | 242 | margin-bottom: 0.5em; |
243 | 243 | } |
244 | 244 | |
245 | | -.articleFeedback-rating-average { |
| 245 | +.articleFeedbackv5-rating-average { |
246 | 246 | float: left; |
247 | 247 | margin-right: 0.5em; |
248 | 248 | width: 2em; |
— | — | @@ -250,7 +250,7 @@ |
251 | 251 | line-height: 17px; |
252 | 252 | } |
253 | 253 | |
254 | | -.articleFeedback-rating-meter { |
| 254 | +.articleFeedbackv5-rating-meter { |
255 | 255 | float: left; |
256 | 256 | height: 17px; |
257 | 257 | width: 104px; |
— | — | @@ -263,7 +263,7 @@ |
264 | 264 | overflow: hidden; |
265 | 265 | } |
266 | 266 | |
267 | | -.articleFeedback-rating-meter div { |
| 267 | +.articleFeedbackv5-rating-meter div { |
268 | 268 | float: left; |
269 | 269 | height: 17px; |
270 | 270 | /* @embed */ |
— | — | @@ -272,7 +272,7 @@ |
273 | 273 | background-position: center left; |
274 | 274 | } |
275 | 275 | |
276 | | -.articleFeedback-rating-count { |
| 276 | +.articleFeedbackv5-rating-count { |
277 | 277 | float: right; |
278 | 278 | font-size: 0.8em; |
279 | 279 | color: #999999; |
— | — | @@ -280,7 +280,7 @@ |
281 | 281 | margin-right: 1em; |
282 | 282 | } |
283 | 283 | |
284 | | -.articleFeedback-label { |
| 284 | +.articleFeedbackv5-label { |
285 | 285 | cursor: pointer; |
286 | 286 | padding-left: 20px; |
287 | 287 | /* @embed */ |
— | — | @@ -289,34 +289,34 @@ |
290 | 290 | background-position: center left; |
291 | 291 | } |
292 | 292 | |
293 | | -.articleFeedback-label:hover { |
| 293 | +.articleFeedbackv5-label:hover { |
294 | 294 | /* @embed */ |
295 | 295 | background-image: url(images/question-hover.png); |
296 | 296 | } |
297 | 297 | |
298 | | -.articleFeedback-submit { |
| 298 | +.articleFeedbackv5-submit { |
299 | 299 | float: right; |
300 | 300 | } |
301 | 301 | |
302 | | -.articleFeedback-expertise-disabled, |
303 | | -.articleFeedback-helpimprove-disabled { |
| 302 | +.articleFeedbackv5-expertise-disabled, |
| 303 | +.articleFeedbackv5-helpimprove-disabled { |
304 | 304 | color: silver; |
305 | 305 | } |
306 | 306 | |
307 | | -.articleFeedback-expertise { |
| 307 | +.articleFeedbackv5-expertise { |
308 | 308 | float: left; |
309 | 309 | margin-bottom: 0.5em; |
310 | 310 | margin-top: 0.75em; |
311 | 311 | } |
312 | 312 | |
313 | | -.articleFeedback-expertise input { |
| 313 | +.articleFeedbackv5-expertise input { |
314 | 314 | float: left; |
315 | 315 | margin-bottom: 0.5em; |
316 | 316 | clear: both; |
317 | 317 | cursor: pointer; |
318 | 318 | } |
319 | 319 | |
320 | | -.articleFeedback-expertise label { |
| 320 | +.articleFeedbackv5-expertise label { |
321 | 321 | margin-left: 0.5em; |
322 | 322 | margin-bottom: 0.5em; |
323 | 323 | float: left; |
— | — | @@ -324,49 +324,49 @@ |
325 | 325 | cursor: pointer; |
326 | 326 | } |
327 | 327 | |
328 | | -.articleFeedback-expertise-options { |
| 328 | +.articleFeedbackv5-expertise-options { |
329 | 329 | clear: both; |
330 | 330 | display: none; |
331 | 331 | } |
332 | 332 | |
333 | | -.articleFeedback-expertise-options input { |
| 333 | +.articleFeedbackv5-expertise-options input { |
334 | 334 | display: block; |
335 | 335 | clear: both; |
336 | 336 | margin-left: 2em; |
337 | 337 | } |
338 | 338 | |
339 | | -.articleFeedback-expertise-options label { |
| 339 | +.articleFeedbackv5-expertise-options label { |
340 | 340 | line-height: 1.6em; |
341 | 341 | } |
342 | 342 | |
343 | | -.articleFeedback-expertise-options .articleFeedback-helpimprove-email { |
| 343 | +.articleFeedbackv5-expertise-options .articleFeedbackv5-helpimprove-email { |
344 | 344 | width: 20em; |
345 | 345 | margin-left: 4em; |
346 | 346 | margin-top: 0.25em; |
347 | 347 | cursor: text; |
348 | 348 | } |
349 | 349 | |
350 | | -.articleFeedback-helpimprove-note { |
| 350 | +.articleFeedbackv5-helpimprove-note { |
351 | 351 | margin-left: 4em; |
352 | 352 | font-size: 0.8em; |
353 | 353 | clear: both; |
354 | 354 | } |
355 | 355 | |
356 | | -.articleFeedback-helpimprove-email.valid { |
| 356 | +.articleFeedbackv5-helpimprove-email.valid { |
357 | 357 | background-color: #C0FFC0; |
358 | 358 | } |
359 | 359 | |
360 | | -.articleFeedback-helpimprove-email.invalid { |
| 360 | +.articleFeedbackv5-helpimprove-email.invalid { |
361 | 361 | background-color: #FFC0C0; |
362 | 362 | } |
363 | 363 | |
364 | | -.articleFeedback-pending, |
365 | | -.articleFeedback-success { |
| 364 | +.articleFeedbackv5-pending, |
| 365 | +.articleFeedbackv5-success { |
366 | 366 | float: right; |
367 | 367 | } |
368 | 368 | |
369 | | -.articleFeedback-pending span, |
370 | | -.articleFeedback-success span { |
| 369 | +.articleFeedbackv5-pending span, |
| 370 | +.articleFeedbackv5-success span { |
371 | 371 | display: none; |
372 | 372 | padding: 12px 12px 12px 28px; |
373 | 373 | font-size: 0.8em; |
— | — | @@ -376,23 +376,23 @@ |
377 | 377 | color: green; |
378 | 378 | } |
379 | 379 | |
380 | | -.articleFeedback-pending span { |
| 380 | +.articleFeedbackv5-pending span { |
381 | 381 | /* @embed */ |
382 | 382 | background-image: url(images/attention.png); |
383 | 383 | } |
384 | 384 | |
385 | | -.articleFeedback-success span { |
| 385 | +.articleFeedbackv5-success span { |
386 | 386 | /* @embed */ |
387 | 387 | background-image: url(images/success.png); |
388 | 388 | } |
389 | 389 | |
390 | | -.articleFeedback-expiry { |
| 390 | +.articleFeedbackv5-expiry { |
391 | 391 | display: none; |
392 | 392 | border: solid 1px orange; |
393 | 393 | background-color: white; |
394 | 394 | padding: 0.5em; |
395 | 395 | } |
396 | | -.articleFeedback-expiry-title { |
| 396 | +.articleFeedbackv5-expiry-title { |
397 | 397 | font-size: 1.2em; |
398 | 398 | padding-left: 28px; |
399 | 399 | /* @embed */ |
— | — | @@ -400,7 +400,7 @@ |
401 | 401 | background-repeat: no-repeat; |
402 | 402 | background-position: center left; |
403 | 403 | } |
404 | | -.articleFeedback-expiry-message { |
| 404 | +.articleFeedbackv5-expiry-message { |
405 | 405 | padding-left: 28px; |
406 | 406 | color: #777777; |
407 | 407 | } |
Index: trunk/extensions/ArticleFeedbackv5/modules/ext.articleFeedback/ext.articleFeedback.js |
— | — | @@ -80,11 +80,11 @@ |
81 | 81 | |
82 | 82 | this.load = function() { |
83 | 83 | // Try to select existing dialog |
84 | | - $dialog = $( '#articleFeedback-dialog' ); |
| 84 | + $dialog = $( '#articleFeedbackv5-dialog' ); |
85 | 85 | // Fall-back on creating one |
86 | 86 | if ( $dialog.length === 0 ) { |
87 | 87 | // Create initially in loading state |
88 | | - $dialog = $( '<div id="articleFeedback-dialog" class="loading" />' ) |
| 88 | + $dialog = $( '<div id="articleFeedbackv5-dialog" class="loading" />' ) |
89 | 89 | .dialog( { |
90 | 90 | 'width': 600, |
91 | 91 | 'height': 400, |
— | — | @@ -118,7 +118,7 @@ |
119 | 119 | // Insert disclaimer message |
120 | 120 | $button.before( |
121 | 121 | $( '<div>' ) |
122 | | - .addClass( 'articleFeedback-survey-disclaimer' ) |
| 122 | + .addClass( 'articleFeedbackv5-survey-disclaimer' ) |
123 | 123 | // Can't use .text() with mw.message(, /* $1 */ link).toString(), |
124 | 124 | // because 'link' should not be re-escaped (which would happen if done by mw.message) |
125 | 125 | .html( function() { |
— | — | @@ -139,7 +139,7 @@ |
140 | 140 | $dialog.dialog( 'open' ); |
141 | 141 | }; |
142 | 142 | this.submit = function() { |
143 | | - $dialog = $( '#articleFeedback-dialog' ); |
| 143 | + $dialog = $( '#articleFeedbackv5-dialog' ); |
144 | 144 | // Put dialog into "loading" state |
145 | 145 | $dialog |
146 | 146 | .addClass( 'loading' ) |
— | — | @@ -205,7 +205,7 @@ |
206 | 206 | }; |
207 | 207 | this.alert = function( message ) { |
208 | 208 | $message = $( '<div />' ) |
209 | | - .addClass( 'articleFeedback-survey-message-' + message ) |
| 209 | + .addClass( 'articleFeedbackv5-survey-message-' + message ) |
210 | 210 | .text( mw.msg( 'articlefeedbackv5-survey-message-' + message ) ) |
211 | 211 | .appendTo( $dialog ); |
212 | 212 | $dialog.dialog( 'option', 'height', $message.height() + 100 ); |
— | — | @@ -316,7 +316,7 @@ |
317 | 317 | }; |
318 | 318 | |
319 | 319 | /* Load at the bottom of the article */ |
320 | | -var $aftDiv = $( '<div id="mw-articlefeedback"></div>' ).articleFeedback( config ); |
| 320 | +var $aftDiv = $( '<div id="mw-articlefeedback"></div>' ).articleFeedbackv5( config ); |
321 | 321 | |
322 | 322 | // Put on bottom of article before #catlinks (if it exists) |
323 | 323 | // Except in legacy skins, which have #catlinks above the article but inside content-div. |
Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.hooks.php |
— | — | @@ -13,6 +13,7 @@ |
14 | 14 | 'scripts' => 'ext.articleFeedback/ext.articleFeedback.startup.js', |
15 | 15 | 'dependencies' => array( |
16 | 16 | 'mediawiki.util', |
| 17 | + 'ext.articleFeedback', |
17 | 18 | ), |
18 | 19 | ), |
19 | 20 | 'ext.articleFeedback' => array( |
— | — | @@ -84,7 +85,7 @@ |
85 | 86 | 'articlefeedbackv5-report-panel-description', |
86 | 87 | 'articlefeedbackv5-report-empty', |
87 | 88 | 'articlefeedbackv5-report-ratings', |
88 | | - 'articlefeedbackv5-privacyurl' |
| 89 | + 'articlefeedbackv5-privacyurl', |
89 | 90 | ), |
90 | 91 | 'dependencies' => array( |
91 | 92 | 'jquery.appear', |
— | — | @@ -161,6 +162,19 @@ |
162 | 163 | $remotepath = "$wgExtensionAssetsPath/ArticleFeedbackv5/modules"; |
163 | 164 | |
164 | 165 | foreach ( self::$modules as $name => $resources ) { |
| 166 | + if ( $name == 'jquery.articleFeedback' ) { |
| 167 | + $fields = ApiArticleFeedbackv5Utils::getFields(); |
| 168 | + $prefix = 'articlefeedbackv5-field-'; |
| 169 | + foreach( $fields as $field ) { |
| 170 | + $resources['messages'][] = $prefix . $field->aaf_name . '-label'; |
| 171 | + $resources['messages'][] = $prefix . $field->aaf_name . '-tip'; |
| 172 | + $resources['messages'][] = $prefix . $field->aaf_name . '-tooltip-1'; |
| 173 | + $resources['messages'][] = $prefix . $field->aaf_name . '-tooltip-2'; |
| 174 | + $resources['messages'][] = $prefix . $field->aaf_name . '-tooltip-3'; |
| 175 | + $resources['messages'][] = $prefix . $field->aaf_name . '-tooltip-4'; |
| 176 | + $resources['messages'][] = $prefix . $field->aaf_name . '-tooltip-5'; |
| 177 | + } |
| 178 | + } |
165 | 179 | $resourceLoader->register( |
166 | 180 | $name, new ResourceLoaderFileModule( $resources, $localpath, $remotepath ) |
167 | 181 | ); |
— | — | @@ -189,10 +203,9 @@ |
190 | 204 | $vars['wgArticleFeedbackv5WhatsThisPage'] = wfMsgForContent( 'articlefeedbackv5-form-panel-explanation-link' ); |
191 | 205 | |
192 | 206 | $fields = ApiArticleFeedbackv5Utils::getFields(); |
193 | | -error_log('hi'); |
194 | 207 | foreach( $fields as $field ) { |
195 | 208 | $vars['wgArticleFeedbackv5RatingTypes'][] = $field->aaf_name; |
196 | | - $vars['wgArticleFeedbackv5RatingTypesFlipped'][$field->aaf_name] = $fiekd->aaf_id; |
| 209 | + $vars['wgArticleFeedbackv5RatingTypesFlipped'][$field->aaf_name] = $field->aaf_id; |
197 | 210 | } |
198 | 211 | return true; |
199 | 212 | } |