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 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
|
<!doctype html>
<title>Slide Viewer</title>
<style type="text/css">
html {
overflow: hidden;
}
body {
margin: 5px;
}
h1 {
font-size: 1.2em;
}
.notice {
font-style: italic;
}
div#images {
position: absolute;
width: 15%;
}
div#images h2 {
font-size: 1em;
margin: 0;
}
.associated-images {
margin-left: 1.5em;
margin-top: 0;
margin-bottom: 0;
padding-left: 0;
}
div#images li {
list-style-type: none;
}
.current-slide {
background-color: #ccf;
}
div#view {
position: absolute;
left: 16%;
width: 58%;
height: 98%;
background-color: black;
border: 1px solid #000;
color: white;
}
div#view.fullpage {
left: 0%;
border: 0;
}
div#properties {
position: absolute;
left: 75%;
width: 24.5%;
height: 98%;
overflow: auto;
}
div#properties-inner {
display: inline-block;
}
div#properties dl {
font-size: small;
margin: 0;
}
div#properties dt {
font-weight: bold;
border-top: 1px solid #000;
background-color: #eee;
}
div#properties dd {
margin-left: 0;
}
</style>
<div id="images">
<h1>View</h1>
<div class="current-slide">
<a class="load-slide" href="#" data-url="{{ slide_url }}">Slide</a>
</div>
<h2>Associated images</h2>
{% if associated %}
<ul class="associated-images">
{% for name in associated|sort %}
<li><a class="load-slide" href="#"
data-url="{{ associated[name] }}">
{{ name }}
</a>
{% endfor %}
</ul>
{% else %}
<span class="associated-images notice">None</span>
{% endif %}
</div>
<div id="view"></div>
<div id="properties">
<h1>Slide properties</h1>
{% if properties %}
<div id="properties-inner">
<dl>
{% for name in properties %}
<dt>{{ name }}
<dd>{{ properties[name] }}
{% endfor %}
</dl>
</div>
{% else %}
<span class="notice">None</span>
{% endif %}
</div>
<script type="text/javascript" src="static/jquery.js"></script>
<script type="text/javascript" src="static/openseadragon.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var dzi_data = {{ dzi_data|default('{}')|safe }};
var viewer = new OpenSeadragon({
id: "view",
prefixUrl: "static/images/",
timeout: 120000,
animationTime: 0.5,
blendTime: 0.1,
constrainDuringPan: true,
maxZoomPixelRatio: 2,
minZoomLevel: 1,
visibilityRatio: 1,
zoomPerScroll: 2,
});
viewer.addHandler("open", function() {
// To improve load times, ignore the lowest-resolution Deep Zoom
// levels. This is a hack: we can't configure the minLevel via
// OpenSeadragon configuration options when the viewer is created
// from DZI XML.
viewer.source.minLevel = 8;
});
function open_slide(url) {
var tile_source;
if (dzi_data[url]) {
// DZI XML provided as template argument (deepzoom_tile.py)
tile_source = new OpenSeadragon.DziTileSource(
OpenSeadragon.DziTileSource.prototype.configure(
OpenSeadragon.parseXml(dzi_data[url]), url));
} else {
// DZI XML fetched from server (deepzoom_server.py)
tile_source = url;
}
viewer.open(tile_source);
}
open_slide("{{ slide_url }}");
$(".load-slide").click(function(ev) {
$(".current-slide").removeClass("current-slide");
$(this).parent().addClass("current-slide");
open_slide($(this).attr('data-url'));
ev.preventDefault();
});
});
</script>
|