PageSourceSearch

https://www.dmu.ac.uk/ScriptResource.axd?d=uDdUOit10pbiX4pRLti-TIu…9OrGAdJYjNMynTeGLiAOwT3EVrdgKmGU1&t=fc48546

js dmu.ac.uk collected 2026-09-24 08:29:16 UTC 16,304 bytes, 460 lines download raw bytes

1/// <reference name="MicrosoftAjax.js"/>
2
3Array.Clone = function(array) {
4    if (!array) { return null; }
5    return Array.clone(array);
6}
7
8Array.Find = function(array, func, context, start, length) {
9    var index = Array.FindIndex.apply(Array, arguments);
10    if (index >= 0) { return array[index]; }
11    return null;
12};
13
14Array.FindAll = function(array, func, context, start, length) {
15    start = start ? start : 0;
16    length = length ? length : array.length;
17    var result = [];
18    for (var i = start; i < length; i++) {
19        var res = func.call(context, array[i], i, array);
20        if (res) { result[result.length] = array[i]; }
21    }
22    return -1;
23};
24
25Array.FindIndex = function(array, func, context, start, length) {
26    start = start ? start : 0;
27    length = length ? length : array.length;
28    for (var i = start; i < length; i++) {
29        var res = func.call(context, array[i], i, array);
30        if (res) { return i; }
31    }
32    return -1;
33};
34
35Array.FindLast = function(array, func, context, start, length) {
36    var index = Array.FindLastIndex.apply(Array, arguments);
37    if (index >= 0) { return array[index]; }
38    return null;
39};
40
41Array.FindLastIndex = function(array, func, context, start, length) {
42    start = start == null ? start : array.length - 1; // 0 is false    
43    length = length == null ? array.length : length;
44    for (var i = start, l = start - length; i > l; i--) {
45        var res = func.call(context, array[i], i, array);
46        if (res) { return i; }
47    }
48    return -1;
49};
50
51Array.getRange = function(array, index, length) {
52    return array.slice(index, index + length);
53};
54
55Array.InsertRange = function(array, index, insertArray) {
56    var temp = [];
57    Array.addRange(temp, array.slice(0, index));
58    Array.addRange(temp, insertArray);
59    Array.addRange(temp, array.slice(index));
60    Array.clear(array);
61    Array.addRange(array, temp);
62};
63
64Array.IsArray = function(obj) {
65    if (obj.constructor == Array) { return true; }
66    return false;
67};
68
69Array.IsNullOrEmpty = function(value) {
70    if (!value) { return true; }
71    if (!Array.IsArray(value)) { return true; }
72    if (value.length == 0) { return true; }
73    return false;
74};
75
76Array.Load = function(obj, source, start, length) {
77    obj = obj ? obj : [];
78    start = start ? start : 0;
79    length = length ? length : source.length;
80    var data = source;
81    if (Array.IsArray(data)) {
82        if (start > 0) { data.slice(start); };
83        if (length < data.length) { data.slice(0, length - 1); }
84    }
85    else {
86        data = [];
87        for (var i = start, ilen = start + length; i < ilen; i++) {
88            if (i >= source.length) { break; }
89            data[data.length] = source[i];
90        }
91    }
92    if (!Array.IsArray(obj)) { obj.length = 0; }
93    Array.prototype.push.apply(obj, data);
94    return obj;
95};
96
97Array.RemoveRange = function(array, index, count) {
98    array.splice(index, count);
99};
100
101Cloneable = function(){ };
102
103Cloneable.Clone = function(obj) {
104    var s = Sys.Serialization.JavaScriptSerializer.serialize(obj);
105    var result = Sys.Serialization.JavaScriptSerializer.deserialize(s);
106    return result;
107};
108
109Function.NotImplemented = function(message) {
110    return function() { alert(this.constructor.getName() + ': ' + message + ' not implemented'); };
111};
112
113Function.NotImplementedMethod = Function.NotImplementedFunction = function() { throw Error.notImplemented(message); };
114
115Object.Extend = function(destination, source) {
116    for (var propertyName in source)
117    {
118        if (typeof(destination[propertyName]) == 'undefined')
119        {
120            destination[propertyName] = source[propertyName];               
121        }
122    }
123    return destination;
124};
125
126Object.Sync = function(destination, source) {
127    for (var propertyName in source)
128    {
129        if (typeof (destination[propertyName]) != 'undefined')
130        {
131            destination[propertyName] = source[propertyName];
132        }
133    }
134    return destination;
135}
136
137String.IsNullOrEmpty = function(value) {
138    return !value;
139};
140
141String.PadLeft = function(s, padding, maxLength) {
142    var st = s + '';
143    while (st.length < maxLength)
144    {
145        st = padding + st;
146    }
147    return st;
148};
149
150String.PadRight = function(s, padding, maxLength) {
151    var st = s + '';
152    while (st.length < maxLength)
153    {
154        st += padding;
155    }
156    return st;
157};
158
159Sys.UI.DomElement.setClassname = function(element, className) {
160    if (!element) { return ''; }
161    if (!className)
162    {
163        element.className = '';
164        element.removeAttribute("class", 0); //Moz
165        element.removeAttribute("classname", 0); //IE
166    }
167    else
168    {
169        element.className = className;
170    }
171}
172
173Sys.UI.DomElement.getElementParentByTag = function(element, tagName) {
174    if (null == element) { return null; }
175    if (null == tagName) { return element; }
176    try
177    {
178        while (element && null != element.tagName && element.tagName != tagName)
179        {
180            element = element.parentNode;
181        }
182        return ((element.tagName == tagName) ? element : null);
183    }
184    catch (e) { return null; }
185}
186
187Sys.UI.DomElement.getOuterHTML = function(element) {
188    if (element.outerHTML) { return element.outerHTML; }
189    else
190	{
191	    var elementCopy = element.cloneNode(true);
192		var tmpDiv = element.ownerDocument.createElement("DIV");
193		tmpDiv.appendChild(elementCopy);
194		return tmpDiv.innerHTML;		
195    }
196}
197
198Sys.UI.DomElement.Clear = function(element) {
199    if (element)
200    {
201        if (element.childNodes)
202        {
203            while (element.childNodes.length > 0)
204            {
205                var child = element.childNodes[0];
206                if (typeof(child.outerHTML) != 'undefined')
207                {
208                    try { child.outerHTML = ''; }
209                    catch (e) { element.removeChild(child); }
210                }
211                else { element.removeChild(child); }
212                delete child;
213            }
214        }
215    }
216}
217
218Sys.UI.DomElement.setInnerHTML = function(element, content) {
219    Sys.UI.DomElement.Clear(element);
220    if (element)
221    {
222        try { element.innerHTML = '<span>&nbsp;</span>' + content; }
223        catch (ex)
224        {
225            try
226            {
227                var tmpDiv = element.ownerDocument.createElement("DIV");
228                tmpDiv.innerHTML = '<span>&nbsp;</span>' + content;
229                while (tmpDiv.childNodes.length > 0)
230                {
231                    element.appendChild(tmpDiv.childNodes[0]);
232                }
233            }
234            catch (ex1) { return; }
235        }
236        element.removeChild(element.firstChild);
237    }
238}
239
240Sys.UI.DomEvent.prototype.Kill = function() {
241    this.stopPropagation();
242    this.preventDefault();
243    return false;
244};
245
246Type.prototype.AddElementToStore = function(elementName) {
247    var storeName = Contensis.Web.UI.$Contensis.PrivateStoreName;
248    this.CreatePrivateStore();
249    this.prototype[storeName].HTMLElements[this.prototype[storeName].HTMLElements.length] = elementName;
250};
251
252Type.prototype.CreatePrivateStore = function() {
253    var storeName = Contensis.Web.UI.$Contensis.PrivateStoreName;
254    if (typeof (this.prototype[storeName]) == 'undefined') {
255        this.prototype[storeName] = { HTMLElements: [] };
256    }
257};
258
259Type.prototype._registerClass = Type.prototype.registerClass;
260
261Type.prototype.registerClass = function() {
262    if (typeof(this.prototype.Properties) != 'undefined')
263    {
264        for (var propertyName in this.prototype.Properties)
265        {
266            if (this.prototype.Properties.hasOwnProperty(propertyName))
267            {
268                if (typeof(this.prototype.Properties[propertyName]) != 'function')
269                {                
270                    var defaultDefinition = {type:Object, readOnly:false, writeOnly:false, initialValue:null, clone:true};
271                    var definition = this.prototype.Properties[propertyName];
272                    definition = Object.Extend(definition, defaultDefinition);
273                    if ((definition.clone) && (typeof(definition.type.Clone) == 'function'))
274                    {
275                        definition.initialValue = definition.type.Clone(definition.initialValue);
276                    }
277                    var doRead = true;
278                    if (definition.writeOnly) { doRead = false; }
279                    var doWrite = true;
280                    if (definition.readOnly) { doWrite = false; }
281                    if (doRead) { this.registerGetter(propertyName, definition); }
282                    if (doWrite) { this.registerSetter(propertyName, definition.type); }
283                }
284            }
285        }        
286    }    
287    if (typeof(this.prototype.Events) != 'undefined')
288    {
289        for (var eventName in this.prototype.Events)
290        {
291            if (this.prototype.Events.hasOwnProperty(eventName))
292            {
293                var defaultDefinition = {};
294                var definition = this.prototype.Events[eventName];
295                definition = Object.Extend(definition, defaultDefinition);
296                this.registerEvent(eventName, definition);
297            }
298        }
299    }
300    Type.prototype._registerClass.apply(this, arguments);
301    Type.prototype.LoadInterfaces.apply(this, arguments);
302}
303
304Type.prototype._initializeBase = Type.prototype.initializeBase;
305
306Type.prototype.initializeBase = function(instance, baseArguments) {
307    Type.prototype._initializeBase.apply(this, arguments);    
308    if (typeof (this.prototype.Properties) != 'undefined') {
309        for (var propertyName in this.prototype.Properties) {
310            if (this.prototype.Properties.hasOwnProperty(propertyName)) {
311                if (typeof (this.prototype.Properties[propertyName]) != 'function') {
312                    var defaultDefinition = { type: Object, readOnly: false, writeOnly: false, initialValue: null, jQuery: false };
313                    var definition = this.prototype.Properties[propertyName];
314                    definition = Object.Extend(definition, defaultDefinition);
315                    var initialValue = definition.initialValue;
316                    if ((definition.clone) && (typeof (definition.type.Clone) == 'function')) {
317                        initialValue = definition.type.Clone(initialValue);
318                    }
319                    instance['_' + propertyName] = initialValue;                   
320                }
321            }
322        }
323    }
324    if (typeof (this.prototype.Private) != 'undefined') {
325        for (var privateName in this.prototype.Private) {
326            if (this.prototype.Private.hasOwnProperty(privateName)) {
327                var defaultDefinition = { type: Object, initialValue: null, clone: true };
328                var definition = this.prototype.Private[privateName];
329                definition = Object.Extend(definition, defaultDefinition);
330                var initialValue = definition.initialValue;
331                if ((definition.clone) && (typeof (definition.type.Clone) == 'function')) {
332                    initialValue = definition.type.Clone(initialValue);
333                }
334                instance['_' + privateName] = initialValue;
335            }
336        }
337    }
338}
339
340Type.prototype.registerEvent = function(eventName, definition) {
341    var addFunc = function(handler) { this.get_events().addHandler(eventName, handler); };
342    if (typeof(this.prototype.Events['add_' + eventName]) == 'function')
343    {
344        addFunc = this.prototype.Events['add_' + eventName];
345    }
346    this.prototype['add_' + eventName] = addFunc;
347    var removeFunc = function(handler) { this.get_events().removeHandler(eventName, handler); };
348    if (typeof(this.prototype.Events['remove_' + eventName]) == 'function')
349    {
350        removeFunc = this.prototype.Events['remove_' + eventName];
351    }
352    this.prototype['remove_' + eventName] = removeFunc;
353    var raiseFunc = function(args) { 
354        var handler = this.get_events().getHandler(eventName);
355        if (handler) {
356            if (!args) { args = Sys.EventArgs.Empty; }
357            handler(this, args);
358        }
359    };
360    if (typeof(this.prototype.Events['raise_' + eventName]) == 'function')
361    {
362        raiseFunc = this.prototype.Events['raise_' + eventName];
363    }
364    this.prototype['raise_' + eventName] = raiseFunc;
365}
366
367Type.prototype.registerGetter = function(propertyName, definition) {
368    var privateName = '_' + propertyName;    
369    if (definition.type == Sys.UI.DomElement) { this.AddElementToStore(privateName); }
370    var f = function() { return this[privateName]; };
371    if (typeof(this.prototype.Properties['get_' + propertyName]) == 'function')
372    {
373        f = this.prototype.Properties['get_' + propertyName];
374    }
375    this.prototype['get_' + propertyName] = f;
376}
377
378Type.prototype.registerSetter = function(propertyName, definition) {
379    var privateName = '_' + propertyName;    
380    if (definition.type == Sys.UI.DomElement) { this.AddElementToStore(privateName); }
381    var f = function(value) { 
382        if (this[privateName] !== value) {
383            this[privateName] = value;
384            if (typeof(this.raisePropertyChanged) == 'function')
385            {
386                this.raisePropertyChanged(propertyName);
387            }
388        }
389    };
390    if (typeof(this.prototype.Properties['set_' + propertyName]) == 'function')
391    {
392        f = this.prototype.Properties['set_' + propertyName];
393    }
394    this.prototype['set_' + propertyName] = f;
395}
396
397Type.prototype._registerInterface = Type.prototype.registerInterface;
398
399Type.prototype.registerInterface = function() {
400    if (typeof(this.prototype.Properties) != 'undefined')
401    {
402        for (var propertyName in this.prototype.Properties)
403        {
404            if (this.prototype.Properties.hasOwnProperty(propertyName))
405            {
406                if (typeof(this.prototype.Properties[propertyName]) != 'function')
407                {                
408                    var defaultDefinition = {readOnly:false, writeOnly:false};
409                    var definition = this.prototype.Properties[propertyName];
410                    definition = Object.Extend(definition, defaultDefinition);
411                    var doRead = true;
412                    if (definition.writeOnly) { doRead = false; }
413                    var doWrite = true;
414                    if (definition.readOnly) { doWrite = false; }
415                    if (doRead) { this.registerInterfaceGetter(propertyName); }
416                    if (doWrite) { this.registerInterfaceSetter(propertyName); }
417                }
418            }
419        }        
420    }    
421    if (typeof(this.prototype.Methods) != 'undefined')
422    {
423        for (var methodName in this.prototype.Methods)
424        {
425            if (this.prototype.Methods.hasOwnProperty(methodName))
426            {
427                var defaultDefinition = {};
428                var definition = this.prototype.Methods[methodName];
429                definition = Object.Extend(definition, defaultDefinition);
430                this.registerInterfaceMethod(methodName);
431            }
432        }
433    }
434    Type.prototype._registerInterface.apply(this, arguments);
435}
436
437Type.prototype.registerInterfaceGetter = function(propertyName) {
438    this.prototype['get_' + propertyName] = Function.NotImplemented('get_' + propertyName);    
439}
440
441Type.prototype.registerInterfaceSetter = function(propertyName) {
442    this.prototype['set_' + propertyName] = Function.NotImplemented('set_' + propertyName);
443}  
444
445Type.prototype.registerInterfaceMethod = function(methodName) {
446    this.prototype[methodName] = Function.NotImplemented(methodName);
447}  
448
449Type.prototype.Create = function() {
450    var f = function() {};
451    f.prototype = this.prototype;
452    f.prototype.constructor = this;
453    
454    var result = new f();
455    this.apply(result, arguments);
456    return result;
457}
458
459    
460if (typeof (Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.