##// END OF EJS Templates
small fix for new templates
rt@lightning -
r256:87d72fef default
parent child Browse files
Show More
@@ -1,56 +1,56 b''
1 1 function addGalleryPanel() {
2 2 var gallery = $('a[class="thumb"]').clone(true),
3 3 normal = $('.post').clone(true);
4 4
5 5 $('.navigation_panel').filter(':first').after(
6 6 '<div class="image-mode-tab" role="radiogroup" aria-label="Image mode2">' +
7 7 '<label><input type="radio" class="image-mode-normal" name="image-mode" value="0" checked="checked"/>'+ gettext('Normal') +'</label>' +
8 8 '<label><input type="radio" class="image-mode-table" name="image-mode" value="1"/>'+ gettext('Gallery') +'</label>' +
9 9 '</div>'
10 10 );
11 11
12 12 $('input[name="image-mode"]').change(function() {
13 13 //gallery mode
14 14 if($(this).val() === '1') {
15 $('#posts').replaceWith(
15 $('.thread').replaceWith(
16 16 $('<div id="posts-table"></div>').append(gallery)
17 17 );
18 18 }
19 19 //normal mode
20 20 else {
21 21 $('#posts-table').replaceWith(
22 $('<div id="posts"></div>').append(normal)
22 $('<div class="thread"></div>').append(normal)
23 23 );
24 24 }
25 25 });
26 26 }
27 27
28 28 function moveCaretToEnd(el) {
29 29 if (typeof el.selectionStart == "number") {
30 30 el.selectionStart = el.selectionEnd = el.value.length;
31 31 } else if (typeof el.createTextRange != "undefined") {
32 32 el.focus();
33 33 var range = el.createTextRange();
34 34 range.collapse(false);
35 35 range.select();
36 36 }
37 37 }
38 38
39 39 function addQuickReply(postId) {
40 40 var textToAdd = '>>' + postId + '\n\n';
41 41 var textAreaId = '#id_text';
42 42 $(textAreaId).val($(textAreaId).val()+ textToAdd);
43 43
44 44 var textarea = document.getElementById('id_text');
45 45 $(textAreaId).focus();
46 46 moveCaretToEnd(textarea);
47 47
48 48 $("html, body").animate({ scrollTop: $(textAreaId).offset().top }, "slow");
49 49 }
50 50
51 51
52 52
53 53 $(document).ready(function(){
54 54 addGalleryPanel();
55 55 addRefLinkMap();
56 56 });
General Comments 0
You need to be logged in to leave comments. Login now