From 1c3a935ef0fd01c38b9e1ad9c5765f411c632d8c Mon Sep 17 00:00:00 2001 From: Santhosh Thottingal Date: Mon, 10 Feb 2014 17:52:04 +0530 Subject: [PATCH] Try to restore the old preferences, if any, if possible Preferences were saved using jStorage. The browsers which ULS supports now have wide native support for local storage, so we removed jquery.jStorage in I09b2bd52972. The old local storage key was 'jStorage' as put by jquery.jStorage. We now check if that key is present. If so we migrate the preferences and remove the old key to save space. We are not aware of anything else using this module. Change-Id: I995a32c4cb7a3bc818fe255f92dbc972211cb112 --- resources/js/ext.uls.preferences.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/resources/js/ext.uls.preferences.js b/resources/js/ext.uls.preferences.js index 71be07c7..f4f99ffb 100644 --- a/resources/js/ext.uls.preferences.js +++ b/resources/js/ext.uls.preferences.js @@ -137,6 +137,16 @@ // No value supplied, return value try { data = localStorage.getItem( key ); + if ( !data ) { + // Try to restore the old preferences, if any, if possible. + try { + data = JSON.parse( localStorage.getItem( 'jStorage' ) )['uls-preferences']; + // And try to remove it. + localStorage.removeItem( 'jStorage' ); + } catch ( e ) { + // Don't bother about it. + } + } } catch ( e ) { // Use cookie data = $.cookie( key ); }