js_topic_and_post_functions.naml

<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>