1 {% extends "base.html" %}
4 <script src="/static/js/jquery.lazyload.js" type="text/javascript" charset="utf-8"></script>
5 <script type="text/javascript" charset="utf-8">
6 function aboveViewport(container, element, treshold) {
7 return $(container).offset().top >= $(element).offset().top + $(element).height() + treshold;
10 function belowViewport(container, element, treshold) {
11 return $(container).offset().top + $(container).height() + treshold <= $(element).offset().top;
15 var lastScroll = -1000;
17 function checkScroll() {
18 console.log('checkScroll', $('#images').scrollTop(), lastScroll);
20 if (Math.abs($('#images').scrollTop() - lastScroll) > 300) {
21 console.log('checking!');
23 var container = $('#images');
24 lastScroll = container.scrollTop();
26 $('#images .image-box').each(function() {
27 if (aboveViewport(container, this, TRESHOLD)) {
28 $(this).html('loading...');
29 } else if (belowViewport(container, this, TRESHOLD)) {
30 $(this).html('loading...');
32 $(this).html('<img src="' + $(this).attr('src') + '" width="460" height="460"/>');
36 setTimeout(checkScroll, 2000);
40 $('#id_folders').change(function() {
41 $('#images').load('/images/' + $('#id_folders').val() + '/', function() {
46 setTimeout(checkScroll, 2000);
49 {% endblock extrahead %}
51 {% block breadcrumbs %}<a href="/">Platforma Redakcyjna</a> ❯ plik {{ hash }}{% endblock breadcrumbs %}
53 {% block maincontent %}
54 <div id="tabs"><a href="{% url file_xml hash %}" class="active">Źródło</a><a href="{% url file_html hash %}">HTML</a> <div style="padding: 3px; margin-left: 10px">{{ image_folders_form.folders }}</div><div style="clear: both; height: 0; width: 0"> </div></div>
57 <div class="image-box">
58 <p>Aby zobaczyć obrazki wybierz folder z obrazkami powyżej.</p>
61 <form action="." method="post" accept-charset="utf-8">
63 <p><input type="submit" value="Zapisz"/></p>
65 {% endblock maincontent %}