js_header_functions

NAML documentation   Watch a video
   Usages of this macro
The source code below doesn't have navigation links because no usage has been compiled yet. Navigation links depend on how and where the macro is used, so first you may try finding all usages of "js_header_functions".
... in js_header_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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<override_macro name="js_header_functions" requires="servlet">
    var t_login = "<t>Login</t>";
    var t_register = "<t>Register</t>";
    var t_logout = "<t>Log out</t>";
    var t_my_posts = "<t>My posts</t>";
    var t_account_settings = "<t>Account settings</t>";
    var t_show_nabble_notice = "<t>Show Nabble notice</t>";
    var t_permalink = "<t>Link</t>";
    var t_refresh = "<t>Refresh</t>";
    var login_path = "<n.login_path/>";
    var logout_path = "<n.logout_path/>";
    var register_path = "<n.register_path/>";
    var user_profile_path = "<n.user_profile_path/>";
    <![CDATA[
    Nabble.userId = Nabble.getCookie("userId");
    var encodedUsername = Nabble.getCookie("username");
    if (encodedUsername) {
        Nabble.username = decodeURIComponent(encodedUsername)
            .replace(new RegExp('\\+','g'),' ');
    }
 
    if (!Nabble.userId) {
        Nabble.anonymousId = Nabble.getCookie("anonymousId");
        var encodedName = Nabble.getCookie("anonymousName");
        if (encodedName) {
            Nabble.anonymousName = decodeURIComponent(encodedName)
                .replace(new RegExp('\\+','g'),' ')
                .replace(new RegExp('<','g'),'&lt;')
                .replace(new RegExp('>','g'),'&gt;');
        }
    }
 
    Nabble.embedPermalink = function(url) {
        if (!Nabble.isEmbedded)
            return url;
        return url.replace(/(;|&)cid=(\d|\-)+/g, '').replace(/\?cid=(\d|\-)+(&)?/g, '?');
    };
 
    Nabble.getPermalink = function() {
        return Nabble.embedPermalink(
            Nabble.overridePermalink? Nabble.overridePermalink : Nabble.getParent().nabbleiframe.location.href);
    };
 
    Nabble.permalinkLabel = function() {
        if (!Nabble.isEmbedded)
            return '';
        var p = "<script>function openPermalink() { prompt('Copy this:', Nabble.getPermalink()); };</script>";
        p += "<a href='javascript: void openPermalink();'>"+t_permalink+"</a>&nbsp;&nbsp;";
        return p;
    };
 
    Nabble.refreshLabel = function() {
        if (Nabble.isEmbedded)
            return "<a href='javascript: location.reload(true);'>"+t_refresh+"</a>&nbsp;&nbsp;";
        return '';
    };
 
    Nabble.siteHeader = function() {
        var s = Nabble.refreshLabel();
        s += Nabble.permalinkLabel();
        if (!Nabble.userId) {
            var nextUrl = typeof loginNextUrl == 'undefined'? window.location.href : loginNextUrl;
            s += '<a href="'+login_path+'&nextUrl='+encodeURIComponent(nextUrl)+'">'+t_login+'</a>';
            s += '&nbsp;&nbsp;';
            s += '<a href="'+register_path+'&nextUrl='+encodeURIComponent(nextUrl)+'">'+t_register+'</a>';
            if (Nabble.anonymousId && Nabble.anonymousName) {
                s += '&nbsp;&nbsp;';
                s += '<a href="/template/NamlServlet.jtp?macro=user_nodes&user=' + Nabble.anonymousId + '~' + Nabble.anonymousName + '">';
                s += Nabble.anonymousName;
                s += '</a>';
            }
        } else
            s += '<span id="user-dd"></span>';
        return s;
    };
 
    Nabble.userDropdown = function() {
        var $t = $('#user-dd');
        if ($t.size() == 0)
            return;
        $t.empty();
        var dropdown = new NabbleDropdown('usrdd', Nabble.escapeHTML(Nabble.username));
        dropdown.add('myPosts','<a href="/template/NamlServlet.jtp?macro=user_nodes&user='+Nabble.userId + '">'+t_my_posts+'</a>');
        dropdown.add('personalSettings','<a href="'+user_profile_path+'">'+t_account_settings+'</a>');
        dropdown.add('adminNotice','<a href="javascript: void Nabble.showAdminNotice()">'+t_show_nabble_notice+'</a>','display:none');
        dropdown.add('logout','<a href="javascript: void Nabble.logout()">'+t_logout+'</a>');
        $t.html(dropdown.getHtml());
        dropdownInit('usrdd');
    };
 
    Nabble.addUserHeaderListener(function() {
        Nabble.userDropdown();
    });
 
    Nabble.showAdminNotice = function() {
        Nabble.deleteCookie('admin-notice');
        window.location.reload();
    };
 
    Nabble.logout = function() {
        window.location = '/template/NamlServlet.jtp?macro=logout_page' + Nabble.getClientID();
    };
    ]]>
</override_macro>
Overrides default macro
... in javascript_library.naml
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
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
411
412
413
414
415
416
417
418
419
420
421
<macro name="js_header_functions" requires="servlet">
    var t_login = "<t>Login</t>";
    var t_register = "<t>Register</t>";
    var t_logout = "<t>Log out</t>";
    var t_my_posts = "<t>My posts</t>";
    var t_account_settings = "<t>Account settings</t>";
    var t_show_nabble_notice = "<t>Show Nabble notice</t>";
    var t_permalink = "<t>Permalink</t>";
    var t_refresh = "<t>Refresh</t>";
    var login_path = "<n.login_path/>";
    var logout_path = "<n.logout_path/>";
    var register_path = "<n.register_path/>";
    var user_profile_path = "<n.user_profile_path/>";
    <![CDATA[
    Nabble.userId = Nabble.getCookie("userId");
    var encodedUsername = Nabble.getCookie("username");
    if (encodedUsername) {
        Nabble.username = decodeURIComponent(encodedUsername)
            .replace(new RegExp('\\+','g'),' ');
    }
 
    if (!Nabble.userId) {
        Nabble.anonymousId = Nabble.getCookie("anonymousId");
        var encodedName = Nabble.getCookie("anonymousName");
        if (encodedName) {
            Nabble.anonymousName = decodeURIComponent(encodedName)
                .replace(new RegExp('\\+','g'),' ')
                .replace(new RegExp('<','g'),'&lt;')
                .replace(new RegExp('>','g'),'&gt;');
        }
    }
 
    Nabble.getPermalink = function() {
        return Nabble.getParent().nabbleiframe.location.href;
    };
 
    Nabble.permalinkLabel = function() {
        if (!Nabble.isEmbedded)
            return '';
        var p = "<script>function openPermalink() { prompt('Copy this:', Nabble.getPermalink()); };</script>";
        p += "<a href='javascript: void openPermalink();'>"+t_permalink+"</a>&nbsp;&nbsp;";
        return p;
    };
 
    Nabble.refreshLabel = function() {
        if (Nabble.isEmbedded)
            return "<a href='javascript: location.reload(true);'>"+t_refresh+"</a>&nbsp;&nbsp;";
        return '';
    };
 
    Nabble.siteHeader = function() {
        var s = Nabble.refreshLabel();
        s += Nabble.permalinkLabel();
        if (!Nabble.userId) {
            var nextUrl = typeof loginNextUrl == 'undefined'? window.location.href : loginNextUrl;
            s += '<a href="'+login_path+'&nextUrl='+encodeURIComponent(nextUrl)+'">'+t_login+'</a>';
            s += '&nbsp;&nbsp;';
            s += '<a href="'+register_path+'&nextUrl='+encodeURIComponent(nextUrl)+'">'+t_register+'</a>';
            if (Nabble.anonymousId && Nabble.anonymousName) {
                s += '&nbsp;&nbsp;';
                s += '<a href="/template/NamlServlet.jtp?macro=user_nodes&user=' + Nabble.anonymousId + '~' + Nabble.anonymousName + '">';
                s += Nabble.anonymousName;
                s += '</a>';
            }
        } else
            s += '<span id="user-dd"></span>';
        return s;
    };
 
    Nabble.userDropdown = function() {
        var $t = $('#user-dd');
        if ($t.size() == 0)
            return;
        $t.empty();
        var dropdown = new NabbleDropdown('usrdd', Nabble.escapeHTML(Nabble.username));
        dropdown.add('myPosts','<a href="/template/NamlServlet.jtp?macro=user_nodes&user='+Nabble.userId + '">'+t_my_posts+'</a>');
        dropdown.add('personalSettings','<a href="'+user_profile_path+'">'+t_account_settings+'</a>');
        dropdown.add('adminNotice','<a href="javascript: void Nabble.showAdminNotice()">'+t_show_nabble_notice+'</a>','display:none');
        dropdown.add('logout','<a href="javascript: void Nabble.logout()">'+t_logout+'</a>');
        $t.html(dropdown.getHtml());
        dropdownInit('usrdd');
    };
 
    Nabble.addUserHeaderListener(function() {
        Nabble.userDropdown();
    });
 
    Nabble.showAdminNotice = function() {
        Nabble.deleteCookie('admin-notice');
        window.location.reload();
    };
 
    Nabble.logout = function() {
        window.location = '/template/NamlServlet.jtp?macro=logout_page';
    };
    ]]>
</macro>