summaryrefslogtreecommitdiff
path: root/site/public/assets/javascripts/_env.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2015-04-13 18:30:24 -0400
committerJules Laplace <jules@okfoc.us>2015-04-13 18:32:27 -0400
commit58b62a1d76298a568aa0ded39f986477f889b793 (patch)
tree09748866101c59b3c5d4c4ffaa9555210793f81b /site/public/assets/javascripts/_env.js
parentd45f617dc74a07beb352d04537d47a77193f487f (diff)
use type and id for frontend lookups
Diffstat (limited to 'site/public/assets/javascripts/_env.js')
-rw-r--r--site/public/assets/javascripts/_env.js36
1 files changed, 17 insertions, 19 deletions
diff --git a/site/public/assets/javascripts/_env.js b/site/public/assets/javascripts/_env.js
index 2c183aa..8871602 100644
--- a/site/public/assets/javascripts/_env.js
+++ b/site/public/assets/javascripts/_env.js
@@ -43,16 +43,14 @@ environment.ready = function(){
$("nav a").click(function(e){
e.preventDefault()
- var hash = "#" + $(this).data("hash")
+ var page = "/" + $(this).data("type") + "/" + $(this).data("id")
+ var hash = "#" + page
if (done_loading && window.location.hash == hash) return
window.location.hash = hash
$("nav a.active").removeClass("active")
$(this).addClass("active")
open_entry()
-
- var page = $(this).attr("href")
- if (page.indexOf("#") !== -1) page = "#"
$("#entry_container").removeClass("visible")
@@ -66,8 +64,8 @@ environment.ready = function(){
$("nav .about").click(function(e){
e.preventDefault()
- if (done_loading && window.location.hash == "#about") return
- window.location.hash = "#about"
+ if (done_loading && window.location.hash == "#/about") return
+ window.location.hash = "#/about"
$("nav a.active").removeClass("active")
open_entry()
@@ -81,8 +79,8 @@ environment.ready = function(){
$("nav .contact").click(function(e){
e.preventDefault()
- if (done_loading && window.location.hash == "#contact") return
- window.location.hash = "#contact"
+ if (done_loading && window.location.hash == "#/contact") return
+ window.location.hash = "#/contact"
$("nav a.active").removeClass("active")
open_entry()
@@ -96,8 +94,8 @@ environment.ready = function(){
$("nav .index").click(function(e){
e.preventDefault()
- if (done_loading && window.location.hash == "#index") return
- window.location.hash = "#index"
+ if (done_loading && window.location.hash == "#/index") return
+ window.location.hash = "#/index"
$("nav a.active").removeClass("active")
open_entry()
@@ -107,13 +105,13 @@ environment.ready = function(){
$loader.load("all .entry", function(){
display_entry($loader.children()[0])
})
- })
+ })
$(".toggleRapper").click(toggle_menu)
$(".toplogo").click(hide_entry)
$(document).on("click", ".project", function(){
- var hash = as_hash( $(this).find("span").text() )
- load_hash(hash)
+ var page = "/" + $(this).data("type") + "/" + $(this).data("id")
+ load_hash(page)
})
$(window).mousedown(function(e){
@@ -146,13 +144,13 @@ environment.ready = function(){
var current_hash = window.location.hash.replace("#","")
$("nav a").each(function(){
- var key = as_hash(this.innerHTML)
- hashes[key] = this
- $(this).data("hash", key)
+ var page = "/" + $(this).data("type") + "/" + $(this).data("id")
+ hashes[page] = this
+ $(this).data("hash", page)
})
- hashes['about'] = $("nav .about")
- hashes['contact'] = $("nav .contact")
- hashes['index'] = $("nav .index")
+ hashes['/about'] = $("nav .about")
+ hashes['/contact'] = $("nav .contact")
+ hashes['/index'] = $("nav .index")
if (current_hash in hashes) {
toggle_menu()