summaryrefslogtreecommitdiff
path: root/StoneIsland/www/js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2015-09-14 18:59:39 -0400
committerJules Laplace <jules@okfoc.us>2015-09-14 19:06:34 -0400
commit685d2f5bd5b27f22b9ce01a99bc578585d955c33 (patch)
tree8d5dbbae1d9bd4071f5c043ea589b7a1aae4dde6 /StoneIsland/www/js
parentc7f78fee3e5c9a78dbd6c22910ca529a0ee34827 (diff)
nav and routing
Diffstat (limited to 'StoneIsland/www/js')
-rw-r--r--StoneIsland/www/js/lib/_router.js42
-rw-r--r--StoneIsland/www/js/lib/nav/IntroView.js26
-rw-r--r--StoneIsland/www/js/lib/nav/NavView.js62
-rw-r--r--StoneIsland/www/js/lib/router.js16
4 files changed, 126 insertions, 20 deletions
diff --git a/StoneIsland/www/js/lib/_router.js b/StoneIsland/www/js/lib/_router.js
new file mode 100644
index 00000000..0d0c3bd1
--- /dev/null
+++ b/StoneIsland/www/js/lib/_router.js
@@ -0,0 +1,42 @@
+var SiteRouter = Router.extend({
+
+ el: 'body',
+
+ routes: {
+ '/': 'intro',
+ '/store': 'store',
+ '/hub': 'hub',
+ '/story': 'story',
+ '/archive': 'archive',
+
+ '/faq': 'faq',
+ '/search': 'search',
+ },
+
+ initialize: function(){
+ this.route()
+ },
+
+ go: function(url){
+ if (app.view && app.view.hide) {
+ app.view.hide()
+ }
+ this.parseRoute(url)
+ },
+
+ intro: function(){
+ },
+
+ store: function(){
+ },
+
+ hub: function(){
+ },
+
+ story: function(){
+ },
+
+ archive: function(){
+ },
+
+})
diff --git a/StoneIsland/www/js/lib/nav/IntroView.js b/StoneIsland/www/js/lib/nav/IntroView.js
index 6e04a39e..346c3aef 100644
--- a/StoneIsland/www/js/lib/nav/IntroView.js
+++ b/StoneIsland/www/js/lib/nav/IntroView.js
@@ -3,13 +3,28 @@ var IntroView = View.extend({
el: "#intro",
events: {
+ "click .store": "store",
+ "click .hub": "hub",
+ "click .story": "story",
+ "click .archive": "archive",
},
initialize: function(){
- this.logo = this.$("#logo").get(0)
- window.addEventListener("deviceorientation", deviceorientation)
+ this.compass = this.$("#compass").get(0)
+ this.orient = this.deviceorientation.bind(this)
},
+ show: function(){
+ this.$el.show()
+ window.addEventListener("deviceorientation", this.orient)
+ // get location..
+ },
+
+ hide: function(){
+ this.$el.hide()
+ window.removeEventListener("deviceorientation", this.orient)
+ },
+
deviceorientation: function(e){
var heading
if ('webkitCompassHeading' in e) {
@@ -18,7 +33,12 @@ var IntroView = View.extend({
else {
heading = e.alpha
}
- this.logo.css[transformProp] = "translateZ(0) rotate(" + heading + "deg)"
+ this.compass.css[transformProp] = "translateZ(0) rotate(" + heading + "deg)"
},
+
+ store: function(){ app.router.go("store") },
+ hub: function(){ app.router.go("hub") },
+ story: function(){ app.router.go("story") },
+ archive: function(){ app.router.go("archive") },
})
diff --git a/StoneIsland/www/js/lib/nav/NavView.js b/StoneIsland/www/js/lib/nav/NavView.js
index 57eaf357..6e57ec32 100644
--- a/StoneIsland/www/js/lib/nav/NavView.js
+++ b/StoneIsland/www/js/lib/nav/NavView.js
@@ -3,9 +3,69 @@ var NavView = View.extend({
el: "#nav",
events: {
+ "click .store": "store",
+ "click .hub": "hub",
+ "click .story": "story",
+ "click .archive": "archive",
+ "click .login": "login",
+ "click .faq": "faq",
+ "click .search": "search",
+ "click .fb": "fb",
+ "click .insta": "insta",
+ "click .tw": "tw",
},
initialize: function(){
},
+
+ show: function(){
+ $("body").addClass("nav")
+ },
+
+ hide: function(){
+ $("body").removeClass("nav")
+ },
+
+ store: function(){
+ this.hide()
+ app.router.go("store")
+ },
+ hub: function(){
+ this.hide()
+ app.router.go("hub")
+ },
+ story: function(){
+ this.hide()
+ app.router.go("story")
+ },
+ archive: function(){
+ this.hide()
+ app.router.go("archive")
+ },
+
+ login: function(){
+ this.hide()
+ app.router.go("login")
+ },
+
+ search: function(){
+ this.hide()
+ app.router.go("search")
+ },
+ faq: function(){
+ this.hide()
+ app.router.go("faq")
+ },
+
+ fb: function(){
+ window.open("https://www.facebook.com/StoneIsland", '_system')
+ },
+ insta: function(){
+ window.open("https://instagram.com/stoneisland_official", '_system')
+ },
+ tw: function(){
+ window.open("https://twitter.com/stoneisland", '_system')
+ },
+
-}) \ No newline at end of file
+})
diff --git a/StoneIsland/www/js/lib/router.js b/StoneIsland/www/js/lib/router.js
deleted file mode 100644
index 28793fe5..00000000
--- a/StoneIsland/www/js/lib/router.js
+++ /dev/null
@@ -1,16 +0,0 @@
-var SiteRouter = Router.extend({
-
- el: "body",
-
- routes: {
- "/": 'index',
- },
-
- initialize: function(){
- this.route()
- },
-
- index: function(){
- },
-
-}) \ No newline at end of file