Skip to content

Commit

Permalink
refactored to make the plugin more jQuery compatible and avoid collis…
Browse files Browse the repository at this point in the history
…ions (use a namespace/object)
  • Loading branch information
Dan Pickett committed May 21, 2009
1 parent 770e1cb commit cb04f1b
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 62 deletions.
66 changes: 66 additions & 0 deletions script/jquery.under_construction.js
@@ -0,0 +1,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();
}
},


}

62 changes: 0 additions & 62 deletions script/under_construction.js

This file was deleted.

0 comments on commit cb04f1b

Please sign in to comment.