diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2017-08-18 23:00:34 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2017-08-18 23:00:34 +0200 |
| commit | a8a5509a02fec7dcc57ec9382c97685cf711360d (patch) | |
| tree | af0ae90be0dba4db5875799496d5da57d7f9d75b /public | |
| parent | 12c1d5bd29fcc23b5c0ddb0bf2332d256abbf3a9 (diff) | |
index stuff
Diffstat (limited to 'public')
| -rw-r--r-- | public/css.css | 50 | ||||
| -rw-r--r-- | public/site.js | 71 |
2 files changed, 121 insertions, 0 deletions
diff --git a/public/css.css b/public/css.css new file mode 100644 index 0000000..2bed6d9 --- /dev/null +++ b/public/css.css @@ -0,0 +1,50 @@ +html,body { +} +body.about, +body.entry, +body.submit { + overflow: hidden; +} + +#about, #entry, #submit { + position: fixed; + top: 0; left: 0; + width: 100%; height: 100%; + background: #444; + pointer-events: none; + opacity: 0; +} +.about #about, +.entry #entry, +.submit #submit { + opacity: 1; + pointer-events: auto; +} + +#header { + width: 100%; +} + +.cell { + display: inline-block; + width: 100vw; + height: 20vw; + color: white; + text-shadow: 0 0 2px #000; +} + +.media { + width: 100%; + max-height: 50vh; +} + +.cell:nth-child(3n+1) { background: #800; } +.cell:nth-child(3n+2) { background: #880; } +.cell:nth-child(3n+3) { background: #808; } + +@media screen and (max-width: 600px) { + .cell { + width: 100vw; + height: 20vh; + } +}
\ No newline at end of file diff --git a/public/site.js b/public/site.js new file mode 100644 index 0000000..a604c15 --- /dev/null +++ b/public/site.js @@ -0,0 +1,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') +}
\ No newline at end of file |
