r101642 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101641‎ | r101642 | r101643 >
Date:17:53, 2 November 2011
Author:catrope
Status:ok
Tags:
Comment:
Partial revert r101118: reinstate the restore-from-cookie code, but only for the checkboxes, not for the username box
Modified paths:
  • /trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/ext.moodBar.dashboard.js (modified) (history)

Diff [purge]

Index: trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/ext.moodBar.dashboard.js
@@ -35,7 +35,6 @@
3636 */
3737 function setCookies() {
3838 $.cookie( 'moodbar-feedback-types', formState.types.join( '|' ), { 'path': '/', 'expires': 7 } );
39 - $.cookie( 'moodbar-feedback-username', formState.username, { 'path': '/', 'expires': 7 } );
4039 }
4140
4241 /**
@@ -45,15 +44,7 @@
4645 */
4746 function loadFromCookies() {
4847 var cookieTypes = $.cookie( 'moodbar-feedback-types' ),
49 - $username = $( '#fbd-filters-username' ),
5048 changed = false;
51 - if ( $username.val() == '' ) {
52 - var cookieUsername = $.cookie( 'moodbar-feedback-username' );
53 - if ( cookieUsername != '' && cookieUsername !== null ) {
54 - $username.val( cookieUsername );
55 - changed = true;
56 - }
57 - }
5849
5950 if ( cookieTypes ) {
6051 // Because calling .indexOf() on an array doesn't work in all browsers,
@@ -340,4 +331,15 @@
341332 // you changed the form state then clicked More.
342333 loadComments( 'more' );
343334 } );
 335+
 336+ saveFormState();
 337+ var filterType = $( '#fbd-filters' ).children( 'form' ).data( 'filtertype' );
 338+ // If filtering already happened on the PHP side, don't load the form state from cookies
 339+ if ( filterType != 'filtered' ) {
 340+ // Don't do an AJAX filter if we're on an ID view, or if the form is still blank after loadFromCookies()
 341+ if ( loadFromCookies() && filterType != 'id' ) {
 342+ saveFormState();
 343+ loadComments( 'filter' );
 344+ }
 345+ }
344346 } );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r101118Remove functionality: Loading form state from cookies, and clicking on userna...werdna05:26, 28 October 2011

Status & tagging log