sp-jsom-node
Version:
SharePoint JavaScript Object Model for Node.js
1,338 lines (1,261 loc) • 302 kB
JavaScript
function $_global_init() {
String.prototype.trim = function() {
return (this.replace(/^\s\s*/, '')).replace(/\s\s*$/, '');
};
currentCtx = null;
itemTable = null;
if ('undefined' == typeof g_supportFiles)
g_supportFiles = new Array(0);
if (!Boolean(ULS))
ULS = new ULSObject;
ULSObject.prototype = {
bucket: undefined,
request: undefined,
Correlation: undefined,
OnReceiveBucketParameters: undefined,
WebServiceNS: undefined,
file: undefined,
line: undefined,
callStack: undefined,
clientInfo: undefined,
enable: undefined
};
if (typeof window.onerror != 'undefined' && window.onerror != ULSOnError) {
ULS.OriginalOnError = window.onerror;
window.onerror = ULSOnError;
}
if (!Boolean(ULSCat))
ULSCat = {};
ULSCat.msoulscat_WSS_General = 'WSS';
ULSCat.msoulscat_WSS_DeltaManager = 'DeltaManager';
ULSCat.msoulscat_WSS_Inplview = 'Inplview';
ULSCat.msoulscat_WSS_JsGrid = 'JsGrid';
ULSCat.msoulscat_WSS_MediaPlayer = 'MediaPlayer';
ULSCat.msoulscat_WSS_SPGantt = 'SPGantt';
ULS.AssertJS = function(category, condition, message) {
if (condition == false) {
var formattedMessage = "[Category: " + category + "] [Assert: " + message + "]";
ULSSendExceptionImpl(formattedMessage, window.location.href, 0, ULS.AssertJS.caller);
}
};
ULS.SendErrorMessageJS = function(category, message) {
var formattedMessage = "[Category: " + category + "] [Error: " + message + "]";
ULSSendExceptionImpl(formattedMessage, window.location.href, 0, ULS.SendErrorMessageJS.caller);
};
ULS.SendExceptionJS = function(category, exception) {
var formattedMessage;
if (exception != null) {
var exmessage = exception.message;
var exname = exception.name;
if (typeof exmessage != "undefined" && typeof exname != "undefined") {
formattedMessage = "[Category: " + category + "] [Exception Name: " + exname + ", Exception Message: " + exmessage + "]";
}
else {
formattedMessage = "[Category: " + category + "] [Exception: " + exception.toString() + "]";
}
}
else {
formattedMessage = "[Category: " + category + "] [Exception: Null Exception]";
}
ULSSendExceptionImpl(formattedMessage, window.location.href, 0, ULS.SendExceptionJS.caller);
};
Browseris.prototype = {
firefox: undefined,
firefox36up: undefined,
firefox3up: undefined,
firefox4up: undefined,
ie: undefined,
ie55up: undefined,
ie5up: undefined,
ie7down: undefined,
ie8down: undefined,
ie8standard: undefined,
ie8standardUp: undefined,
ie9standardUp: undefined,
ie10standardUp: undefined,
ie11: undefined,
ipad: undefined,
windowsphone7: undefined,
chrome: undefined,
chrome7up: undefined,
chrome8up: undefined,
chrome9up: undefined,
msEdge: undefined,
iever: undefined,
mac: undefined,
major: undefined,
msTouch: undefined,
isTouch: undefined,
nav: undefined,
nav6: undefined,
nav6up: undefined,
nav7up: undefined,
osver: undefined,
safari: undefined,
safari125up: undefined,
safari3up: undefined,
safariMobile: undefined,
verIEFull: undefined,
w3c: undefined,
webKit: undefined,
win: undefined,
win8AppHost: undefined,
win32: undefined,
win64bit: undefined,
winnt: undefined,
armProcessor: undefined
};
browseris = new Browseris();
bis = browseris;
if (typeof Sys != "undefined" && Boolean(Sys) && typeof Sys.Application != "undefined" && Boolean(Sys.Application) && typeof Sys.Application.notifyScriptLoaded == "function") {
Sys.Application.notifyScriptLoaded();
}
if (typeof NotifyScriptLoadedAndExecuteWaitingJobs == "function") {
NotifyScriptLoadedAndExecuteWaitingJobs("owsbrows.js");
}
g_cde = {};
;
UTF8_1ST_OF_2 = 0xc0;
UTF8_1ST_OF_3 = 0xe0;
UTF8_1ST_OF_4 = 0xf0;
UTF8_TRAIL = 0x80;
HIGH_SURROGATE_BITS = 0xD800;
LOW_SURROGATE_BITS = 0xDC00;
SURROGATE_6_BIT = 0xFC00;
SURROGATE_ID_BITS = 0xF800;
SURROGATE_OFFSET = 0x10000;
if (typeof String.prototype.endsWith == "undefined") {
String.prototype.endsWith = function(suffix) {
return this.substr(this.length - suffix.length) === suffix;
};
}
if (typeof String.prototype.startsWith == "undefined") {
String.prototype.startsWith = function(prefix) {
return this.substr(0, prefix.length) === prefix;
};
}
;
XUIHtml = {};
XUIHtml.SetOpacity = function(domNode, newVal) {
if (typeof domNode.style == "undefined")
return;
if (document.body.style.opacity != null) {
if (newVal == 1)
XUIHtml.RemoveCSSProperty(domNode, "opacity");
else
domNode.style.opacity = newVal;
}
else {
if (newVal == 1)
XUIHtml.RemoveCSSProperty(domNode, "filter");
else
domNode.style.filter = 'alpha(opacity=' + String(newVal * 100) + ')';
}
};
XUIHtml.RemoveCSSProperty = function(domNode, propName) {
if (typeof domNode.style.removeProperty != "undefined")
domNode.style.removeProperty(propName);
else
domNode.style.removeAttribute(propName);
};
XUIHtml.GetOpacity = function(domNode) {
if (typeof domNode.style == "undefined")
return -1;
if (document.body.style.opacity != null) {
var o = domNode.style.opacity;
return o != null && o != '' ? parseFloat(o) : 1;
}
else {
var f = domNode.style.filter;
return f != null && f != '' ? parseInt((f.replace('alpha(opacity=', '')).replace(')', '')) / 100 : 1;
}
};
;
LegalUrlChars = [false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, true, false, false, true, false, false, true, true, true, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, true, false, true, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false];
if (typeof Sys != "undefined" && Boolean(Sys) && Boolean(Sys.Application)) {
Sys.Application.notifyScriptLoaded();
}
if (typeof NotifyScriptLoadedAndExecuteWaitingJobs == "function") {
NotifyScriptLoadedAndExecuteWaitingJobs("commonvalidation.js");
}
recycleBinEnabled = 0;
cascadeDeleteWarningMessage = "";
bIsFileDialogView = false;
g_ViewIdToViewCounterMap = [];
g_ctxDict = [];
bIsFileDialogView = false;
g_ViewIdToViewCounterMap = [];
g_ctxDict = [];
g_rgdwchMinEncoded = [0x00000000, 0x00000080, 0x00000800, 0x00010000, 0x00200000, 0x04000000, 0x80000000];
g_updateFormDigestPageLoaded = new Date();
g_objProjectTaskLaunch = null;
g_ssImporterObj = null;
g_fSSImporter = false;
BasePermissions.prototype = {
ManageLists: undefined,
OpenItems: undefined
};
ContextInfo.prototype = {
AllowGridMode: undefined,
BasePermissions: undefined,
BaseViewID: undefined,
CascadeDeleteWarningMessage: undefined,
ContentTypesEnabled: undefined,
CurrentSelectedItems: undefined,
CurrentUserId: undefined,
EnableMinorVersions: undefined,
ExternalDataList: undefined,
HasRelatedCascadeLists: undefined,
HttpPath: undefined,
HttpRoot: undefined,
LastSelectableRowIdx: undefined,
LastSelectedItemIID: undefined,
LastRowIndexSelected: undefined,
RowFocusTimerID: undefined,
ListData: undefined,
ListSchema: undefined,
ModerationStatus: undefined,
PortalUrl: undefined,
RecycleBinEnabled: undefined,
SelectAllCbx: undefined,
SendToLocationName: undefined,
SendToLocationUrl: undefined,
StateInitDone: undefined,
TableCbxFocusHandler: undefined,
TableMouseoverHandler: undefined,
TotalListItems: undefined,
WorkflowsAssociated: undefined,
clvp: undefined,
ctxId: undefined,
ctxType: undefined,
dictSel: undefined,
displayFormUrl: undefined,
editFormUrl: undefined,
imagesPath: undefined,
inGridMode: undefined,
inGridFullRender: undefined,
isForceCheckout: undefined,
isModerated: undefined,
isPortalTemplate: undefined,
isVersions: undefined,
isWebEditorPreview: undefined,
leavingGridMode: false,
loadingAsyncData: false,
listBaseType: undefined,
listName: undefined,
listTemplate: undefined,
listUrlDir: undefined,
newFormUrl: undefined,
onRefreshFailed: undefined,
overrideDeleteConfirmation: undefined,
overrideFilterQstring: undefined,
recursiveView: undefined,
rootFolderForDisplay: undefined,
serverUrl: undefined,
verEnabled: undefined,
view: undefined,
queryString: undefined,
IsClientRendering: undefined,
wpq: undefined,
rootFolder: undefined,
IsAppWeb: undefined,
NewWOPIDocumentEnabled: undefined,
NewWOPIDocumentUrl: undefined,
AllowCreateFolder: undefined,
CanShareLinkForNewDocument: undefined,
noGroupCollapse: undefined
};
CTXTYPE_EDITMENU = 0;
CTXTYPE_VIEWSELECTOR = 1;
if (typeof Date.now === 'undefined' || Date.now === null) {
Date.now = function() {
return Number(new Date());
};
}
JSRequest = {
QueryString: null,
FileName: null,
PathName: null,
EnsureSetup: function() {
if (JSRequest.QueryString != null)
return;
JSRequest.QueryString = [];
var queryString = (ajaxNavigate.get_search()).substring(1);
var pairs = queryString.split("&");
var p;
for (var i = 0; i < pairs.length; i++) {
var pair = pairs[i];
p = pair.indexOf("=");
if (p > -1) {
var key = pair.substring(0, p);
var value = pair.substring(p + 1);
JSRequest.QueryString[key] = value;
}
}
var path = JSRequest.PathName = window.location.pathname;
p = path.lastIndexOf("/");
if (p > -1) {
JSRequest.FileName = path.substring(p + 1);
}
else {
JSRequest.PageName = path;
}
}
};
ExpGroupWPListName = "WSS_ExpGroupWPList";
ExpGroupCookiePrefix = "WSS_ExpGroup_";
ExpGroupCookieDelimiter = "&";
ExpGroupMaxWP = 11;
ExpGroupMaxCookieLength = 3960;
g_ExpGroupCAMLQueue = new Array(0);
g_ExpGroupXSLTQueue = new Array(0);
g_ExpGroupInProgress = false;
g_ExpInitializing = false;
g_ExpGroupTable = [];
g_ExpGroupNeedsState = false;
g_ExpGroupParseStage = false;
locked = false;
CSSUtil = {
AddClass: function(el, className) {
el.className += ' ' + className;
},
RemoveClass: function(el, className) {
var oldClassName = el.className;
var leadingSpaceClassName = ' ' + className;
el.className = oldClassName.indexOf(leadingSpaceClassName) == -1 ? oldClassName.replace(className, '') : oldClassName.replace(leadingSpaceClassName, '');
}
};
if ("undefined" == typeof _v_dictSod) {
_v_dictSod = [];
}
Sods = {
missing: 1,
loading: 2,
pending: 3,
loaded: 4
};
_v_qsod = [];
_v_sodctx = {
"document": document,
"window": window
};
Sod.prototype = {
url: undefined,
key: undefined,
loaded: undefined,
depkeys: undefined,
state: undefined,
qfn: undefined,
reset: undefined
};
g_PendingLoadSodQueue = null;
g_viewportHeight = null;
g_viewportWidth = null;
g_wpadderHeight = 0;
g_setWidthInited = false;
g_workspaceResizedHandlers = [];
g_setScrollPos = false;
g_frl = false;
g_spribbon = new Object();
g_spribbon.isMinimized = true;
g_spribbon.isInited = false;
g_spribbon.minimizedHeight = "35px";
g_spribbon.maximizedHeight = "126px";
v_stsOpenDoc2 = null;
v_strStsOpenDoc2 = null;
deleteInstance = 0;
firstCalled = true;
_callbackinitdelayed = false;
fRightToLeft = document.documentElement.dir == "rtl";
g_spDragDropUpload = {};
SPDragUploadInfo.prototype = {
webPartId: undefined,
serverUrl: undefined,
siteRelativeUrl: undefined,
listName: undefined,
rootFolder: undefined,
overwriteAll: undefined,
hideProgressBar: undefined,
refreshFunc: undefined,
preUploadFunc: undefined,
postUploadFunc: undefined,
checkPermissionFunc: undefined
};
g_QuickLaunchControlIds = [];
;
IMNControlObj = null;
bIMNControlInited = false;
IMNDictionaryObj = null;
bIMNSorted = false;
bIMNOnloadAttached = false;
IMNOrigScrollFunc = null;
bIMNInScrollFunc = false;
IMNSortableObj = null;
IMNHeaderObj = null;
IMNNameDictionaryObj = null;
IMNShowOfflineObj = null;
IMNImageInfo_InitializePrototype();
imnCount = 0;
imnElemsCount = 0;
imnMarkerBatchSize = 4;
imnMarkerBatchDelay = 40;
_spBodyOnLoadCalled = false;
if (typeof _spBodyOnLoadFunctions === "undefined" || _spBodyOnLoadFunctions === null) {
_spBodyOnLoadFunctions = [];
}
_spFormOnSubmitCalled = false;
_spBodyOnPageShowRegistered = false;
_spBodyOnLoadCalled = false;
if ("undefined" != typeof _spBodyOnLoad) {
_spBodyOnLoad = undefined;
}
if ("undefined" != typeof _spRestoreScrollForDiv_rscr) {
_spRestoreScrollForDiv_rscr = undefined;
}
if (_spBodyOnLoadFunctionNames == null) {
_spBodyOnLoadFunctionNames = [];
_spBodyOnLoadFunctionNames.push("_spBodyOnLoad");
_spBodyOnLoadFunctionNames.push("_spRestoreScrollForDiv_rscr");
}
_spFormOnSubmitCalled = false;
_spBodyOnPageShowRegistered = false;
_spPageLoadedRegistered = false;
_inlineEditString = null;
_spOriginalFormAction = null;
g_numberOfYields = 10;
g_spPreFetchKeys = [];
_spSuppressFormOnSubmitWrapper = false;
_inlineEditString = null;
_spPageLoadedRegistered = false;
g_fAnimateListCSR = true;
if (document.body == null || document.body.firstChild == null) {
if (typeof document.addEventListener != 'undefined' && typeof window.msWriteProfilerMark != 'undefined') {
document.addEventListener("DOMContentLoaded", function() {
window.msWriteProfilerMark("DOMContentLoaded");
}, false);
}
AttachEvent("DOMContentLoaded", _spBodyOnLoadWrapper, document);
window.onload = _spBodyOnLoadWrapper;
AttachEvent("hashchange", _bodyOnHashChangeHandler, window);
}
DeveloperDashboard = {
wnd: null,
msgQueue: [],
cookie: 'WSS_DeveloperDashboard',
PostMsg: function(to, subject, msg) {
DeveloperDashboard.msgQueue.push({
to: to,
subject: subject,
msg: msg
});
}
};
(function() {
window.setTimeout(function() {
ddInit();
ddToggleCScope();
}, 0);
})();
flyoutsAllowed = false;
g_ExecuteOrWaitJobs = new Object();
cuiKeyHash = {};
cuiKeyHash[219] = 91;
cuiKeyHash[221] = 93;
cuiKeyHash[51] = 35;
cuiKeyHash[186] = 59;
cuiKeyHash[187] = 61;
cuiKeyHash[188] = 44;
cuiKeyHash[189] = 45;
cuiKeyHash[190] = 46;
cuiKeyHash[191] = 47;
cuiKeyHash[222] = 39;
g_ribbonHeaderScaleClass = ['ms-cui-tts', 'ms-cui-tts-scale-1', 'ms-cui-tts-scale-2'];
SPRibbonInfo.prototype.buildMinimized = undefined;
SPRibbonInfo.prototype.initialTabId = undefined;
StatusIdWithTopPriority = null;
StatusColorWithTopPriority = null;
StatusPriority = {
red: 4,
yellow: 3,
green: 2,
blue: 1
};
StatusBarClassNames = {
"4": "ms-status-red",
"3": "ms-status-yellow",
"2": "ms-status-green",
"1": "ms-status-blue"
};
g_uniqueIndex = 0;
c_defaultSuiteDataVersion = 2;
SuiteNavRenderingOptions.prototype = {
culture: "",
dataEndpoint: "",
top: "",
version: c_defaultSuiteDataVersion
};
LinkData.prototype.TargetWindow = "";
LinkData.prototype.Text = "";
LinkData.prototype.Url = "";
SuiteNavData.prototype.AboutMeLink = null;
SuiteNavData.prototype.ClientData = "";
SuiteNavData.prototype.CurrentMainLinkElementID = "";
SuiteNavData.prototype.CurrentWorkloadHelpSubLinks = [];
SuiteNavData.prototype.CurrentWorkloadSettingsSubLinks = [];
SuiteNavData.prototype.CurrentWorkloadUserSubLinks = [];
SuiteNavData.prototype.HelpLink = null;
SuiteNavData.prototype.IsAuthenticated = false;
SuiteNavData.prototype.PinnedApps = null;
SuiteNavData.prototype.SignOutLink = null;
SuiteNavData.prototype.StringsOverride = null;
SuiteNavData.prototype.UserDisplayName = null;
SuiteNavData.prototype.WorkloadLinks = null;
SuiteData.prototype.DoNotCache = false;
SuiteData.prototype.NavBarData = null;
SuiteData.prototype.SPSuiteVersion = c_defaultSuiteDataVersion;
BrowserStorage = {};
StorageObject.prototype = {
getItem: function(key) {
return "";
},
setItem: function(key, value) {
},
removeItem: function(key) {
},
clear: function() {
},
length: 0
};
;
CachedStorage.prototype = StorageObject.prototype;
_testKey = "BrowserStorageTest";
_testValue = "1";
_local = null;
_session = null;
try {
if (typeof window.localStorage != 'undefined') {
var localStorageObject = window.localStorage;
if (TestStorage(localStorageObject))
_local = localStorageObject;
}
}
catch (exUsingLocalStorage) { }
try {
if (typeof window.sessionStorage != 'undefined') {
var sessionStorageObject = window.sessionStorage;
if (TestStorage(sessionStorageObject))
_session = sessionStorageObject;
}
}
catch (exUsingSessionStorage) { }
if (_session == null)
_session = new StorageObject();
if (_local == null)
_local = _session;
BrowserStorage.local = new CachedStorage(_local);
BrowserStorage.session = new CachedStorage(_session);
c_strUndefined = "undefined";
key_Date = "SPSuiteLinksDate";
key_Language = "SPSuiteLinksLanguage";
key_LinksJson = "SPSuiteLinksJson";
key_MySiteLinks = "SPMySiteLinks";
key_SuiteNavHeight = "SPSuiteNavHeight";
key_UserKey = "SPSuiteLinksUserKey";
key_LinksCached = "SPSuiteLinksCached";
_restHeaders = [new RequestHeader("Content-Type", "application/x-www-form-urlencoded"), new RequestHeader("ACCEPT", "application/json; odata=verbose")];
g_dlgWndTop = null;
g_spDlgLauncher = true;
g_ModalDialogCount = 0;
g_overlayPopup = undefined;
g_childDialog = undefined;
CommonGlobalDialogReturnValue_InitializePrototype();
commonModalDialogReturnValue = new CommonGlobalDialogReturnValue();
;
;
;
AjaxNavigate.prototype = {
update: AjaxNavigate$update,
add_navigate: AjaxNavigate$add_navigate,
remove_navigate: AjaxNavigate$remove_navigate,
_raiseNavigate: AjaxNavigate$_raiseNavigate,
_buildHashBag: AjaxNavigate$_buildHashBag,
_fixLayoutsUrl: AjaxNavigate$_fixLayoutsUrl,
_clear: AjaxNavigate$_clear,
submit: AjaxNavigate$submit,
getParam: AjaxNavigate$_getParam,
get_href: AjaxNavigate$get_href,
get_hash: AjaxNavigate$get_hash,
get_search: AjaxNavigate$get_search,
getSavedFormAction: AjaxNavigate$_getSavedFormAction,
convertMDSURLtoRegularURL: AjaxNavigate$convertMDSURLtoRegularURL,
_list: undefined
};
if ('undefined' == typeof ajaxNavigate) {
ajaxNavigate = new AjaxNavigate();
}
if (!(window.location.pathname.toLowerCase()).endsWith("/_layouts/15/start.aspx")) {
var raiseNav = function() {
if ("unknown" != typeof Sys && "undefined" != typeof Sys && null != Sys && null != Sys.Application) {
Sys.Application.add_load(function() {
window.setTimeout(function() {
ajaxNavigate._raiseNavigate(ajaxNavigate);
}, 0);
});
}
};
var aListener = function() {
document.removeEventListener("DOMContentLoaded", aListener, false);
raiseNav();
};
if (Boolean(document.addEventListener)) {
document.addEventListener("DOMContentLoaded", aListener, false);
}
else {
_spBodyOnLoadFunctions.push(raiseNav);
}
}
URI = function(uriString, options) {
var that = this;
var URI_POUND = "#";
var URI_COLON = ":";
var URI_FORWARDSLASH = "/";
var URI_DOUBLE_FORWARDSLASHES = "//";
var URI_QUESTIONMARK = "?";
var URI_SEMICOLON = ";";
var URI_AMPERSAND = "&";
var URI_AT = "@";
var URI_EQUAL = "=";
var URI_DELIMITERS = ";/?:@&=$,";
var URI_AUTHORITY_TERMINATORS = "/?";
var m_queryCaseInsensitive = false;
if (typeof options !== "undefined" && typeof options.queryCaseInsensitive === 'boolean') {
m_queryCaseInsensitive = options.queryCaseInsensitive;
}
var m_disableEncodingDecodingForLegacyCode = false;
if (typeof options !== "undefined" && typeof options.disableEncodingDecodingForLegacyCode === 'boolean') {
m_disableEncodingDecodingForLegacyCode = options.disableEncodingDecodingForLegacyCode;
}
var m_pathCaseInsensitive = false;
if (typeof options !== "undefined" && typeof options.pathCaseInsensitive === 'boolean') {
m_pathCaseInsensitive = options.pathCaseInsensitive;
}
var m_scheme = "";
var m_user = "";
var m_host = "";
var m_port = "";
var m_path = "";
var m_pathEncoded = "";
var m_parameters = "";
var m_query = {};
var m_fragment = "";
this.getScheme = function() {
return m_scheme;
};
this.setScheme = function(scheme) {
m_scheme = decodeURIComponentIfNecessary(scheme);
};
this.getAuthority = function() {
return getAuthority(false);
};
this.setAuthority = function(authority) {
parseAuthority(authority);
};
this.getUser = function() {
return m_user;
};
this.getHost = function() {
return m_host;
};
this.getPort = function() {
return m_port;
};
this.getPath = function(trimTrailingSlash) {
var retPath = m_path;
if (typeof trimTrailingSlash === 'boolean' && trimTrailingSlash) {
if (retPath !== null && retPath.lastIndexOf(URI_FORWARDSLASH) === retPath.length - 1) {
retPath = retPath.slice(0, -1);
}
}
return retPath;
};
this.setPath = function(path) {
if (path.indexOf(URI_FORWARDSLASH) !== 0) {
path = URI_FORWARDSLASH + path;
}
parsePath(path);
};
this.getPathSegments = function() {
if (m_path === null) {
return [];
}
var ret = m_path.split(URI_FORWARDSLASH);
if (ret.length > 0) {
if (ret[0] === "") {
ret.shift();
}
else if (ret[ret.length - 1] === "") {
ret.pop();
}
}
return ret;
};
this.getLastPathSegment = function(includeParameters) {
var pathSegments = that.getPathSegments();
if (pathSegments.length === 0) {
return "";
}
else {
var retPath = pathSegments[pathSegments.length - 1];
if (typeof includeParameters !== 'boolean' || !includeParameters) {
var paramBeginPos = retPath.indexOf(URI_SEMICOLON);
if (paramBeginPos >= 0) {
retPath = retPath.substring(0, paramBeginPos);
}
}
return retPath;
}
};
this.getParameters = function() {
return m_parameters;
};
this.getQuery = function() {
return serializeQuery(m_query);
};
this.setQuery = function(query) {
var queryObject = deserializeQuery(query);
that.setQueryFromObject(queryObject);
};
this.getQueryAsObject = function() {
return m_query;
};
this.setQueryFromObject = function(queryObj) {
m_query = {};
for (var queryKey in queryObj) {
if (queryObj.hasOwnProperty(queryKey)) {
that.setQueryParameter(queryKey, queryObj[queryKey]);
}
}
};
this.getQueryParameter = function(queryKey) {
var ret = null;
var query = that.getQueryAsObject();
if (m_queryCaseInsensitive) {
for (var key in query) {
if (m_query.hasOwnProperty(key) && key.toLowerCase() === queryKey.toLowerCase()) {
ret = query[key];
}
}
}
else {
ret = query[queryKey];
}
if (typeof ret !== 'undefined') {
return ret;
}
else {
return null;
}
};
this.setQueryParameter = function(queryKey, queryValue) {
var queryKeyDecoded = decodeURIComponentIfNecessary(queryKey);
var queryValueDecoded = decodeURIComponentIfNecessary(queryValue);
m_query[queryKeyDecoded] = queryValueDecoded;
};
this.removeQueryParameter = function(queryKey) {
var queryKeyDecoded = decodeURIComponentIfNecessary(queryKey);
delete m_query[queryKeyDecoded];
};
this.getFragment = function() {
return m_fragment;
};
this.setFragment = function(fragment) {
if (fragment.indexOf(URI_POUND) === 0) {
fragment = fragment.substring(1);
}
m_fragment = decodeURIComponentIfNecessary(fragment);
};
var isStringEqualInensitive = function(a, b) {
if (a != null && b != null) {
return a.toLowerCase() === b.toLowerCase();
}
else {
return a === b;
}
;
};
var isStringEqual = function(a, b) {
return a === b;
};
this.equals = function(uri) {
return m_scheme.toLowerCase() === (uri.getScheme()).toLowerCase() && m_user === uri.getUser() && m_host.toLowerCase() === (uri.getHost()).toLowerCase() && m_port === uri.getPort() && (m_pathCaseInsensitive ? isStringEqualInensitive : isStringEqual)(that.getPath(true), uri.getPath(true)) && m_parameters === uri.getParameters() && (m_queryCaseInsensitive ? isStringEqualInensitive : isStringEqual)(that.getQuery(), uri.getQuery()) && m_fragment === uri.getFragment();
};
this.getString = function() {
return getStringInternal(true);
};
this.getDecodedStringForDisplay = function() {
return getStringInternal(false);
};
this.getStringWithoutQueryAndFragment = function() {
return getStringWithoutQueryAndFragmentInternal(true);
};
var getStringInternal = function(encoded) {
var ret = getStringWithoutQueryAndFragmentInternal(encoded);
var query = serializeQuery(m_query, encoded);
if (query !== "") {
ret += URI_QUESTIONMARK + query;
}
if (m_fragment !== "") {
ret += URI_POUND + (encoded ? encodeURIComponentIfNecessary(m_fragment) : m_fragment);
}
return ret;
};
var getStringWithoutQueryAndFragmentInternal = function(encoded) {
var ret = "";
if (m_scheme !== "") {
ret += (encoded ? encodeURIComponentIfNecessary(m_scheme) : m_scheme) + URI_COLON;
}
var authority = getAuthority(encoded);
if (authority !== "") {
ret += URI_DOUBLE_FORWARDSLASHES + authority;
}
if (m_pathEncoded !== "") {
ret += encoded ? m_pathEncoded : m_path;
}
return ret;
};
var normalizeQueryKey = function(queryKey) {
var key = queryKey;
if (m_queryCaseInsensitive) {
key = key.toLowerCase();
}
return key;
};
var deserializeQuery = function(queryStr) {
var queryObj = {};
if (queryStr.indexOf(URI_QUESTIONMARK) === 0) {
queryStr = queryStr.substring(1);
}
var queryParts = queryStr.split(/[;&]+/);
for (var queryIdx = 0; queryIdx < queryParts.length; queryIdx++) {
var queryPart = queryParts[queryIdx];
var queryPartSegments = queryPart.split(URI_EQUAL);
if (queryPartSegments.length > 0) {
var queryKey = queryPartSegments[0];
if (queryKey.length > 0) {
var queryValue = "";
if (queryPartSegments.length == 2) {
queryValue = queryPartSegments[1];
}
queryObj[queryKey] = queryValue;
}
}
}
return queryObj;
};
var serializeQuery = function(queryObj, encoded) {
encoded = typeof encoded === "undefined" ? false : encoded;
var queryStr = "";
for (var queryKey in queryObj) {
if (queryObj.hasOwnProperty(queryKey)) {
var key = queryKey;
var value = queryObj[queryKey];
if (encoded) {
key = encodeURIComponentIfNecessary(key);
value = encodeURIComponentIfNecessary(value);
}
if (value === null || value === "") {
queryStr += key + URI_EQUAL + URI_AMPERSAND;
}
else {
queryStr += key + URI_EQUAL + value + URI_AMPERSAND;
}
}
}
if (queryStr !== "") {
queryStr = queryStr.slice(0, -1);
}
return queryStr;
};
var parseURI = function() {
var remainingString = uriString;
var fragmentBeginPos = remainingString.indexOf(URI_POUND);
if (fragmentBeginPos >= 0) {
var fragment = remainingString.substring(fragmentBeginPos + 1);
that.setFragment(fragment);
remainingString = remainingString.substring(0, fragmentBeginPos);
}
var schemeEndPos = findOneOf(remainingString, URI_DELIMITERS);
if (schemeEndPos >= 0) {
var firstColonPos = remainingString.indexOf(URI_COLON);
if (firstColonPos >= 0 && firstColonPos === schemeEndPos) {
m_scheme = remainingString.substring(0, schemeEndPos);
remainingString = remainingString.substring(schemeEndPos + 1);
}
}
else {
parsePath(remainingString);
return;
}
var authority = "";
var doubleSlashPos = remainingString.indexOf(URI_DOUBLE_FORWARDSLASHES);
if (doubleSlashPos >= 0 && doubleSlashPos === 0) {
remainingString = remainingString.substring(2);
var nothingElseLeft;
var authorityEndPos = findOneOf(remainingString, URI_AUTHORITY_TERMINATORS);
if (authorityEndPos >= 0) {
authority = remainingString.substring(0, authorityEndPos);
remainingString = remainingString.substring(authorityEndPos);
nothingElseLeft = false;
}
else {
authority = remainingString;
nothingElseLeft = true;
}
parseAuthority(authority);
if (nothingElseLeft) {
return;
}
}
var queryBeginPos = remainingString.indexOf(URI_QUESTIONMARK);
if (queryBeginPos >= 0) {
that.setQuery(remainingString.substring(queryBeginPos + 1));
remainingString = remainingString.substring(0, queryBeginPos);
}
parsePath(remainingString);
};
var parseAuthority = function(authority) {
m_host = authority;
var userNameEndPos = authority.lastIndexOf(URI_AT);
if (userNameEndPos >= 0) {
m_host = m_host.substring(userNameEndPos + 1);
}
var hostPortSeparatorPos = m_host.indexOf(URI_COLON);
if (userNameEndPos < 0 && hostPortSeparatorPos < 0) {
return;
}
var authorityComponents = authority;
if (userNameEndPos < 0) {
m_host = authorityComponents;
}
else {
m_user = authorityComponents.substring(0, userNameEndPos);
m_host = authorityComponents.substring(userNameEndPos + 1);
}
if (hostPortSeparatorPos >= 0) {
m_port = m_host.substring(hostPortSeparatorPos + 1);
m_host = m_host.substring(0, hostPortSeparatorPos);
}
m_user = decodeURIComponentIfNecessary(m_user);
m_host = decodeURIComponentIfNecessary(m_host);
};
var parsePath = function(remainingString) {
var paramBeginPos = remainingString.indexOf(URI_SEMICOLON);
if (paramBeginPos >= 0) {
m_parameters = decodeURIComponentIfNecessary(remainingString.substring(paramBeginPos + 1));
}
m_path = decodeURIComponentIfNecessary(remainingString);
var encodedPathSegments = remainingString.split(URI_FORWARDSLASH);
for (var i = 0; i < encodedPathSegments.length; ++i) {
var segment = encodedPathSegments[i];
var segmentAndParameters = segment.split(URI_SEMICOLON);
var decodedSegment = decodeURIComponentIfNecessary(segmentAndParameters[0]);
encodedPathSegments[i] = encodeURIComponentIfNecessary(decodedSegment);
for (var j = 1; j < segmentAndParameters.length; ++j) {
var decodedParameter = decodeURIComponentIfNecessary(segmentAndParameters[j]);
encodedPathSegments[i] += URI_SEMICOLON + encodeURIComponentIfNecessary(decodedParameter);
}
}
m_pathEncoded = encodedPathSegments.join(URI_FORWARDSLASH);
};
var findOneOf = function(str, searchValues) {
for (var strIdx = 0; strIdx < str.length; strIdx++) {
var c = str[strIdx];
for (var delimIdx = 0; delimIdx < searchValues.length; delimIdx++) {
if (c === searchValues[delimIdx]) {
return strIdx;
}
}
}
return -1;
};
var getUserEncodedIfNecessary = function() {
var user;
if (m_disableEncodingDecodingForLegacyCode) {
user = m_user;
}
else {
user = encodeURIComponentIfNecessary(m_user);
user = user.replace("%3A", ":");
}
return user;
};
var getAuthority = function(encoded) {
var authority = "";
var user;
var host;
var port;
if (encoded) {
user = getUserEncodedIfNecessary();
host = encodeURIComponentIfNecessary(m_host);
port = encodeURIComponentIfNecessary(m_port);
}
else {
user = m_user;
host = m_host;
port = m_port;
}
if (user !== "") {
authority = user + URI_AT;
}
if (m_host !== "") {
authority += host;
}
if (m_port !== "") {
authority += URI_COLON + port;
}
return authority;
};
var encodeURIComponentIfNecessary = function(component) {
return m_disableEncodingDecodingForLegacyCode ? component : encodeURIComponent(component);
};
var decodeURIComponentIfNecessary = function(component) {
return m_disableEncodingDecodingForLegacyCode ? component : unescapeProperly(component);
};
parseURI();
};
_EnsureJSNamespace("SP");
if (typeof SP.SOD == "undefined")
SP.SOD = {};
SP.SOD.execute = EnsureScriptParams;
SP.SOD.executeFunc = EnsureScriptFunc;
SP.SOD.registerSod = RegisterSod;
SP.SOD.registerSodDep = RegisterSodDep;
SP.SOD.executeOrDelayUntilScriptLoaded = ExecuteOrDelayUntilScriptLoaded;
SP.SOD.executeOrDelayUntilEventNotified = ExecuteOrDelayUntilEventNotified;
SP.SOD.notifyScriptLoadedAndExecuteWaitingJobs = NotifyScriptLoadedAndExecuteWaitingJobs;
SP.SOD.notifyEventAndExecuteWaitingJobs = NotifyEventAndExecuteWaitingJobs;
SP.SOD.loadMultiple = LoadMultipleSods;
SP.SOD.delayUntilEventNotified = DelayUntilEventNotified;
g_prefetch = 1;
SP.SOD.get_prefetch = function() {
return g_prefetch;
};
SP.SOD.set_prefetch = function(prefetch) {
g_prefetch = prefetch;
};
SP.SOD.prefetch = _spPreFetch;
g_ribbonImagePrefetch = true;
SP.SOD.get_ribbonImagePrefetchEnabled = function() {
return g_ribbonImagePrefetch;
};
SP.SOD.set_ribbonImagePrefetchEnabled = function(ribbonImagePrefetchEnabled) {
g_ribbonImagePrefetch = ribbonImagePrefetchEnabled;
};
_EnsureJSNamespace("SP.UI");
if (typeof SP.UI.Workspace == "undefined")
SP.UI.Workspace = {};
SP.UI.Workspace.add_resized = function(handler) {
g_workspaceResizedHandlers.push(handler);
};
SP.UI.Workspace.remove_resized = function(handler) {
var match = -1;
for (var i = 0, wLen = g_workspaceResizedHandlers.length; i < wLen; i++) {
if (handler == g_workspaceResizedHandlers[i]) {
match = i;
break;
}
}
if (match != -1) {
g_workspaceResizedHandlers.splice(match, 1);
}
};
_spBodyOnLoadFunctionNames.push("AllowCSSFiltersOnIE8");
initJsLoaded = true;
notifyScriptsLoadedAndExecuteWaitingJobs("init.js");
}
var currentCtx;
var ctx;
var itemTable;
var g_supportFiles;
var g_MDNav;
var ULS;
function ULSObject() {
}
function ULSTrim(str) {
str = str.replace(/^\s*/, "");
str = str.replace(/\s*$/, "");
return str;
}
function ULSEncodeXML(str) {
str = String(str);
str = str.replace(/&/g, "&");
str = str.replace(/</g, "<");
str = str.replace(/>/g, ">");
str = str.replace(/'/g, "'");
str = str.replace(/"/g, """);
return str;
}
function ULSStripPII(url) {
if (url.indexOf('?') != -1)
url = url.substring(0, url.indexOf('?'));
if (Boolean(window.location))
url = url.replace(window.location.hostname, "[server]");
return url;
}
function ULSGetFunction(fn, depth, topfn) {
var sF = fn.toString();
var sFnNm = ULSTrim(sF.substring(0, sF.indexOf("{")));
if (sFnNm.indexOf("function") == 0)
sFnNm = ULSTrim(sFnNm.substring(8));
var s = '<function ';
if (depth >= 0)
s += 'depth="' + depth.toString() + '" ';
s += 'signature="' + sFnNm + '">';
if (depth == 0 || sFnNm.indexOf("anonymous") == 0 || sFnNm.indexOf("(") == 0)
s += '\n<![CDATA[' + sF + ']]>\n';
s += '</function>';
return s;
}
function ULSGetMetadataFromFrame(oCS) {
var sFunctionText = oCS.toString();
var iOpeningBrace = sFunctionText.indexOf("{");
if (iOpeningBrace == -1)
return false;
sFunctionText = sFunctionText.substr(iOpeningBrace + 1);
var iFirstStatement = sFunctionText.search(/[^\s]/);
if (iFirstStatement == -1)
return false;
var reMatch = sFunctionText.match(/ULS[^\s;]*:/);
if (reMatch == null || typeof reMatch.index != "undefined" && reMatch.index != iFirstStatement)
return false;
var sLabelName = reMatch[0];
sLabelName = sLabelName.substr(0, sLabelName.length - 1);
try {
var o = eval(sLabelName + "()");
if (typeof o == "undefined" || typeof o.ULSTeamName == "undefined" || typeof o.ULSFileName == "undefined")
return false;
ULS.teamName = o.ULSTeamName;
ULS.originalFile = o.ULSFileName;
return true;
}
catch (e) {
return false;
}
}
function ULSGetCallstack(callerArg) {
var stack = "";
try {
if (Boolean(callerArg)) {
var fFoundMetadata = false;
var oCS = callerArg;
var depth = 0;
while (Boolean(oCS) && depth < 20) {
if (!fFoundMetadata)
fFoundMetadata = ULSGetMetadataFromFrame(oCS);
stack += ULSGetFunction(oCS, depth, callerArg) + '\n';
oCS = oCS.caller;
depth++;
}
}
}
catch (e) { }
return stack;
}
function ULSGetClientInfo() {
var client = "";
try {
var lang = navigator.browserLanguage;
if (!Boolean(lang))
lang = navigator.language;
if (!Boolean(lang))
lang = navigator.systemLanguage;
var agt = navigator.userAgent.toLowerCase();
var app = navigator.appName;
var ver = parseFloat(navigator.appVersion);
if (agt.indexOf("msie ") != -1)
ver = parseFloat(agt.substring(agt.indexOf("msie ") + 5));
if (agt.indexOf("firefox/") != -1) {
app = "Firefox";
ver = parseFloat(agt.substring(agt.indexOf("firefox/") + 8));
}
client += '<browser name="' + ULSEncodeXML(app) + '" version="' + ULSEncodeXML(ver.toString()) + '" />\n';
client += '<useragent>' + ULSEncodeXML(navigator.userAgent) + '</useragent>\n';
if (Boolean(lang))
client += '<language>' + ULSEncodeXML(lang) + '</language>\n';
if (Boolean(document.referrer)) {
var ref = ULSStripPII(document.referrer);
client += '<referrer>' + ULSEncodeXML(ref) + '</referrer>\n';
}
if (Boolean(window.location)) {
var loc = ULSStripPII(window.location.toString());
client += '<location>' + ULSEncodeXML(loc) + '</location>\n';
}
if (Boolean(ULS.Correlation))
client += '<correlation>' + ULSEncodeXML(ULS.Correlation) + '</correlation>\n';
}
catch (e) { }
return client;
}
function ULSHandleWebServiceResponse() {
var req = ULS.request;
if (req.readyState == 4 && req.status == 200) {
ULSFinishErrorHandling();
}
if ((req.readyState == 0 || req.readyState == 4) && req.status > 200) {
ULSFinishErrorHandling();
}
}
function ULSFinishErrorHandling() {
ULS.message = null;
}
function ULSGetWebServiceUrl() {
var url = "";
var idx1 = document.URL.indexOf('://');
if (idx1 > 0) {
var idx2 = document.URL.indexOf('/', idx1 + 3);
if (idx2 > 0)
url = document.URL.substring(0, idx2);
else
url = document.URL;
}
if (url.charAt(url.length - 1) != '/')
url += '/';
url += '_vti_bin/diagnostics.asmx';
return url;
}
function ULSUploadReport(msg, correlation, url) {
if (Boolean(ULS) && ULS.enable) {
ULS.message = msg;
if (url.indexOf('?') != -1)
url = url.substr(0, url.indexOf('?'));
ULS.file = url.substr(url.lastIndexOf('/') + 1);
ULS.line = 0;
ULS.WebServiceNS = "http://schemas.microsoft.com/sharepoint/diagnostics/";
ULS.Correlation = correlation;
ULS.teamName = '';
ULS.originalFile = '';
ULS.callStack = '';
ULS.clientInfo = '<client>\n' + ULSGetClientInfo() + '</client>';
ULSSendReport(false);
}
}
function ULSSendReport(async) {
ULS.request = new XMLHttpRequest();
ULS.request.onreadystatechange = ULSHandleWebServiceResponse;
ULS.request.open("POST", ULSGetWebServiceUrl(), async);
ULS.request.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
ULS.request.setRequestHeader("SOAPAction", ULS.WebServiceNS + "SendClientScriptErrorReport");
ULS.request.send('<?xml version="1.0" encoding="utf-8"?>' + '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">' + '<soap:Body>' + '<SendClientScriptErrorReport xmlns="' + ULS.WebServiceNS + '">' + '<message>' + ULSEncodeXML(ULS.message) + '</message>' + '<file>' + ULSEncodeXML(ULS.file) + '</file>' + '<line>' + String(ULS.line) + '</line>' + '<stack>' + ULSEncodeXML(ULS.callStack) + '</stack>' + '<client>' + ULSEncodeXML(ULS.clientInfo) + '</client>' + '<team>' + ULSEncodeXML(ULS.teamName) + '</team>' + '<originalFile>' + ULSEncodeXML(ULS.originalFile) + '</originalFile>' + '</SendClientScriptErrorReport>' + '</soap:Body>' + '</soap:Envelope>');
}
function ULSSendExceptionImpl(msg, url, line, oCaller) {
if (Boolean(ULS) && ULS.enable) {
ULS.enable = false;
window.onerror = ULS.OriginalOnError;
ULS.WebServiceNS = "http://schemas.microsoft.com/sharepoint/diagnostics/";
try {
ULS.message = msg;
if (url.indexOf('?') != -1)
url = url.substr(0, url.indexOf('?'));
ULS.file = url.substr(url.lastIndexOf('/') + 1);
ULS.line = line;
ULS.teamName = "";