PageSourceSearch

https://aussiefloyd.com/ScriptResource.axd?d=2f_RYtTgOhYsPrnVrHlOA…Ncq2HfbenV_jlIT3mdq2GuUAAbSfL_E1&t=51e37521

js aussiefloyd.com collected 2026-10-02 06:16:31 UTC 17,211 bytes, 470 lines download raw bytes

1// Name:        AsyncFileUpload.AsyncFileUpload.debug.js
2// Assembly:    AjaxControlToolkit
3// Version:     4.1.7.1213
4// FileVersion: 4.1.7.1213
5Type.registerNamespace("Sys.Extended.UI");
6
7Sys.Extended.UI.AsyncFileUpload = function (element) {
8    Sys.Extended.UI.AsyncFileUpload.initializeBase(this, [element]);
9
10    this._hiddenField = null;
11    this._inputFile = null;
12    this._innerTB = null;
13    this._postBackUrl = "";
14    this._formName = "";
15    this._iframe = null;
16    this._waitTimer = null;
17    this._completeBackColor = "";
18    this._uploadingBackColor = "";
19    this._errorBackColor = "";
20    this._throbber = null;
21
22    this._onchange$delegate = null;
23    this._onload$delegate = null;
24    this._app_onload$delegate = Function.createDelegate(this, this._app_onload);
25    this._onmouseup$delegate = null;
26}
27
28Sys.Extended.UI.AsyncFileUpload.prototype = {
29
30    get_throbber: function () {
31        return this._throbber;
32    },
33    set_throbber: function (value) {
34        this._throbber = value;
35    },
36
37    get_completeBackColor: function () {
38        return this._completeBackColor;
39    },
40    set_completeBackColor: function (value) {
41        this._completeBackColor = value;
42    },
43
44    get_errorBackColor: function () {
45        return this._errorBackColor;
46    },
47    set_errorBackColor: function (value) {
48        this._errorBackColor = value;
49    },
50
51    get_uploadingBackColor: function () {
52        return this._uploadingBackColor;
53    },
54    set_uploadingBackColor: function (value) {
55        this._uploadingBackColor = value;
56    },
57
58    get_inputFile: function () {
59        return this._inputFile;
60    },
61    set_inputFile: function (value) {
62        this._inputFile = value;
63    },
64
65    get_hiddenField: function () {
66        return this._hiddenField;
67    },
68    set_hiddenField: function (value) {
69        this._hiddenField = value;
70    },
71
72    get_innerTB: function () {
73        return this._innerTB;
74    },
75    set_innerTB: function (value) {
76        this._innerTB = value;
77    },
78
79    get_postBackUrl: function () {
80        return this._postBackUrl;
81    },
82    set_postBackUrl: function (value) {
83        this._postBackUrl = value;
84    },
85
86    get_formName: function () {
87        return this._formName;
88    },
89    set_formName: function (value) {
90        this._formName = value;
91    },
92
93    add_uploadStarted: function (handler) {
94        this.get_events().addHandler("uploadStarted", handler);
95    },
96    remove_uploadStarted: function (handler) {
97        this.get_events().removeHandler("uploadStarted", handler);
98    },
99    raiseUploadStarted: function (e) {
100        var eh = this.get_events().getHandler("uploadStarted");
101        if (eh) {
102            return eh(this, e);
103        }
104        return true;
105    },
106
107    add_uploadComplete: function (handler) {
108        this.get_events().addHandler("uploadComplete", handler);
109    },
110    remove_uploadComplete: function (handler) {
111        this.get_events().removeHandler("uploadComplete", handler);
112    },
113    raiseUploadComplete: function (e) {
114        var eh = this.get_events().getHandler("uploadComplete");
115        if (eh) {
116            eh(this, e);
117        }
118    },
119
120    add_uploadError: function (handler) {
121        this.get_events().addHandler("uploadError", handler);
122    },
123    remove_uploadError: function (handler) {
124        this.get_events().removeHandler("uploadError", handler);
125    },
126    raiseUploadError: function (e) {
127        var eh = this.get_events().getHandler("uploadError");
128        if (eh) {
129            eh(this, e);
130            return true;
131        }
132        return false;
133    },
134
135    setThrobber: function (value) {
136        if (this.get_throbber() != null) {
137            this.get_throbber().style.display = value ? "" : "none";
138        }
139    },
140
141    _onStart: function (fileName) {
142        var valid = this.raiseUploadStarted(new Sys.Extended.UI.AsyncFileUploadEventArgs(fileName, null, null, null));
143        if (typeof valid == 'undefined') {
144            valid = true;
145        }
146
147        return valid;
148    },
149
150    initialize: function () {
151        Sys.Extended.UI.AsyncFileUpload.callBaseMethod(this, "initialize");
152        Sys.Application.add_load(this._app_onload$delegate);
153        this._iframeName = this.get_element() + "_iframe";
154        this.setThrobber(false);
155    },
156
157    dispose: function () {
158        Sys.Application.remove_load(this._app_onload$delegate);
159        if (this._onchange$delegate != null) {
160            $common.removeHandlers(this._inputFile, {
161                change: this._onchange$delegate
162            });
163            this._onchange$delegate = null;
164        }
165        if (this._onmouseup$delegate != null) {
166            $common.removeHandlers(this._inputFile, {
167                mouseup: this._onmouseup$delegate
168            });
169            this._onmouseup$delegate = null;
170        }
171        this._removeIframe();
172        Sys.Extended.UI.AsyncFileUpload.callBaseMethod(this, "dispose");
173    },
174
175    _onmouseup: function () {
176        var inputFile = this._inputFile;
177        setTimeout(function () { inputFile.blur(); }, 0);
178        return true;
179    },
180
181    _app_onload: function (sender, e) {
182        this.setThrobber(false);
183        if (this._inputFile != null) {
184            if (this._onchange$delegate == null) {
185                this._onchange$delegate = Function.createDelegate(this, this._onchange);
186                $addHandlers(this._inputFile, {
187                    change: this._onchange$delegate
188                });
189            }
190            if (this._innerTB != null) {
191                this._inputFile.blur();
192                var inputFile = this._inputFile;
193                setTimeout(function () { inputFile.blur(); }, 0);
194                this._innerTB.style.width = (this._inputFile.offsetWidth - 107) + "px";
195                this._inputFile.parentNode.style.width = this._inputFile.offsetWidth + "px";
196                if (Sys.Browser.agent == Sys.Browser.InternetExplorer) {
197                    this._onmouseup$delegate = Function.createDelegate(this, this._onmouseup);
198                    $addHandlers(this._inputFile, {
199                        mouseup: this._onmouseup$delegate
200                    });
201                }
202            }
203        }
204    },
205
206    _removeIframe: function () {
207        this._removeTimer();
208        if (this._iframe != null) {
209            if (this._onload$delegate != null) {
210                $common.removeHandlers(this._iframe, {
211                    load: this._onload$delegate
212                });
213                this._onload$delegate = null;
214            }
215            document.body.removeChild(this._iframe);
216            this._iframe = null;
217        }
218    },
219
220    _removeTimer: function () {
221        if (this._waitTimer != null) {
222            window.clearTimeout(this._waitTimer);
223            this._waitTimer = null;
224        }
225    },
226
227    _onError: function (error) {
228        var unhandledException = Sys.Extended.UI.Resources.AsyncFileUpload_UnhandledException;
229        this.setThrobber(false);
230
231        if (this.get_errorBackColor() != "") {
232            if (this._innerTB != null) {
233                this._innerTB.style.backgroundColor = this.get_errorBackColor();
234            } else {
235                this._inputFile.style.backgroundColor = this.get_errorBackColor();
236            }
237        }
238        if (!this.raiseUploadError(new Sys.Extended.UI.AsyncFileUploadEventArgs(this._inputFile.value, null, null, error))) {
239            alert(unhandledException + ": " + error);
240        }
241    },
242
243    _onchange: function (e) {
244        var value = this._inputFile.value;
245        if (value == "") {
246            return;
247        }
248        if (this._innerTB != null) {
249            this._innerTB.value = value;
250        }
251        if (this._hiddenField != null) {
252            this._hiddenField.value = value;
253        }
254
255        try {
256            if (this._iframe == null) {
257                this._onload$delegate = Function.createDelegate(this, this._onload);
258                var iframe = document.createElement("IFRAME");
259                iframe.width = "0";
260                iframe.height = "0";
261                iframe.style.display = "none";
262                iframe.src = "about:blank";
263                iframe.id = this._iframeName;
264                iframe.name = this._iframeName;
265                $addHandlers(iframe, {
266                    load: this._onload$delegate
267                });
268                this._iframe = iframe;
269                document.body.appendChild(this._iframe);
270                iframe.contentWindow.name = this._iframeName;
271            } else {
272                this._removeIframe();
273                var internalErrorMessage = Sys.Extended.UI.Resources.AsyncFileUpload_InternalErrorMessage;
274                this._onError(internalErrorMessage);
275            }
276        } catch (ex) {
277            this._onError(ex.message);
278        }
279    },
280
281    _stopLoad: function (result) {
282        var mainForm = document.getElementById(this._formName);
283        this._removeTimer();
284        this.setThrobber(false);
285        mainForm.target = "_top";
286        mainForm.action = this._postBackUrl;
287        var length;
288        var contentType = "";
289        var temp = result.split("------");
290        if (temp.length > 0) {
291            if (temp[0] == "error") {
292                this._onError(temp[1]);
293                return;
294            }
295            length = parseInt(temp[0]);
296        }
297        if (temp.length > 1) {
298            contentType = temp[1];
299        }
300        if (this.get_completeBackColor() != "") {
301            if (this._innerTB != null) {
302                this._innerTB.style.backgroundColor = this.get_completeBackColor();
303            } else {
304                this._inputFile.style.backgroundColor = this.get_completeBackColor();
305            }
306        }
307        this.raiseUploadComplete(new Sys.Extended.UI.AsyncFileUploadEventArgs(this._inputFile.value, length, contentType, null));
308    },
309
310    _onload: function (e) {
311        var cleanup = true;
312        var uploader = this;
313        var mainForm = document.getElementById(this._formName);
314        try {
315            var frameDocument = this._iframe.contentWindow.document;
316            if (frameDocument == null || frameDocument.location == null) {
317                var e = { "message": Sys.Extended.UI.Resources.AsyncFileUpload_UploadingProblem };
318                throw (e);
319            } else if (frameDocument.location.href == 'about:blank') {
320                this._removeTimer();
321                if (this.get_uploadingBackColor() != "") {
322                    if (this._innerTB != null) {
323                        this._innerTB.style.backgroundColor = this.get_uploadingBackColor();
324                    } else {
325                        this._inputFile.style.backgroundColor = this.get_uploadingBackColor();
326                    }
327                }
328
329                var valid = this._onStart(this._inputFile.value);
330                if (valid) {
331                    var url = this._postBackUrl;
332                    url += url.indexOf("?") === -1 ? "?" : "&";
333                    mainForm.action = url + 'AsyncFileUploadID=' + this.get_element().id + '&rnd=' + Math.random().toString().replace(/\./g, "");
334                    mainForm.target = this._iframeName;
335                    cleanup = false;
336                    this.setThrobber(true);
337                    setTimeout(function () {
338                        mainForm.submit();
339                        uploader._waitTimer = setTimeout(function () { uploader._wait() }, 100);
340                    }, 0);
341                    return true;
342                }
343            } else {
344                if (frameDocument.body.innerHTML == "") {
345                    return true;
346                }
347                var result = frameDocument.getElementById(this.get_element().id);
348                var length;
349                var contentType = "";
350                if (result != null) {
351                    var temp = result.innerHTML.split("------");
352                    if (temp.length > 0) {
353                        if (temp[0] == "error") {
354                            var e = { "message": temp[1] };
355                            throw (e);
356                        }
357                        length = parseInt(temp[0]);
358                    }
359                    if (temp.length > 1) {
360                        contentType = temp[1];
361                    }
362                } else {
363                    var serverError = Sys.Extended.UI.Resources.AsyncFileUpload_UnknownServerError;
364                    function replace_func(p0, p1) {
365                        serverError = p1;
366                        return "";
367                    }
368                    frameDocument.body.innerHTML.replace(/Exception\]:([^\n\r]+)[\n\r]/, replace_func);
369                    var exMessage = Sys.Extended.UI.Resources.AsyncFileUpload_ServerResponseError + ": '" + serverError + "'";
370                    var ret = confirm(exMessage + "\n\n" + Sys.Extended.UI.Resources.AsyncFileUpload_ConfirmToSeeErrorPage);
371                    if (ret) {
372                        var handle = window.open("", "NotFoundInAnswer", "toolbar=0,status=1,scrollbars=1,resizable=1,width=600,height=400");
373                        function onOpen() {
374                            try {
375                                if (!handle.document)
376                                    setTimeout(onOpen, 100);
377                            }
378                            catch (e) { return; }
379                            var _doc = handle.document;
380                            _doc.open();
381                            _doc.write("<body>" + frameDocument.body.innerHTML + "</body>");
382                            _doc.close();
383                        }
384                        setTimeout(onOpen, 0);
385                    }
386                    var e = { "message": exMessage };
387                    throw (e);
388                }
389
390                this._removeTimer();
391                mainForm.target = "_top";
392                mainForm.action = this._postBackUrl;
393                if (this.get_completeBackColor() != "") {
394                    if (this._innerTB != null) {
395                        this._innerTB.style.backgroundColor = this.get_completeBackColor();
396                    } else {
397                        this._inputFile.style.backgroundColor = this.get_completeBackColor();
398                    }
399                }
400                this.setThrobber(false);
401                this.raiseUploadComplete(new Sys.Extended.UI.AsyncFileUploadEventArgs(this._inputFile.value, length, contentType, null));
402            }
403        }
404        catch (ex) {
405            this._removeTimer();
406            mainForm.target = "_top";
407            mainForm.action = this._postBackUrl;
408            this._onError(ex.message);
409        }
410        finally {
411            if (cleanup) {
412                setTimeout(function () { uploader._removeIframe(); }, 100);
413            }
414        }
415    },
416
417    _wait: function () {
418        if (this._waitTimer == null) {
419            return;
420        }
421        var uploader = this;
422        try {
423            var frameDocument = this._iframe.contentWindow.document;
424            var location = frameDocument.location;
425            var href = location.href;
426            this._waitTimer = setTimeout(function () { uploader._wait() }, 100);
427        } catch (ex) {
428            setTimeout(function () { uploader._removeIframe(); }, 100);
429            setTimeout(function () { uploader._onError(Sys.Extended.UI.Resources.AsyncFileUpload_UploadingProblem); }, 0);
430            this._waitTimer = null;
431        }
432    }
433}
434
435Sys.Extended.UI.AsyncFileUpload.registerClass("Sys.Extended.UI.AsyncFileUpload", Sys.Extended.UI.ControlBase);
436
437Sys.Extended.UI.AsyncFileUploadEventArgs = function (fileName, length, contentType, errorMessage) {
438    if (arguments.length != 4) throw Error.parameterCount();
439
440    Sys.Extended.UI.AsyncFileUploadEventArgs.initializeBase(this);
441    this._fileName = fileName;
442    this._length = length;
443    this._contentType = contentType;
444    this._errorMessage = errorMessage;
445}
446
447Sys.Extended.UI.AsyncFileUploadEventArgs.prototype =
448{
449    get_fileName: function () {
450        var slashPos = this._fileName.lastIndexOf("/");
451        var backSlashPos = this._fileName.lastIndexOf("\\");
452
453        var fileName = this._fileName.substr(((slashPos > backSlashPos) ? slashPos : backSlashPos) + 1);
454        return fileName;
455    },
456    get_path: function () {
457        return this._fileName;
458    },
459    get_length: function () {
460        return this._length;
461    },
462    get_contentType: function () {
463        return this._contentType;
464    },
465    get_errorMessage: function () {
466        return this._errorMessage;
467    }
468}
469
470Sys.Extended.UI.AsyncFileUploadEventArgs.registerClass('Sys.Extended.UI.AsyncFileUploadEventArgs', Sys.EventArgs);

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.