1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 | var __extends=this.__extends || function (d, b) {
|
20 | for (var p in b) if (b.hasOwnProperty(p)) d[p]=b[p];
|
21 | function __() { this.constructor=d; }
|
22 | __.prototype=b.prototype;
|
23 | d.prototype=new __();
|
24 | };
|
25 | var OfficeExt;
|
26 | (function (OfficeExt) {
|
27 | var MicrosoftAjaxFactory=(function () {
|
28 | function MicrosoftAjaxFactory() {
|
29 | }
|
30 | MicrosoftAjaxFactory.prototype.isMsAjaxLoaded=function () {
|
31 | if (typeof (Sys) !=='undefined' && typeof (Type) !=='undefined' && Sys.StringBuilder && typeof (Sys.StringBuilder)==="function" && Type.registerNamespace && typeof (Type.registerNamespace)==="function" && Type.registerClass && typeof (Type.registerClass)==="function" && typeof (Function._validateParams)==="function") {
|
32 | return true;
|
33 | } else {
|
34 | return false;
|
35 | }
|
36 | };
|
37 | MicrosoftAjaxFactory.prototype.loadMsAjaxFull=function (callback) {
|
38 | var msAjaxCDNPath=(window.location.protocol.toLowerCase()==='https:' ? 'https:' : 'http:')+'//ajax.aspnetcdn.com/ajax/3.5/MicrosoftAjax.js';
|
39 | OSF.OUtil.loadScript(msAjaxCDNPath, callback);
|
40 | };
|
41 | Object.defineProperty(MicrosoftAjaxFactory.prototype, "msAjaxError", {
|
42 | get: function () {
|
43 | if (this._msAjaxError==null && this.isMsAjaxLoaded()) {
|
44 | this._msAjaxError=Error;
|
45 | }
|
46 | return this._msAjaxError;
|
47 | },
|
48 | set: function (errorClass) {
|
49 | this._msAjaxError=errorClass;
|
50 | },
|
51 | enumerable: true,
|
52 | configurable: true
|
53 | });
|
54 | Object.defineProperty(MicrosoftAjaxFactory.prototype, "msAjaxSerializer", {
|
55 | get: function () {
|
56 | if (this._msAjaxSerializer==null && this.isMsAjaxLoaded()) {
|
57 | this._msAjaxSerializer=Sys.Serialization.JavaScriptSerializer;
|
58 | }
|
59 | return this._msAjaxSerializer;
|
60 | },
|
61 | set: function (serializerClass) {
|
62 | this._msAjaxSerializer=serializerClass;
|
63 | },
|
64 | enumerable: true,
|
65 | configurable: true
|
66 | });
|
67 | Object.defineProperty(MicrosoftAjaxFactory.prototype, "msAjaxString", {
|
68 | get: function () {
|
69 | if (this._msAjaxString==null && this.isMsAjaxLoaded()) {
|
70 | this._msAjaxSerializer=String;
|
71 | }
|
72 | return this._msAjaxString;
|
73 | },
|
74 | set: function (stringClass) {
|
75 | this._msAjaxString=stringClass;
|
76 | },
|
77 | enumerable: true,
|
78 | configurable: true
|
79 | });
|
80 | Object.defineProperty(MicrosoftAjaxFactory.prototype, "msAjaxDebug", {
|
81 | get: function () {
|
82 | if (this._msAjaxDebug==null && this.isMsAjaxLoaded()) {
|
83 | this._msAjaxDebug=Sys.Debug;
|
84 | }
|
85 | return this._msAjaxDebug;
|
86 | },
|
87 | set: function (debugClass) {
|
88 | this._msAjaxDebug=debugClass;
|
89 | },
|
90 | enumerable: true,
|
91 | configurable: true
|
92 | });
|
93 | return MicrosoftAjaxFactory;
|
94 | })();
|
95 | OfficeExt.MicrosoftAjaxFactory=MicrosoftAjaxFactory;
|
96 | })(OfficeExt || (OfficeExt={}));
|
97 | var OsfMsAjaxFactory=new OfficeExt.MicrosoftAjaxFactory();
|
98 | var OSF=OSF || {};
|
99 | var OfficeExt;
|
100 | (function (OfficeExt) {
|
101 | var SafeStorage=(function () {
|
102 | function SafeStorage(_internalStorage) {
|
103 | this._internalStorage=_internalStorage;
|
104 | }
|
105 | SafeStorage.prototype.getItem=function (key) {
|
106 | try {
|
107 | return this._internalStorage && this._internalStorage.getItem(key);
|
108 | } catch (e) {
|
109 | return null;
|
110 | }
|
111 | };
|
112 | SafeStorage.prototype.setItem=function (key, data) {
|
113 | try {
|
114 | this._internalStorage && this._internalStorage.setItem(key, data);
|
115 | } catch (e) {
|
116 | }
|
117 | };
|
118 | SafeStorage.prototype.clear=function () {
|
119 | try {
|
120 | this._internalStorage && this._internalStorage.clear();
|
121 | } catch (e) {
|
122 | }
|
123 | };
|
124 | SafeStorage.prototype.removeItem=function (key) {
|
125 | try {
|
126 | this._internalStorage && this._internalStorage.removeItem(key);
|
127 | } catch (e) {
|
128 | }
|
129 | };
|
130 | SafeStorage.prototype.getKeysWithPrefix=function (keyPrefix) {
|
131 | var keyList=[];
|
132 | try {
|
133 | var len=this._internalStorage && this._internalStorage.length || 0;
|
134 | for (var i=0; i < len; i++) {
|
135 | var key=this._internalStorage.key(i);
|
136 | if (key.indexOf(keyPrefix)===0) {
|
137 | keyList.push(key);
|
138 | }
|
139 | }
|
140 | } catch (e) {
|
141 | }
|
142 | return keyList;
|
143 | };
|
144 | return SafeStorage;
|
145 | })();
|
146 | OfficeExt.SafeStorage=SafeStorage;
|
147 | })(OfficeExt || (OfficeExt={}));
|
148 | OSF.OUtil=(function () {
|
149 | var _uniqueId=-1;
|
150 | var _xdmInfoKey='&_xdm_Info=';
|
151 | var _serializerVersionKey='&_serializer_version=';
|
152 | var _xdmSessionKeyPrefix='_xdm_';
|
153 | var _serializerVersionKeyPrefix='_serializer_version=';
|
154 | var _fragmentSeparator='#';
|
155 | var _loadedScripts={};
|
156 | var _defaultScriptLoadingTimeout=30000;
|
157 | var _safeSessionStorage=null;
|
158 | var _safeLocalStorage=null;
|
159 |
|
160 | var _rndentropy=new Date().getTime();
|
161 | function _random() {
|
162 | var nextrand=0x7fffffff * (Math.random());
|
163 | nextrand ^=_rndentropy ^ ((new Date().getMilliseconds()) << Math.floor(Math.random() * (31 - 10)));
|
164 |
|
165 | return nextrand.toString(16);
|
166 | }
|
167 | ;
|
168 | function _getSessionStorage() {
|
169 | if (!_safeSessionStorage) {
|
170 | try {
|
171 | var sessionStorage=window.sessionStorage;
|
172 | } catch (ex) {
|
173 | sessionStorage=null;
|
174 | }
|
175 | _safeSessionStorage=new OfficeExt.SafeStorage(sessionStorage);
|
176 | }
|
177 | return _safeSessionStorage;
|
178 | }
|
179 | ;
|
180 | return {
|
181 | set_entropy: function OSF_OUtil$set_entropy(entropy) {
|
182 | if (typeof entropy=="string") {
|
183 | for (var i=0; i < entropy.length; i+=4) {
|
184 | var temp=0;
|
185 | for (var j=0; j < 4 && i+j < entropy.length; j++) {
|
186 | temp=(temp << 8)+entropy.charCodeAt(i+j);
|
187 | }
|
188 | _rndentropy ^=temp;
|
189 | }
|
190 | } else if (typeof entropy=="number") {
|
191 | _rndentropy ^=entropy;
|
192 | } else {
|
193 | _rndentropy ^=0x7fffffff * Math.random();
|
194 | }
|
195 | _rndentropy &=0x7fffffff;
|
196 | },
|
197 | extend: function OSF_OUtil$extend(child, parent) {
|
198 | var F=function () {
|
199 | };
|
200 | F.prototype=parent.prototype;
|
201 | child.prototype=new F();
|
202 | child.prototype.constructor=child;
|
203 | child.uber=parent.prototype;
|
204 | if (parent.prototype.constructor===Object.prototype.constructor) {
|
205 | parent.prototype.constructor=parent;
|
206 | }
|
207 | },
|
208 | setNamespace: function OSF_OUtil$setNamespace(name, parent) {
|
209 | if (parent && name && !parent[name]) {
|
210 | parent[name]={};
|
211 | }
|
212 | },
|
213 | unsetNamespace: function OSF_OUtil$unsetNamespace(name, parent) {
|
214 | if (parent && name && parent[name]) {
|
215 | delete parent[name];
|
216 | }
|
217 | },
|
218 | loadScript: function OSF_OUtil$loadScript(url, callback, timeoutInMs) {
|
219 | if (url && callback) {
|
220 | var doc=window.document;
|
221 | var _loadedScriptEntry=_loadedScripts[url];
|
222 | if (!_loadedScriptEntry) {
|
223 | var script=doc.createElement("script");
|
224 | script.type="text/javascript";
|
225 | _loadedScriptEntry={ loaded: false, pendingCallbacks: [callback], timer: null };
|
226 | _loadedScripts[url]=_loadedScriptEntry;
|
227 | var onLoadCallback=function OSF_OUtil_loadScript$onLoadCallback() {
|
228 | if (_loadedScriptEntry.timer !=null) {
|
229 | clearTimeout(_loadedScriptEntry.timer);
|
230 | delete _loadedScriptEntry.timer;
|
231 | }
|
232 | _loadedScriptEntry.loaded=true;
|
233 | var pendingCallbackCount=_loadedScriptEntry.pendingCallbacks.length;
|
234 | for (var i=0; i < pendingCallbackCount; i++) {
|
235 | var currentCallback=_loadedScriptEntry.pendingCallbacks.shift();
|
236 | currentCallback();
|
237 | }
|
238 | };
|
239 | var onLoadError=function OSF_OUtil_loadScript$onLoadError() {
|
240 | delete _loadedScripts[url];
|
241 | if (_loadedScriptEntry.timer !=null) {
|
242 | clearTimeout(_loadedScriptEntry.timer);
|
243 | delete _loadedScriptEntry.timer;
|
244 | }
|
245 | var pendingCallbackCount=_loadedScriptEntry.pendingCallbacks.length;
|
246 | for (var i=0; i < pendingCallbackCount; i++) {
|
247 | var currentCallback=_loadedScriptEntry.pendingCallbacks.shift();
|
248 | currentCallback();
|
249 | }
|
250 | };
|
251 | if (script.readyState) {
|
252 | script.onreadystatechange=function () {
|
253 | if (script.readyState=="loaded" || script.readyState=="complete") {
|
254 | script.onreadystatechange=null;
|
255 | onLoadCallback();
|
256 | }
|
257 | };
|
258 | } else {
|
259 | script.onload=onLoadCallback;
|
260 | }
|
261 | script.onerror=onLoadError;
|
262 |
|
263 | timeoutInMs=timeoutInMs || _defaultScriptLoadingTimeout;
|
264 | _loadedScriptEntry.timer=setTimeout(onLoadError, timeoutInMs);
|
265 | script.src=url;
|
266 | doc.getElementsByTagName("head")[0].appendChild(script);
|
267 | } else if (_loadedScriptEntry.loaded) {
|
268 | callback();
|
269 | } else {
|
270 | _loadedScriptEntry.pendingCallbacks.push(callback);
|
271 | }
|
272 | }
|
273 | },
|
274 | loadCSS: function OSF_OUtil$loadCSS(url) {
|
275 | if (url) {
|
276 | var doc=window.document;
|
277 | var link=doc.createElement("link");
|
278 | link.type="text/css";
|
279 | link.rel="stylesheet";
|
280 | link.href=url;
|
281 | doc.getElementsByTagName("head")[0].appendChild(link);
|
282 | }
|
283 | },
|
284 | parseEnum: function OSF_OUtil$parseEnum(str, enumObject) {
|
285 | var parsed=enumObject[str.trim()];
|
286 | if (typeof (parsed)=='undefined') {
|
287 | OsfMsAjaxFactory.msAjaxDebug.trace("invalid enumeration string:"+str);
|
288 | throw OsfMsAjaxFactory.msAjaxError.argument("str");
|
289 | }
|
290 | return parsed;
|
291 | },
|
292 | delayExecutionAndCache: function OSF_OUtil$delayExecutionAndCache() {
|
293 | var obj={ calc: arguments[0] };
|
294 | return function () {
|
295 | if (obj.calc) {
|
296 | obj.val=obj.calc.apply(this, arguments);
|
297 | delete obj.calc;
|
298 | }
|
299 | return obj.val;
|
300 | };
|
301 | },
|
302 | getUniqueId: function OSF_OUtil$getUniqueId() {
|
303 | _uniqueId=_uniqueId+1;
|
304 | return _uniqueId.toString();
|
305 | },
|
306 | formatString: function OSF_OUtil$formatString() {
|
307 | var args=arguments;
|
308 | var source=args[0];
|
309 | return source.replace(/{(\d+)}/gm, function (match, number) {
|
310 | var index=parseInt(number, 10)+1;
|
311 | return args[index]===undefined ? '{'+number+'}' : args[index];
|
312 | });
|
313 | },
|
314 | generateConversationId: function OSF_OUtil$generateConversationId() {
|
315 | return [_random(), _random(), (new Date()).getTime().toString()].join('_');
|
316 | },
|
317 | getFrameNameAndConversationId: function OSF_OUtil$getFrameNameAndConversationId(cacheKey, frame) {
|
318 | var frameName=_xdmSessionKeyPrefix+cacheKey+this.generateConversationId();
|
319 | frame.setAttribute("name", frameName);
|
320 | return this.generateConversationId();
|
321 | },
|
322 | addXdmInfoAsHash: function OSF_OUtil$addXdmInfoAsHash(url, xdmInfoValue) {
|
323 | return OSF.OUtil.addInfoAsHash(url, _xdmInfoKey, xdmInfoValue);
|
324 | },
|
325 | addSerializerVersionAsHash: function OSF_OUtil$addSerializerVersionAsHash(url, serializerVersion) {
|
326 | return OSF.OUtil.addInfoAsHash(url, _serializerVersionKey, serializerVersion);
|
327 | },
|
328 | addInfoAsHash: function OSF_OUtil$addInfoAsHash(url, keyName, infoValue) {
|
329 | url=url.trim() || '';
|
330 | var urlParts=url.split(_fragmentSeparator);
|
331 | var urlWithoutFragment=urlParts.shift();
|
332 | var fragment=urlParts.join(_fragmentSeparator);
|
333 | return [urlWithoutFragment, _fragmentSeparator, fragment, keyName, infoValue].join('');
|
334 | },
|
335 | parseXdmInfo: function OSF_OUtil$parseXdmInfo(skipSessionStorage) {
|
336 | return OSF.OUtil.parseXdmInfoWithGivenFragment(skipSessionStorage, window.location.hash);
|
337 | },
|
338 | parseXdmInfoWithGivenFragment: function OSF_OUtil$parseXdmInfoWithGivenFragment(skipSessionStorage, fragment) {
|
339 | return OSF.OUtil.parseInfoWithGivenFragment(_xdmInfoKey, _xdmSessionKeyPrefix, skipSessionStorage, fragment);
|
340 | },
|
341 | parseSerializerVersion: function OSF_OUtil$parseSerializerVersion(skipSessionStorage) {
|
342 | return OSF.OUtil.parseSerializerVersionWithGivenFragment(skipSessionStorage, window.location.hash);
|
343 | },
|
344 | parseSerializerVersionWithGivenFragment: function OSF_OUtil$parseSerializerVersionWithGivenFragment(skipSessionStorage, fragment) {
|
345 | return parseInt(OSF.OUtil.parseInfoWithGivenFragment(_serializerVersionKey, _serializerVersionKeyPrefix, skipSessionStorage, fragment));
|
346 | },
|
347 | parseInfoWithGivenFragment: function OSF_OUtil$parseInfoWithGivenFragment(infoKey, infoKeyPrefix, skipSessionStorage, fragment) {
|
348 | var fragmentParts=fragment.split(infoKey);
|
349 | var xdmInfoValue=fragmentParts.length > 1 ? fragmentParts[fragmentParts.length - 1] : null;
|
350 | var osfSessionStorage=_getSessionStorage();
|
351 | if (!skipSessionStorage && osfSessionStorage) {
|
352 | var sessionKeyStart=window.name.indexOf(infoKeyPrefix);
|
353 | if (sessionKeyStart > -1) {
|
354 | var sessionKeyEnd=window.name.indexOf(";", sessionKeyStart);
|
355 | if (sessionKeyEnd==-1) {
|
356 | sessionKeyEnd=window.name.length;
|
357 | }
|
358 | var sessionKey=window.name.substring(sessionKeyStart, sessionKeyEnd);
|
359 | if (xdmInfoValue) {
|
360 | osfSessionStorage.setItem(sessionKey, xdmInfoValue);
|
361 | } else {
|
362 | xdmInfoValue=osfSessionStorage.getItem(sessionKey);
|
363 | }
|
364 | }
|
365 | }
|
366 | return xdmInfoValue;
|
367 | },
|
368 | getConversationId: function OSF_OUtil$getConversationId() {
|
369 | var searchString=window.location.search;
|
370 | var conversationId=null;
|
371 | if (searchString) {
|
372 | var index=searchString.indexOf("&");
|
373 |
|
374 | conversationId=index > 0 ? searchString.substring(1, index) : searchString.substr(1);
|
375 | if (conversationId && conversationId.charAt(conversationId.length - 1)==='=') {
|
376 | conversationId=conversationId.substring(0, conversationId.length - 1);
|
377 | if (conversationId) {
|
378 | conversationId=decodeURIComponent(conversationId);
|
379 | }
|
380 | }
|
381 | }
|
382 | return conversationId;
|
383 | },
|
384 | getInfoItems: function OSF_OUtil$getInfoItems(strInfo) {
|
385 | var items=strInfo.split("$");
|
386 | if (typeof items[1]=="undefined") {
|
387 | items=strInfo.split("|");
|
388 | }
|
389 | return items;
|
390 | },
|
391 | getConversationUrl: function OSF_OUtil$getConversationUrl() {
|
392 | var conversationUrl='';
|
393 | var xdmInfoValue=OSF.OUtil.parseXdmInfo(true);
|
394 | if (xdmInfoValue) {
|
395 | var items=OSF.OUtil.getInfoItems(xdmInfoValue);
|
396 | if (items !=undefined && items.length >=3) {
|
397 | conversationUrl=items[2];
|
398 | }
|
399 | }
|
400 | return conversationUrl;
|
401 | },
|
402 | validateParamObject: function OSF_OUtil$validateParamObject(params, expectedProperties, callback) {
|
403 | var e=Function._validateParams(arguments, [
|
404 | { name: "params", type: Object, mayBeNull: false },
|
405 | { name: "expectedProperties", type: Object, mayBeNull: false },
|
406 | { name: "callback", type: Function, mayBeNull: true }
|
407 | ]);
|
408 | if (e)
|
409 | throw e;
|
410 | for (var p in expectedProperties) {
|
411 | e=Function._validateParameter(params[p], expectedProperties[p], p);
|
412 | if (e)
|
413 | throw e;
|
414 | }
|
415 | },
|
416 | writeProfilerMark: function OSF_OUtil$writeProfilerMark(text) {
|
417 | if (window.msWriteProfilerMark) {
|
418 | window.msWriteProfilerMark(text);
|
419 | OsfMsAjaxFactory.msAjaxDebug.trace(text);
|
420 | }
|
421 | },
|
422 | outputDebug: function OSF_OUtil$outputDebug(text) {
|
423 | if (typeof (Sys) !=='undefined' && Sys && Sys.Debug) {
|
424 | OsfMsAjaxFactory.msAjaxDebug.trace(text);
|
425 | }
|
426 | },
|
427 | defineNondefaultProperty: function OSF_OUtil$defineNondefaultProperty(obj, prop, descriptor, attributes) {
|
428 | descriptor=descriptor || {};
|
429 | for (var nd in attributes) {
|
430 | var attribute=attributes[nd];
|
431 | if (descriptor[attribute]==undefined) {
|
432 | descriptor[attribute]=true;
|
433 | }
|
434 | }
|
435 | Object.defineProperty(obj, prop, descriptor);
|
436 | return obj;
|
437 | },
|
438 | defineNondefaultProperties: function OSF_OUtil$defineNondefaultProperties(obj, descriptors, attributes) {
|
439 | descriptors=descriptors || {};
|
440 | for (var prop in descriptors) {
|
441 | OSF.OUtil.defineNondefaultProperty(obj, prop, descriptors[prop], attributes);
|
442 | }
|
443 | return obj;
|
444 | },
|
445 | defineEnumerableProperty: function OSF_OUtil$defineEnumerableProperty(obj, prop, descriptor) {
|
446 | return OSF.OUtil.defineNondefaultProperty(obj, prop, descriptor, ["enumerable"]);
|
447 | },
|
448 | defineEnumerableProperties: function OSF_OUtil$defin |
\ | No newline at end of file |