1 {% extends "base.html" %}
4 <script src="/static/js/jquery.fieldselection.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);
48 $('#rozdzial-button').click(function(event) {
49 console.log($('#id_text').getSelection().text);
50 $('#id_text').replaceSelection('<rozdzial>' + $('#id_text').getSelection().text + '</rozdzial>', true);
51 event.preventDefault();
55 {% endblock extrahead %}
57 {% block breadcrumbs %}<a href="/">Platforma Redakcyjna</a> ❯ plik {{ hash }}{% endblock breadcrumbs %}
59 {% block maincontent %}
60 <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>
63 <div class="image-box">
64 <p>Aby zobaczyć obrazki wybierz folder z obrazkami powyżej.</p>
67 <form action="." method="post" accept-charset="utf-8">
68 <a href="#" id="rozdzial-button">Rodział</a>
70 <p>Użytkownik: {{ form.user }} Opis zmian: {{ form.commit_message }} <input type="submit" value="Zapisz"/></p>
72 {% endblock maincontent %}