summaryrefslogtreecommitdiff
path: root/public/assets/js/lib
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets/js/lib')
-rw-r--r--public/assets/js/lib/_router.js83
-rw-r--r--public/assets/js/lib/nav/DesktopNav.js49
-rw-r--r--public/assets/js/lib/nav/MobileNav.js32
-rw-r--r--public/assets/js/lib/view/HomeView.js27
-rw-r--r--public/assets/js/lib/view/ListView.js37
-rw-r--r--public/assets/js/lib/view/PageView.js43
-rw-r--r--public/assets/js/lib/view/PaintingView.js36
7 files changed, 0 insertions, 307 deletions
diff --git a/public/assets/js/lib/_router.js b/public/assets/js/lib/_router.js
deleted file mode 100644
index 8d27b9c..0000000
--- a/public/assets/js/lib/_router.js
+++ /dev/null
@@ -1,83 +0,0 @@
-var SiteRouter = Router.extend({
-
- el: 'body',
- routeByHash: false,
-
- routes: {
- '/': 'home',
- '/page/:id': 'pageById',
- '/painting/:id': 'paintingById',
- '/picture/:id': 'paintingById',
- '/paintings': 'list',
- '/pictures': 'list',
- },
-
- initialize: function(){
- var fn
- for (var route in this.routes) {
- fn = this.routes[route]
- if (! this[fn]) {
- this[fn] = this.default_view(fn)
- }
- }
- },
-
- initial_route: null,
- launch: function(){
- if (this.initial_route) {
- this.parseRoute( this.initial_route )
- }
- else {
- this.route()
- }
- this.initial_route = null
- },
-
- go: function(url){
- if (app.view && app.view.hide) {
- app.view.hide()
- }
- this.pushState(url)
- this.parseRoute(url)
- },
-
- default_view: function(name){
- var fn = function(){
- if (app.view != app.login && app.view != app.signin) {
- app.last_view = app.view
- }
- if (app.view && app.view.hide) {
- app.view.hide()
- }
- if (name.match(/\./)) {
- var n = name.split(".")
- app.view = app.views[n[0]][n[1]]
- }
- else {
- app.view = app.views[name]
- }
- app.view.show()
- }.bind(this)
- return fn
- },
-
- paintingById: function(id){
- if (app.view && app.view.hide) {
- app.view.hide()
- }
- app.view = app.views.painting
- app.views.painting.show()
- app.views.painting.load(id)
- },
-
- pageById: function(id){
- if (app.view && app.view.hide) {
- app.view.hide()
- }
- app.view = app.views.page
- app.views.page.show()
- app.views.page.load(id)
- }
-
-})
-
diff --git a/public/assets/js/lib/nav/DesktopNav.js b/public/assets/js/lib/nav/DesktopNav.js
deleted file mode 100644
index 0503b4a..0000000
--- a/public/assets/js/lib/nav/DesktopNav.js
+++ /dev/null
@@ -1,49 +0,0 @@
-var NavView = View.extend({
-
- el: "#mobile-nav",
-
- events: {
- "click .pages a": "go",
- "click .pages > span": "go_span",
- },
-
- initialize: function(){
- },
-
- home: function(){
- app.router.go("/")
- this.$headings.find(".active").removeClass("active")
- if (app.mobile_nav && app.mobile_nav.state.open) {
- app.mobile_nav.hamburger()
- }
- },
-
- go: function(e){
- e.preventDefault()
- e.stopPropagation()
- var href = $(e.currentTarget).attr("href")
- app.router.go(href)
- console.log(href)
- if (is_mobile) {
- app.mobile_nav.hamburger()
- }
- this.after_go()
- },
-
- go_span: function(e){
- $("a", e.currentTarget).trigger("click")
- },
-
- after_go: function(){
- },
-
- setActive: function(id){
- var href = '/' + id
- var $el = $('[href="' + href + '"]')
- this.$('.active').removeClass('active')
- if ($el.length) {
- $el.addClass('active')
- }
- },
-
-});
diff --git a/public/assets/js/lib/nav/MobileNav.js b/public/assets/js/lib/nav/MobileNav.js
deleted file mode 100644
index 5c0f253..0000000
--- a/public/assets/js/lib/nav/MobileNav.js
+++ /dev/null
@@ -1,32 +0,0 @@
-var MobileNav = View.extend({
-
- el: '#mobile_nav',
-
- events: {
- 'touchstart .logo': 'home',
- 'touchstart .hamburger': 'hamburger'
- },
-
- initialize: function(options){
- options = options || {}
- this.state = {
- open: false
- }
- },
-
- home: function (){
- app.nav.home()
- },
-
- hamburger: function (e){
- $('html').toggleClass('navopen')
- app.mobile_nav.state.open = ! app.mobile_nav.state.open
- if (app.mobile_nav.state.open) {
- $("#rapper").on("click", app.mobile_nav.hamburger)
- }
- else {
- $("#rapper").off("click", app.mobile_nav.hamburger)
- }
- },
-
-})
diff --git a/public/assets/js/lib/view/HomeView.js b/public/assets/js/lib/view/HomeView.js
deleted file mode 100644
index 3eac71e..0000000
--- a/public/assets/js/lib/view/HomeView.js
+++ /dev/null
@@ -1,27 +0,0 @@
-var HomeView = View.extend({
-
- el: "#home",
-
- // template: liquid($('#tmpl-home').html()),
-
- events: {
- },
-
- initialize: function(options){
- options = options || {}
- var data = this.data = options.data
- },
-
- render: function(){
- if (this.rendered) return
- this.rendered = true
- },
-
- show: function(){
- this.render(this.data)
- },
-
- hide: function(){
- },
-
-})
diff --git a/public/assets/js/lib/view/ListView.js b/public/assets/js/lib/view/ListView.js
deleted file mode 100644
index 5161a31..0000000
--- a/public/assets/js/lib/view/ListView.js
+++ /dev/null
@@ -1,37 +0,0 @@
-var ListView = View.extend({
-
- el: "#list",
-
- events: {
- "click div": "load",
- },
-
- initialize: function(options){
- options = options || {}
- var data = this.data = options.data
- },
-
- render: function(){
- if (this.rendered) return
- this.rendered = true
- },
-
- show: function(){
- this.render(this.data)
- document.body.className = "listopen"
- },
-
- hide: function(){
- document.body.className = ""
- $(".visible").removeClass("visible")
- $("#nav a.active").removeClass('active')
- },
-
- load: function(e){
- var index = $(e.currentTarget).data("index")
- $.fn.fullpage.moveTo(index+1)
- console.log(index)
- this.hide()
- },
-
-})
diff --git a/public/assets/js/lib/view/PageView.js b/public/assets/js/lib/view/PageView.js
deleted file mode 100644
index 10f18d6..0000000
--- a/public/assets/js/lib/view/PageView.js
+++ /dev/null
@@ -1,43 +0,0 @@
-var PageView = View.extend({
-
- el: "body",
-
- events: {
- "click #close": "close",
- },
-
- initialize: function(options){
- options = options || {}
- var data = this.data = options.data
- },
-
- render: function(){
- if (this.rendered) return
- this.rendered = true
- },
-
- show: function(){
- this.render(this.data)
- document.body.className = "pageopen"
- MAKE_CONFETTI()
- confetti_on = true
- },
-
- hide: function(){
- document.body.className = ""
- confetti_on = false
- $(".visible").removeClass("visible")
- $("#nav a.active").removeClass('active')
- },
-
- close: function(){
- app.router.go("/")
- },
-
- load: function(id){
- $("#nav a[href='/page/" + id + "']").addClass('active')
- this.$("#" + id).addClass("visible")
- },
-
-
-})
diff --git a/public/assets/js/lib/view/PaintingView.js b/public/assets/js/lib/view/PaintingView.js
deleted file mode 100644
index 5c4f3bd..0000000
--- a/public/assets/js/lib/view/PaintingView.js
+++ /dev/null
@@ -1,36 +0,0 @@
-var PaintingView = View.extend({
-
- el: "body",
-
- // template: liquid($('#tmpl-about').html()),
-
- events: {
- },
-
- initialize: function(options){
- options = options || {}
- var data = this.data = options.data
- },
-
- render: function(){
- if (this.rendered) return
- this.rendered = true
- },
-
- show: function(){
- this.render(this.data)
- document.body.className = "painting"
- },
-
- hide: function(){
- // document.body.className = "about"
- },
-
- load: function(id){
- var index = this.data.paintings.map(function(p){ return p.id }).indexOf(id)
- if (index) {
- $.fn.fullpage.moveTo(index+1)
- }
- },
-
-})