jquery.under_construction.js
1.65 KB
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
56
57
58
59
60
61
62
63
64
65
66
jQuery.under_construction = {
hidePendingElements : function() {
jQuery(".pending").each(function(i){
jQuery(this).addClass("not_visible");
});
},
showPendingElements : function() {
jQuery(".pending").removeClass("not_visible");
},
hideOverlayOfPendingElements : function() {
jQuery(".overlay_for_pending").remove();
},
overlayPendingElements : function() {
jQuery(".pending").each(function(i){
//clone the element so that we can overlay it
var overlay_element = jQuery("<div>");
//set the height
var height = jQuery(this).outerHeight();
var width = jQuery(this).outerWidth();
jQuery(overlay_element).height(height);
jQuery(overlay_element).width(width);
//set the position
var pos = jQuery(this).position();
jQuery(overlay_element).css("top", pos.top);
jQuery(overlay_element).css("left", pos.left);
//add the class that sets opacity and background color
jQuery(overlay_element).addClass("overlay_for_pending");
//todo: replace this with a delimited class to indicate what milestone it is
jQuery(overlay_element).html("");
//insert after the element in question
jQuery("body").append(overlay_element);
});
},
toggleDisplayOfPendingElements : function() {
if(jQuery(".pending").hasClass("not_visible")) {
this.showPendingElements();
}
else {
this.hidePendingElements();
}
},
toggleOverlayOfPendingElements : function() {
if(jQuery(".overlay_for_pending").length > 0) {
this.hideOverlayOfPendingElements();
}
else {
this.overlayPendingElements();
}
},
}