Path: blob/main/static/src/gs/public/radius-raid/js/storage.js
1325 views
// local storage helpers - source: http://stackoverflow.com/questions/2010892/storing-objects-in-html5-localstorage/3146971#31469711Storage.prototype.setObject = function( key, value ) {2this.setItem( key, JSON.stringify( value ) );3}45Storage.prototype.getObject = function( key ) {6var value = this.getItem( key );7return value && JSON.parse( value );8}910Storage.prototype.removeObject = function( key ) {11this.removeItem( key );12}1314$.setupStorage = function() {15$.storage = localStorage.getObject( 'radiusraid' ) || {16'mute': 0,17'autofire': 0,18'score': 0,19'level': 0,20'rounds': 0,21'kills': 0,22'bullets': 0,23'powerups': 0,24'time': 025};26};2728$.updateStorage = function() {29localStorage.setObject( 'radiusraid', $.storage );30};3132$.clearStorage = function() {33localStorage.removeObject( 'radiusraid' );34$.setupStorage();35};3637