javascript_library

NAML documentation   Watch a video
   Usages of this macro
... in poll.naml
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
<override_macro name="javascript_library" requires="servlet">
    <n.overridden/>
    <n.comment
Macro
Parameters: text
.>
        Javascript to validate and submit a poll vote.
    </n.comment.>
    <n.compress
Macro
Parameters: text
.>
        Nabble.vote = function(nodeId,maxChoices) {
            var vote_count = $('#poll_form'+nodeId+' input:checked').length;
            <![CDATA[
            if (vote_count > maxChoices) {
            ]]>
                alert('<t>Please select no more than <t.number>'+maxChoices+'</t.number> options.</t>');
                return false;
            } else if (vote_count == 0) {
                alert('<t>Please select at least one option.</t>');
                return false;
            }
            var params = $('#poll_form'+nodeId).serialize();
            var call = '/template/NamlServlet.jtp?macro=vote&'+params+Nabble.getClientID();
            var call2 = '/template/NamlServlet.jtp?macro=poll_js&poll_node_id='+nodeId+Nabble.getClientID();
            $.getScript(call, function() {
                notice('<t>Your vote has been submitted.</t>', 5000, 2000);
                $.getScript(call2);
            });
            return false;
        };
    </n.compress.>
</override_macro>
Overrides default macro
... in javascript_library.naml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<macro name="javascript_library" requires="servlet">
    <n.uncache_for
Binary
Namespace: ServletNamespace
Parameters: do
/>
    <n.javascript_response
Macro
Requires: servlet
/>
    <n.compress
Macro
Parameters: text
.>
        <n.js_basic_nabble_functions
Binary
Namespace: NabbleNamespace
/>
        <n.js_basic_embedding_code
Macro
/>
        <n.js_basic_site_functions
Macro
Requires: servlet
/>
        <n.js_date_functions
Macro
Requires: servlet
/>
        <n.js_header_functions
Macro
Requires: servlet
/>
        <n.js_delete_functions
Macro
Requires: servlet
/>
        <n.js_topic_and_post_functions
Macro
Requires: servlet
/>
        <n.js_search_functions
Macro
Requires: servlet
/>
    </n.compress.>
</macro>