diff options
author | Peter Wu <peter@lekensteyn.nl> | 2015-04-08 13:38:37 +0200 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2015-04-08 13:38:37 +0200 |
commit | f67bc6d080c4089e3e49e02c50f548fca9b053ad (patch) | |
tree | 4ec3a779e1e74ec8291944d573a9d128eec6e04d | |
parent | 4927936db62d62e1129b27b3a145d2d1bfa0ff29 (diff) | |
download | site-f67bc6d080c4089e3e49e02c50f548fca9b053ad.tar.gz |
Add campus pictures
-rw-r--r-- | images/campus-auditorium.png | bin | 0 -> 183948 bytes | |||
-rw-r--r-- | images/campus-bike-repair-shop.png | bin | 0 -> 97936 bytes | |||
-rw-r--r-- | images/campus-bus-stops.png | bin | 0 -> 323931 bytes | |||
-rw-r--r-- | images/campus-supermarket.png | bin | 0 -> 219358 bytes | |||
-rw-r--r-- | images/campus-zwarte-doos.png | bin | 0 -> 116172 bytes | |||
-rw-r--r-- | js/campus.js | 23 | ||||
-rw-r--r-- | style/campus.less | 13 |
7 files changed, 36 insertions, 0 deletions
diff --git a/images/campus-auditorium.png b/images/campus-auditorium.png Binary files differnew file mode 100644 index 0000000..a1d28c0 --- /dev/null +++ b/images/campus-auditorium.png diff --git a/images/campus-bike-repair-shop.png b/images/campus-bike-repair-shop.png Binary files differnew file mode 100644 index 0000000..d027a93 --- /dev/null +++ b/images/campus-bike-repair-shop.png diff --git a/images/campus-bus-stops.png b/images/campus-bus-stops.png Binary files differnew file mode 100644 index 0000000..ee00fb4 --- /dev/null +++ b/images/campus-bus-stops.png diff --git a/images/campus-supermarket.png b/images/campus-supermarket.png Binary files differnew file mode 100644 index 0000000..3575254 --- /dev/null +++ b/images/campus-supermarket.png diff --git a/images/campus-zwarte-doos.png b/images/campus-zwarte-doos.png Binary files differnew file mode 100644 index 0000000..2dd503e --- /dev/null +++ b/images/campus-zwarte-doos.png diff --git a/js/campus.js b/js/campus.js index 8d6846b..55e0efe 100644 --- a/js/campus.js +++ b/js/campus.js @@ -46,6 +46,27 @@ define(['campus-coords', 'd3'], function(coords, d3) { }); } + function try_add_image(building, element) { + var image_url = 'images/campus-' + building.id + '.png'; + var img = new Image(); + img.src = image_url; + img.className = 'description-picture'; + img.addEventListener('load', function() { + var clear = document.createElement('div'); + clear.style.clear = 'both'; + + if (img.width > 500) { + img.classList.add('large'); + element.appendChild(img); + element.appendChild(clear); + } else { + img.classList.add('small'); + element.insertBefore(img, element.firstChild); + element.insertBefore(clear, element.firstChild); + } + }); + } + return function() { var svg = d3.select('#campus-map').append('svg'); initSvg(svg); @@ -67,6 +88,8 @@ define(['campus-coords', 'd3'], function(coords, d3) { back_to_top.textContent = 'Back to top'; links_block.appendChild(back_to_top); citems.appendChild(links_block); + + try_add_image(building, text_block); }); }; }); diff --git a/style/campus.less b/style/campus.less index a330595..02d9126 100644 --- a/style/campus.less +++ b/style/campus.less @@ -17,4 +17,17 @@ body[data-page="campus"] #campus-map { } } } + +body[data-page="campus"] { + img.description-picture { + float: right; + margin-left: 1em; + + &.small { + } + + &.large { + } + } +} /* vim: set sw=4 et ts=4: */ |