mobile.naml

<namespace name="mobile"/>

<macro name="html5" parameters="head,body">
    <n.html5_impl>
        <head>
            <n.head/>
        </head>
        <body>
            <n.html5_top_bar/>
            <n.body/>
            <n.html5_nabble_footer/>
        </body>
    </n.html5_impl>
</macro>

<macro name="html5_impl" parameters="head,body" requires="servlet">
    <n.page_start/>
    <n.nabble_html>
        <do>
            <n.put_in_head.head/>
            <n.body/>
            <n.load_call_later_script/>
        </do>
        <output>
            <![CDATA[<!DOCTYPE html>]]>
            <html>
                <head>
                    <![CDATA[<meta charset="utf-8">
                    <meta name="viewport" content="width=device-width, initial-scale=1.0">]]>
                    <n.html5_stylesheets/>
                    <n.html5_javascript_libraries/>
                    <n.html_head_content/>
                </head>
                <body>
                    <div class="nabble macro_[n.page_template/]" id="nabble">
                        <n.apply_filters.html_body_content/>
                    </div>
                    <n.bottom_scripts/>
                    <n.as_html_comments.site_information/>
                </body>
            </html>
        </output>
    </n.nabble_html>
</macro>

<override_macro name="nabble_shared_scripts">
    <n.overridden/>
    <script>
        (function(a){(jQuery.browser=jQuery.browser||{}).mobile=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))})(navigator.userAgent||navigator.vendor||window.opera);

            $(document).ready(function() {
                if (jQuery.browser.mobile) {
                    $('a').each(function(){
                        var href = $(this).attr('href');
                        if (href.indexOf('/template/NamlServlet.jtp?macro=new_topic&') >= 0) {
                            $(this).attr('href',href.replace(/=new_topic&/, '=new_topic5&')).attr('target','top');
                        } else if (href.indexOf('/template/NamlServlet.jtp?macro=reply&') >= 0) {
                            $(this).attr('href',href.replace(/=reply&/, '=reply5&')).attr('target','top');;
                        }
                    });
                }
            });
    </script>
</override_macro>

<macro name="html5_stylesheets">
    <link rel="stylesheet" href="/assets/bootstrap/css/bootstrap.min.css"/>
    <style>body {background:transparent}</style>
    <link rel="stylesheet" href="/nabble[n.dot_pack/].css?v=[n.css_version/]" type="text/css" />
    <link rel="stylesheet" href="/template/NamlServlet.jtp?macro=site_style" type="text/css" />
</macro>

<macro name="html5_javascript_libraries">
    <script src="/assets/jquery/jquery-1.9.1.min.js"></script>
    <script src="/assets/bootstrap/js/bootstrap.min.js"></script>
    <script src="[n.html5_js_path/]" type="text/javascript"></script>
</macro>

<macro name="html5_top_bar">
    <div class="top-bar">
        <div class="breadcrumbs pull-left">
            <n.breadcrumbs/>
        </div>
        <div class="pull-right">
            <n.html5_user_header/>
        </div>
    </div>
</macro>

<macro name="html5_nabble_footer">
    <n.nabble_footer/>
</macro>

<macro name="html5_user_header">
    <span style="white-space:nowrap;" id="nabble-user-header"></span>
    <script type="text/javascript">Nabble.userHeader();</script>
</macro>

<macro name="html5_js">
    var NabbleDropdown = {};
    <n.javascript_library/>
    <n.html5_js_fix/>
</macro>

<macro name="html5_js_fix">
    Nabble.userDropdown = function() {
        var $t = $('#user-dd');
        if ($t.size() == 0)
            return;
        $t.empty();
        var elem = '<div class="dropdown user-menu">';
        elem += '<a class="dropdown-toggle" data-toggle="dropdown" href="javascript:void(0)">'+Nabble.escapeHTML(Nabble.username)+' <img src="/images/more.png" width="10" height="10"/></a>';
        elem += '<ul class="dropdown-menu light-bg-color" role="menu" aria-labelledby="dLabel" style="right:0;left:auto">';
        elem += '<li><a tabindex="-1" href="/template/NamlServlet.jtp?macro=user_nodes&user='+Nabble.userId+'">'+t_my_posts+'</a></li>';
        elem += '<li><a tabindex="-1" href="'+user_profile_path+'">'+t_account_settings+'</a></li>';
        elem += '<li><a tabindex="-1" href="javascript: void Nabble.logout()">'+t_logout+'</a></li>';
        elem += '</ul></div>';
        $t.html(elem);
    };
</macro>

<macro name="html5_js_path">
    <n.encode_url.>
        /template/NamlServlet.jtp?macro=html5_js&v=<n.javascript_version/>
    </n.encode_url.>
</macro>

<macro name="new_post5" parameters="page_name,mailing_list_etiquette,bottom,focus" requires="servlet">
    <n.mobile.>
        <n.node_page.>
            <n.handle_new_node_permission_error/>
            <n.if.not.is_submitted_form>
                <then>
                    <n.subject_field.set_value value="[n.page_node.default_reply_subject/]" />
                    <n.alert_field.set_value value="[n.page_node.alert_default_value/]" />
                    <n.init_new_post_custom_fields/>
                </then>
                <else>
                    <n.catch_exception. id="save-block">
                        <n.handle_anonymous_submit/>
                        <n.check_antispam_submit bypass="preview"/>
                        <n.check_recent_post_limit/>
                        <n.create_child_of_page_node commit="[n.not.is_preview/]">
                            <subject><n.subject_field.value/></subject>
                            <message><n.message_field.value/></message>
                            <is_html><n.html_format_field.value/></is_html>
                            <type><n.type_field.value/></type>
                            <kind>post</kind>
                            <do>
                                <n.remember_new_node/>
                                <n.if.not.is_preview>
                                    <then>
                                        <n.save_post/>
                                        <n.save_new_post_custom_fields/>
                                        <n.new_node.send_node_as_email/>
                                    </then>
                                </n.if.not.is_preview>
                            </do>
                        </n.create_child_of_page_node>
                        <n.if.not.is_preview>
                            <then>
                                <n.new_node.save_alert_field/>
                                <n.redirect_to.new_node.url/>
                            </then>
                        </n.if.not.is_preview>
                    </n.catch_exception.>
                </else>
            </n.if.not.is_submitted_form>
            <n.html5>
                <head>
                    <META NAME="robots" CONTENT="noindex,nofollow"/>
                    <n.title.><n.page_name/></n.title.>
                    <n.focus/>
                    <style>
                        .title-row {
                        padding:.6em .8em;
                        font-weight:bold;
                        }
                        div.field-title { margin-top: 0; }
                        label { display:inline;vertical-align:-15%; }
                        #subject { width:90% }
                    </style>
                </head>
                <body>
                    <n.edit_header first_text="[n.page_name/]" second_text="[n.truncate. size='80'][n.page_node.subject/][/n.truncate.]" />

                    <n.if.is_submitted_form>
                        <then>
                            <n.if.has_exception for="save-block">
                                <then.show_new_node_error/>
                                <else>
                                    <n.if.is_preview>
                                        <then.new_node.preview/>
                                    </n.if.is_preview>
                                </else>
                            </n.if.has_exception>
                        </then>
                    </n.if.is_submitted_form>

                    <n.subscription_reminder/>

                    <n.form. onsubmit="return singleSubmit(this)">
                        <n.type_field.hidden/>
                        <n.mailing_list_notice.mailing_list_etiquette/>

                        <n.reply_form />

                        <div style="margin-top:1em">
                            <n.antispam_submit_button class="toolbar action-button" value="[t]Post Message[/t]"/>
                            <input type="submit" class="toolbar action-button" name="preview" value="[t]Preview Message[/t]"/>
                            <t>or</t>
                            <a href="[n.page_node.url /]"><t>Cancel</t></a>
                        </div>
                    </n.form.>

                    <n.hide_null.bottom/>
                </body>
            </n.html5>
        </n.node_page.>
    </n.mobile.>
</macro>

<macro name="reply5" requires="servlet">
    <n.new_post5>
        <page_name>
            <t>Reply</t>
        </page_name>
        <focus>
            <n.message_field.focus/>
        </focus>
        <mailing_list_etiquette>
            <li><t>Quote what you reply to and trim it to only the relevant parts. This provides context for those who will read your message by email.</t></li>
            <li><t>Avoid small talk such as "Thank you", "Great"... You can <n.page_node.reply_to_author_link.>send a private email</n.page_node.reply_to_author_link.> if you want.</t></li>
        </mailing_list_etiquette>
        <bottom>
            <n.in_reply_to/>
        </bottom>
    </n.new_post5>
</macro>

<macro name="editor_toolbar" parameters="textarea_id, original_text, node_id" requires="mobile">
    <n.put_in_head.>
        <n.editor_stylesheet/>
        <style>
            .nabble div.toolbar { min-width: auto; max-width: none; }
        </style>
        <n.editor_shared_scripts textarea_id="[n.textarea_id/]" node_id="[n.node_id/]"/>
        <script>
            <![CDATA[
            $.browser = $.browser || {};

            $(document).ready(function() {
                $('div.toolbar').removeClass('shaded-bg-color');
                $('#message').removeAttr('style').css({width:'90%'}).attr('rows',15);

                $('div.toolbar button').each(function() {
                    var $btn = $(this);
                    if ($btn.text().length > 0) {
                        var img = $btn.html();
                        $btn.html(img.match(/<img[^>]+>/));
                        $btn.css('width','2.5em');
                    }
                });
            });
            ]]>
        </script>
    </n.put_in_head.>

    <div class="toolbar rounded-top shaded-bg-color">
        <table class="toobar">
            <tr>
                <n.editor_quote_button original_text="[n.original_text/]"/>
                <n.editor_insert_image_button/>
                <n.editor_bold_button/>
                <n.editor_italic_button/>
                <n.editor_link_button/>
                <n.editor_file_button/>
                <n.editor_smiley_button/>
            </tr>
        </table>
    </div>
</macro>

<macro name="editor_file_button">
    <n.put_in_head.>
        <script type="text/javascript">
            <![CDATA[
            Nabble.uploadFile = function() {
                Nabble.closeWindows();
                var $fileDiv = $('#file-upload');
                var isOpen = $fileDiv.css("display") != 'none';
                var alreadyLoaded = window.fileuploader && $('#file-upload-form', window.fileuploader.document).size() == 1;
                if (isOpen)
                    return;
                else if (alreadyLoaded)
                    $fileDiv.show();
                else {
                    var f = '';
                    if ($.browser && $.browser.msie)
                        f += '<br style="line-height:1px"/>';
                    f += "<iframe id='fileuploader' name='fileuploader' src='/forum/UploadFile.jtp?node=" + nodeId + Nabble.getClientID() + "' width='380' height='100' frameBorder='0' scrolling='no' allowtransparency='true'>";
                    $fileDiv.html(f).show();
                }
            };
            Nabble.uploadedFile = function(name) {
                var textarea = Nabble.get(textareaID);
                this.setSelection( textarea, '<nabble_a href="'+name+'">'+name+'</nabble_a>' );
                textarea.focus();
                Nabble.closeWindows();
            };
            ]]>
        </script>
    </n.put_in_head.>
    <td class="nowrap has-dropdown">
        <div id="file-upload" class="editor-dropdown file-upload medium-border-color light-bg-color drop-shadow"></div>
        <button type="button" onclick="Nabble.uploadFile()" class="toolbar file-upload" title="[t]Upload a file[/t]">
            <img src="/images/paperclip.png" border="0" height="12" alt="File" style="vertical-align:middle"/>
        </button>
        <n.tooltip use_title="true"/>
    </td>
</macro>

<macro name="new_topic5" requires="servlet">
    <n.new_post5>
        <page_name>
            <t>Post New Message</t>
        </page_name>
        <focus>
            <n.subject_field.focus/>
        </focus>
        <mailing_list_etiquette>
            <li><t>If you are posting a question, please try search first. Your question may have already been answered.</t></li>
            <li><t>Don't post repeatedly. Wait for a few days. People will read your post by email.</t></li>
        </mailing_list_etiquette>
    </n.new_post5>
</macro>