blob: a604c159792135247e890a489015402bab840386 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
var site = {}
$(function(){
$.getJSON('/db.json', function(data){
site = data
site.entry.forEach(function(entry){
entry.tags = entry.tags.split('#').map(function(tag){
return tag.trim()
})
})
ready()
})
})
function ready() {
bind()
build()
}
function bind(){
$('.cell').click( function(){
var id = $(this).data().id
var entry = site.entry[id]
show_entry(entry)
})
$('.close').click( function(){
close_modals()
})
$('.tag').click( function(){
var tag = $(this).html()
filter_by_tag(tag)
})
}
function build(){
$('.cell').each( function(){
var id = $(this).data().id
var entry = site.entry[id]
if (entry.media && entry.media.length) {
var media = entry.media[0]
switch (media.type) {
case 'youtube':
bg = media.thumb
break
case 'image':
bg = media.uri
break
}
$(this).css('background-image', 'url(' + bg + ')')
}
})
}
function show_entry(entry){
$('#entry h1').html(entry.title)
$('#entry .content').html(entry.body)
$('#entry .media').empty()
if (media.gallery) {
}
else {
}
$('body').addClass('entry')
}
function hide_entry(){
setTimeout(clear_entry, 500)
}
function clear_entry(){
}
function close_modals(){
$('body').removeClass('entry').removeClass('about')
}
|