summaryrefslogtreecommitdiff
path: root/StoneIsland/www/js
diff options
context:
space:
mode:
Diffstat (limited to 'StoneIsland/www/js')
-rw-r--r--StoneIsland/www/js/index.js26
-rw-r--r--StoneIsland/www/js/lib/_router.js20
-rw-r--r--StoneIsland/www/js/lib/blogs/ArchiveView.js4
-rw-r--r--StoneIsland/www/js/lib/blogs/HubView.js4
-rw-r--r--StoneIsland/www/js/lib/blogs/StoryView.js6
-rw-r--r--StoneIsland/www/js/lib/nav/CurtainView.js21
-rw-r--r--StoneIsland/www/js/lib/nav/IntroView.js6
-rw-r--r--StoneIsland/www/js/lib/nav/LoginView.js8
-rw-r--r--StoneIsland/www/js/lib/nav/NavView.js2
-rw-r--r--StoneIsland/www/js/lib/products/CollectionView.js7
-rw-r--r--StoneIsland/www/js/lib/products/Selector.js3
-rw-r--r--StoneIsland/www/js/vendor/util.js6
12 files changed, 104 insertions, 9 deletions
diff --git a/StoneIsland/www/js/index.js b/StoneIsland/www/js/index.js
index 9a8e945c..64027d2a 100644
--- a/StoneIsland/www/js/index.js
+++ b/StoneIsland/www/js/index.js
@@ -2,19 +2,39 @@ var app = (function(){
var app = {}
app.init = function(){
+ app.archive = new ArchiveView ()
+ app.hub = new HubView ()
+ app.story = new StoryView ()
+
+ app.cart = new CartView ()
+
+ app.header = new HeaderView ()
+ app.footer = new FooterView ()
+ app.nav = new NavView ()
+
+ app.login = new LoginView ()
+ app.intro = new IntroView ()
+
+ app.product = new ProductView ()
+ app.collection = new CollectionView ()
+
+ app.selector = new Selector ()
+
app.bind()
}
app.bind = function(){
+ if (window.location.href.match("8000")) { app.ready() }
document.addEventListener('deviceready', app.ready, false)
}
app.ready = function(){
app.view = null
- app.nav = new NavView ()
app.router = new SiteRouter ()
+ app.router.route()
}
- app.init()
-
+ return app
})()
+
+app.init()
diff --git a/StoneIsland/www/js/lib/_router.js b/StoneIsland/www/js/lib/_router.js
index 0d0c3bd1..6434e9bf 100644
--- a/StoneIsland/www/js/lib/_router.js
+++ b/StoneIsland/www/js/lib/_router.js
@@ -1,6 +1,7 @@
var SiteRouter = Router.extend({
el: 'body',
+ routeByHash: true,
routes: {
'/': 'intro',
@@ -11,32 +12,49 @@ var SiteRouter = Router.extend({
'/faq': 'faq',
'/search': 'search',
+
+ '/cart': 'cart',
},
initialize: function(){
- this.route()
},
go: function(url){
if (app.view && app.view.hide) {
app.view.hide()
}
+ window.location.href = "#/" + url
this.parseRoute(url)
+ console.log(url)
},
intro: function(){
+ app.view = app.intro
+ app.intro.show()
},
store: function(){
+ app.view = app.store
+ app.collection.show()
},
hub: function(){
+ app.view = app.hub
+ app.hub.show()
},
story: function(){
+ app.view = app.story
+ app.story.show()
},
archive: function(){
+ app.view = app.archive
+ app.archive.show()
+ },
+
+
+ cart: function(){
},
})
diff --git a/StoneIsland/www/js/lib/blogs/ArchiveView.js b/StoneIsland/www/js/lib/blogs/ArchiveView.js
index 04b43a4b..742ee0f2 100644
--- a/StoneIsland/www/js/lib/blogs/ArchiveView.js
+++ b/StoneIsland/www/js/lib/blogs/ArchiveView.js
@@ -10,6 +10,10 @@ var ArchiveView = View.extend({
this.$content = this.$(".content")
},
+ show: function(){
+ document.body.className = "archive"
+ },
+
populate: function(){
},
diff --git a/StoneIsland/www/js/lib/blogs/HubView.js b/StoneIsland/www/js/lib/blogs/HubView.js
index 4958b320..430464b1 100644
--- a/StoneIsland/www/js/lib/blogs/HubView.js
+++ b/StoneIsland/www/js/lib/blogs/HubView.js
@@ -10,6 +10,10 @@ var HubView = View.extend({
this.$content = this.$(".content")
},
+ show: function(){
+ document.body.className = "hub"
+ },
+
populate: function(){
},
diff --git a/StoneIsland/www/js/lib/blogs/StoryView.js b/StoneIsland/www/js/lib/blogs/StoryView.js
index 4c71e9ff..ed46af31 100644
--- a/StoneIsland/www/js/lib/blogs/StoryView.js
+++ b/StoneIsland/www/js/lib/blogs/StoryView.js
@@ -9,7 +9,11 @@ var StoryView = View.extend({
initialize: function(){
this.$content = this.$(".content")
},
-
+
+ show: function(){
+ document.body.className = "story"
+ },
+
populate: function(){
},
diff --git a/StoneIsland/www/js/lib/nav/CurtainView.js b/StoneIsland/www/js/lib/nav/CurtainView.js
new file mode 100644
index 00000000..30c3190e
--- /dev/null
+++ b/StoneIsland/www/js/lib/nav/CurtainView.js
@@ -0,0 +1,21 @@
+var CurtainView = View.extend({
+
+ el: "#curtain",
+
+ events: {
+ "click": "click",
+ },
+
+ initialize: function(){
+ },
+
+ click: function(){
+ if (document.body.classList.contains("nav")) {
+ app.nav.hide()
+ }
+ else if (document.body.classList.contains("login")) {
+ app.login.hide()
+ }
+ },
+
+}) \ No newline at end of file
diff --git a/StoneIsland/www/js/lib/nav/IntroView.js b/StoneIsland/www/js/lib/nav/IntroView.js
index 346c3aef..7b726f6a 100644
--- a/StoneIsland/www/js/lib/nav/IntroView.js
+++ b/StoneIsland/www/js/lib/nav/IntroView.js
@@ -15,13 +15,13 @@ var IntroView = View.extend({
},
show: function(){
- this.$el.show()
+ document.body.className = "intro"
window.addEventListener("deviceorientation", this.orient)
+ this.orient({ alpha: 0 })
// get location..
},
hide: function(){
- this.$el.hide()
window.removeEventListener("deviceorientation", this.orient)
},
@@ -33,7 +33,7 @@ var IntroView = View.extend({
else {
heading = e.alpha
}
- this.compass.css[transformProp] = "translateZ(0) rotate(" + heading + "deg)"
+ this.compass.style[transformProp] = "translateZ(0) transformX(-50%) transformY(-50%) rotate(" + heading + "deg)"
},
store: function(){ app.router.go("store") },
diff --git a/StoneIsland/www/js/lib/nav/LoginView.js b/StoneIsland/www/js/lib/nav/LoginView.js
index 670fb333..0f30db3d 100644
--- a/StoneIsland/www/js/lib/nav/LoginView.js
+++ b/StoneIsland/www/js/lib/nav/LoginView.js
@@ -7,5 +7,13 @@ var LoginView = View.extend({
initialize: function(){
},
+
+ show: function(){
+ document.body.classList.add("login")
+ },
+
+ hide: function(){
+ document.body.classList.remove("login")
+ },
}) \ No newline at end of file
diff --git a/StoneIsland/www/js/lib/nav/NavView.js b/StoneIsland/www/js/lib/nav/NavView.js
index 42877d88..c9eb2d4e 100644
--- a/StoneIsland/www/js/lib/nav/NavView.js
+++ b/StoneIsland/www/js/lib/nav/NavView.js
@@ -22,10 +22,12 @@ var NavView = View.extend({
show: function(){
$("body").addClass("nav")
+ $("#curtain").show()
},
hide: function(){
$("body").removeClass("nav")
+ $("#curtain").hide()
},
store: function(){
diff --git a/StoneIsland/www/js/lib/products/CollectionView.js b/StoneIsland/www/js/lib/products/CollectionView.js
index 65ed0230..137d0ec3 100644
--- a/StoneIsland/www/js/lib/products/CollectionView.js
+++ b/StoneIsland/www/js/lib/products/CollectionView.js
@@ -1,11 +1,16 @@
var CollectionView = View.extend({
el: "#collection",
-
+ template: $("#collection .template").html(),
+
events: {
},
initialize: function(){
+ this.$content = this.$(".content")
+ },
+
+ populate: function(){
},
}) \ No newline at end of file
diff --git a/StoneIsland/www/js/lib/products/Selector.js b/StoneIsland/www/js/lib/products/Selector.js
index c0d59deb..3d3d5ccc 100644
--- a/StoneIsland/www/js/lib/products/Selector.js
+++ b/StoneIsland/www/js/lib/products/Selector.js
@@ -7,5 +7,8 @@ var Selector = View.extend({
initialize: function(){
},
+
+ select: function(options, callback){
+ },
}) \ No newline at end of file
diff --git a/StoneIsland/www/js/vendor/util.js b/StoneIsland/www/js/vendor/util.js
index 0cc7e704..8a58a84c 100644
--- a/StoneIsland/www/js/vendor/util.js
+++ b/StoneIsland/www/js/vendor/util.js
@@ -165,6 +165,12 @@ var is_android = (navigator.userAgent.match(/Android/i))
var is_mobile = is_iphone || is_ipad || is_android
var is_desktop = ! is_mobile;
var transformProp = browser.safari ? "WebkitTransform" : "transform";
+if (is_android) {
+ document.body.parentNode.classList.add("android")
+}
+else {
+ document.body.parentNode.classList.add("ios")
+}
function selectElementContents(el) {
if (window.getSelection && document.createRange) {