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
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
<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() > 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>