Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js |
— | — | @@ -226,6 +226,30 @@ |
227 | 227 | $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-tooltip' ).hide(); |
228 | 228 | } ); |
229 | 229 | |
| 230 | + // Enable submission and switch out the comment default on toggle selection |
| 231 | + $block.find( '.articleFeedbackv5-button-placeholder' ) |
| 232 | + .click( function ( e ) { |
| 233 | + var new_val = $( this ).parent().attr( 'rel' ); |
| 234 | + var old_val = ( new_val == 'yes' ? 'no' : 'yes' ); |
| 235 | + var $wrap = $.articleFeedbackv5.$holder.find( '#articleFeedbackv5-bucket1-toggle-wrapper-' + new_val ); |
| 236 | + var $other_wrap = $.articleFeedbackv5.$holder.find( '#articleFeedbackv5-bucket1-toggle-wrapper-' + old_val ); |
| 237 | + // make the button blue |
| 238 | + $wrap.find( 'span' ).addClass( 'articleFeedbackv5-button-placeholder-active' ); |
| 239 | + $other_wrap.find( 'span' ).removeClass( 'articleFeedbackv5-button-placeholder-active' ); |
| 240 | + // check/uncheck radio buttons |
| 241 | + $wrap.find( 'input' ).attr( 'checked', 'checked' ); |
| 242 | + $other_wrap.find( 'input' ).attr( 'checked', '' ); |
| 243 | + // set default comment message |
| 244 | + var $txt = $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-comment textarea' ); |
| 245 | + var def_msg_yes = mw.msg( 'articlefeedbackv5-bucket1-question-comment-yes' ); |
| 246 | + var def_msg_no = mw.msg( 'articlefeedbackv5-bucket1-question-comment-no' ); |
| 247 | + if ( $txt.val() == '' || $txt.val() == def_msg_yes || $txt.val() == def_msg_no ) { |
| 248 | + $txt.val( new_val == 'yes' ? def_msg_yes : def_msg_no ); |
| 249 | + } |
| 250 | + // enable submission |
| 251 | + $.articleFeedbackv5.currentBucket().enableSubmission( true ); |
| 252 | + } ); |
| 253 | + |
230 | 254 | // Clear out the question on focus |
231 | 255 | $block.find( '.articleFeedbackv5-comment textarea' ) |
232 | 256 | .focus( function () { |
— | — | @@ -253,30 +277,6 @@ |
254 | 278 | } |
255 | 279 | } ); |
256 | 280 | |
257 | | - // Enable submission and switch out the comment default on toggle selection |
258 | | - $block.find( '.articleFeedbackv5-button-placeholder' ) |
259 | | - .click( function ( e ) { |
260 | | - var new_val = $( this ).parent().attr( 'rel' ); |
261 | | - var old_val = ( new_val == 'yes' ? 'no' : 'yes' ); |
262 | | - var $wrap = $.articleFeedbackv5.$holder.find( '#articleFeedbackv5-bucket1-toggle-wrapper-' + new_val ); |
263 | | - var $other_wrap = $.articleFeedbackv5.$holder.find( '#articleFeedbackv5-bucket1-toggle-wrapper-' + old_val ); |
264 | | - // make the button blue |
265 | | - $wrap.find( 'span' ).addClass( 'articleFeedbackv5-button-placeholder-active' ); |
266 | | - $other_wrap.find( 'span' ).removeClass( 'articleFeedbackv5-button-placeholder-active' ); |
267 | | - // check/uncheck radio buttons |
268 | | - $wrap.find( 'input' ).attr( 'checked', 'checked' ); |
269 | | - $other_wrap.find( 'input' ).attr( 'checked', '' ); |
270 | | - // set default comment message |
271 | | - var $txt = $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-comment textarea' ); |
272 | | - var def_msg_yes = mw.msg( 'articlefeedbackv5-bucket1-question-comment-yes' ); |
273 | | - var def_msg_no = mw.msg( 'articlefeedbackv5-bucket1-question-comment-no' ); |
274 | | - if ( $txt.val() == '' || $txt.val() == def_msg_yes || $txt.val() == def_msg_no ) { |
275 | | - $txt.val( new_val == 'yes' ? def_msg_yes : def_msg_no ); |
276 | | - } |
277 | | - // enable submission |
278 | | - $.articleFeedbackv5.currentBucket().enableSubmission( true ); |
279 | | - } ); |
280 | | - |
281 | 281 | // Attach the submit |
282 | 282 | $block.find( '.articleFeedbackv5-submit' ) |
283 | 283 | .click( function ( e ) { |