New private function called SPServicesContext() created to determine the context. A variable called SPServicesContext now holds as much context as can be determined.
// Get the current context (as much as we can) on startup
// See: http://johnliu.net/blog/2012/2/3/sharepoint-javascript-current-page-context-info.html
function SPServicesContext() {
// SharePoint 2010 gives us a context variable
if(typeof _spPageContextInfo !== "undefined") {
this.thisSite = _spPageContextInfo.webServerRelativeUrl;
this.thisList = _spPageContextInfo.pageListId;
this.thisUserId = _spPageContextInfo.userId;
// In SharePoint 2007, we know the site and UserId
} else {
this.thisSite = (typeof L_Menu_BaseUrl !== "undefined") ? L_Menu_BaseUrl : "";
this.thisList = "";
this.thisUserId = (typeof _spUserId !== "undefined") ? _spUserId : undefined;
}
} // End of function SPServicesContext
// Get the current context (as much as we can) on startup
// See: http://johnliu.net/blog/2012/2/3/sharepoint-javascript-current-page-context-info.html
function SPServicesContext() {
// SharePoint 2010 gives us a context variable
if(typeof _spPageContextInfo !== "undefined") {
this.thisSite = _spPageContextInfo.webServerRelativeUrl;
this.thisList = _spPageContextInfo.pageListId;
this.thisUserId = _spPageContextInfo.userId;
// In SharePoint 2007, we know the site and UserId
} else {
this.thisSite = (typeof L_Menu_BaseUrl !== "undefined") ? L_Menu_BaseUrl : "";
this.thisList = "";
this.thisUserId = (typeof _spUserId !== "undefined") ? _spUserId : undefined;
}
} // End of function SPServicesContext