MaskNode.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. o2.widget = o2.widget || {};
  2. o2.require("o2.widget.Mask", null, false);
  3. o2.widget.MaskNode = new Class({
  4. Implements: [Options, Events],
  5. Extends: o2.widget.Mask,
  6. options: {
  7. "style": "node"
  8. },
  9. node: null,
  10. initialize: function(node, options){
  11. this.parent(options);
  12. this.node = node;
  13. },
  14. load: function(){
  15. if (this.fireEvent("queryLoad")){
  16. this.container.inject($(this.node));
  17. var size = $(this.node).getSize();
  18. var position = $(this.node).getPosition();
  19. var markPosition = this.container.getPosition();
  20. this.container.setStyles({
  21. "width": size.x,
  22. "height": size.y,
  23. "top": position.y - markPosition.y+"px"
  24. });
  25. this.maskBar.setStyles({
  26. "width": size.x,
  27. "height": size.y
  28. });
  29. this.backgroundBar.setStyles({
  30. "width": size.x,
  31. "height": size.y
  32. });
  33. if (!this.options.loading){
  34. this.loadBar.setStyle("display", "none");
  35. }else{
  36. this.loadBar.setStyle("display", "block");
  37. var tmpLeft = (size.x-120)/2;
  38. var tmpTop = (size.y-30)/2;
  39. this.loadBar.setStyle("left", ""+tmpLeft+"px");
  40. this.loadBar.setStyle("top", ""+tmpTop+"px");
  41. }
  42. this.fireEvent("postLoad");
  43. }
  44. }
  45. });