summaryrefslogtreecommitdiff
path: root/StoneIsland/platforms/android/assets/www/js/lib/nav/IntroView.js
diff options
context:
space:
mode:
Diffstat (limited to 'StoneIsland/platforms/android/assets/www/js/lib/nav/IntroView.js')
-rwxr-xr-xStoneIsland/platforms/android/assets/www/js/lib/nav/IntroView.js64
1 files changed, 64 insertions, 0 deletions
diff --git a/StoneIsland/platforms/android/assets/www/js/lib/nav/IntroView.js b/StoneIsland/platforms/android/assets/www/js/lib/nav/IntroView.js
new file mode 100755
index 00000000..c075619a
--- /dev/null
+++ b/StoneIsland/platforms/android/assets/www/js/lib/nav/IntroView.js
@@ -0,0 +1,64 @@
+var IntroView = View.extend({
+
+ el: "#intro",
+
+ events: {
+ "click .store": "store",
+ "click .hub": "hub",
+ "click .story": "story",
+ "click .archive": "archive",
+ },
+
+ initialize: function(){
+ this.$alert = this.$(".alert")
+ this.compass = this.$("#compass").get(0)
+ this.orient = this.deviceorientation.bind(this)
+ this.$alert.hide()
+ },
+
+ show: function(){
+ document.body.className = "intro"
+ window.addEventListener("deviceorientation", this.orient)
+ app.footer.hide()
+ this.orient({ alpha: 0 })
+ },
+
+ hide: function(){
+ window.removeEventListener("deviceorientation", this.orient)
+ this.$alert.hide()
+ },
+
+ deviceorientation: function(e){
+ var heading
+ if ('webkitCompassHeading' in e) {
+ heading = e.webkitCompassHeading || 0
+ }
+ else {
+ heading = e.alpha || 0
+ }
+ heading = - heading
+ this.compass.style[transformProp] = "translateZ(0) translateX(-50%) translateY(-50%) rotate(" + heading + "deg)"
+ },
+
+ store: function(e){
+ e.preventDefault()
+ e.stopPropagation()
+ app.router.go("store")
+ },
+ hub: function(e){
+ e.preventDefault()
+ e.stopPropagation()
+ app.router.go("hub")
+ },
+ story: function(e){
+ e.preventDefault()
+ e.stopPropagation()
+ app.router.go("story")
+ },
+ archive: function(e){
+ e.preventDefault()
+ e.stopPropagation()
+ app.router.go("archive")
+ },
+
+})