-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjquery.modal.loader.js
55 lines (45 loc) · 1.25 KB
/
jquery.modal.loader.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
* Part of Nitriques Solutions inc. (http://www.nitriques.com) jQuery plug-in bundle
* Liscence under the The Code Project Open License (CPOL)
* http://www.codeproject.com/info/cpol10.aspx
* Name: jquery.modal.loader.js
* Date: 2010-10-30
* Version: 1.0
* Version 1.0 : First release
Simplify the add of a modal loading panel for MS AJAX Requests
* Pre-requisites:
* jquery.modal.js version 1.1
* jquery.center.js version 1.0
* jquery.scroll.js version 1.0
* Copyrights (c) Solutions Nitriques inc.
*/
(function ($) {
var s = false,
t = null,
int = 100,
l = "#loader";
function show() {
if (!s) {
$.ntr$modal.show(l);
s = true;
}
}
function beginRequest() {
t = setTimeout(show, int);
}
function endRequest() {
if (s) {
$.ntr$modal.hide(l);
s = false;
} else {
clearTimeout(t);
}
}
$(function () {
// Hook up modal panel
$(l).ntr$modal();
// Register for Ajax posts
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginRequest)
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequest)
});
})(jQuery);