1
1
<div id =" headerNav" ></div >
2
- {literal }
3
- <script>
4
- var UNI_NAV_PROD_URL = '//uni-nav.topcoder.com/v1/tc-universal-nav.js';
5
- var UNI_NAV_DEV_URL = '//uni-nav.topcoder-dev.com/v1/tc-universal-nav.js';
6
-
7
- var TOPCODER_DOMAIN = 'topcoder.com'
8
- var isProdEnv = window.location.hostname && window.location.hostname.includes(TOPCODER_DOMAIN);
9
- var scriptURL = isProdEnv ? UNI_NAV_PROD_URL : UNI_NAV_DEV_URL;
10
2
3
+ <script >
4
+ const signInUrl = ' { $SignInUrl } ' ;
5
+ const signUpUrl = ' { $SignUpUrl } ' ;
6
+ const signOutUrl = ' { $SignOutUrl } ' ;
7
+ {literal }
11
8
!function(n,t,e,a,c,i,o){ n[' TcUnivNavConfig' ]=c,n[c]=n[c]|| function(){
12
9
(n[c].q= n[c].q??[]).push(arguments)} ,n[c].l= 1*new Date();i= t.createElement(e),
13
10
o= t.getElementsByTagName(e)[0];i.async= 1;i.type= " module" ;i.src= a;o.parentNode.insertBefore(i,o)
14
- }(window,document,"script",scriptURL,"tcUniNav");
15
-
16
- var user;
17
-
18
- if ('{/literal } { $User .SignedIn} {literal } ') {
19
- var photoUrl = ' {/literal}{$User.Photo}{literal}' != null ? ' {/literal}{$User.Photo}{literal}' : undefined;
20
- var userId = null; // leaving it empty as it' s currently not available
21
- var handle = ' {/literal } { $User .Name|escape :' html' } {literal }';
22
- var initials = handle ? handle.substr(0, 2).toUpperCase() : '';
23
-
24
- user = {
25
- photoUrl,
26
- userId,
27
- initials,
28
- handle
29
- };
30
- }
31
-
11
+ } (window,document,"script","{ /literal } { $UniversalNavUrl } {literal }","tcUniNav");
12
+ { /literal }
13
+ { if $User .SignedIn}
14
+ const handle = '{ $User .Name|escape :' html' } ';
15
+ const initials = handle ? handle.substr(0, 2).toUpperCase() : '';
16
+ const userId = { $User .TopcoderUserID} ;
17
+ const photoURL = '{ $User .TopcoderPhotoUrl} ';
18
+ const user = {
19
+ photoURL: photoURL,
20
+ userId: userId,
21
+ initials: initials,
22
+ handle: handle,
23
+ } ;
24
+ { else }
25
+ const user = null;
26
+ { /if }
27
+ {literal }
32
28
tcUniNav('init', 'headerNav', {
33
29
type: ' tool' ,
34
30
toolName: ' Discussion' ,
35
31
user,
36
32
signIn() {
37
- window.location.href = '/entry/signin?Source=forum' ;
33
+ window.location.replace(signInUrl) ;
38
34
} ,
39
35
signOut() {
40
- var signOutUrl = '/entry/signout';
41
- if (window.gdn && window.gdn.meta && window.gdn.meta.TransientKey) {
42
- signOutUrl += '?TransientKey=' + window.gdn.meta.TransientKey;
43
- }
44
- window.location.href = signOutUrl;
36
+ window.location.replace(signOutUrl);
45
37
} ,
46
38
signUp() {
47
- window.location.href = '/entry/register?Target=discussions' ;
39
+ window.location.replace(signUpUrl) ;
48
40
}
49
41
} );
50
42
51
43
tcUniNav('init', 'footerNav', {
52
44
type: ' footer'
53
45
} );
54
-
46
+ { / literal }
55
47
</script >
56
- {/literal }
0 commit comments