From: Marek Stępniowski Date: Fri, 7 Aug 2009 13:35:49 +0000 (+0200) Subject: - Usunięcie wywołań console.log ze skryptów. X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/e41427616dba910c993c8ab08d70313ca1d8872d - Usunięcie wywołań console.log ze skryptów. - Dodanie funkcji addEditorButton, która odpowiada za tworzenie przycisków edytora. --- diff --git a/project/templates/explorer/file_html.html b/project/templates/explorer/file_html.html index 7e126f0a..bb2c230c 100644 --- a/project/templates/explorer/file_html.html +++ b/project/templates/explorer/file_html.html @@ -15,11 +15,7 @@ var lastScroll = -1000; function checkScroll() { - console.log('checkScroll', $('#images').scrollTop(), lastScroll); - if (Math.abs($('#images').scrollTop() - lastScroll) > 300) { - console.log('checking!'); - var container = $('#images'); lastScroll = container.scrollTop(); diff --git a/project/templates/explorer/file_xml.html b/project/templates/explorer/file_xml.html index 66e128de..2a2afaac 100644 --- a/project/templates/explorer/file_xml.html +++ b/project/templates/explorer/file_xml.html @@ -15,11 +15,7 @@ var lastScroll = -1000; function checkScroll() { - console.log('checkScroll', $('#images').scrollTop(), lastScroll); - if (Math.abs($('#images').scrollTop() - lastScroll) > 300) { - console.log('checking!'); - var container = $('#images'); lastScroll = container.scrollTop(); @@ -36,20 +32,25 @@ setTimeout(checkScroll, 2000); } + function addEditorButton(label, fn) { + $('').click(function(event) { + var text = $('#id_text').getSelection().text; + $('#id_text').replaceSelection(fn(text)); + event.preventDefault(); + }).appendTo('#buttons'); + } + $(function() { $('#id_folders').change(function() { $('#images').load('/images/' + $('#id_folders').val() + '/', function() { lastScroll = -1000; }); }); + + addEditorButton('utwór', function(text) { return '' + text + ''; }); + addEditorButton('akap', function(text) { return '' + text + ''; }); setTimeout(checkScroll, 2000); - - $('#rozdzial-button').click(function(event) { - console.log($('#id_text').getSelection().text); - $('#id_text').replaceSelection('' + $('#id_text').getSelection().text + '', true); - event.preventDefault(); - }); }); {% endblock extrahead %} @@ -65,7 +66,7 @@
- Rodział +
{{ form.text }}

Użytkownik: {{ form.user }} Opis zmian: {{ form.commit_message }}