1window.fakeStorage = { 2 _data: {}, 3 4 setItem: function (id, val) { 5 return this._data[id] = String(val); 6 }, 7 8 getItem: function (id) { 9 return this._data.hasOwnProperty(id) ? this._data[id] : undefined; 10 }, 11 12 removeItem: function (id) { 13 return delete this._data[id]; 14 }, 15 16 clear: function () { 17 return this._data = {}; 18 } 19}; 20 21function LocalScoreManager() { 22 this.key = "bestScore"; 23 24 var supported = this.localStorageSupported(); 25 this.storage = supported ? window.localStorage : window.fakeStorage; 26} 27 28LocalScoreManager.prototype.localStorageSupported = function () { 29 var testKey = "test"; 30 var storage = window.localStorage; 31 32 try { 33 storage.setItem(testKey, "1"); 34 storage.removeItem(testKey); 35 return true; 36 } catch (error) { 37 return false; 38 } 39}; 40 41LocalScoreManager.prototype.get = function () { 42 return this.storage.getItem(this.key) || 0; 43}; 44 45LocalScoreManager.prototype.set = function (score) { 46 this.storage.setItem(this.key, score); 47}; 48
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.