js_topic_and_post_functions

NAML documentation   Watch a video
   Usages of this macro
... in js_topic_and_post_functions.naml
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
<override_macro name="js_topic_and_post_functions" requires="servlet">
    <![CDATA[
    Nabble.messageTextWidth = function() {
        var maxWidth = Nabble.getCookie("max_width");
        if( maxWidth==null )
            return;
        document.write("<style type='text/css'>.nabble .message-text {max-width: "+maxWidth+";}</style>");
    };
 
    Nabble.setFontSize = function() {
        var fontSize = Nabble.getCookie("font_size");
        if (fontSize)
            document.write("<style type='text/css'>body, table .nabble {font-size: "+fontSize+";}</style>");
    };
 
    Nabble.fixTopicLinks = function() {
        if (Nabble.tview == "classic")
            return;
        var a = Nabble.get("nabble").getElementsByTagName("a");
        for (var i=0; i<a.length; i++) {
            var tag = a[i];
            var threadHref = tag.getAttribute("threaded_href");
            var listHref = tag.getAttribute("list_href");
            if (threadHref && Nabble.tview == "threaded") {
                tag.href = threadHref;
            } else if (listHref && Nabble.tview == "list") {
                tag.href = listHref;
            }
        }
    };
 
    Nabble.hideQuotes = function(context) {
        $('div.shrinkable-quote,blockquote',context).each(function() {
            var $this = $(this);
            if ($this.outerHeight() > 600) {
                $this.after("<div class='shrink-quote'><span></span> [<a href='javascript:void(0)'></a>]</div>");
            }
        });
        $('div.shrink-quote a', context)
            .click(function(){
                var $this = $(this);
                var v = parseInt($this.attr('collapsed') || 1) % 2;
                if (v == 0) {
                    $this.prev().html( "&#171;&nbsp;" );
                    $this.html( "hide part of quote" );
                    var $text = $this.parent().prev();
                    $text.css( 'height', 'auto' );
                    $text.css( 'overflowY', 'auto' );
                } else {
                    $this.prev().html( "..." );
                    $this.html( "show rest of quote" );
                    var $text = $this.parent().prev();
                    $text.css('height', '600px');
                    $text.css('overflowY', 'hidden' );
                }
                $this.attr('collapsed', v+1);
                Nabble.resizeFrames();
            })
            .click()
        ;
    };
    ]]>
</override_macro>
Overrides default macro
... in javascript_library.naml
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
<macro name="js_topic_and_post_functions" requires="servlet">
    <![CDATA[
    Nabble.messageTextWidth = function() {
        var maxWidth = Nabble.getCookie("max_width");
        if( maxWidth==null )
            return;
        document.write("<style type='text/css'>.nabble .message-text {max-width: "+maxWidth+";}</style>");
    };
 
    Nabble.setFontSize = function() {
        var fontSize = Nabble.getCookie("font_size");
        if (fontSize)
            document.write("<style type='text/css'>body, table .nabble {font-size: "+fontSize+";}</style>");
    };
 
    Nabble.hideQuotes = function(context) {
        $('div.shrinkable-quote,blockquote',context).each(function() {
            var $this = $(this);
            if ($this.outerHeight() > 300) {
                $this.after("<div class='shrink-quote'><span></span> [<a href='javascript:void(0)'></a>]</div>");
            }
        });
        $('div.shrink-quote a', context)
            .click(function(){
                var $this = $(this);
                var v = parseInt($this.attr('collapsed') || 1) % 2;
                if (v == 0) {
                    $this.prev().html( "&#171;&nbsp;" );
                    $this.html( "hide part of quote" );
                    var $text = $this.parent().prev();
                    $text.css( 'height', 'auto' );
                    $text.css( 'overflowY', 'auto' );
                } else {
                    $this.prev().html( "..." );
                    $this.html( "show rest of quote" );
                    var $text = $this.parent().prev();
                    $text.css('height', '300px');
                    $text.css('overflowY', 'hidden' );
                }
                $this.attr('collapsed', v+1);
                Nabble.resizeFrames();
            })
            .click()
        ;
    };
    ]]>
</macro>