Difference between revisions of "Global JavaScript Variables"

From LongJump Support Wiki
imported>Aeric
imported>Aeric
m (Text replace - '[[Role Based Access' to '[[Data Access')
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
The following JavaScript variables are ''global''. They are available in all JavaScript code running on the platform:
The following [[JavaScript]] variables are ''global''. They are available in all JavaScript code running on the platform.


:;Considerations:
::* Variable names are case-sensitive
::* In a [[Sites|Site]], no one is logged in, and the page is not running on the platform, so the variables have no meaning in that context.
====User Variables====
:;LJUserName:Name of the (logged in) User
:;LJUserName:Name of the (logged in) User
:;LJPrimaryTeamName:Name of the [[Primary Team]] (user is a member of this team)
:;LJPrimaryTeamName:Name of the [[Primary Team]] (user is a member of this team)
:;LJPrimaryTeamRoleName:[[Role Based Access Permissions|Role]] of the User in the Primary Team
:;LJPrimaryTeamRoleName:[[Data Access Permissions|Role]] of the User in the Primary Team
 
====Page Variables====
:;lj_window_src:
::Contains the URL of the current page. (Needs to be URL encoded when used.)


;Considerations:
::;Sample Usage:
:* Variables names are case-sensitive
:::<syntaxhighlight lang="javascript" enclose="div">
:* Since no one is logged in a [[Sites|Site]], the variables have no meaning in that context.
encodeURIComponent(lj_window_src)
</syntaxhighlight>
<noinclude>
<noinclude>


[[Category:JavaScript APIs]]
[[Category:JavaScript APIs]]
</noinclude>
</noinclude>

Latest revision as of 01:35, 16 October 2012

The following JavaScript variables are global. They are available in all JavaScript code running on the platform.

Considerations
  • Variable names are case-sensitive
  • In a Site, no one is logged in, and the page is not running on the platform, so the variables have no meaning in that context.

User Variables

LJUserName
Name of the (logged in) User
LJPrimaryTeamName
Name of the Primary Team (user is a member of this team)
LJPrimaryTeamRoleName
Role of the User in the Primary Team

Page Variables

lj_window_src
Contains the URL of the current page. (Needs to be URL encoded when used.)
Sample Usage
encodeURIComponent(lj_window_src)