forked from benjamind/yui3-gallery
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gallery-2011.08.24-22-36 jafl gallery-busyoverlay
- Loading branch information
YUI Builder
committed
Aug 24, 2011
1 parent
9a015e7
commit 03c1571
Showing
6 changed files
with
173 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
* html .yui3-busyoverlay-browser-hacks select | ||
{ | ||
visibility:hidden; | ||
} |
7 changes: 7 additions & 0 deletions
7
src/gallery-busyoverlay/assets/skins/sam/gallery-busyoverlay-skin.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.yui3-skin-sam .yui3-component-busy | ||
{ | ||
background:#fff url(spinner.gif) no-repeat scroll center; | ||
filter:alpha(opacity=60); | ||
opacity:0.6; | ||
z-index:100; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
builddir=../../../builder/componentbuild | ||
component=gallery-busyoverlay | ||
component.jsfiles=BusyOverlay.js | ||
component.requires=plugin,node-pluginhost,node-screen,node-style | ||
#component.supersedes= | ||
#component.optional= | ||
component.skinnable=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project name="Accordion" default="local"> | ||
<description>Accordion build file</description> | ||
<property file="build.properties" /> | ||
<import file="${builddir}/3.x/bootstrap.xml" /> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
/********************************************************************** | ||
* A plugin for Y.Node or Y.Widget that creates an overlaying div. | ||
* Especially useful for a widget that is waiting for an AJAX response. | ||
* | ||
* @module gallery-busyoverlay | ||
* @namespace Plugin | ||
* @class BusyOverlay | ||
* @extends Plugin.Base | ||
*/ | ||
function BusyOverlayPlugin(config) | ||
{ | ||
BusyOverlayPlugin.superclass.constructor.apply(this, arguments); | ||
} | ||
|
||
BusyOverlayPlugin.NAME = "BusyOverlayPlugin"; | ||
BusyOverlayPlugin.NS = "busy"; | ||
|
||
BusyOverlayPlugin.ATTRS = | ||
{ | ||
/** | ||
* CSS class to apply to the overlay. | ||
* | ||
* @config css | ||
* @type {String} | ||
* @default "yui3-component-busy" | ||
*/ | ||
css: | ||
{ | ||
value: 'yui3-component-busy', | ||
validator: Y.Lang.isString | ||
} | ||
}; | ||
|
||
function resizeOverlay() | ||
{ | ||
var r = this.getTargetNode().get('region'); | ||
if (r && | ||
(!this.target_region || | ||
r.top !== this.target_region.top || | ||
r.bottom !== this.target_region.bottom || | ||
r.left !== this.target_region.left || | ||
r.right !== this.target_region.right)) | ||
{ | ||
this.target_region = r; | ||
|
||
this.o.setXY([r.left, r.top]); | ||
this.o.setStyle('width', r.width + 'px'); | ||
this.o.setStyle('height', r.height + 'px'); | ||
} | ||
} | ||
|
||
Y.extend(BusyOverlayPlugin, Y.Plugin.Base, | ||
{ | ||
initializer: function(config) | ||
{ | ||
this.o = Y.Node.create('<div style="position:absolute;display:none;visibility:hidden;"></div>'); | ||
this.o.set('className', this.get('css')); | ||
this.getTargetNode().get('parentNode').appendChild(this.o); | ||
|
||
this.on('cssChange', function(e) | ||
{ | ||
this.o.set('className', e.newVal); | ||
}); | ||
}, | ||
|
||
destructor: function() | ||
{ | ||
this.o.remove(); | ||
}, | ||
|
||
/** | ||
* @return {Boolean} true if the overlay is visible | ||
*/ | ||
isVisible: function() | ||
{ | ||
return (this.o.getStyle('visibility') != 'hidden'); | ||
}, | ||
|
||
/** | ||
* Show the overlay. | ||
*/ | ||
show: function() | ||
{ | ||
this.setVisible(true); | ||
}, | ||
|
||
/** | ||
* Hide the overlay. | ||
*/ | ||
hide: function() | ||
{ | ||
this.setVisible(false); | ||
}, | ||
|
||
/** | ||
* Toggle the visibility of the overlay. | ||
*/ | ||
toggleVisible: function() | ||
{ | ||
this.setVisible(!this.isVisible()); | ||
}, | ||
|
||
/** | ||
* Set the visibility of the overlay. | ||
* | ||
* @param visible {Boolean} | ||
*/ | ||
setVisible: function( | ||
/* boolean */ visible) | ||
{ | ||
this.target_region = null; | ||
|
||
this.o.setStyle('display', (visible ? '' : 'none')); | ||
resizeOverlay.call(this); | ||
this.o.setStyle('visibility', (visible ? '' : 'hidden')); | ||
|
||
if (visible) | ||
{ | ||
if (!this.timer) | ||
{ | ||
this.timer = Y.later(500, this, resizeOverlay, null, true); | ||
} | ||
|
||
this.getTargetNode().addClass('yui3-busyoverlay-browser-hacks'); | ||
} | ||
else | ||
{ | ||
if (this.timer) | ||
{ | ||
this.timer.cancel(); | ||
this.timer = null; | ||
} | ||
|
||
this.getTargetNode().removeClass('yui3-busyoverlay-browser-hacks'); | ||
} | ||
}, | ||
|
||
/** | ||
* @return {Node} node to overlay | ||
*/ | ||
getTargetNode: function() | ||
{ | ||
var host = this.get('host'); | ||
return (Y.Widget && host instanceof Y.Widget ? host.get('boundingBox') : host); | ||
} | ||
}); | ||
|
||
Y.namespace("Plugin"); | ||
Y.Plugin.BusyOverlay = BusyOverlayPlugin; |