Index: trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/ext.moodBar.dashboard.js |
— | — | @@ -35,7 +35,6 @@ |
36 | 36 | */ |
37 | 37 | function setCookies() { |
38 | 38 | $.cookie( 'moodbar-feedback-types', formState.types.join( '|' ), { 'path': '/', 'expires': 7 } ); |
39 | | - $.cookie( 'moodbar-feedback-username', formState.username, { 'path': '/', 'expires': 7 } ); |
40 | 39 | } |
41 | 40 | |
42 | 41 | /** |
— | — | @@ -45,15 +44,7 @@ |
46 | 45 | */ |
47 | 46 | function loadFromCookies() { |
48 | 47 | var cookieTypes = $.cookie( 'moodbar-feedback-types' ), |
49 | | - $username = $( '#fbd-filters-username' ), |
50 | 48 | 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 | | - } |
58 | 49 | |
59 | 50 | if ( cookieTypes ) { |
60 | 51 | // Because calling .indexOf() on an array doesn't work in all browsers, |
— | — | @@ -340,4 +331,15 @@ |
341 | 332 | // you changed the form state then clicked More. |
342 | 333 | loadComments( 'more' ); |
343 | 334 | } ); |
| 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 | + } |
344 | 346 | } ); |