X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=Main.js;h=20c5fdb0f2f6059b3ffdfa35a53166204d820211;hb=HEAD;hp=35c3a6cd215cb55d5fbce617aafbc72d1206e3a2;hpb=1c721a96d70dcffb50c33ee81c8df3d78ef0a28f;p=Hacks.git diff --git a/Main.js b/Main.js index 35c3a6c..20c5fdb 100644 --- a/Main.js +++ b/Main.js @@ -20,24 +20,27 @@ enyo.kind({ {name: "preferencesView", kind: "HackPreferences", onClose: "savePreferences"} ], hacksList: [ - {name: "Nimbus", kind: "Nimbus", dark: false}, - {name: "HexaSpinner", kind: "HexaSpinnerHack", dark: false}, - {name: "Landscape", kind: "Landscape", dark: false}, - {name: "Munch", kind: "Munch", dark: true}, - {name: "Orbit", kind: "Orbit", dark: false}, - {name: "Pixelfade", kind: "Pixelfade", dark: true}, - //{name: "Swarm", kind: "Swarm", dark: false}, // crashy - //{name: "Spinner.CGA", kind: "XSpinnerCGA", dark: true}, // no webfont support - {name: "Spinner", kind: "XSpinner", dark: true} + {name: "Labyrinth", kind: "Labyrinth"}, + {name: "Nimbus", kind: "Nimbus"}, + {name: "HexaSpinner", kind: "HexaSpinnerHack"}, + {name: "Landscape", kind: "Landscape"}, + {name: "Munch", kind: "Munch"}, + {name: "Orbit", kind: "Orbit"}, + {name: "Pixelfade", kind: "Pixelfade"}, + //{name: "Swarm", kind: "Swarm"}, // crashy + //{name: "Spinner.CGA", kind: "XSpinnerCGA"}, // no webfont support + {name: "Spinner", kind: "XSpinner"} ], create: function() { this.inherited(arguments); - /* - this.index = localStorage.getItem('hack.index'); - if (!this.index) + try { + this.index = parseInt(localStorage.getItem('hack.index')); + if (!this.index) + this.index = 0; + } catch(e) { + enyo.log("Could not load last hack index"); this.index = 0; - */ - this.index = 0; + } this.lastScrollPos = 0; this.$.hacksCarousel.setCenterView(this.getHack(this.index)); }, @@ -50,6 +53,7 @@ enyo.kind({ }); } this.$.hacksListSelector.setItems(displayList); + this.$.hacksListSelector.setValue(this.index); this.startHack(); window.addEventListener('resize', this.resizeHack.bind(this), false); this.setNotice('Swipe for more...'); @@ -106,7 +110,6 @@ enyo.kind({ this.index = inValue; this.lastScrollPos = 0; this.$.hacksCarousel.setCenterView(this.getHack(this.index)); - this.$.info.addRemoveClass('dark', this.hacksList[this.index].dark); // For some reason, setCenterView above fires the startScroll // event without a subsequent stopScroll event. To work around // this, we defer the start until later. @@ -117,7 +120,11 @@ enyo.kind({ //enyo.log('starting view ' + view); if (view) view.start(); - //localStorage.setItem('hack.index', this.index); + try { + localStorage.setItem('hack.index', this.index); + } catch(e) { + enyo.log("Could not set hack index"); + } }, stopHack: function(direction) { var view = this.$.hacksCarousel.fetchView(direction || 'center'); @@ -151,7 +158,6 @@ enyo.kind({ this.$.hacksListSelector.setValue(this.index); this.hackHidden('right'); this.infoFade(); - this.$.info.addRemoveClass('dark', this.hacksList[this.index].dark); } if (this.index == 0) return null; @@ -164,7 +170,6 @@ enyo.kind({ this.$.hacksListSelector.setValue(this.index); this.hackHidden('left'); this.infoFade(); - this.$.info.addRemoveClass('dark', this.hacksList[this.index].dark); } if (this.index == this.hacksList.length - 1) return null;