merging new yui
BIN
www/extras/layout_sprite.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
114
www/extras/resize-skin.css
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
/*
|
||||
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 2.5.0
|
||||
*/
|
||||
/* Give the handle a background color */
|
||||
.yui-resize .yui-resize-handle {
|
||||
/*background-color: #0000FF;*/
|
||||
}
|
||||
/* Give the active handle a different color */
|
||||
.yui-resize .yui-resize-handle-active {
|
||||
background-color: #7D98B8;
|
||||
zoom: 1;
|
||||
}
|
||||
/* Give a border to the 8-way knob style handles */
|
||||
.yui-resize-knob .yui-resize-handle {
|
||||
border: 1px solid #808080;
|
||||
}
|
||||
/* Show the active handle when hovered */
|
||||
.yui-resize-hover .yui-resize-handle-active {
|
||||
opacity: 1;
|
||||
filter: alpha(opacity=100);
|
||||
}
|
||||
|
||||
/* Style the resize proxy */
|
||||
.yui-resize-proxy {
|
||||
border: 1px dashed #426FD9;
|
||||
}
|
||||
|
||||
/* Style the status box similar to a tooltip */
|
||||
.yui-resize-status {
|
||||
border: 1px solid #A6982B;
|
||||
border-top: 1px solid #D4C237;
|
||||
background-color: #FFEE69
|
||||
}
|
||||
|
||||
|
||||
/* Style the content of the status box */
|
||||
.yui-resize-status strong, .yui-resize-status em {
|
||||
float: left;
|
||||
display: block;
|
||||
clear: both;
|
||||
padding: 1px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Setup the gripper */
|
||||
.yui-resize .yui-resize-handle-inner-r,
|
||||
.yui-resize .yui-resize-handle-inner-l {
|
||||
background: transparent url( layout_sprite.png) no-repeat 0 -5px;
|
||||
height: 16px;
|
||||
width: 5px;
|
||||
position: absolute;
|
||||
top: 45%;
|
||||
}
|
||||
|
||||
/* Setup the gripper */
|
||||
.yui-resize .yui-resize-handle-inner-t,
|
||||
.yui-resize .yui-resize-handle-inner-b {
|
||||
background: transparent url(layout_sprite.png) no-repeat -20px 0;
|
||||
height: 5px;
|
||||
width: 16px;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
}
|
||||
|
||||
/* Bottom Right Gripper */
|
||||
.yui-resize .yui-resize-handle-br {
|
||||
background-image: url( layout_sprite.png );
|
||||
background-repeat: no-repeat;
|
||||
background-position: -22px -62px;
|
||||
}
|
||||
|
||||
/* Top Right Gripper */
|
||||
.yui-resize .yui-resize-handle-tr {
|
||||
background-image: url( layout_sprite.png );
|
||||
background-repeat: no-repeat;
|
||||
background-position: -22px -42px;
|
||||
}
|
||||
|
||||
/* Top Left Gripper */
|
||||
.yui-resize .yui-resize-handle-tl {
|
||||
background-image: url( layout_sprite.png );
|
||||
background-repeat: no-repeat;
|
||||
background-position: -22px -82px;
|
||||
}
|
||||
|
||||
/* Bottom Left Gripper */
|
||||
.yui-resize .yui-resize-handle-bl {
|
||||
background-image: url( layout_sprite.png );
|
||||
background-repeat: no-repeat;
|
||||
background-position: -22px -23px;
|
||||
}
|
||||
|
||||
/* Remove the background image from the 8-way knobs */
|
||||
.yui-resize-knob .yui-resize-handle-t,
|
||||
.yui-resize-knob .yui-resize-handle-r,
|
||||
.yui-resize-knob .yui-resize-handle-b,
|
||||
.yui-resize-knob .yui-resize-handle-l,
|
||||
.yui-resize-knob .yui-resize-handle-tl,
|
||||
.yui-resize-knob .yui-resize-handle-tr,
|
||||
.yui-resize-knob .yui-resize-handle-bl,
|
||||
.yui-resize-knob .yui-resize-handle-br,
|
||||
.yui-resize-knob .yui-resize-handle-inner-t,
|
||||
.yui-resize-knob .yui-resize-handle-inner-r,
|
||||
.yui-resize-knob .yui-resize-handle-inner-b,
|
||||
.yui-resize-knob .yui-resize-handle-inner-l,
|
||||
.yui-resize-knob .yui-resize-handle-inner-tl,
|
||||
.yui-resize-knob .yui-resize-handle-inner-tr,
|
||||
.yui-resize-knob .yui-resize-handle-inner-bl,
|
||||
.yui-resize-knob .yui-resize-handle-inner-br {
|
||||
background-image: none;
|
||||
}
|
||||
7
www/extras/resize.css
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
/*
|
||||
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 2.5.0
|
||||
*/
|
||||
.yui-resize{position:relative;zoom:1;z-index:0;}.yui-resize-wrap{zoom:1;}.yui-draggable{cursor:move;}.yui-resize .yui-resize-handle{position:absolute;z-index:1;font-size:0;margin:0;padding:0;zoom:1;height:1px;width:1px;}.yui-resize .yui-resize-handle-br{height:5px;width:5px;bottom:0;right:0;cursor:se-resize;z-index:2;zoom:1;}.yui-resize .yui-resize-handle-bl{height:5px;width:5px;bottom:0;left:0;cursor:sw-resize;z-index:2;zoom:1;}.yui-resize .yui-resize-handle-tl{height:5px;width:5px;top:0;left:0;cursor:nw-resize;z-index:2;zoom:1;}.yui-resize .yui-resize-handle-tr{height:5px;width:5px;top:0;right:0;cursor:ne-resize;z-index:2;zoom:1;}.yui-resize .yui-resize-handle-r{width:5px;height:100%;top:0;right:0;cursor:e-resize;zoom:1;}.yui-resize .yui-resize-handle-l{height:100%;width:5px;top:0;left:0;cursor:w-resize;zoom:1;}.yui-resize .yui-resize-handle-b{width:100%;height:5px;bottom:0;right:0;cursor:s-resize;zoom:1;}.yui-resize .yui-resize-handle-t{width:100%;height:5px;top:0;right:0;cursor:n-resize;zoom:1;}.yui-resize-proxy{position:absolute;border:1px dashed #000;visibility:hidden;z-index:1000;}.yui-resize-hover .yui-resize-handle,.yui-resize-hidden .yui-resize-handle{opacity:0;filter:alpha(opacity=0);}.yui-resize-ghost{opacity:.5;filter:alpha(opacity=50);}.yui-resize-knob .yui-resize-handle{height:6px;width:6px;}.yui-resize-knob .yui-resize-handle-tr{right:-3px;top:-3px;}.yui-resize-knob .yui-resize-handle-tl{left:-3px;top:-3px;}.yui-resize-knob .yui-resize-handle-bl{left:-3px;bottom:-3px;}.yui-resize-knob .yui-resize-handle-br{right:-3px;bottom:-3px;}.yui-resize-knob .yui-resize-handle-t{left:45%;top:-3px;}.yui-resize-knob .yui-resize-handle-r{right:-3px;top:45%;}.yui-resize-knob .yui-resize-handle-l{left:-3px;top:45%;}.yui-resize-knob .yui-resize-handle-b{left:45%;bottom:-3px;}.yui-resize-status{position:absolute;top:-999px;left:-999px;padding:2px;font-size:80%;display:none;zoom:1;z-index:9999;}.yui-resize-status strong,.yui-resize-status em{font-weight:normal;font-style:normal;padding:1px;zoom:1;}.yui-resize .yui-resize-handle{background-color:#F2F2F2;}.yui-resize .yui-resize-handle-active{background-color:#7D98B8;zoom:1;}.yui-resize-knob .yui-resize-handle{border:1px solid #808080;}.yui-resize-hover .yui-resize-handle-active{opacity:1;filter:alpha(opacity=100);}.yui-resize-proxy{border:1px dashed #426FD9;}.yui-resize-status{border:1px solid #A6982B;border-top:1px solid #D4C237;background-color:#FFEE69}.yui-resize-status strong,.yui-resize-status em{float:left;display:block;clear:both;padding:1px;text-align:center;}.yui-resize .yui-resize-handle-inner-r,.yui-resize .yui-resize-handle-inner-l{background:transparent url( layout_sprite.png) no-repeat 0 -5px;height:16px;width:5px;position:absolute;top:45%;}.yui-resize .yui-resize-handle-inner-t,.yui-resize .yui-resize-handle-inner-b{background:transparent url(layout_sprite.png) no-repeat -20px 0;height:5px;width:16px;position:absolute;left:50%;}.yui-resize .yui-resize-handle-br{background-image:url( layout_sprite.png );background-repeat:no-repeat;background-position:-22px -62px;}.yui-resize .yui-resize-handle-tr{background-image:url( layout_sprite.png );background-repeat:no-repeat;background-position:-22px -42px;}.yui-resize .yui-resize-handle-tl{background-image:url( layout_sprite.png );background-repeat:no-repeat;background-position:-22px -82px;}.yui-resize .yui-resize-handle-bl{background-image:url( layout_sprite.png );background-repeat:no-repeat;background-position:-22px -23px;}.yui-resize-knob .yui-resize-handle-t,.yui-resize-knob .yui-resize-handle-r,.yui-resize-knob .yui-resize-handle-b,.yui-resize-knob .yui-resize-handle-l,.yui-resize-knob .yui-resize-handle-tl,.yui-resize-knob .yui-resize-handle-tr,.yui-resize-knob .yui-resize-handle-bl,.yui-resize-knob .yui-resize-handle-br,.yui-resize-knob .yui-resize-handle-inner-t,.yui-resize-knob .yui-resize-handle-inner-r,.yui-resize-knob .yui-resize-handle-inner-b,.yui-resize-knob .yui-resize-handle-inner-l,.yui-resize-knob .yui-resize-handle-inner-tl,.yui-resize-knob .yui-resize-handle-inner-tr,.yui-resize-knob .yui-resize-handle-inner-bl,.yui-resize-knob .yui-resize-handle-inner-br{background-image:none;}
|
||||
|
|
@ -1,208 +0,0 @@
|
|||
YUI Library Release Notes
|
||||
|
||||
*** version 2.2.2 ***
|
||||
|
||||
This update contains general fixes to the YUI library. Please see the
|
||||
README file for each component in the build directory for specific updates since
|
||||
version 2.2.1.
|
||||
|
||||
*** version 2.2.1 ***
|
||||
|
||||
This update contains general fixes to the YUI library. Please see the
|
||||
README file for each component in the build directory for specific updates since
|
||||
version 2.2.0.
|
||||
|
||||
*** version 2.2.0 ***
|
||||
|
||||
This release synchronizes the SourceForge version with Yahoo!'s version of YUI
|
||||
-- version number 2.2.0. Please see the following blog article for information
|
||||
on this specific version increment at:
|
||||
http://www.yuiblog.com/blog/2007/02/20/yui-220-released
|
||||
|
||||
The following new components are introduced with this release:
|
||||
|
||||
* Button
|
||||
* DataTable
|
||||
* Browser History Manager
|
||||
|
||||
The following components are now available as utilities:
|
||||
|
||||
* Element
|
||||
* DataSource
|
||||
|
||||
These new components are introduced as "beta", with the exception of Browser
|
||||
History Manager as an experimental component. Please see the YUI FAQ on the
|
||||
definition of beta and experimental at:
|
||||
http://developer.yahoo.com/yui/articles/faq/#beta
|
||||
|
||||
* CSS customizations *
|
||||
Calendar, Container, and Menu have been revised to allow image customizations
|
||||
through their respective CSS files. Please refer to each component's README to
|
||||
see the full details on affected properties.
|
||||
|
||||
Additional details for fixes and updates can be found in the README files for
|
||||
each updated component. All YUI API cheatsheets have been updated for the
|
||||
current version and can be found at: yui/docs/assets/cheatsheets.zip.
|
||||
|
||||
*** version 0.12.2 ***
|
||||
|
||||
This update contains general fixes to the YUI library. Please see the
|
||||
README file for each component in the build directory for specific updates since
|
||||
version 0.12.1. As part of the 0.12.2 update, a number of corrections have been
|
||||
made to functional examples that were configured incorrectly in 0.12.1.
|
||||
|
||||
*** version 0.12.1 ***
|
||||
|
||||
This update contains general fixes to the YUI library. Please see the
|
||||
README file for each component in the build directory for specific updates since
|
||||
version 0.12.0.
|
||||
|
||||
Beginning with this release, all YUI minification will be performed with JSMin(
|
||||
http://www.crockford.com/javascript/jsmin.html). Line breaks will be preserved.
|
||||
|
||||
*** version 0.12.0 ***
|
||||
|
||||
This version introduces the Tabview widget as well as general fixes to the YUI
|
||||
library. Additional details can be found in the README files for each updated
|
||||
component. All YUI API cheatsheets have been updated for the current version
|
||||
and can be found at: yui/docs/assets/cheatsheets.zip.
|
||||
|
||||
* documentation *
|
||||
The YUI API documentation format is revised with this release. This new
|
||||
format -- now a flat file structure under yui/docs/ -- implements the YUI
|
||||
AutoComplete widget on the main landing page to allow keyword searching of YUI.
|
||||
It also contains the full API documentation for all YUI components along with
|
||||
the following categories of data for each component(if applicable):
|
||||
|
||||
* Inheritance hierarchy for extensions and subclasses.
|
||||
* YUI dependencies
|
||||
* Properties and methods
|
||||
* Events
|
||||
* Configuration attributes.
|
||||
|
||||
* concatenated files *
|
||||
For convenience, three additional, minified variations of YUI are now available
|
||||
for your use:
|
||||
|
||||
* reset-fonts-grids.css
|
||||
* yahoo-dom-event.js
|
||||
* utilities.js
|
||||
|
||||
* API changes *
|
||||
There are interface changes to the Calendar widget. Please see the 0.12.0
|
||||
Calendar upgrade guide at http:// developer.yahoo.com/yui/calendar/upgrade.html
|
||||
to see if this update affects your Calendar implementation and instructions on
|
||||
upgrading to version 0.12.0.
|
||||
|
||||
|
||||
*** version 0.11.4 ***
|
||||
|
||||
This update contains some priority bug fixes to the following components:
|
||||
|
||||
* Yahoo
|
||||
* Container
|
||||
* Drag and Drop
|
||||
* Event
|
||||
|
||||
Additional details can be found in the README files for each updated component.
|
||||
|
||||
*** version 0.11.3 ***
|
||||
|
||||
This update contains general fixes to the YUI library. Please see the
|
||||
README file for each component in the build directory for updates and fixes
|
||||
since version 0.11.2.
|
||||
|
||||
*** version 0.11.2 ***
|
||||
|
||||
This update contains a high-priority fix to Drag and Drop that prevents text
|
||||
selection. Additional details can be found in the README file for:
|
||||
|
||||
* Drag and Drop
|
||||
|
||||
*** version 0.11.1 ***
|
||||
|
||||
Release 0.11.1 addresses some high-priority bugs reported in the recently
|
||||
released version 0.11.0. Additional details can be found in the README files for
|
||||
each updated component:
|
||||
|
||||
* Animation
|
||||
* Dom
|
||||
* Drag and Drop
|
||||
* Connection Manager
|
||||
* Container
|
||||
|
||||
*** version 0.11.0 ***
|
||||
|
||||
This version introduces the Logger widget. The YUI cheatsheets for version
|
||||
0.11.0 and 0.10.0 are also included in this distribution under docs/assets.
|
||||
|
||||
Please see the README file for each component in the build directory for
|
||||
updates and fixes since version 0.10.0.
|
||||
|
||||
*** version 0.10.0 ***
|
||||
|
||||
In this release, the directory structure has been modified to provide more
|
||||
component organization. This is the new format:
|
||||
|
||||
yui/
|
||||
|
|
||||
-- build/
|
||||
| |
|
||||
| -- dom/
|
||||
| |
|
||||
| | -- assets/
|
||||
| |
|
||||
| | -- dom.js
|
||||
| |
|
||||
-- docs/
|
||||
| |
|
||||
| -- dom/
|
||||
| |
|
||||
-- examples/
|
||||
| |
|
||||
| -- dom/
|
||||
| |
|
||||
| | -- img/
|
||||
|
||||
Notice there are three immediate directories under the
|
||||
root YUI. They are:
|
||||
|
||||
*build/*
|
||||
This directory contains the source files for each YUI component, and each
|
||||
component is presented as a sub-directory under build/. Notice that there are
|
||||
generally two source files: component.js and component-min.js. The "component"
|
||||
source is the raw, commented build and "component-min" is the minified version
|
||||
of the same file with comments and whitespace removed. With some components,
|
||||
there is an assets sub-directory. CSS and image dependencies for each
|
||||
component are stored in its assets sub-directory.
|
||||
|
||||
Note: If a component makes use of images, the image source path in the
|
||||
component's CSS file will point to Akamai. The physical images are also
|
||||
available in the assets/ directory for local availability. Please modify the
|
||||
CSS image references if you wish to use your own image assets.
|
||||
|
||||
*docs/*
|
||||
This directory contains the jsdoc-generated API reference for every YUI
|
||||
component. Each component is presented as a sub-directory under docs/.
|
||||
|
||||
*examples/*
|
||||
This directory contains functional examples for each component in the YUI
|
||||
Library. The examples are not part of the formal distribution; rather,
|
||||
they provide demonstrations of each component in use. Each example uses YUI
|
||||
Library source files from the build/ directory, while all example-specific
|
||||
dependencies are stored in sub-directories (e.g. examples/dom/img).
|
||||
Some components, including the AutoComplete Control and Connection Manager,
|
||||
make use of PHP to implement certain examples.
|
||||
|
||||
For example:
|
||||
In yui/examples/dom, the dom.js source file and all YUI .js dependencies
|
||||
are drawn from yui/build/ directories. All other example-specific sources are
|
||||
stored as sub-directories: yui/examples/dom/css and yui/examples/dom/img.
|
||||
|
||||
Each functional example is also available and functional on
|
||||
developer.yahoo.com/yui/. They reproduced here as part of the distribution
|
||||
for your convenience.
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
Animation Release Notes
|
||||
|
||||
*** version 2.2.2 **
|
||||
|
||||
* no change
|
||||
|
||||
*** version 2.2.1 **
|
||||
|
||||
* no change
|
||||
|
||||
*** version 2.2.0 **
|
||||
|
||||
* Fixed AnimMgr.stop() when called without tween
|
||||
|
||||
*** version 0.12.2 ***
|
||||
|
||||
* raised AnimMgr.fps to 1000
|
||||
|
||||
*** version 0.12.1 ***
|
||||
* minified version no longer strips line breaks
|
||||
|
||||
*** version 0.12.0 ***
|
||||
|
||||
* added boolean finish argument to Anim.stop()
|
||||
|
||||
*** version 0.11.3 ***
|
||||
|
||||
* no changes
|
||||
|
||||
*** version 0.11.1 ***
|
||||
|
||||
* changed "prototype" shorthand to "proto" (workaround firefox < 1.5 scoping
|
||||
bug)
|
||||
|
||||
*** version 0.11.0 ***
|
||||
|
||||
* ColorAnim subclass added
|
||||
* Motion and Scroll now inherit from ColorAnim
|
||||
* getDefaultUnit method added
|
||||
* defaultUnit and defaultUnits deprecated
|
||||
* getDefault and setDefault methods deprecated
|
||||
|
||||
*** version 0.10.0 ***
|
||||
|
||||
* Scroll now handles relative ("by") animation correctly
|
||||
|
||||
* Now converts "auto" values of "from" to appropriate initial values
|
||||
|
||||
*** version 0.9.0 ***
|
||||
|
||||
* Initial release
|
||||
|
||||
|
||||
1355
www/extras/yui/build/animation/animation-debug.js
vendored
75
www/extras/yui/build/animation/animation-min.js
vendored
|
|
@ -1,75 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 2.2.2
|
||||
*/
|
||||
|
||||
YAHOO.util.Anim=function(el,attributes,duration,method){if(el){this.init(el,attributes,duration,method);}};YAHOO.util.Anim.prototype={toString:function(){var el=this.getEl();var id=el.id||el.tagName;return("Anim "+id);},patterns:{noNegatives:/width|height|opacity|padding/i,offsetAttribute:/^((width|height)|(top|left))$/,defaultUnit:/width|height|top$|bottom$|left$|right$/i,offsetUnit:/\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i},doMethod:function(attr,start,end){return this.method(this.currentFrame,start,end-start,this.totalFrames);},setAttribute:function(attr,val,unit){if(this.patterns.noNegatives.test(attr)){val=(val>0)?val:0;}
|
||||
YAHOO.util.Dom.setStyle(this.getEl(),attr,val+unit);},getAttribute:function(attr){var el=this.getEl();var val=YAHOO.util.Dom.getStyle(el,attr);if(val!=='auto'&&!this.patterns.offsetUnit.test(val)){return parseFloat(val);}
|
||||
var a=this.patterns.offsetAttribute.exec(attr)||[];var pos=!!(a[3]);var box=!!(a[2]);if(box||(YAHOO.util.Dom.getStyle(el,'position')=='absolute'&&pos)){val=el['offset'+a[0].charAt(0).toUpperCase()+a[0].substr(1)];}else{val=0;}
|
||||
return val;},getDefaultUnit:function(attr){if(this.patterns.defaultUnit.test(attr)){return'px';}
|
||||
return'';},setRuntimeAttribute:function(attr){var start;var end;var attributes=this.attributes;this.runtimeAttributes[attr]={};var isset=function(prop){return(typeof prop!=='undefined');};if(!isset(attributes[attr]['to'])&&!isset(attributes[attr]['by'])){return false;}
|
||||
start=(isset(attributes[attr]['from']))?attributes[attr]['from']:this.getAttribute(attr);if(isset(attributes[attr]['to'])){end=attributes[attr]['to'];}else if(isset(attributes[attr]['by'])){if(start.constructor==Array){end=[];for(var i=0,len=start.length;i<len;++i){end[i]=start[i]+attributes[attr]['by'][i];}}else{end=start+attributes[attr]['by'];}}
|
||||
this.runtimeAttributes[attr].start=start;this.runtimeAttributes[attr].end=end;this.runtimeAttributes[attr].unit=(isset(attributes[attr].unit))?attributes[attr]['unit']:this.getDefaultUnit(attr);},init:function(el,attributes,duration,method){var isAnimated=false;var startTime=null;var actualFrames=0;el=YAHOO.util.Dom.get(el);this.attributes=attributes||{};this.duration=duration||1;this.method=method||YAHOO.util.Easing.easeNone;this.useSeconds=true;this.currentFrame=0;this.totalFrames=YAHOO.util.AnimMgr.fps;this.getEl=function(){return el;};this.isAnimated=function(){return isAnimated;};this.getStartTime=function(){return startTime;};this.runtimeAttributes={};this.animate=function(){if(this.isAnimated()){return false;}
|
||||
this.currentFrame=0;this.totalFrames=(this.useSeconds)?Math.ceil(YAHOO.util.AnimMgr.fps*this.duration):this.duration;YAHOO.util.AnimMgr.registerElement(this);};this.stop=function(finish){if(finish){this.currentFrame=this.totalFrames;this._onTween.fire();}
|
||||
YAHOO.util.AnimMgr.stop(this);};var onStart=function(){this.onStart.fire();this.runtimeAttributes={};for(var attr in this.attributes){this.setRuntimeAttribute(attr);}
|
||||
isAnimated=true;actualFrames=0;startTime=new Date();};var onTween=function(){var data={duration:new Date()-this.getStartTime(),currentFrame:this.currentFrame};data.toString=function(){return('duration: '+data.duration+', currentFrame: '+data.currentFrame);};this.onTween.fire(data);var runtimeAttributes=this.runtimeAttributes;for(var attr in runtimeAttributes){this.setAttribute(attr,this.doMethod(attr,runtimeAttributes[attr].start,runtimeAttributes[attr].end),runtimeAttributes[attr].unit);}
|
||||
actualFrames+=1;};var onComplete=function(){var actual_duration=(new Date()-startTime)/1000;var data={duration:actual_duration,frames:actualFrames,fps:actualFrames/actual_duration};data.toString=function(){return('duration: '+data.duration+', frames: '+data.frames+', fps: '+data.fps);};isAnimated=false;actualFrames=0;this.onComplete.fire(data);};this._onStart=new YAHOO.util.CustomEvent('_start',this,true);this.onStart=new YAHOO.util.CustomEvent('start',this);this.onTween=new YAHOO.util.CustomEvent('tween',this);this._onTween=new YAHOO.util.CustomEvent('_tween',this,true);this.onComplete=new YAHOO.util.CustomEvent('complete',this);this._onComplete=new YAHOO.util.CustomEvent('_complete',this,true);this._onStart.subscribe(onStart);this._onTween.subscribe(onTween);this._onComplete.subscribe(onComplete);}};YAHOO.util.AnimMgr=new function(){var thread=null;var queue=[];var tweenCount=0;this.fps=1000;this.delay=1;this.registerElement=function(tween){queue[queue.length]=tween;tweenCount+=1;tween._onStart.fire();this.start();};this.unRegister=function(tween,index){tween._onComplete.fire();index=index||getIndex(tween);if(index!=-1){queue.splice(index,1);}
|
||||
tweenCount-=1;if(tweenCount<=0){this.stop();}};this.start=function(){if(thread===null){thread=setInterval(this.run,this.delay);}};this.stop=function(tween){if(!tween){clearInterval(thread);for(var i=0,len=queue.length;i<len;++i){if(queue[0].isAnimated()){this.unRegister(queue[0],0);}}
|
||||
queue=[];thread=null;tweenCount=0;}
|
||||
else{this.unRegister(tween);}};this.run=function(){for(var i=0,len=queue.length;i<len;++i){var tween=queue[i];if(!tween||!tween.isAnimated()){continue;}
|
||||
if(tween.currentFrame<tween.totalFrames||tween.totalFrames===null)
|
||||
{tween.currentFrame+=1;if(tween.useSeconds){correctFrame(tween);}
|
||||
tween._onTween.fire();}
|
||||
else{YAHOO.util.AnimMgr.stop(tween,i);}}};var getIndex=function(anim){for(var i=0,len=queue.length;i<len;++i){if(queue[i]==anim){return i;}}
|
||||
return-1;};var correctFrame=function(tween){var frames=tween.totalFrames;var frame=tween.currentFrame;var expected=(tween.currentFrame*tween.duration*1000/tween.totalFrames);var elapsed=(new Date()-tween.getStartTime());var tweak=0;if(elapsed<tween.duration*1000){tweak=Math.round((elapsed/expected-1)*tween.currentFrame);}else{tweak=frames-(frame+1);}
|
||||
if(tweak>0&&isFinite(tweak)){if(tween.currentFrame+tweak>=frames){tweak=frames-(frame+1);}
|
||||
tween.currentFrame+=tweak;}};};YAHOO.util.Bezier=new function(){this.getPosition=function(points,t){var n=points.length;var tmp=[];for(var i=0;i<n;++i){tmp[i]=[points[i][0],points[i][1]];}
|
||||
for(var j=1;j<n;++j){for(i=0;i<n-j;++i){tmp[i][0]=(1-t)*tmp[i][0]+t*tmp[parseInt(i+1,10)][0];tmp[i][1]=(1-t)*tmp[i][1]+t*tmp[parseInt(i+1,10)][1];}}
|
||||
return[tmp[0][0],tmp[0][1]];};};(function(){YAHOO.util.ColorAnim=function(el,attributes,duration,method){YAHOO.util.ColorAnim.superclass.constructor.call(this,el,attributes,duration,method);};YAHOO.extend(YAHOO.util.ColorAnim,YAHOO.util.Anim);var Y=YAHOO.util;var superclass=Y.ColorAnim.superclass;var proto=Y.ColorAnim.prototype;proto.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("ColorAnim "+id);};proto.patterns.color=/color$/i;proto.patterns.rgb=/^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i;proto.patterns.hex=/^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i;proto.patterns.hex3=/^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i;proto.patterns.transparent=/^transparent|rgba\(0, 0, 0, 0\)$/;proto.parseColor=function(s){if(s.length==3){return s;}
|
||||
var c=this.patterns.hex.exec(s);if(c&&c.length==4){return[parseInt(c[1],16),parseInt(c[2],16),parseInt(c[3],16)];}
|
||||
c=this.patterns.rgb.exec(s);if(c&&c.length==4){return[parseInt(c[1],10),parseInt(c[2],10),parseInt(c[3],10)];}
|
||||
c=this.patterns.hex3.exec(s);if(c&&c.length==4){return[parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16),parseInt(c[3]+c[3],16)];}
|
||||
return null;};proto.getAttribute=function(attr){var el=this.getEl();if(this.patterns.color.test(attr)){var val=YAHOO.util.Dom.getStyle(el,attr);if(this.patterns.transparent.test(val)){var parent=el.parentNode;val=Y.Dom.getStyle(parent,attr);while(parent&&this.patterns.transparent.test(val)){parent=parent.parentNode;val=Y.Dom.getStyle(parent,attr);if(parent.tagName.toUpperCase()=='HTML'){val='#fff';}}}}else{val=superclass.getAttribute.call(this,attr);}
|
||||
return val;};proto.doMethod=function(attr,start,end){var val;if(this.patterns.color.test(attr)){val=[];for(var i=0,len=start.length;i<len;++i){val[i]=superclass.doMethod.call(this,attr,start[i],end[i]);}
|
||||
val='rgb('+Math.floor(val[0])+','+Math.floor(val[1])+','+Math.floor(val[2])+')';}
|
||||
else{val=superclass.doMethod.call(this,attr,start,end);}
|
||||
return val;};proto.setRuntimeAttribute=function(attr){superclass.setRuntimeAttribute.call(this,attr);if(this.patterns.color.test(attr)){var attributes=this.attributes;var start=this.parseColor(this.runtimeAttributes[attr].start);var end=this.parseColor(this.runtimeAttributes[attr].end);if(typeof attributes[attr]['to']==='undefined'&&typeof attributes[attr]['by']!=='undefined'){end=this.parseColor(attributes[attr].by);for(var i=0,len=start.length;i<len;++i){end[i]=start[i]+end[i];}}
|
||||
this.runtimeAttributes[attr].start=start;this.runtimeAttributes[attr].end=end;}};})();YAHOO.util.Easing={easeNone:function(t,b,c,d){return c*t/d+b;},easeIn:function(t,b,c,d){return c*(t/=d)*t+b;},easeOut:function(t,b,c,d){return-c*(t/=d)*(t-2)+b;},easeBoth:function(t,b,c,d){if((t/=d/2)<1){return c/2*t*t+b;}
|
||||
return-c/2*((--t)*(t-2)-1)+b;},easeInStrong:function(t,b,c,d){return c*(t/=d)*t*t*t+b;},easeOutStrong:function(t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b;},easeBothStrong:function(t,b,c,d){if((t/=d/2)<1){return c/2*t*t*t*t+b;}
|
||||
return-c/2*((t-=2)*t*t*t-2)+b;},elasticIn:function(t,b,c,d,a,p){if(t==0){return b;}
|
||||
if((t/=d)==1){return b+c;}
|
||||
if(!p){p=d*.3;}
|
||||
if(!a||a<Math.abs(c)){a=c;var s=p/4;}
|
||||
else{var s=p/(2*Math.PI)*Math.asin(c/a);}
|
||||
return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;},elasticOut:function(t,b,c,d,a,p){if(t==0){return b;}
|
||||
if((t/=d)==1){return b+c;}
|
||||
if(!p){p=d*.3;}
|
||||
if(!a||a<Math.abs(c)){a=c;var s=p/4;}
|
||||
else{var s=p/(2*Math.PI)*Math.asin(c/a);}
|
||||
return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b;},elasticBoth:function(t,b,c,d,a,p){if(t==0){return b;}
|
||||
if((t/=d/2)==2){return b+c;}
|
||||
if(!p){p=d*(.3*1.5);}
|
||||
if(!a||a<Math.abs(c)){a=c;var s=p/4;}
|
||||
else{var s=p/(2*Math.PI)*Math.asin(c/a);}
|
||||
if(t<1){return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;}
|
||||
return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b;},backIn:function(t,b,c,d,s){if(typeof s=='undefined'){s=1.70158;}
|
||||
return c*(t/=d)*t*((s+1)*t-s)+b;},backOut:function(t,b,c,d,s){if(typeof s=='undefined'){s=1.70158;}
|
||||
return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b;},backBoth:function(t,b,c,d,s){if(typeof s=='undefined'){s=1.70158;}
|
||||
if((t/=d/2)<1){return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;}
|
||||
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b;},bounceIn:function(t,b,c,d){return c-YAHOO.util.Easing.bounceOut(d-t,0,c,d)+b;},bounceOut:function(t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b;}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b;}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b;}
|
||||
return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b;},bounceBoth:function(t,b,c,d){if(t<d/2){return YAHOO.util.Easing.bounceIn(t*2,0,c,d)*.5+b;}
|
||||
return YAHOO.util.Easing.bounceOut(t*2-d,0,c,d)*.5+c*.5+b;}};(function(){YAHOO.util.Motion=function(el,attributes,duration,method){if(el){YAHOO.util.Motion.superclass.constructor.call(this,el,attributes,duration,method);}};YAHOO.extend(YAHOO.util.Motion,YAHOO.util.ColorAnim);var Y=YAHOO.util;var superclass=Y.Motion.superclass;var proto=Y.Motion.prototype;proto.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("Motion "+id);};proto.patterns.points=/^points$/i;proto.setAttribute=function(attr,val,unit){if(this.patterns.points.test(attr)){unit=unit||'px';superclass.setAttribute.call(this,'left',val[0],unit);superclass.setAttribute.call(this,'top',val[1],unit);}else{superclass.setAttribute.call(this,attr,val,unit);}};proto.getAttribute=function(attr){if(this.patterns.points.test(attr)){var val=[superclass.getAttribute.call(this,'left'),superclass.getAttribute.call(this,'top')];}else{val=superclass.getAttribute.call(this,attr);}
|
||||
return val;};proto.doMethod=function(attr,start,end){var val=null;if(this.patterns.points.test(attr)){var t=this.method(this.currentFrame,0,100,this.totalFrames)/100;val=Y.Bezier.getPosition(this.runtimeAttributes[attr],t);}else{val=superclass.doMethod.call(this,attr,start,end);}
|
||||
return val;};proto.setRuntimeAttribute=function(attr){if(this.patterns.points.test(attr)){var el=this.getEl();var attributes=this.attributes;var start;var control=attributes['points']['control']||[];var end;var i,len;if(control.length>0&&!(control[0]instanceof Array)){control=[control];}else{var tmp=[];for(i=0,len=control.length;i<len;++i){tmp[i]=control[i];}
|
||||
control=tmp;}
|
||||
if(Y.Dom.getStyle(el,'position')=='static'){Y.Dom.setStyle(el,'position','relative');}
|
||||
if(isset(attributes['points']['from'])){Y.Dom.setXY(el,attributes['points']['from']);}
|
||||
else{Y.Dom.setXY(el,Y.Dom.getXY(el));}
|
||||
start=this.getAttribute('points');if(isset(attributes['points']['to'])){end=translateValues.call(this,attributes['points']['to'],start);var pageXY=Y.Dom.getXY(this.getEl());for(i=0,len=control.length;i<len;++i){control[i]=translateValues.call(this,control[i],start);}}else if(isset(attributes['points']['by'])){end=[start[0]+attributes['points']['by'][0],start[1]+attributes['points']['by'][1]];for(i=0,len=control.length;i<len;++i){control[i]=[start[0]+control[i][0],start[1]+control[i][1]];}}
|
||||
this.runtimeAttributes[attr]=[start];if(control.length>0){this.runtimeAttributes[attr]=this.runtimeAttributes[attr].concat(control);}
|
||||
this.runtimeAttributes[attr][this.runtimeAttributes[attr].length]=end;}
|
||||
else{superclass.setRuntimeAttribute.call(this,attr);}};var translateValues=function(val,start){var pageXY=Y.Dom.getXY(this.getEl());val=[val[0]-pageXY[0]+start[0],val[1]-pageXY[1]+start[1]];return val;};var isset=function(prop){return(typeof prop!=='undefined');};})();(function(){YAHOO.util.Scroll=function(el,attributes,duration,method){if(el){YAHOO.util.Scroll.superclass.constructor.call(this,el,attributes,duration,method);}};YAHOO.extend(YAHOO.util.Scroll,YAHOO.util.ColorAnim);var Y=YAHOO.util;var superclass=Y.Scroll.superclass;var proto=Y.Scroll.prototype;proto.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("Scroll "+id);};proto.doMethod=function(attr,start,end){var val=null;if(attr=='scroll'){val=[this.method(this.currentFrame,start[0],end[0]-start[0],this.totalFrames),this.method(this.currentFrame,start[1],end[1]-start[1],this.totalFrames)];}else{val=superclass.doMethod.call(this,attr,start,end);}
|
||||
return val;};proto.getAttribute=function(attr){var val=null;var el=this.getEl();if(attr=='scroll'){val=[el.scrollLeft,el.scrollTop];}else{val=superclass.getAttribute.call(this,attr);}
|
||||
return val;};proto.setAttribute=function(attr,val,unit){var el=this.getEl();if(attr=='scroll'){el.scrollLeft=val[0];el.scrollTop=val[1];}else{superclass.setAttribute.call(this,attr,val,unit);}};})();YAHOO.register("animation",YAHOO.util.Anim,{version:"2.2.2",build:"204"});
|
||||
1352
www/extras/yui/build/animation/animation.js
vendored
|
|
@ -1,91 +0,0 @@
|
|||
AutoComplete Release Notes
|
||||
|
||||
**** version 2.2.2 ***
|
||||
|
||||
* No changes.
|
||||
|
||||
|
||||
|
||||
*** version 2.2.1 ***
|
||||
|
||||
* Fixed form submission in Safari bug.
|
||||
* Fixed broken DS_JSArray support for minQueryLength=0.
|
||||
* Improved type checking with YAHOO.lang.
|
||||
|
||||
|
||||
|
||||
*** version 2.2.0 ***
|
||||
|
||||
* No changes.
|
||||
|
||||
|
||||
|
||||
*** version 0.12.2 ***
|
||||
|
||||
* No changes.
|
||||
|
||||
|
||||
|
||||
*** version 0.12.1 ***
|
||||
|
||||
* No longer trigger typeAhead feature when user is backspacing on input text.
|
||||
|
||||
|
||||
|
||||
*** version 0.12.0 ***
|
||||
|
||||
* The following constants must be defined as static class properties and are no longer
|
||||
available as instance properties:
|
||||
|
||||
YAHOO.widget.DataSource.ERROR_DATANULL
|
||||
YAHOO.widget.DataSource.ERROR_DATAPARSE
|
||||
YAHOO.widget.DS_XHR.TYPE_JSON
|
||||
YAHOO.widget.DS_XHR.TYPE_XML
|
||||
YAHOO.widget.DS_XHR.TYPE_FLAT
|
||||
YAHOO.widget.DS_XHR.ERROR_DATAXHR
|
||||
|
||||
* The property minQueryLength now supports zero and negative number values for
|
||||
DS_JSFunction and DS_XHR objects, to enable null or empty string queries and to disable
|
||||
AutoComplete functionality altogether, respectively.
|
||||
|
||||
* Enabling the alwaysShowContainer feature will no longer send containerExpandEvent or
|
||||
containerCollapseEvent.
|
||||
|
||||
|
||||
|
||||
**** version 0.11.3 ***
|
||||
|
||||
* The iFrameSrc property has been deprecated. Implementers no longer need to
|
||||
specify an https URL to avoid IE security warnings when working with sites over
|
||||
SSL.
|
||||
|
||||
|
||||
|
||||
*** version 0.11.0 ***
|
||||
|
||||
* The method getListIds() has been deprecated for getListItems(), which returns
|
||||
an array of DOM references.
|
||||
|
||||
* All classnames have been prefixed with "yui-ac-".
|
||||
|
||||
* Container elements should no longer have CSS property "display" set to "none".
|
||||
|
||||
* The useIFrame property can now be set after instantiation.
|
||||
|
||||
* On some browsers, the unmatchedItemSelectEvent may not be fired properly when
|
||||
delimiter characters are defined.
|
||||
|
||||
* On some browsers, defining delimiter characters while enabling forceSelection
|
||||
may result in unexpected behavior.
|
||||
|
||||
|
||||
|
||||
*** version 0.10.0 ***
|
||||
|
||||
* Initial release
|
||||
|
||||
* In order to enable the useIFrame property, it should be set in the
|
||||
constructor.
|
||||
|
||||
* On some browsers, defining delimiter characters while enabling forceSelection
|
||||
may result in unexpected behavior.
|
||||
3104
www/extras/yui/build/autocomplete/autocomplete-debug.js
vendored
|
|
@ -1,184 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 2.2.2
|
||||
*/
|
||||
|
||||
YAHOO.widget.AutoComplete=function(elInput,elContainer,oDataSource,oConfigs){if(elInput&&elContainer&&oDataSource){if(oDataSource instanceof YAHOO.widget.DataSource){this.dataSource=oDataSource;}
|
||||
else{return;}
|
||||
if(YAHOO.util.Dom.inDocument(elInput)){if(YAHOO.lang.isString(elInput)){this._sName="instance"+YAHOO.widget.AutoComplete._nIndex+" "+elInput;this._oTextbox=document.getElementById(elInput);}
|
||||
else{this._sName=(elInput.id)?"instance"+YAHOO.widget.AutoComplete._nIndex+" "+elInput.id:"instance"+YAHOO.widget.AutoComplete._nIndex;this._oTextbox=elInput;}}
|
||||
else{return;}
|
||||
if(YAHOO.util.Dom.inDocument(elContainer)){if(YAHOO.lang.isString(elContainer)){this._oContainer=document.getElementById(elContainer);}
|
||||
else{this._oContainer=elContainer;}
|
||||
if(this._oContainer.style.display=="none"){}}
|
||||
else{return;}
|
||||
if(oConfigs&&(oConfigs.constructor==Object)){for(var sConfig in oConfigs){if(sConfig){this[sConfig]=oConfigs[sConfig];}}}
|
||||
this._initContainer();this._initProps();this._initList();this._initContainerHelpers();var oSelf=this;var oTextbox=this._oTextbox;var oContent=this._oContainer._oContent;YAHOO.util.Event.addListener(oTextbox,"keyup",oSelf._onTextboxKeyUp,oSelf);YAHOO.util.Event.addListener(oTextbox,"keydown",oSelf._onTextboxKeyDown,oSelf);YAHOO.util.Event.addListener(oTextbox,"focus",oSelf._onTextboxFocus,oSelf);YAHOO.util.Event.addListener(oTextbox,"blur",oSelf._onTextboxBlur,oSelf);YAHOO.util.Event.addListener(oContent,"mouseover",oSelf._onContainerMouseover,oSelf);YAHOO.util.Event.addListener(oContent,"mouseout",oSelf._onContainerMouseout,oSelf);YAHOO.util.Event.addListener(oContent,"scroll",oSelf._onContainerScroll,oSelf);YAHOO.util.Event.addListener(oContent,"resize",oSelf._onContainerResize,oSelf);if(oTextbox.form){YAHOO.util.Event.addListener(oTextbox.form,"submit",oSelf._onFormSubmit,oSelf);}
|
||||
YAHOO.util.Event.addListener(oTextbox,"keypress",oSelf._onTextboxKeyPress,oSelf);this.textboxFocusEvent=new YAHOO.util.CustomEvent("textboxFocus",this);this.textboxKeyEvent=new YAHOO.util.CustomEvent("textboxKey",this);this.dataRequestEvent=new YAHOO.util.CustomEvent("dataRequest",this);this.dataReturnEvent=new YAHOO.util.CustomEvent("dataReturn",this);this.dataErrorEvent=new YAHOO.util.CustomEvent("dataError",this);this.containerExpandEvent=new YAHOO.util.CustomEvent("containerExpand",this);this.typeAheadEvent=new YAHOO.util.CustomEvent("typeAhead",this);this.itemMouseOverEvent=new YAHOO.util.CustomEvent("itemMouseOver",this);this.itemMouseOutEvent=new YAHOO.util.CustomEvent("itemMouseOut",this);this.itemArrowToEvent=new YAHOO.util.CustomEvent("itemArrowTo",this);this.itemArrowFromEvent=new YAHOO.util.CustomEvent("itemArrowFrom",this);this.itemSelectEvent=new YAHOO.util.CustomEvent("itemSelect",this);this.unmatchedItemSelectEvent=new YAHOO.util.CustomEvent("unmatchedItemSelect",this);this.selectionEnforceEvent=new YAHOO.util.CustomEvent("selectionEnforce",this);this.containerCollapseEvent=new YAHOO.util.CustomEvent("containerCollapse",this);this.textboxBlurEvent=new YAHOO.util.CustomEvent("textboxBlur",this);oTextbox.setAttribute("autocomplete","off");YAHOO.widget.AutoComplete._nIndex++;}
|
||||
else{}};YAHOO.widget.AutoComplete.prototype.dataSource=null;YAHOO.widget.AutoComplete.prototype.minQueryLength=1;YAHOO.widget.AutoComplete.prototype.maxResultsDisplayed=10;YAHOO.widget.AutoComplete.prototype.queryDelay=0.5;YAHOO.widget.AutoComplete.prototype.highlightClassName="yui-ac-highlight";YAHOO.widget.AutoComplete.prototype.prehighlightClassName=null;YAHOO.widget.AutoComplete.prototype.delimChar=null;YAHOO.widget.AutoComplete.prototype.autoHighlight=true;YAHOO.widget.AutoComplete.prototype.typeAhead=false;YAHOO.widget.AutoComplete.prototype.animHoriz=false;YAHOO.widget.AutoComplete.prototype.animVert=true;YAHOO.widget.AutoComplete.prototype.animSpeed=0.3;YAHOO.widget.AutoComplete.prototype.forceSelection=false;YAHOO.widget.AutoComplete.prototype.allowBrowserAutocomplete=true;YAHOO.widget.AutoComplete.prototype.alwaysShowContainer=false;YAHOO.widget.AutoComplete.prototype.useIFrame=false;YAHOO.widget.AutoComplete.prototype.useShadow=false;YAHOO.widget.AutoComplete.prototype.toString=function(){return"AutoComplete "+this._sName;};YAHOO.widget.AutoComplete.prototype.isContainerOpen=function(){return this._bContainerOpen;};YAHOO.widget.AutoComplete.prototype.getListItems=function(){return this._aListItems;};YAHOO.widget.AutoComplete.prototype.getListItemData=function(oListItem){if(oListItem._oResultData){return oListItem._oResultData;}
|
||||
else{return false;}};YAHOO.widget.AutoComplete.prototype.setHeader=function(sHeader){if(sHeader){if(this._oContainer._oContent._oHeader){this._oContainer._oContent._oHeader.innerHTML=sHeader;this._oContainer._oContent._oHeader.style.display="block";}}
|
||||
else{this._oContainer._oContent._oHeader.innerHTML="";this._oContainer._oContent._oHeader.style.display="none";}};YAHOO.widget.AutoComplete.prototype.setFooter=function(sFooter){if(sFooter){if(this._oContainer._oContent._oFooter){this._oContainer._oContent._oFooter.innerHTML=sFooter;this._oContainer._oContent._oFooter.style.display="block";}}
|
||||
else{this._oContainer._oContent._oFooter.innerHTML="";this._oContainer._oContent._oFooter.style.display="none";}};YAHOO.widget.AutoComplete.prototype.setBody=function(sBody){if(sBody){if(this._oContainer._oContent._oBody){this._oContainer._oContent._oBody.innerHTML=sBody;this._oContainer._oContent._oBody.style.display="block";this._oContainer._oContent.style.display="block";}}
|
||||
else{this._oContainer._oContent._oBody.innerHTML="";this._oContainer._oContent.style.display="none";}
|
||||
this._maxResultsDisplayed=0;};YAHOO.widget.AutoComplete.prototype.formatResult=function(oResultItem,sQuery){var sResult=oResultItem[0];if(sResult){return sResult;}
|
||||
else{return"";}};YAHOO.widget.AutoComplete.prototype.doBeforeExpandContainer=function(oResultItem,sQuery){return true;};YAHOO.widget.AutoComplete.prototype.sendQuery=function(sQuery){this._sendQuery(sQuery);};YAHOO.widget.AutoComplete.prototype.textboxFocusEvent=null;YAHOO.widget.AutoComplete.prototype.textboxKeyEvent=null;YAHOO.widget.AutoComplete.prototype.dataRequestEvent=null;YAHOO.widget.AutoComplete.prototype.dataReturnEvent=null;YAHOO.widget.AutoComplete.prototype.dataErrorEvent=null;YAHOO.widget.AutoComplete.prototype.containerExpandEvent=null;YAHOO.widget.AutoComplete.prototype.typeAheadEvent=null;YAHOO.widget.AutoComplete.prototype.itemMouseOverEvent=null;YAHOO.widget.AutoComplete.prototype.itemMouseOutEvent=null;YAHOO.widget.AutoComplete.prototype.itemArrowToEvent=null;YAHOO.widget.AutoComplete.prototype.itemArrowFromEvent=null;YAHOO.widget.AutoComplete.prototype.itemSelectEvent=null;YAHOO.widget.AutoComplete.prototype.unmatchedItemSelectEvent=null;YAHOO.widget.AutoComplete.prototype.selectionEnforceEvent=null;YAHOO.widget.AutoComplete.prototype.containerCollapseEvent=null;YAHOO.widget.AutoComplete.prototype.textboxBlurEvent=null;YAHOO.widget.AutoComplete._nIndex=0;YAHOO.widget.AutoComplete.prototype._sName=null;YAHOO.widget.AutoComplete.prototype._oTextbox=null;YAHOO.widget.AutoComplete.prototype._bFocused=true;YAHOO.widget.AutoComplete.prototype._oAnim=null;YAHOO.widget.AutoComplete.prototype._oContainer=null;YAHOO.widget.AutoComplete.prototype._bContainerOpen=false;YAHOO.widget.AutoComplete.prototype._bOverContainer=false;YAHOO.widget.AutoComplete.prototype._aListItems=null;YAHOO.widget.AutoComplete.prototype._nDisplayedItems=0;YAHOO.widget.AutoComplete.prototype._maxResultsDisplayed=0;YAHOO.widget.AutoComplete.prototype._sCurQuery=null;YAHOO.widget.AutoComplete.prototype._sSavedQuery=null;YAHOO.widget.AutoComplete.prototype._oCurItem=null;YAHOO.widget.AutoComplete.prototype._bItemSelected=false;YAHOO.widget.AutoComplete.prototype._nKeyCode=null;YAHOO.widget.AutoComplete.prototype._nDelayID=-1;YAHOO.widget.AutoComplete.prototype._iFrameSrc="javascript:false;";YAHOO.widget.AutoComplete.prototype._queryInterval=null;YAHOO.widget.AutoComplete.prototype._sLastTextboxValue=null;YAHOO.widget.AutoComplete.prototype._initProps=function(){var minQueryLength=this.minQueryLength;if(!YAHOO.lang.isNumber(minQueryLength)||(minQueryLength<1)){minQueryLength=1;}
|
||||
var maxResultsDisplayed=this.maxResultsDisplayed;if(!YAHOO.lang.isNumber(maxResultsDisplayed)||(maxResultsDisplayed<1)){maxResultsDisplayed=10;}
|
||||
var queryDelay=this.queryDelay;if(!YAHOO.lang.isNumber(queryDelay)||(queryDelay<0)){queryDelay=0.5;}
|
||||
var delimChar=this.delimChar;if(YAHOO.lang.isString(delimChar)){delimChar=[delimChar];}
|
||||
else if(!YAHOO.lang.isArray(delimChar)){delimChar=null;}
|
||||
var animSpeed=this.animSpeed;if((this.animHoriz||this.animVert)&&YAHOO.util.Anim){if(!YAHOO.lang.isNumber(animSpeed)||(animSpeed<0)){animSpeed=0.3;}
|
||||
if(!this._oAnim){oAnim=new YAHOO.util.Anim(this._oContainer._oContent,{},animSpeed);this._oAnim=oAnim;}
|
||||
else{this._oAnim.duration=animSpeed;}}
|
||||
if(this.forceSelection&&delimChar){}};YAHOO.widget.AutoComplete.prototype._initContainerHelpers=function(){if(this.useShadow&&!this._oContainer._oShadow){var oShadow=document.createElement("div");oShadow.className="yui-ac-shadow";this._oContainer._oShadow=this._oContainer.appendChild(oShadow);}
|
||||
if(this.useIFrame&&!this._oContainer._oIFrame){var oIFrame=document.createElement("iframe");oIFrame.src=this._iFrameSrc;oIFrame.frameBorder=0;oIFrame.scrolling="no";oIFrame.style.position="absolute";oIFrame.style.width="100%";oIFrame.style.height="100%";oIFrame.tabIndex=-1;this._oContainer._oIFrame=this._oContainer.appendChild(oIFrame);}};YAHOO.widget.AutoComplete.prototype._initContainer=function(){if(!this._oContainer._oContent){var oContent=document.createElement("div");oContent.className="yui-ac-content";oContent.style.display="none";this._oContainer._oContent=this._oContainer.appendChild(oContent);var oHeader=document.createElement("div");oHeader.className="yui-ac-hd";oHeader.style.display="none";this._oContainer._oContent._oHeader=this._oContainer._oContent.appendChild(oHeader);var oBody=document.createElement("div");oBody.className="yui-ac-bd";this._oContainer._oContent._oBody=this._oContainer._oContent.appendChild(oBody);var oFooter=document.createElement("div");oFooter.className="yui-ac-ft";oFooter.style.display="none";this._oContainer._oContent._oFooter=this._oContainer._oContent.appendChild(oFooter);}
|
||||
else{}};YAHOO.widget.AutoComplete.prototype._initList=function(){this._aListItems=[];while(this._oContainer._oContent._oBody.hasChildNodes()){var oldListItems=this.getListItems();if(oldListItems){for(var oldi=oldListItems.length-1;oldi>=0;oldi--){oldListItems[oldi]=null;}}
|
||||
this._oContainer._oContent._oBody.innerHTML="";}
|
||||
var oList=document.createElement("ul");oList=this._oContainer._oContent._oBody.appendChild(oList);for(var i=0;i<this.maxResultsDisplayed;i++){var oItem=document.createElement("li");oItem=oList.appendChild(oItem);this._aListItems[i]=oItem;this._initListItem(oItem,i);}
|
||||
this._maxResultsDisplayed=this.maxResultsDisplayed;};YAHOO.widget.AutoComplete.prototype._initListItem=function(oItem,nItemIndex){var oSelf=this;oItem.style.display="none";oItem._nItemIndex=nItemIndex;oItem.mouseover=oItem.mouseout=oItem.onclick=null;YAHOO.util.Event.addListener(oItem,"mouseover",oSelf._onItemMouseover,oSelf);YAHOO.util.Event.addListener(oItem,"mouseout",oSelf._onItemMouseout,oSelf);YAHOO.util.Event.addListener(oItem,"click",oSelf._onItemMouseclick,oSelf);};YAHOO.widget.AutoComplete.prototype._onIMEDetected=function(oSelf){oSelf._enableIntervalDetection();};YAHOO.widget.AutoComplete.prototype._enableIntervalDetection=function(){var currValue=this._oTextbox.value;var lastValue=this._sLastTextboxValue;if(currValue!=lastValue){this._sLastTextboxValue=currValue;this._sendQuery(currValue);}};YAHOO.widget.AutoComplete.prototype._cancelIntervalDetection=function(oSelf){if(oSelf._queryInterval){clearInterval(oSelf._queryInterval);}};YAHOO.widget.AutoComplete.prototype._isIgnoreKey=function(nKeyCode){if((nKeyCode==9)||(nKeyCode==13)||(nKeyCode==16)||(nKeyCode==17)||(nKeyCode>=18&&nKeyCode<=20)||(nKeyCode==27)||(nKeyCode>=33&&nKeyCode<=35)||(nKeyCode>=36&&nKeyCode<=38)||(nKeyCode==40)||(nKeyCode>=44&&nKeyCode<=45)){return true;}
|
||||
return false;};YAHOO.widget.AutoComplete.prototype._sendQuery=function(sQuery){if(this.minQueryLength==-1){this._toggleContainer(false);return;}
|
||||
var aDelimChar=(this.delimChar)?this.delimChar:null;if(aDelimChar){var nDelimIndex=-1;for(var i=aDelimChar.length-1;i>=0;i--){var nNewIndex=sQuery.lastIndexOf(aDelimChar[i]);if(nNewIndex>nDelimIndex){nDelimIndex=nNewIndex;}}
|
||||
if(aDelimChar[i]==" "){for(var j=aDelimChar.length-1;j>=0;j--){if(sQuery[nDelimIndex-1]==aDelimChar[j]){nDelimIndex--;break;}}}
|
||||
if(nDelimIndex>-1){var nQueryStart=nDelimIndex+1;while(sQuery.charAt(nQueryStart)==" "){nQueryStart+=1;}
|
||||
this._sSavedQuery=sQuery.substring(0,nQueryStart);sQuery=sQuery.substr(nQueryStart);}
|
||||
else if(sQuery.indexOf(this._sSavedQuery)<0){this._sSavedQuery=null;}}
|
||||
if(sQuery&&(sQuery.length<this.minQueryLength)||(!sQuery&&this.minQueryLength>0)){if(this._nDelayID!=-1){clearTimeout(this._nDelayID);}
|
||||
this._toggleContainer(false);return;}
|
||||
sQuery=encodeURIComponent(sQuery);this._nDelayID=-1;this.dataRequestEvent.fire(this,sQuery);this.dataSource.getResults(this._populateList,sQuery,this);};YAHOO.widget.AutoComplete.prototype._populateList=function(sQuery,aResults,oSelf){if(aResults===null){oSelf.dataErrorEvent.fire(oSelf,sQuery);}
|
||||
if(!oSelf._bFocused||!aResults){return;}
|
||||
var isOpera=(navigator.userAgent.toLowerCase().indexOf("opera")!=-1);var contentStyle=oSelf._oContainer._oContent.style;contentStyle.width=(!isOpera)?null:"";contentStyle.height=(!isOpera)?null:"";var sCurQuery=decodeURIComponent(sQuery);oSelf._sCurQuery=sCurQuery;oSelf._bItemSelected=false;if(oSelf._maxResultsDisplayed!=oSelf.maxResultsDisplayed){oSelf._initList();}
|
||||
var nItems=Math.min(aResults.length,oSelf.maxResultsDisplayed);oSelf._nDisplayedItems=nItems;if(nItems>0){oSelf._initContainerHelpers();var aItems=oSelf._aListItems;for(var i=nItems-1;i>=0;i--){var oItemi=aItems[i];var oResultItemi=aResults[i];oItemi.innerHTML=oSelf.formatResult(oResultItemi,sCurQuery);oItemi.style.display="list-item";oItemi._sResultKey=oResultItemi[0];oItemi._oResultData=oResultItemi;}
|
||||
for(var j=aItems.length-1;j>=nItems;j--){var oItemj=aItems[j];oItemj.innerHTML=null;oItemj.style.display="none";oItemj._sResultKey=null;oItemj._oResultData=null;}
|
||||
if(oSelf.autoHighlight){var oFirstItem=aItems[0];oSelf._toggleHighlight(oFirstItem,"to");oSelf.itemArrowToEvent.fire(oSelf,oFirstItem);oSelf._typeAhead(oFirstItem,sQuery);}
|
||||
else{oSelf._oCurItem=null;}
|
||||
var ok=oSelf.doBeforeExpandContainer(oSelf._oTextbox,oSelf._oContainer,sQuery,aResults);oSelf._toggleContainer(ok);}
|
||||
else{oSelf._toggleContainer(false);}
|
||||
oSelf.dataReturnEvent.fire(oSelf,sQuery,aResults);};YAHOO.widget.AutoComplete.prototype._clearSelection=function(){var sValue=this._oTextbox.value;var sChar=(this.delimChar)?this.delimChar[0]:null;var nIndex=(sChar)?sValue.lastIndexOf(sChar,sValue.length-2):-1;if(nIndex>-1){this._oTextbox.value=sValue.substring(0,nIndex);}
|
||||
else{this._oTextbox.value="";}
|
||||
this._sSavedQuery=this._oTextbox.value;this.selectionEnforceEvent.fire(this);};YAHOO.widget.AutoComplete.prototype._textMatchesOption=function(){var foundMatch=false;for(var i=this._nDisplayedItems-1;i>=0;i--){var oItem=this._aListItems[i];var sMatch=oItem._sResultKey.toLowerCase();if(sMatch==this._sCurQuery.toLowerCase()){foundMatch=true;break;}}
|
||||
return(foundMatch);};YAHOO.widget.AutoComplete.prototype._typeAhead=function(oItem,sQuery){if(!this.typeAhead||(this._nKeyCode==8)){return;}
|
||||
var oTextbox=this._oTextbox;var sValue=this._oTextbox.value;if(!oTextbox.setSelectionRange&&!oTextbox.createTextRange){return;}
|
||||
var nStart=sValue.length;this._updateValue(oItem);var nEnd=oTextbox.value.length;this._selectText(oTextbox,nStart,nEnd);var sPrefill=oTextbox.value.substr(nStart,nEnd);this.typeAheadEvent.fire(this,sQuery,sPrefill);};YAHOO.widget.AutoComplete.prototype._selectText=function(oTextbox,nStart,nEnd){if(oTextbox.setSelectionRange){oTextbox.setSelectionRange(nStart,nEnd);}
|
||||
else if(oTextbox.createTextRange){var oTextRange=oTextbox.createTextRange();oTextRange.moveStart("character",nStart);oTextRange.moveEnd("character",nEnd-oTextbox.value.length);oTextRange.select();}
|
||||
else{oTextbox.select();}};YAHOO.widget.AutoComplete.prototype._toggleContainerHelpers=function(bShow){var bFireEvent=false;var width=this._oContainer._oContent.offsetWidth+"px";var height=this._oContainer._oContent.offsetHeight+"px";if(this.useIFrame&&this._oContainer._oIFrame){bFireEvent=true;if(bShow){this._oContainer._oIFrame.style.width=width;this._oContainer._oIFrame.style.height=height;}
|
||||
else{this._oContainer._oIFrame.style.width=0;this._oContainer._oIFrame.style.height=0;}}
|
||||
if(this.useShadow&&this._oContainer._oShadow){bFireEvent=true;if(bShow){this._oContainer._oShadow.style.width=width;this._oContainer._oShadow.style.height=height;}
|
||||
else{this._oContainer._oShadow.style.width=0;this._oContainer._oShadow.style.height=0;}}};YAHOO.widget.AutoComplete.prototype._toggleContainer=function(bShow){var oContainer=this._oContainer;if(this.alwaysShowContainer&&this._bContainerOpen){return;}
|
||||
if(!bShow){this._oContainer._oContent.scrollTop=0;var aItems=this._aListItems;if(aItems&&(aItems.length>0)){for(var i=aItems.length-1;i>=0;i--){aItems[i].style.display="none";}}
|
||||
if(this._oCurItem){this._toggleHighlight(this._oCurItem,"from");}
|
||||
this._oCurItem=null;this._nDisplayedItems=0;this._sCurQuery=null;}
|
||||
if(!bShow&&!this._bContainerOpen){oContainer._oContent.style.display="none";return;}
|
||||
var oAnim=this._oAnim;if(oAnim&&oAnim.getEl()&&(this.animHoriz||this.animVert)){if(!bShow){this._toggleContainerHelpers(bShow);}
|
||||
if(oAnim.isAnimated()){oAnim.stop();}
|
||||
var oClone=oContainer._oContent.cloneNode(true);oContainer.appendChild(oClone);oClone.style.top="-9000px";oClone.style.display="block";var wExp=oClone.offsetWidth;var hExp=oClone.offsetHeight;var wColl=(this.animHoriz)?0:wExp;var hColl=(this.animVert)?0:hExp;oAnim.attributes=(bShow)?{width:{to:wExp},height:{to:hExp}}:{width:{to:wColl},height:{to:hColl}};if(bShow&&!this._bContainerOpen){oContainer._oContent.style.width=wColl+"px";oContainer._oContent.style.height=hColl+"px";}
|
||||
else{oContainer._oContent.style.width=wExp+"px";oContainer._oContent.style.height=hExp+"px";}
|
||||
oContainer.removeChild(oClone);oClone=null;var oSelf=this;var onAnimComplete=function(){oAnim.onComplete.unsubscribeAll();if(bShow){oSelf.containerExpandEvent.fire(oSelf);}
|
||||
else{oContainer._oContent.style.display="none";oSelf.containerCollapseEvent.fire(oSelf);}
|
||||
oSelf._toggleContainerHelpers(bShow);};oContainer._oContent.style.display="block";oAnim.onComplete.subscribe(onAnimComplete);oAnim.animate();this._bContainerOpen=bShow;}
|
||||
else{if(bShow){oContainer._oContent.style.display="block";this.containerExpandEvent.fire(this);}
|
||||
else{oContainer._oContent.style.display="none";this.containerCollapseEvent.fire(this);}
|
||||
this._toggleContainerHelpers(bShow);this._bContainerOpen=bShow;}};YAHOO.widget.AutoComplete.prototype._toggleHighlight=function(oNewItem,sType){var sHighlight=this.highlightClassName;if(this._oCurItem){YAHOO.util.Dom.removeClass(this._oCurItem,sHighlight);}
|
||||
if((sType=="to")&&sHighlight){YAHOO.util.Dom.addClass(oNewItem,sHighlight);this._oCurItem=oNewItem;}};YAHOO.widget.AutoComplete.prototype._togglePrehighlight=function(oNewItem,sType){if(oNewItem==this._oCurItem){return;}
|
||||
var sPrehighlight=this.prehighlightClassName;if((sType=="mouseover")&&sPrehighlight){YAHOO.util.Dom.addClass(oNewItem,sPrehighlight);}
|
||||
else{YAHOO.util.Dom.removeClass(oNewItem,sPrehighlight);}};YAHOO.widget.AutoComplete.prototype._updateValue=function(oItem){var oTextbox=this._oTextbox;var sDelimChar=(this.delimChar)?(this.delimChar[0]||this.delimChar):null;var sSavedQuery=this._sSavedQuery;var sResultKey=oItem._sResultKey;oTextbox.focus();oTextbox.value="";if(sDelimChar){if(sSavedQuery){oTextbox.value=sSavedQuery;}
|
||||
oTextbox.value+=sResultKey+sDelimChar;if(sDelimChar!=" "){oTextbox.value+=" ";}}
|
||||
else{oTextbox.value=sResultKey;}
|
||||
if(oTextbox.type=="textarea"){oTextbox.scrollTop=oTextbox.scrollHeight;}
|
||||
var end=oTextbox.value.length;this._selectText(oTextbox,end,end);this._oCurItem=oItem;};YAHOO.widget.AutoComplete.prototype._selectItem=function(oItem){this._bItemSelected=true;this._updateValue(oItem);this._cancelIntervalDetection(this);this.itemSelectEvent.fire(this,oItem,oItem._oResultData);this._toggleContainer(false);};YAHOO.widget.AutoComplete.prototype._jumpSelection=function(){if(!this.typeAhead){return;}
|
||||
else{this._toggleContainer(false);}};YAHOO.widget.AutoComplete.prototype._moveSelection=function(nKeyCode){if(this._bContainerOpen){var oCurItem=this._oCurItem;var nCurItemIndex=-1;if(oCurItem){nCurItemIndex=oCurItem._nItemIndex;}
|
||||
var nNewItemIndex=(nKeyCode==40)?(nCurItemIndex+1):(nCurItemIndex-1);if(nNewItemIndex<-2||nNewItemIndex>=this._nDisplayedItems){return;}
|
||||
if(oCurItem){this._toggleHighlight(oCurItem,"from");this.itemArrowFromEvent.fire(this,oCurItem);}
|
||||
if(nNewItemIndex==-1){if(this.delimChar&&this._sSavedQuery){if(!this._textMatchesOption()){this._oTextbox.value=this._sSavedQuery;}
|
||||
else{this._oTextbox.value=this._sSavedQuery+this._sCurQuery;}}
|
||||
else{this._oTextbox.value=this._sCurQuery;}
|
||||
this._oCurItem=null;return;}
|
||||
if(nNewItemIndex==-2){this._toggleContainer(false);return;}
|
||||
var oNewItem=this._aListItems[nNewItemIndex];var oContent=this._oContainer._oContent;var scrollOn=((YAHOO.util.Dom.getStyle(oContent,"overflow")=="auto")||(YAHOO.util.Dom.getStyle(oContent,"overflowY")=="auto"));if(scrollOn&&(nNewItemIndex>-1)&&(nNewItemIndex<this._nDisplayedItems)){if(nKeyCode==40){if((oNewItem.offsetTop+oNewItem.offsetHeight)>(oContent.scrollTop+oContent.offsetHeight)){oContent.scrollTop=(oNewItem.offsetTop+oNewItem.offsetHeight)-oContent.offsetHeight;}
|
||||
else if((oNewItem.offsetTop+oNewItem.offsetHeight)<oContent.scrollTop){oContent.scrollTop=oNewItem.offsetTop;}}
|
||||
else{if(oNewItem.offsetTop<oContent.scrollTop){this._oContainer._oContent.scrollTop=oNewItem.offsetTop;}
|
||||
else if(oNewItem.offsetTop>(oContent.scrollTop+oContent.offsetHeight)){this._oContainer._oContent.scrollTop=(oNewItem.offsetTop+oNewItem.offsetHeight)-oContent.offsetHeight;}}}
|
||||
this._toggleHighlight(oNewItem,"to");this.itemArrowToEvent.fire(this,oNewItem);if(this.typeAhead){this._updateValue(oNewItem);}}};YAHOO.widget.AutoComplete.prototype._onItemMouseover=function(v,oSelf){if(oSelf.prehighlightClassName){oSelf._togglePrehighlight(this,"mouseover");}
|
||||
else{oSelf._toggleHighlight(this,"to");}
|
||||
oSelf.itemMouseOverEvent.fire(oSelf,this);};YAHOO.widget.AutoComplete.prototype._onItemMouseout=function(v,oSelf){if(oSelf.prehighlightClassName){oSelf._togglePrehighlight(this,"mouseout");}
|
||||
else{oSelf._toggleHighlight(this,"from");}
|
||||
oSelf.itemMouseOutEvent.fire(oSelf,this);};YAHOO.widget.AutoComplete.prototype._onItemMouseclick=function(v,oSelf){oSelf._toggleHighlight(this,"to");oSelf._selectItem(this);};YAHOO.widget.AutoComplete.prototype._onContainerMouseover=function(v,oSelf){oSelf._bOverContainer=true;};YAHOO.widget.AutoComplete.prototype._onContainerMouseout=function(v,oSelf){oSelf._bOverContainer=false;if(oSelf._oCurItem){oSelf._toggleHighlight(oSelf._oCurItem,"to");}};YAHOO.widget.AutoComplete.prototype._onContainerScroll=function(v,oSelf){oSelf._oTextbox.focus();};YAHOO.widget.AutoComplete.prototype._onContainerResize=function(v,oSelf){oSelf._toggleContainerHelpers(oSelf._bContainerOpen);};YAHOO.widget.AutoComplete.prototype._onTextboxKeyDown=function(v,oSelf){var nKeyCode=v.keyCode;switch(nKeyCode){case 9:if(oSelf.delimChar&&(oSelf._nKeyCode!=nKeyCode)){if(oSelf._bContainerOpen){YAHOO.util.Event.stopEvent(v);}}
|
||||
if(oSelf._oCurItem){oSelf._selectItem(oSelf._oCurItem);}
|
||||
else{oSelf._toggleContainer(false);}
|
||||
break;case 13:if(oSelf._nKeyCode!=nKeyCode){if(oSelf._bContainerOpen){YAHOO.util.Event.stopEvent(v);}}
|
||||
if(oSelf._oCurItem){oSelf._selectItem(oSelf._oCurItem);}
|
||||
else{oSelf._toggleContainer(false);}
|
||||
break;case 27:oSelf._toggleContainer(false);return;case 39:oSelf._jumpSelection();break;case 38:YAHOO.util.Event.stopEvent(v);oSelf._moveSelection(nKeyCode);break;case 40:YAHOO.util.Event.stopEvent(v);oSelf._moveSelection(nKeyCode);break;default:break;}};YAHOO.widget.AutoComplete.prototype._onTextboxKeyPress=function(v,oSelf){var nKeyCode=v.keyCode;var isMac=(navigator.userAgent.toLowerCase().indexOf("mac")!=-1);if(isMac){switch(nKeyCode){case 9:if(oSelf.delimChar&&(oSelf._nKeyCode!=nKeyCode)){YAHOO.util.Event.stopEvent(v);}
|
||||
break;case 13:if(oSelf._nKeyCode!=nKeyCode){YAHOO.util.Event.stopEvent(v);}
|
||||
break;case 38:case 40:YAHOO.util.Event.stopEvent(v);break;default:break;}}
|
||||
else if(nKeyCode==229){oSelf._queryInterval=setInterval(function(){oSelf._onIMEDetected(oSelf);},500);}};YAHOO.widget.AutoComplete.prototype._onTextboxKeyUp=function(v,oSelf){oSelf._initProps();var nKeyCode=v.keyCode;oSelf._nKeyCode=nKeyCode;var sText=this.value;if(oSelf._isIgnoreKey(nKeyCode)||(sText.toLowerCase()==oSelf._sCurQuery)){return;}
|
||||
else{oSelf.textboxKeyEvent.fire(oSelf,nKeyCode);}
|
||||
if(oSelf.queryDelay>0){var nDelayID=setTimeout(function(){oSelf._sendQuery(sText);},(oSelf.queryDelay*1000));if(oSelf._nDelayID!=-1){clearTimeout(oSelf._nDelayID);}
|
||||
oSelf._nDelayID=nDelayID;}
|
||||
else{oSelf._sendQuery(sText);}};YAHOO.widget.AutoComplete.prototype._onTextboxFocus=function(v,oSelf){oSelf._oTextbox.setAttribute("autocomplete","off");oSelf._bFocused=true;if(!oSelf._bItemSelected){oSelf.textboxFocusEvent.fire(oSelf);}};YAHOO.widget.AutoComplete.prototype._onTextboxBlur=function(v,oSelf){if(!oSelf._bOverContainer||(oSelf._nKeyCode==9)){if(!oSelf._bItemSelected){if(!oSelf._bContainerOpen||(oSelf._bContainerOpen&&!oSelf._textMatchesOption())){if(oSelf.forceSelection){oSelf._clearSelection();}
|
||||
else{oSelf.unmatchedItemSelectEvent.fire(oSelf,oSelf._sCurQuery);}}}
|
||||
if(oSelf._bContainerOpen){oSelf._toggleContainer(false);}
|
||||
oSelf._cancelIntervalDetection(oSelf);oSelf._bFocused=false;oSelf.textboxBlurEvent.fire(oSelf);}};YAHOO.widget.AutoComplete.prototype._onFormSubmit=function(v,oSelf){if(oSelf.allowBrowserAutocomplete){oSelf._oTextbox.setAttribute("autocomplete","on");}
|
||||
else{oSelf._oTextbox.setAttribute("autocomplete","off");}};YAHOO.widget.DataSource=function(){};YAHOO.widget.DataSource.ERROR_DATANULL="Response data was null";YAHOO.widget.DataSource.ERROR_DATAPARSE="Response data could not be parsed";YAHOO.widget.DataSource.prototype.maxCacheEntries=15;YAHOO.widget.DataSource.prototype.queryMatchContains=false;YAHOO.widget.DataSource.prototype.queryMatchSubset=false;YAHOO.widget.DataSource.prototype.queryMatchCase=false;YAHOO.widget.DataSource.prototype.toString=function(){return"DataSource "+this._sName;};YAHOO.widget.DataSource.prototype.getResults=function(oCallbackFn,sQuery,oParent){var aResults=this._doQueryCache(oCallbackFn,sQuery,oParent);if(aResults.length===0){this.queryEvent.fire(this,oParent,sQuery);this.doQuery(oCallbackFn,sQuery,oParent);}};YAHOO.widget.DataSource.prototype.doQuery=function(oCallbackFn,sQuery,oParent){};YAHOO.widget.DataSource.prototype.flushCache=function(){if(this._aCache){this._aCache=[];}
|
||||
if(this._aCacheHelper){this._aCacheHelper=[];}
|
||||
this.cacheFlushEvent.fire(this);};YAHOO.widget.DataSource.prototype.queryEvent=null;YAHOO.widget.DataSource.prototype.cacheQueryEvent=null;YAHOO.widget.DataSource.prototype.getResultsEvent=null;YAHOO.widget.DataSource.prototype.getCachedResultsEvent=null;YAHOO.widget.DataSource.prototype.dataErrorEvent=null;YAHOO.widget.DataSource.prototype.cacheFlushEvent=null;YAHOO.widget.DataSource._nIndex=0;YAHOO.widget.DataSource.prototype._sName=null;YAHOO.widget.DataSource.prototype._aCache=null;YAHOO.widget.DataSource.prototype._init=function(){var maxCacheEntries=this.maxCacheEntries;if(!YAHOO.lang.isNumber(maxCacheEntries)||(maxCacheEntries<0)){maxCacheEntries=0;}
|
||||
if(maxCacheEntries>0&&!this._aCache){this._aCache=[];}
|
||||
this._sName="instance"+YAHOO.widget.DataSource._nIndex;YAHOO.widget.DataSource._nIndex++;this.queryEvent=new YAHOO.util.CustomEvent("query",this);this.cacheQueryEvent=new YAHOO.util.CustomEvent("cacheQuery",this);this.getResultsEvent=new YAHOO.util.CustomEvent("getResults",this);this.getCachedResultsEvent=new YAHOO.util.CustomEvent("getCachedResults",this);this.dataErrorEvent=new YAHOO.util.CustomEvent("dataError",this);this.cacheFlushEvent=new YAHOO.util.CustomEvent("cacheFlush",this);};YAHOO.widget.DataSource.prototype._addCacheElem=function(oResult){var aCache=this._aCache;if(!aCache||!oResult||!oResult.query||!oResult.results){return;}
|
||||
if(aCache.length>=this.maxCacheEntries){aCache.shift();}
|
||||
aCache.push(oResult);};YAHOO.widget.DataSource.prototype._doQueryCache=function(oCallbackFn,sQuery,oParent){var aResults=[];var bMatchFound=false;var aCache=this._aCache;var nCacheLength=(aCache)?aCache.length:0;var bMatchContains=this.queryMatchContains;if((this.maxCacheEntries>0)&&aCache&&(nCacheLength>0)){this.cacheQueryEvent.fire(this,oParent,sQuery);if(!this.queryMatchCase){var sOrigQuery=sQuery;sQuery=sQuery.toLowerCase();}
|
||||
for(var i=nCacheLength-1;i>=0;i--){var resultObj=aCache[i];var aAllResultItems=resultObj.results;var matchKey=(!this.queryMatchCase)?encodeURIComponent(resultObj.query).toLowerCase():encodeURIComponent(resultObj.query);if(matchKey==sQuery){bMatchFound=true;aResults=aAllResultItems;if(i!=nCacheLength-1){aCache.splice(i,1);this._addCacheElem(resultObj);}
|
||||
break;}
|
||||
else if(this.queryMatchSubset){for(var j=sQuery.length-1;j>=0;j--){var subQuery=sQuery.substr(0,j);if(matchKey==subQuery){bMatchFound=true;for(var k=aAllResultItems.length-1;k>=0;k--){var aRecord=aAllResultItems[k];var sKeyIndex=(this.queryMatchCase)?encodeURIComponent(aRecord[0]).indexOf(sQuery):encodeURIComponent(aRecord[0]).toLowerCase().indexOf(sQuery);if((!bMatchContains&&(sKeyIndex===0))||(bMatchContains&&(sKeyIndex>-1))){aResults.unshift(aRecord);}}
|
||||
resultObj={};resultObj.query=sQuery;resultObj.results=aResults;this._addCacheElem(resultObj);break;}}
|
||||
if(bMatchFound){break;}}}
|
||||
if(bMatchFound){this.getCachedResultsEvent.fire(this,oParent,sOrigQuery,aResults);oCallbackFn(sOrigQuery,aResults,oParent);}}
|
||||
return aResults;};YAHOO.widget.DS_XHR=function(sScriptURI,aSchema,oConfigs){if(oConfigs&&(oConfigs.constructor==Object)){for(var sConfig in oConfigs){this[sConfig]=oConfigs[sConfig];}}
|
||||
if(!YAHOO.lang.isArray(aSchema)||!YAHOO.lang.isString(sScriptURI)){return;}
|
||||
this.schema=aSchema;this.scriptURI=sScriptURI;this._init();};YAHOO.widget.DS_XHR.prototype=new YAHOO.widget.DataSource();YAHOO.widget.DS_XHR.TYPE_JSON=0;YAHOO.widget.DS_XHR.TYPE_XML=1;YAHOO.widget.DS_XHR.TYPE_FLAT=2;YAHOO.widget.DS_XHR.ERROR_DATAXHR="XHR response failed";YAHOO.widget.DS_XHR.prototype.connMgr=YAHOO.util.Connect;YAHOO.widget.DS_XHR.prototype.connTimeout=0;YAHOO.widget.DS_XHR.prototype.scriptURI=null;YAHOO.widget.DS_XHR.prototype.scriptQueryParam="query";YAHOO.widget.DS_XHR.prototype.scriptQueryAppend="";YAHOO.widget.DS_XHR.prototype.responseType=YAHOO.widget.DS_XHR.TYPE_JSON;YAHOO.widget.DS_XHR.prototype.responseStripAfter="\n<!-";YAHOO.widget.DS_XHR.prototype.doQuery=function(oCallbackFn,sQuery,oParent){var isXML=(this.responseType==YAHOO.widget.DS_XHR.TYPE_XML);var sUri=this.scriptURI+"?"+this.scriptQueryParam+"="+sQuery;if(this.scriptQueryAppend.length>0){sUri+="&"+this.scriptQueryAppend;}
|
||||
var oResponse=null;var oSelf=this;var responseSuccess=function(oResp){if(!oSelf._oConn||(oResp.tId!=oSelf._oConn.tId)){oSelf.dataErrorEvent.fire(oSelf,oParent,sQuery,YAHOO.widget.DataSource.ERROR_DATANULL);return;}
|
||||
for(var foo in oResp){}
|
||||
if(!isXML){oResp=oResp.responseText;}
|
||||
else{oResp=oResp.responseXML;}
|
||||
if(oResp===null){oSelf.dataErrorEvent.fire(oSelf,oParent,sQuery,YAHOO.widget.DataSource.ERROR_DATANULL);return;}
|
||||
var aResults=oSelf.parseResponse(sQuery,oResp,oParent);var resultObj={};resultObj.query=decodeURIComponent(sQuery);resultObj.results=aResults;if(aResults===null){oSelf.dataErrorEvent.fire(oSelf,oParent,sQuery,YAHOO.widget.DataSource.ERROR_DATAPARSE);aResults=[];}
|
||||
else{oSelf.getResultsEvent.fire(oSelf,oParent,sQuery,aResults);oSelf._addCacheElem(resultObj);}
|
||||
oCallbackFn(sQuery,aResults,oParent);};var responseFailure=function(oResp){oSelf.dataErrorEvent.fire(oSelf,oParent,sQuery,YAHOO.widget.DS_XHR.ERROR_DATAXHR);return;};var oCallback={success:responseSuccess,failure:responseFailure};if(YAHOO.lang.isNumber(this.connTimeout)&&(this.connTimeout>0)){oCallback.timeout=this.connTimeout;}
|
||||
if(this._oConn){this.connMgr.abort(this._oConn);}
|
||||
oSelf._oConn=this.connMgr.asyncRequest("GET",sUri,oCallback,null);};YAHOO.widget.DS_XHR.prototype.parseResponse=function(sQuery,oResponse,oParent){var aSchema=this.schema;var aResults=[];var bError=false;var nEnd=((this.responseStripAfter!=="")&&(oResponse.indexOf))?oResponse.indexOf(this.responseStripAfter):-1;if(nEnd!=-1){oResponse=oResponse.substring(0,nEnd);}
|
||||
switch(this.responseType){case YAHOO.widget.DS_XHR.TYPE_JSON:var jsonList;if(window.JSON&&(navigator.userAgent.toLowerCase().indexOf('khtml')==-1)){var jsonObjParsed=JSON.parse(oResponse);if(!jsonObjParsed){bError=true;break;}
|
||||
else{try{jsonList=eval("jsonObjParsed."+aSchema[0]);}
|
||||
catch(e){bError=true;break;}}}
|
||||
else{try{while(oResponse.substring(0,1)==" "){oResponse=oResponse.substring(1,oResponse.length);}
|
||||
if(oResponse.indexOf("{")<0){bError=true;break;}
|
||||
if(oResponse.indexOf("{}")===0){break;}
|
||||
var jsonObjRaw=eval("("+oResponse+")");if(!jsonObjRaw){bError=true;break;}
|
||||
jsonList=eval("(jsonObjRaw."+aSchema[0]+")");}
|
||||
catch(e){bError=true;break;}}
|
||||
if(!jsonList){bError=true;break;}
|
||||
if(!YAHOO.lang.isArray(jsonList)){jsonList=[jsonList];}
|
||||
for(var i=jsonList.length-1;i>=0;i--){var aResultItem=[];var jsonResult=jsonList[i];for(var j=aSchema.length-1;j>=1;j--){var dataFieldValue=jsonResult[aSchema[j]];if(!dataFieldValue){dataFieldValue="";}
|
||||
aResultItem.unshift(dataFieldValue);}
|
||||
if(aResultItem.length==1){aResultItem.push(jsonResult);}
|
||||
aResults.unshift(aResultItem);}
|
||||
break;case YAHOO.widget.DS_XHR.TYPE_XML:var xmlList=oResponse.getElementsByTagName(aSchema[0]);if(!xmlList){bError=true;break;}
|
||||
for(var k=xmlList.length-1;k>=0;k--){var result=xmlList.item(k);var aFieldSet=[];for(var m=aSchema.length-1;m>=1;m--){var sValue=null;var xmlAttr=result.attributes.getNamedItem(aSchema[m]);if(xmlAttr){sValue=xmlAttr.value;}
|
||||
else{var xmlNode=result.getElementsByTagName(aSchema[m]);if(xmlNode&&xmlNode.item(0)&&xmlNode.item(0).firstChild){sValue=xmlNode.item(0).firstChild.nodeValue;}
|
||||
else{sValue="";}}
|
||||
aFieldSet.unshift(sValue);}
|
||||
aResults.unshift(aFieldSet);}
|
||||
break;case YAHOO.widget.DS_XHR.TYPE_FLAT:if(oResponse.length>0){var newLength=oResponse.length-aSchema[0].length;if(oResponse.substr(newLength)==aSchema[0]){oResponse=oResponse.substr(0,newLength);}
|
||||
var aRecords=oResponse.split(aSchema[0]);for(var n=aRecords.length-1;n>=0;n--){aResults[n]=aRecords[n].split(aSchema[1]);}}
|
||||
break;default:break;}
|
||||
sQuery=null;oResponse=null;oParent=null;if(bError){return null;}
|
||||
else{return aResults;}};YAHOO.widget.DS_XHR.prototype._oConn=null;YAHOO.widget.DS_JSFunction=function(oFunction,oConfigs){if(oConfigs&&(oConfigs.constructor==Object)){for(var sConfig in oConfigs){this[sConfig]=oConfigs[sConfig];}}
|
||||
if(!YAHOO.lang.isFunction(oFunction)){return;}
|
||||
else{this.dataFunction=oFunction;this._init();}};YAHOO.widget.DS_JSFunction.prototype=new YAHOO.widget.DataSource();YAHOO.widget.DS_JSFunction.prototype.dataFunction=null;YAHOO.widget.DS_JSFunction.prototype.doQuery=function(oCallbackFn,sQuery,oParent){var oFunction=this.dataFunction;var aResults=[];aResults=oFunction(sQuery);if(aResults===null){this.dataErrorEvent.fire(this,oParent,sQuery,YAHOO.widget.DataSource.ERROR_DATANULL);return;}
|
||||
var resultObj={};resultObj.query=decodeURIComponent(sQuery);resultObj.results=aResults;this._addCacheElem(resultObj);this.getResultsEvent.fire(this,oParent,sQuery,aResults);oCallbackFn(sQuery,aResults,oParent);return;};YAHOO.widget.DS_JSArray=function(aData,oConfigs){if(oConfigs&&(oConfigs.constructor==Object)){for(var sConfig in oConfigs){this[sConfig]=oConfigs[sConfig];}}
|
||||
if(!YAHOO.lang.isArray(aData)){return;}
|
||||
else{this.data=aData;this._init();}};YAHOO.widget.DS_JSArray.prototype=new YAHOO.widget.DataSource();YAHOO.widget.DS_JSArray.prototype.data=null;YAHOO.widget.DS_JSArray.prototype.doQuery=function(oCallbackFn,sQuery,oParent){var i;var aData=this.data;var aResults=[];var bMatchFound=false;var bMatchContains=this.queryMatchContains;if(sQuery){if(!this.queryMatchCase){sQuery=sQuery.toLowerCase();}
|
||||
for(i=aData.length-1;i>=0;i--){var aDataset=[];if(YAHOO.lang.isString(aData[i])){aDataset[0]=aData[i];}
|
||||
else if(YAHOO.lang.isArray(aData[i])){aDataset=aData[i];}
|
||||
if(YAHOO.lang.isString(aDataset[0])){var sKeyIndex=(this.queryMatchCase)?encodeURIComponent(aDataset[0]).indexOf(sQuery):encodeURIComponent(aDataset[0]).toLowerCase().indexOf(sQuery);if((!bMatchContains&&(sKeyIndex===0))||(bMatchContains&&(sKeyIndex>-1))){aResults.unshift(aDataset);}}}}
|
||||
else{for(i=aData.length-1;i>=0;i--){if(YAHOO.lang.isString(aData[i])){aResults.unshift([aData[i]]);}
|
||||
else if(YAHOO.lang.isArray(aData[i])){aResults.unshift(aData[i]);}}}
|
||||
this.getResultsEvent.fire(this,oParent,sQuery,aResults);oCallbackFn(sQuery,aResults,oParent);};YAHOO.register("autocomplete",YAHOO.widget.AutoComplete,{version:"2.2.2",build:"204"});
|
||||
3075
www/extras/yui/build/autocomplete/autocomplete.js
vendored
|
|
@ -1,53 +0,0 @@
|
|||
*** Version 2.2.1 ***
|
||||
|
||||
Added the following features:
|
||||
-----------------------------
|
||||
|
||||
+ Added "getHiddenField" method to YAHOO.widget.Button.
|
||||
|
||||
|
||||
Fixed the following bugs:
|
||||
-------------------------
|
||||
|
||||
+ Removed built-in use of the Event utility's "onAvailable" method from the
|
||||
constructor of Button and ButtonGroup as it was preventing the addition of
|
||||
event listeners on instances created from existing markup. Going forward
|
||||
Button and ButtonGroup instances created from existing markup can only be
|
||||
instantiated once their source HTML element is available in the DOM. The
|
||||
Button examples illustrate how this can be accomplished.
|
||||
|
||||
+ Modified code so that disabled Button instances no longer fire DOM events.
|
||||
|
||||
+ Pressing the enter key while focused on a form field whose parent form
|
||||
contains a Button instance of type "submit" will now automatically submit
|
||||
the form using the first Button instance of type "submit".
|
||||
|
||||
+ Clicking a Button instance of type="submit" will now cause the Button's
|
||||
parent form's "submit" event to fire.
|
||||
|
||||
+ Modified Button CSS so that the filter used to apply alpha transparency to
|
||||
a Button's background PNG is only used by IE 6. The previous code was
|
||||
enabling IE's Alpha image loader for IE 7 in Quirks mode.
|
||||
|
||||
+ Fixed documentation error for "getForm" method.
|
||||
|
||||
|
||||
Changes:
|
||||
--------
|
||||
|
||||
+ Made the "submitForm" method of YAHOO.widget.Button public (was
|
||||
previously protected).
|
||||
|
||||
+ Removed "init" event and corresponding "oninit" configuration attribute
|
||||
from YAHOO.widget.Button and YAHOO.widget.ButtonGroup.
|
||||
|
||||
+ Added the CSS class "ie6" to button.css. This classname is append to root
|
||||
DOM element of Button instances created with IE 6. By default this class
|
||||
is used to apply a filter that gives alpha transparency to a Button's
|
||||
background PNG.
|
||||
|
||||
|
||||
|
||||
*** Version 2.2.0 ***
|
||||
|
||||
* Button Control introduced
|
||||
|
Before Width: | Height: | Size: 185 B |
|
|
@ -1,220 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 2.2.2
|
||||
*/
|
||||
.yuibutton {
|
||||
|
||||
display:-moz-inline-stack; /* Gecko */
|
||||
display:inline-block; /* IE, Opera and Safari */
|
||||
|
||||
border-width:1px 0;
|
||||
border-style:solid;
|
||||
border-color:#999;
|
||||
|
||||
background:#ecece3 url(background.png) left center;
|
||||
margin:auto .25em;
|
||||
|
||||
}
|
||||
|
||||
.yuibutton.ie6 {
|
||||
|
||||
/* Give the transparent background image to IE 6 */
|
||||
background-image:none;
|
||||
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../../build/button/assets/background.png', sizingMethod = 'scale');
|
||||
|
||||
}
|
||||
|
||||
.yuibutton .first-child {
|
||||
|
||||
display:block; /* Gecko, Opera and Safari */
|
||||
*display:inline-block; /* IE */
|
||||
|
||||
border-width:0 1px;
|
||||
border-style:solid;
|
||||
border-color:#999;
|
||||
|
||||
margin:0 -1px;
|
||||
*position:relative;
|
||||
*left:-1px;
|
||||
|
||||
}
|
||||
|
||||
.yuibutton button,
|
||||
.yuibutton a {
|
||||
|
||||
display:block; /* Opera and Safari */
|
||||
display:-moz-inline-block; /* Gecko */
|
||||
*display:inline-block; /* IE */
|
||||
padding:.25em .5em;
|
||||
border:1px solid #ccc;
|
||||
|
||||
}
|
||||
|
||||
.yuibutton button {
|
||||
|
||||
overflow:visible; /* Remove superfluous padding for IE */
|
||||
font-size:100%; /* Makes form controls resizable in IE */
|
||||
background-color:transparent;
|
||||
cursor:pointer;
|
||||
cursor:hand;
|
||||
|
||||
}
|
||||
|
||||
.yuibutton a {
|
||||
|
||||
text-decoration:none;
|
||||
color:#000;
|
||||
|
||||
}
|
||||
|
||||
.yuibutton.splitbutton button,
|
||||
.yuibutton.menubutton button {
|
||||
|
||||
padding-right:20px;
|
||||
background-position:right center;
|
||||
background-repeat:no-repeat;
|
||||
|
||||
}
|
||||
|
||||
.yuibutton.menubutton button {
|
||||
|
||||
background-image:url(menuarrow.gif);
|
||||
|
||||
}
|
||||
|
||||
.yuibutton.splitbutton button {
|
||||
|
||||
background-image:url(splitarrow.gif);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Focus state */
|
||||
|
||||
.yuibutton.focus {
|
||||
|
||||
border-color:#5e5c95;
|
||||
|
||||
}
|
||||
|
||||
.yuibutton.focus .first-child {
|
||||
|
||||
border-color:#5e5c95;
|
||||
|
||||
}
|
||||
|
||||
.yuibutton.focus button,
|
||||
.yuibutton.focus a {
|
||||
|
||||
border-color:#cec1fc;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Hover state */
|
||||
|
||||
.yuibutton.hover {
|
||||
|
||||
border-color:#406fac;
|
||||
background-color:#98d5fc;
|
||||
|
||||
}
|
||||
|
||||
.yuibutton.hover .first-child {
|
||||
|
||||
border-color:#406fac;
|
||||
|
||||
}
|
||||
|
||||
.yuibutton.hover button,
|
||||
.yuibutton.hover a {
|
||||
|
||||
border-color:#7099ce;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Active state */
|
||||
|
||||
.yuibutton.active {
|
||||
|
||||
border-color:#7a8180;
|
||||
background-color:#333;
|
||||
|
||||
}
|
||||
|
||||
.yuibutton.active .first-child {
|
||||
|
||||
border-color:#7a8180;
|
||||
|
||||
}
|
||||
|
||||
.yuibutton.active button,
|
||||
.yuibutton.active a {
|
||||
|
||||
border-color:#98a09f;
|
||||
|
||||
}
|
||||
|
||||
.yuibutton.splitbutton.activeoption button {
|
||||
|
||||
background-color:transparent;
|
||||
background-image:url(splitarrow_active.gif);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Checked state */
|
||||
|
||||
.yuibutton.radio.checked,
|
||||
.yuibutton.checkbox.checked {
|
||||
|
||||
border-color:#7a8180;
|
||||
background-color:#333;
|
||||
|
||||
}
|
||||
|
||||
.yuibutton.radio.checked .first-child,
|
||||
.yuibutton.checkbox.checked .first-child {
|
||||
|
||||
border-color:#7a8180;
|
||||
|
||||
}
|
||||
|
||||
.yuibutton.radio.checked button,
|
||||
.yuibutton.checkbox.checked button {
|
||||
|
||||
border-color:#98a09f;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Disabled state */
|
||||
|
||||
.yuibutton.disabled {
|
||||
|
||||
border-color:#cbcdc5;
|
||||
background:#ecece3;
|
||||
|
||||
filter:none;
|
||||
|
||||
}
|
||||
|
||||
.yuibutton.disabled .first-child {
|
||||
|
||||
border-color:#cbcdc5;
|
||||
|
||||
}
|
||||
|
||||
.yuibutton.disabled button,
|
||||
.yuibutton.disabled a {
|
||||
|
||||
border-color:transparent;
|
||||
color:#b9b9b9;
|
||||
cursor:default;
|
||||
|
||||
}
|
||||
|
Before Width: | Height: | Size: 67 B |
|
Before Width: | Height: | Size: 145 B |
|
Before Width: | Height: | Size: 145 B |
4125
www/extras/yui/build/button/button-beta-debug.js
vendored
131
www/extras/yui/build/button/button-beta-min.js
vendored
|
|
@ -1,131 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 2.2.2
|
||||
*/
|
||||
|
||||
(function(){var Dom=YAHOO.util.Dom,Event=YAHOO.util.Event,Lang=YAHOO.lang,m_oUserAgent=navigator.userAgent.toLowerCase(),m_bOpera=(m_oUserAgent.indexOf('opera')>-1),m_bSafari=(m_oUserAgent.indexOf('safari')>-1),m_bGecko=(!m_bOpera&&!m_bSafari&&m_oUserAgent.indexOf('gecko')>-1),m_bIE7=(!m_bOpera&&m_oUserAgent.indexOf('msie 7')>-1),m_bIE=(!m_bOpera&&m_oUserAgent.indexOf('msie')>-1),m_oButtons={},m_oFocusedButton=null;YAHOO.widget.Button=function(p_oElement,p_oAttributes){var fnSuperClass=YAHOO.widget.Button.superclass.constructor;if(arguments.length==1&&!Lang.isString(p_oElement)&&!p_oElement.nodeName){if(!p_oElement.id){p_oElement.id=Dom.generateId();}
|
||||
fnSuperClass.call(this,(this._createButtonElement(p_oElement.type)),p_oElement);}
|
||||
else{var oConfig={element:null,attributes:(p_oAttributes||{})},sTagName;if(Lang.isString(p_oElement)){var oElement=Dom.get(p_oElement);if(oElement){sTagName=oElement.tagName.toUpperCase();if(sTagName==this.TAG_NAME){oConfig.attributes.id=oElement.id;}
|
||||
else if(sTagName=="INPUT"&&!oConfig.attributes.id){oConfig.attributes.id=Dom.generateId();}
|
||||
oConfig.attributes.srcelement=oElement;initConfig.call(this,oConfig);if(!oConfig.element){oConfig.element=this._createButtonElement(oConfig.attributes.type);}
|
||||
fnSuperClass.call(this,oConfig.element,oConfig.attributes);}}
|
||||
else{sTagName=p_oElement.tagName.toUpperCase();if(sTagName==this.TAG_NAME){if(p_oElement.id){oConfig.attributes.id=p_oElement.id;}
|
||||
else{oConfig.attributes.id=Dom.generateId();}}
|
||||
else if(sTagName=="INPUT"&&!oConfig.attributes.id){oConfig.attributes.id=Dom.generateId();}
|
||||
oConfig.attributes.srcelement=p_oElement;initConfig.call(this,oConfig);if(!oConfig.element){oConfig.element=this._createButtonElement(oConfig.attributes.type);}
|
||||
fnSuperClass.call(this,oConfig.element,oConfig.attributes);}}};function getFirstElement(p_oElement){var oFirstChild=p_oElement.firstChild;if(oFirstChild){if(oFirstChild.nodeType==1){return oFirstChild;}
|
||||
else{var oNextSibling=oFirstChild.nextSibling;if(oNextSibling&&oNextSibling.nodeType==1){return oNextSibling;}}}}
|
||||
function createInputElement(p_sType,p_sName,p_sValue,p_bChecked){var oInput;if(m_bIE){var sInput="<input type=\""+p_sType+"\" name=\""+p_sName+"\"";if(p_bChecked){sInput+=" checked";}
|
||||
sInput+=">";oInput=document.createElement(sInput);}
|
||||
else{oInput=document.createElement("input");oInput.name=p_sName;oInput.type=p_sType;if(p_bChecked){oInput.checked=true;}}
|
||||
oInput.value=p_sValue;return oInput;}
|
||||
function setAttributesFromSrcElement(p_oElement,p_oAttributes){var me=this;function setAttributeFromDOMAttribute(p_sAttribute){if(!(p_sAttribute in p_oAttributes)){var oAttribute=p_oElement.getAttributeNode(p_sAttribute);if(oAttribute&&("value"in oAttribute)){p_oAttributes[p_sAttribute]=oAttribute.value;}}}
|
||||
function setFormElementProperties(){setAttributeFromDOMAttribute("type");if(!("disabled"in p_oAttributes)){p_oAttributes.disabled=p_oElement.disabled;}
|
||||
setAttributeFromDOMAttribute("name");setAttributeFromDOMAttribute("value");setAttributeFromDOMAttribute("title");}
|
||||
var sSrcElementTagName=p_oElement.tagName.toUpperCase();if(!("label"in p_oAttributes)){var sText=sSrcElementTagName=="INPUT"?p_oElement.value:p_oElement.innerHTML;if(sText&&sText.length>0){p_oAttributes.label=sText;}}
|
||||
setAttributeFromDOMAttribute("tabindex");setAttributeFromDOMAttribute("accesskey");switch(sSrcElementTagName){case"A":p_oAttributes.type="link";setAttributeFromDOMAttribute("href");setAttributeFromDOMAttribute("target");break;case"INPUT":setFormElementProperties();if(!("checked"in p_oAttributes)){p_oAttributes.checked=p_oElement.checked;}
|
||||
break;case"BUTTON":setFormElementProperties();var oRootNode=p_oElement.parentNode.parentNode;if(Dom.hasClass(oRootNode,"checked")){p_oAttributes.checked=true;}
|
||||
if(Dom.hasClass(oRootNode,"disabled")){p_oAttributes.disabled=true;}
|
||||
p_oElement.removeAttribute("name");p_oElement.removeAttribute("value");p_oElement.setAttribute("type","button");break;}}
|
||||
function initConfig(p_oConfig){var oAttributes=p_oConfig.attributes,oSrcElement=oAttributes.srcelement,sSrcElementTagName=oSrcElement.tagName.toUpperCase();if(sSrcElementTagName==this.TAG_NAME){p_oConfig.element=oSrcElement;var oFirstChild=getFirstElement(p_oConfig.element);Dom.addClass(oFirstChild,"first-child");if(oFirstChild){var oButton=getFirstElement(oFirstChild);if(oButton){var sButtonTagName=oButton.tagName.toUpperCase();if(sButtonTagName=="A"||sButtonTagName=="BUTTON"){setAttributesFromSrcElement.call(this,oButton,oAttributes);}}}}
|
||||
else if(sSrcElementTagName=="INPUT"){setAttributesFromSrcElement.call(this,oSrcElement,oAttributes);}}
|
||||
YAHOO.extend(YAHOO.widget.Button,YAHOO.util.Element,{_button:null,_menu:null,_hiddenField:null,_onclickAttributeValue:null,_activationKeyPressed:false,_activationButtonPressed:false,_hasKeyEventHandlers:false,_hasMouseEventHandlers:false,TAG_NAME:"SPAN",CHECK_ACTIVATION_KEYS:[32],ACTIVATION_KEYS:[13,32],OPTION_AREA_WIDTH:20,CSS_CLASS_NAME:"yuibutton",RADIO_DEFAULT_TITLE:"Unchecked. Click to check.",RADIO_CHECKED_TITLE:"Checked. Click to uncheck.",CHECKBOX_DEFAULT_TITLE:"Unchecked. Click to check.",CHECKBOX_CHECKED_TITLE:"Checked. Click to uncheck.",MENUBUTTON_DEFAULT_TITLE:"Menu collapsed. Click to expand.",MENUBUTTON_MENU_VISIBLE_TITLE:"Menu expanded. Click or press Esc to collapse.",SPLITBUTTON_DEFAULT_TITLE:"Menu collapsed. Click inside option region or press Ctrl + Shift + M to show the menu.",SPLITBUTTON_OPTION_VISIBLE_TITLE:"Menu expanded. Press Esc or Ctrl + Shift + M to hide the menu.",SUBMIT_TITLE:"Click to submit form.",_setType:function(p_sType){if(p_sType=="splitbutton"){this.on("option",this._onOption);}},_setLabel:function(p_sLabel){this._button.innerHTML=p_sLabel;},_setTabIndex:function(p_nTabIndex){this._button.tabIndex=p_nTabIndex;},_setTitle:function(p_sTitle){if(this.get("type")!="link"){var sTitle=p_sTitle;if(!sTitle){var sType=this.get("type");switch(sType){case"radio":sTitle=this.RADIO_DEFAULT_TITLE;break;case"checkbox":sTitle=this.CHECKBOX_DEFAULT_TITLE;break;case"menubutton":sTitle=this.MENUBUTTON_DEFAULT_TITLE;break;case"splitbutton":sTitle=this.SPLITBUTTON_DEFAULT_TITLE;break;case"submit":sTitle=this.SUBMIT_TITLE;break;}}
|
||||
this._button.title=sTitle;}},_setDisabled:function(p_bDisabled){if(this.get("type")!="link"){if(p_bDisabled){if(this.hasFocus()){this.blur();}
|
||||
this._button.setAttribute("disabled","disabled");this.addClass("disabled");}
|
||||
else{this._button.removeAttribute("disabled");this.removeClass("disabled");}}},_setAccessKey:function(p_sAccessKey){this._button.accessKey=p_sAccessKey;},_setHref:function(p_sHref){if(this.get("type")=="link"){this._button.href=p_sHref;}},_setTarget:function(p_sTarget){if(this.get("type")=="link"){this._button.setAttribute("target",p_sTarget);}},_setChecked:function(p_bChecked){var sType=this.get("type"),sTitle;if(sType=="checkbox"||sType=="radio"){if(p_bChecked){this.addClass("checked");sTitle=(sType=="radio")?this.RADIO_CHECKED_TITLE:this.CHECKBOX_CHECKED_TITLE;}
|
||||
else{this.removeClass("checked");sTitle=(sType=="radio")?this.RADIO_DEFAULT_TITLE:this.CHECKBOX_DEFAULT_TITLE;}
|
||||
this.set("title",sTitle);}},_setMenu:function(p_oMenu){var Menu=YAHOO.widget.Menu,oMenu,me=this;if(!Menu){return false;}
|
||||
function initMenu(){if(oMenu){oMenu.showEvent.subscribe(this._onMenuShow,this,true);oMenu.hideEvent.subscribe(this._onMenuHide,this,true);oMenu.keyDownEvent.subscribe(this._onMenuKeyDown,this,true);oMenu.renderEvent.subscribe(this._onMenuRender,this,true);oMenu.clickEvent.subscribe(this._onMenuClick,this,true);oMenu.itemAddedEvent.subscribe(this._onMenuItemAdded,this,true);var oSrcElement=oMenu.srcElement;if(oSrcElement&&oSrcElement.tagName.toUpperCase()=="SELECT"){oSrcElement.style.display="none";oSrcElement.parentNode.removeChild(oSrcElement);}
|
||||
this._menu=oMenu;}
|
||||
else{this._menu.destroy();this._menu=null;}}
|
||||
if(p_oMenu instanceof Menu){oMenu=p_oMenu;var aItems=oMenu.getItems(),nItems=aItems.length,oItem;if(nItems>0){var i=nItems-1;do{oItem=aItems[i];if(oItem){oItem.cfg.subscribeToConfigEvent("selected",this._onMenuItemSelected,oItem,this);}}
|
||||
while(i--);}
|
||||
initMenu.call(this);}
|
||||
else if(Lang.isArray(p_oMenu)){this.on("appendTo",function(){oMenu=new Menu(Dom.generateId(),{lazyload:true,itemdata:p_oMenu});initMenu.call(me);});}
|
||||
else if(Lang.isString(p_oMenu)){Event.onContentReady(p_oMenu,function(){oMenu=new Menu(this,{lazyload:true});initMenu.call(me);});}
|
||||
else if(p_oMenu&&p_oMenu.nodeName){oMenu=new Menu(p_oMenu,{lazyload:true});initMenu.call(this);}},_setOnClick:function(p_oObject){if(this._onclickAttributeValue&&(this._onclickAttributeValue!=p_oObject)){this.removeListener("click",this._onclickAttributeValue.fn);this._onclickAttributeValue=null;}
|
||||
if(!this._onclickAttributeValue&&Lang.isObject(p_oObject)&&Lang.isFunction(p_oObject.fn)){this.on("click",p_oObject.fn,p_oObject.obj,p_oObject.scope);this._onclickAttributeValue=p_oObject;}},_createButtonElement:function(p_sType){var sTagName=this.TAG_NAME,oElement=document.createElement(sTagName);oElement.innerHTML="<"+sTagName+" class=\"first-child\">"+
|
||||
(p_sType=="link"?"<a></a>":"<button type=\"button\"></button>")+"</"+sTagName+">";return oElement;},_isActivationKey:function(p_nKeyCode){var sType=this.get("type"),aKeyCodes=(sType=="checkbox"||sType=="radio")?this.CHECK_ACTIVATION_KEYS:this.ACTIVATION_KEYS,nKeyCodes=aKeyCodes.length;if(nKeyCodes>0){var i=nKeyCodes-1;do{if(p_nKeyCode==aKeyCodes[i]){return true;}}
|
||||
while(i--);}},_isSplitButtonOptionKey:function(p_oEvent){return(p_oEvent.ctrlKey&&p_oEvent.shiftKey&&Event.getCharCode(p_oEvent)==77);},_addListenersToForm:function(){var oForm=this.getForm();if(oForm){Event.on(oForm,"reset",this._onFormReset,null,this);Event.on(oForm,"submit",this._onFormSubmit,null,this);var oSrcElement=this.get("srcelement");if((m_bIE||m_bGecko)&&(this.get("type")=="submit"||(oSrcElement&&oSrcElement.type=="submit"))){var aListeners=Event.getListeners(oForm,"keydown"),bHasKeyDownListener=false;if(aListeners){var nListeners=aListeners.length;if(nListeners>0){var i=nListeners-1;do{if(aListeners[i].fn==YAHOO.widget.Button.onFormKeyDown){bHasKeyDownListener=true;break;}}
|
||||
while(i--);}}
|
||||
if(!bHasKeyDownListener){Event.on(oForm,"keydown",YAHOO.widget.Button.onFormKeyDown,null,this);}}}},_originalMaxHeight:-1,_showMenu:function(p_oEvent){var oMenu=this._menu;if(oMenu){YAHOO.widget.MenuManager.hideVisible();oMenu.cfg.applyConfig({context:[this.get("id"),"tl","bl"],clicktohide:false,constraintoviewport:false,visible:true});oMenu.cfg.fireQueue();if(p_oEvent.type=="mousedown"){Event.stopPropagation(p_oEvent);}
|
||||
this._menu.focus();var nViewportHeight=Dom.getViewportHeight(),nMenuHeight=oMenu.element.offsetHeight;if((oMenu.cfg.getProperty("y")+nMenuHeight)>nViewportHeight){oMenu.align("bl","tl");var nY=oMenu.cfg.getProperty("y"),nScrollTop=(document.documentElement.scrollTop||document.body.scrollTop);if(nScrollTop>=nY){if(this._originalMaxHeight==-1){this._originalMaxHeight=oMenu.cfg.getProperty("maxheight");}
|
||||
oMenu.cfg.setProperty("maxheight",(nMenuHeight-((nScrollTop-nY)+20)));oMenu.align("bl","tl");}}
|
||||
oMenu.cfg.setProperty("constraintoviewport",true);}},_hideMenu:function(){var oMenu=this._menu;if(oMenu&&oMenu.cfg.getProperty("visible")){oMenu.hide();}},_onMouseOver:function(p_oEvent){if(!this._hasMouseEventHandlers){this.on("mouseout",this._onMouseOut);this.on("mousedown",this._onMouseDown);this.on("mouseup",this._onMouseUp);this._hasMouseEventHandlers=true;}
|
||||
this.addClass("hover");if(this._activationButtonPressed){this.addClass("active");}
|
||||
if(this._bOptionPressed){this.addClass("activeoption");}},_onMouseOut:function(p_oEvent){this.removeClass("hover");if(this.get("type")!="menubutton"){this.removeClass("active");}
|
||||
if(this._activationButtonPressed||this._bOptionPressed){Event.on(document,"mouseup",this._onDocumentMouseUp,null,this);}},_onDocumentMouseUp:function(p_oEvent){this._activationButtonPressed=false;this._bOptionPressed=false;var sType=this.get("type");if(sType=="menubutton"||sType=="splitbutton"){this.removeClass((sType=="menubutton"?"active":"activeoption"));this._hideMenu();}
|
||||
Event.removeListener(document,"mouseup",this._onDocumentMouseUp);},_onMouseDown:function(p_oEvent){if((p_oEvent.which||p_oEvent.button)==1){if(!this.hasFocus()){this.focus();}
|
||||
var sType=this.get("type");if(sType=="splitbutton"){var oElement=this.get("element"),nX=Event.getPageX(p_oEvent)-Dom.getX(oElement);if((oElement.offsetWidth-this.OPTION_AREA_WIDTH)<nX){this.fireEvent("option",p_oEvent);}
|
||||
else{this.addClass("active");this._activationButtonPressed=true;}}
|
||||
else if(sType=="menubutton"){if(this.hasClass("active")){this._hideMenu();this._activationButtonPressed=false;}
|
||||
else{this._showMenu(p_oEvent);this._activationButtonPressed=true;}}
|
||||
else{this.addClass("active");this._activationButtonPressed=true;}
|
||||
if(sType=="splitbutton"||sType=="menubutton"){var me=this;function onMouseUp(){me._hideMenu();me.removeListener("mouseup",onMouseUp);}
|
||||
this._hideMenuTimerId=window.setTimeout(function(){me.on("mouseup",onMouseUp);},250);}}},_onMouseUp:function(p_oEvent){if(this._hideMenuTimerId){window.clearTimeout(this._hideMenuTimerId);}
|
||||
var sType=this.get("type");if(sType=="checkbox"||sType=="radio"){this.set("checked",!(this.get("checked")));}
|
||||
this._activationButtonPressed=false;if(this.get("type")!="menubutton"){this.removeClass("active");}},_onFocus:function(p_oEvent){this.addClass("focus");if(this._activationKeyPressed){this.addClass("active");}
|
||||
m_oFocusedButton=this;if(!this._hasKeyEventHandlers){var oElement=this._button;Event.on(oElement,"blur",this._onBlur,null,this);Event.on(oElement,"keydown",this._onKeyDown,null,this);Event.on(oElement,"keyup",this._onKeyUp,null,this);this._hasKeyEventHandlers=true;}
|
||||
this.fireEvent("focus",p_oEvent);},_onBlur:function(p_oEvent){this.removeClass("focus");if(this.get("type")!="menubutton"){this.removeClass("active");}
|
||||
if(this._activationKeyPressed){Event.on(document,"keyup",this._onDocumentKeyUp,null,this);}
|
||||
m_oFocusedButton=null;this.fireEvent("blur",p_oEvent);},_onDocumentKeyUp:function(p_oEvent){if(this._isActivationKey(Event.getCharCode(p_oEvent))){this._activationKeyPressed=false;Event.removeListener(document,"keyup",this._onDocumentKeyUp);}},_onKeyDown:function(p_oEvent){if(this.get("type")=="splitbutton"&&this._isSplitButtonOptionKey(p_oEvent)){this.fireEvent("option",p_oEvent);}
|
||||
else if(this._isActivationKey(Event.getCharCode(p_oEvent))){if(this.get("type")=="menubutton"){this._showMenu(p_oEvent);}
|
||||
else{this._activationKeyPressed=true;this.addClass("active");}}
|
||||
var oMenu=this._menu;if(oMenu&&oMenu.cfg.getProperty("visible")&&Event.getCharCode(p_oEvent)==27){oMenu.hide();this.focus();}},_onKeyUp:function(p_oEvent){if(this._isActivationKey(Event.getCharCode(p_oEvent))){var sType=this.get("type");if(sType=="checkbox"||sType=="radio"){this.set("checked",!(this.get("checked")));}
|
||||
this._activationKeyPressed=false;if(this.get("type")!="menubutton"){this.removeClass("active");}}},_onClick:function(p_oEvent){var sType=this.get("type"),sTitle;switch(sType){case"radio":case"checkbox":if(this.get("checked")){sTitle=(sType=="radio")?this.RADIO_CHECKED_TITLE:this.CHECKBOX_CHECKED_TITLE;}
|
||||
else{sTitle=(sType=="radio")?this.RADIO_DEFAULT_TITLE:this.CHECKBOX_DEFAULT_TITLE;}
|
||||
this.set("title",sTitle);break;case"submit":this.submitForm();break;case"reset":var oForm=this.getForm();if(oForm){oForm.reset();}
|
||||
break;case"menubutton":sTitle=this._menu.cfg.getProperty("visible")?this.MENUBUTTON_MENU_VISIBLE_TITLE:this.MENUBUTTON_DEFAULT_TITLE;this.set("title",sTitle);break;case"splitbutton":var oElement=this.get("element"),nX=Event.getPageX(p_oEvent)-Dom.getX(oElement);if((oElement.offsetWidth-this.OPTION_AREA_WIDTH)<nX){return false;}
|
||||
else{this._hideMenu();var oSrcElement=this.get("srcelement");if(oSrcElement&&oSrcElement.type=="submit"){this.submitForm();}}
|
||||
sTitle=this._menu.cfg.getProperty("visible")?this.SPLITBUTTON_OPTION_VISIBLE_TITLE:this.SPLITBUTTON_DEFAULT_TITLE;this.set("title",sTitle);break;}},_onAppendTo:function(p_oEvent){var me=this;window.setTimeout(function(){me._addListenersToForm();},0);},_onFormSubmit:function(p_oEvent){var sType=this.get("type"),oMenuItem=this.get("selectedMenuItem"),oForm=this.getForm();if(sType=="radio"||sType=="checkbox"){this.createHiddenField();}
|
||||
else if(oMenuItem){var oSrcElement=this._menu.srcElement;if(oSrcElement&&oSrcElement.tagName.toUpperCase()=="SELECT"){oForm.appendChild(oSrcElement);oSrcElement.selectedIndex=oMenuItem.index;}
|
||||
else{var oValue=(oMenuItem.value===null||oMenuItem.value==="")?oMenuItem.cfg.getProperty("text"):oMenuItem.value;if(oValue){var oField=createInputElement("hidden",(this.get("name")+"_options"),oValue);oForm.appendChild(oField);}}}},_onFormReset:function(p_oEvent){var sType=this.get("type");if(sType=="checkbox"||sType=="radio"){this.resetValue("checked");}
|
||||
if(this._menu){this.resetValue("selectedMenuItem");}},_onDocumentMouseDown:function(p_oEvent){var oTarget=Event.getTarget(p_oEvent),oButtonElement=this.get("element"),oMenuElement=this._menu.element;if(oTarget!=oButtonElement&&!Dom.isAncestor(oButtonElement,oTarget)&&oTarget!=oMenuElement&&!Dom.isAncestor(oMenuElement,oTarget)){this._hideMenu();Event.removeListener(document,"mousedown",this._onDocumentMouseDown);}},_onOption:function(p_oEvent){if(this.hasClass("activeoption")){this._hideMenu();this._bOptionPressed=false;}
|
||||
else{this._showMenu(p_oEvent);this._bOptionPressed=true;}},_onMenuShow:function(p_sType,p_aArgs){Event.on(document,"mousedown",this._onDocumentMouseDown,null,this);var sTitle,sClass;if(this.get("type")=="splitbutton"){sTitle=this.SPLITBUTTON_OPTION_VISIBLE_TITLE;sClass="activeoption";}
|
||||
else{sTitle=this.MENUBUTTON_MENU_VISIBLE_TITLE;sClass="active";}
|
||||
this.addClass(sClass);this.set("title",sTitle);},_onMenuHide:function(p_sType,p_aArgs){if(this._originalMaxHeight!=-1){this._menu.cfg.setProperty("maxheight",this._originalMaxHeight);}
|
||||
var sTitle,sClass;if(this.get("type")=="splitbutton"){sTitle=this.SPLITBUTTON_DEFAULT_TITLE;sClass="activeoption";}
|
||||
else{sTitle=this.MENUBUTTON_DEFAULT_TITLE;sClass="active";}
|
||||
this.removeClass(sClass);this.set("title",sTitle);if(this.get("type")=="splitbutton"){this._bOptionPressed=false;}},_onMenuKeyDown:function(p_sType,p_aArgs){var oEvent=p_aArgs[0];if(Event.getCharCode(oEvent)==27){this.focus();if(this.get("type")=="splitbutton"){this._bOptionPressed=false;}}},_onMenuRender:function(p_sType,p_aArgs){this.get("element").parentNode.appendChild(this._menu.element);},_onMenuItemSelected:function(p_sType,p_aArgs,p_oItem){this.set("selectedMenuItem",p_oItem);},_onMenuItemAdded:function(p_sType,p_aArgs,p_oItem){var oItem=p_aArgs[0];oItem.cfg.subscribeToConfigEvent("selected",this._onMenuItemSelected,oItem,this);},_onMenuClick:function(p_sType,p_aArgs){var oItem=p_aArgs[1];if(oItem){var oSrcElement=this.get("srcelement");if(oSrcElement&&oSrcElement.type=="submit"){this.submitForm();}
|
||||
this._hideMenu();}},createHiddenField:function(){if(!this.get("disabled")){var sType=this.get("type"),bCheckable=(sType=="checkbox"||sType=="radio"),oField=createInputElement((bCheckable?sType:(m_bIE?"submit":"hidden")),this.get("name"),this.get("value"),this.get("checked")),oForm=this.getForm();if(oField){if(bCheckable||oField.type=="submit"){oField.style.display="none";}
|
||||
if(oForm){var oHiddenField=this._hiddenField;if(oHiddenField&&Dom.inDocument(oHiddenField)){oForm.replaceChild(oField,oHiddenField);}
|
||||
else{oForm.appendChild(oField);}}
|
||||
this._hiddenField=oField;return oField;}}},submitForm:function(p_oMenuItem){var oForm=this.getForm();if(oForm){var oInput=this.createHiddenField();if(m_bIE){oInput.click();}
|
||||
else{var oEvent=document.createEvent("HTMLEvents");oEvent.initEvent("submit",true,true);var bSubmitForm=oForm.dispatchEvent(oEvent);if(m_bSafari&&bSubmitForm){oForm.submit();}}}},init:function(p_oElement,p_oAttributes){var sTagName=p_oAttributes.type=="link"?"A":"BUTTON",oSrcElement=p_oAttributes.srcelement;this._button=p_oElement.getElementsByTagName(sTagName)[0];YAHOO.widget.Button.superclass.init.call(this,p_oElement,p_oAttributes);m_oButtons[this.get("id")]=this;this.addClass(this.CSS_CLASS_NAME);if(m_bIE&&!m_bIE7){this.addClass("ie6");}
|
||||
this.addClass(this.get("type"));Event.on(this._button,"focus",this._onFocus,null,this);this.on("mouseover",this._onMouseOver);this.on("click",this._onClick);this.on("appendTo",this._onAppendTo);var oContainer=this.get("container"),oElement=this.get("element");if(oContainer){if(Lang.isString(oContainer)){var me=this;Event.onContentReady(oContainer,function(){me.appendTo(this);});}
|
||||
else{this.appendTo(oContainer);}}
|
||||
else if(!Dom.inDocument(oElement)&&oSrcElement&&oSrcElement.tagName.toUpperCase()=="INPUT"){var oParentNode=oSrcElement.parentNode;if(oParentNode){this.fireEvent("beforeAppendTo",{type:"beforeAppendTo",target:oParentNode});oParentNode.replaceChild(oElement,oSrcElement);this.fireEvent("appendTo",{type:"appendTo",target:oParentNode});}}
|
||||
else if(Dom.inDocument(oElement)&&oSrcElement.tagName.toUpperCase()=="SPAN"){this._addListenersToForm();}},initAttributes:function(p_oAttributes){var oAttributes=p_oAttributes||{};YAHOO.widget.Button.superclass.initAttributes.call(this,oAttributes);this.setAttributeConfig("type",{value:(oAttributes.type||"button"),validator:Lang.isString,writeOnce:true,method:this._setType});this.setAttributeConfig("label",{value:oAttributes.label,validator:Lang.isString,method:this._setLabel});this.setAttributeConfig("value",{value:oAttributes.value});this.setAttributeConfig("name",{value:oAttributes.name,validator:Lang.isString});this.setAttributeConfig("tabindex",{value:oAttributes.tabindex,validator:Lang.isNumber,method:this._setTabIndex});this.configureAttribute("title",{value:oAttributes.title,validator:Lang.isString,method:this._setTitle});this.setAttributeConfig("disabled",{value:(oAttributes.disabled||false),validator:Lang.isBoolean,method:this._setDisabled});this.setAttributeConfig("href",{value:oAttributes.href,validator:Lang.isString,method:this._setHref});this.setAttributeConfig("target",{value:oAttributes.target,validator:Lang.isString,method:this._setTarget});this.setAttributeConfig("checked",{value:(oAttributes.checked||false),validator:Lang.isBoolean,method:this._setChecked});this.setAttributeConfig("container",{value:oAttributes.container});this.setAttributeConfig("srcelement",{value:oAttributes.srcelement,writeOnce:true});this.setAttributeConfig("menu",{value:null,method:this._setMenu});this.setAttributeConfig("selectedMenuItem",{value:null});this.setAttributeConfig("onclick",{value:oAttributes.onclick,method:this._setOnClick});},focus:function(){if(!this.get("disabled")){this._button.focus();}},blur:function(){if(!this.get("disabled")){this._button.blur();}},hasFocus:function(){return(m_oFocusedButton==this);},isActive:function(){return this.hasClass("active");},getMenu:function(){return this._menu;},getForm:function(){return this._button.form;},getHiddenField:function(){return this._hiddenField;},destroy:function(){var oElement=this.get("element"),oParentNode=oElement.parentNode,oMenu=this._menu;if(oMenu){oMenu.destroy();}
|
||||
Event.purgeElement(oElement);Event.purgeElement(this._button);Event.removeListener(document,"mouseup",this._onDocumentMouseUp);Event.removeListener(document,"keyup",this._onDocumentKeyUp);Event.removeListener(document,"mousedown",this._onDocumentMouseDown);var oForm=this.getForm();if(oForm){Event.removeListener(oForm,"reset",this._onFormReset);Event.removeListener(oForm,"submit",this._onFormSubmit);}
|
||||
oParentNode.removeChild(oElement);delete m_oButtons[this.get("id")];},fireEvent:function(p_sType,p_aArgs){if(this.DOM_EVENTS[p_sType]&&this.get("disabled")){return;}
|
||||
YAHOO.widget.Button.superclass.fireEvent.call(this,p_sType,p_aArgs);},toString:function(){return("Button "+this.get("id"));}});YAHOO.widget.Button.onFormKeyDown=function(p_oEvent){var oTarget=Event.getTarget(p_oEvent),nCharCode=Event.getCharCode(p_oEvent);if(nCharCode==13&&oTarget.tagName&&oTarget.tagName.toUpperCase()=="INPUT"){var sType=oTarget.type;if(sType=="text"||sType=="password"||sType=="checkbox"||sType=="radio"||sType=="file"){function isYUISubmitButton(p_oElement){var sId=p_oElement.id;if(sId){var oButton=m_oButtons[sId];if(oButton){var oSrcElement=oButton.get("srcelement");return(oButton.get("type")=="submit"||(oSrcElement&&oSrcElement.type=="submit"));}}}
|
||||
var aButtons=Dom.getElementsBy(isYUISubmitButton,this.TAG_NAME,this.getForm()),nButtons=aButtons.length;if(nButtons>0){m_oButtons[aButtons[0].id].submitForm();}}}};YAHOO.widget.Button.addHiddenFieldsToForm=function(p_oForm){var aButtons=Dom.getElementsByClassName("yuibutton","*",p_oForm),nButtons=aButtons.length;if(nButtons>0){var oButton=null,sType=null,oMenuItem=null,oMenu=null;for(var i=0;i<nButtons;i++){oButton=m_oButtons[aButtons[i].id];if(oButton){sType=oButton.get("type");oMenuItem=oButton.get("selectedMenuItem");if(sType=="radio"||sType=="checkbox"){oButton.createHiddenField();}
|
||||
else if(oMenuItem){oMenu=oButton.getMenu();var oSrcElement=oMenu.srcElement;if(oSrcElement&&oSrcElement.tagName.toUpperCase()=="SELECT"){p_oForm.appendChild(oSrcElement);oSrcElement.selectedIndex=oMenuItem.index;}
|
||||
else{var oValue=(oMenuItem.value===null||oMenuItem.value==="")?oMenuItem.cfg.getProperty("text"):oMenuItem.value;if(oValue){var oHiddenField=oButton.getHiddenField(),oField=createInputElement("hidden",(oButton.get("name")+"_options"),oValue);if(oHiddenField&&Dom.inDocument(oHiddenField)){p_oForm.replaceChild(oField,oHiddenField);}
|
||||
else{p_oForm.appendChild(oField);}}}}}}}};})();(function(){var Dom=YAHOO.util.Dom,Event=YAHOO.util.Event,Lang=YAHOO.lang,Button=YAHOO.widget.Button;m_oButtons={};YAHOO.widget.ButtonGroup=function(p_oElement,p_oAttributes){var fnSuperClass=YAHOO.widget.ButtonGroup.superclass.constructor;if(arguments.length==1&&!Lang.isString(p_oElement)&&!p_oElement.nodeName){if(!p_oElement.id){var sId=Dom.generateId();p_oElement.id=sId;}
|
||||
fnSuperClass.call(this,(this._createGroupElement()),p_oElement);}
|
||||
else if(Lang.isString(p_oElement)){var oElement=Dom.get(p_oElement);if(oElement){if(oElement.nodeName.toUpperCase()==this.TAG_NAME){fnSuperClass.call(this,oElement,p_oAttributes);}}}
|
||||
else{var sNodeName=p_oElement.nodeName;if(sNodeName&&sNodeName==this.TAG_NAME){if(!p_oElement.id){p_oElement.id=Dom.generateId();}
|
||||
fnSuperClass.call(this,p_oElement,p_oAttributes);}}};YAHOO.extend(YAHOO.widget.ButtonGroup,YAHOO.util.Element,{_buttons:null,TAG_NAME:"DIV",CSS_CLASS_NAME:"yuibuttongroup",_createGroupElement:function(){var oElement=document.createElement(this.TAG_NAME);oElement.className=this.CSS_CLASS_NAME;return oElement;},_setDisabled:function(p_bDisabled){var nButtons=this.getCount();if(nButtons>0){var i=nButtons-1;do{this._buttons[i].set("disabled",p_bDisabled);}
|
||||
while(i--);}},_onKeyDown:function(p_oEvent){var oTarget=Event.getTarget(p_oEvent),nCharCode=Event.getCharCode(p_oEvent),sId=oTarget.parentNode.parentNode.id,oButton=m_oButtons[sId],nIndex=-1;if(nCharCode==37||nCharCode==38){nIndex=(oButton.index===0)?(this._buttons.length-1):(oButton.index-1);}
|
||||
else if(nCharCode==39||nCharCode==40){nIndex=(oButton.index===(this._buttons.length-1))?0:(oButton.index+1);}
|
||||
if(nIndex>-1){this.check(nIndex);this.getButton(nIndex).focus();}},_onAppendTo:function(p_oEvent){var aButtons=this._buttons,nButtons=aButtons.length;for(var i=0;i<nButtons;i++){aButtons[i].appendTo(this.get("element"));}},_onButtonCheckedChange:function(p_oEvent,p_oButton){var bChecked=p_oEvent.newValue,oCheckedButton=this.get("checkedButton");if(bChecked&&oCheckedButton!=p_oButton){if(oCheckedButton){oCheckedButton.set("checked",false,true);}
|
||||
this.set("checkedButton",p_oButton);this.set("value",p_oButton.get("value"));}
|
||||
else if(oCheckedButton&&!oCheckedButton.set("checked")){oCheckedButton.set("checked",true,true);}},init:function(p_oElement,p_oAttributes){this._buttons=[];YAHOO.widget.ButtonGroup.superclass.init.call(this,p_oElement,p_oAttributes);var aButtons=this.getElementsByClassName("yuibutton");if(aButtons.length>0){this.addButtons(aButtons);}
|
||||
function isRadioButton(p_oElement){return(p_oElement.type=="radio");}
|
||||
aButtons=Dom.getElementsBy(isRadioButton,"input",this.get("element"));if(aButtons.length>0){this.addButtons(aButtons);}
|
||||
this.on("keydown",this._onKeyDown);this.on("appendTo",this._onAppendTo);var oContainer=this.get("container");if(oContainer){if(Lang.isString(oContainer)){var me=this;Event.onContentReady(oContainer,function(){me.appendTo(this);});}
|
||||
else{this.appendTo(oContainer);}}},initAttributes:function(p_oAttributes){var oAttributes=p_oAttributes||{};YAHOO.widget.ButtonGroup.superclass.initAttributes.call(this,oAttributes);this.setAttributeConfig("name",{value:oAttributes.name,validator:Lang.isString});this.setAttributeConfig("disabled",{value:(oAttributes.disabled||false),validator:Lang.isBoolean,method:this._setDisabled});this.setAttributeConfig("value",{value:oAttributes.value});this.setAttributeConfig("container",{value:oAttributes.container});this.setAttributeConfig("checkedButton",{value:null});},addButton:function(p_oButton){var oButton;if(p_oButton instanceof Button&&p_oButton.get("type")=="radio"){oButton=p_oButton;}
|
||||
else if(!Lang.isString(p_oButton)&&!p_oButton.nodeName){p_oButton.type="radio";oButton=new Button(p_oButton);}
|
||||
else{oButton=new Button(p_oButton,{type:"radio"});}
|
||||
if(oButton){var nIndex=this._buttons.length,sButtonName=oButton.get("name"),sGroupName=this.get("name");oButton.index=nIndex;this._buttons[nIndex]=oButton;m_oButtons[oButton.get("id")]=oButton;if(sButtonName!=sGroupName){oButton.set("name",sGroupName);}
|
||||
if(this.get("disabled")){oButton.set("disabled",true);}
|
||||
if(oButton.get("checked")){this.set("checkedButton",oButton);}
|
||||
oButton.on("checkedChange",this._onButtonCheckedChange,oButton,this);return oButton;}},addButtons:function(p_aButtons){if(Lang.isArray(p_aButtons)){var nButtons=p_aButtons.length,oButton,aButtons=[];if(nButtons>0){for(var i=0;i<nButtons;i++){oButton=this.addButton(p_aButtons[i]);if(oButton){aButtons[aButtons.length]=oButton;}}
|
||||
if(aButtons.length>0){return aButtons;}}}},removeButton:function(p_nIndex){var oButton=this.getButton(p_nIndex);if(oButton){this._buttons.splice(p_nIndex,1);delete m_oButtons[oButton.get("id")];oButton.removeListener("checkedChange",this._onButtonCheckedChange);oButton.destroy();var nButtons=this._buttons.length;if(nButtons>0){var i=this._buttons.length-1;do{this._buttons[i].index=i;}
|
||||
while(i--);}}},getButton:function(p_nIndex){if(Lang.isNumber(p_nIndex)){return this._buttons[p_nIndex];}},getButtons:function(){return this._buttons;},getCount:function(){return this._buttons.length;},focus:function(p_nIndex){var oButton;if(Lang.isNumber(p_nIndex)){oButton=this._buttons[p_nIndex];if(oButton){oButton.focus();}}
|
||||
else{var nButtons=this.getCount();for(var i=0;i<nButtons;i++){oButton=this._buttons[i];if(!oButton.get("disabled")){oButton.focus();break;}}}},check:function(p_nIndex){var oButton=this.getButton(p_nIndex);if(oButton){oButton.set("checked",true);}},destroy:function(){var nButtons=this._buttons.length,oElement=this.get("element"),oParentNode=oElement.parentNode;if(nButtons>0){var i=this._buttons.length-1;do{this._buttons[i].destroy();}
|
||||
while(i--);}
|
||||
Event.purgeElement(oElement);oParentNode.removeChild(oElement);},toString:function(){return("ButtonGroup "+this.get("id"));}});})();YAHOO.register("button",YAHOO.widget.Button,{version:"2.2.2",build:"204"});
|
||||
4013
www/extras/yui/build/button/button-beta.js
vendored
|
|
@ -1,100 +0,0 @@
|
|||
Calendar Release Notes
|
||||
|
||||
*** version 2.2.2 ***
|
||||
|
||||
- Fixed problem with selected dates being shared across instances, when more than one Calendar/CalendarGroup was on the page
|
||||
|
||||
*** version 2.2.1 ***
|
||||
|
||||
- Fixed problem with selectCell adding duplicate selected date entries for dates which were already selected
|
||||
- Fixed problem with CalendarGroup iframe shim not covering the CalendarGroup title area
|
||||
- Removed javascript:void(null) from close button and cell links which was interrupting form submission and firing onbeforeunload in IE
|
||||
- Fixed problem with CalendarGroup getSelectedDates returning invalid results, when used in conjunction with the "selected" Config property (either passed in the constructor config argument or set seperately after construction)
|
||||
- Refactored Calendar and CalendarGroup to improve performance, especially when working with a large number of instances in IE6
|
||||
|
||||
*** version 2.2.0 ***
|
||||
|
||||
- Image customization can now be done through CSS. Images for Close, Left and Right Arrows are now pulled in using CSS defined in calendar.css and by default use relative paths to the images in the same directory as calendar.css.
|
||||
- Deprecated Calendar.IMG_ROOT and NAV_ARROW_LEFT, NAV_ARROW_RIGHT configuration properties. Customizations based on older releases which set these properties will still function as expected.
|
||||
- Deprecated CalendarGroup.CSS_2UPCLOSE. Calendar's Style.CSS_CLOSE property now represents the new default CSS class (calclose) for the close button. CSS_2UPCLOSE is still applied along with CSS_CLOSE to the new markup for the close button to support existing customizations of the CSS_2UPCLOSE CSS class (close-icon)
|
||||
- Fixed problem with Safari setting Calendar pages to incorrect dates if the pages spanned a year boundary in CalendarGroups with 3 or more pages, due to a bug in Safari's implementation of Date setMonth
|
||||
- Fixed problem with CalendarGroup setMonth rendering Calendar pages with incorrect dates in all browsers if current pages spanned year boundary
|
||||
- Fixed incorrect CalendarGroup logging statement in calendar-debug.js
|
||||
- Fixed domEventMap support for Safari versions prior to 2.0.2, caused by hasOwnProperty not being supported
|
||||
- Removed unused private property : _pageDate from Calendar class
|
||||
|
||||
*** version 0.12.2 ***
|
||||
|
||||
- Corrected documentation for clearTime function to reflect the change from midnight to noon
|
||||
|
||||
*** version 0.12.1 ***
|
||||
|
||||
- Calendar and CalendarGroup now automatically parse the argument passed to setMonth and setYear into an integer, eliminating potential concatenation bugs.
|
||||
|
||||
*** version 0.12 ***
|
||||
|
||||
- New documentation format implemented
|
||||
- Calendar2up and Calendar_Core are now deprecated. Now, Calendar alone represents the single Calendar instance, and CalendarGroup represents an n-up instance, defaulting to 2up
|
||||
- Added semantic style classes to Calendar elements to allow for custom styling solely using CSS.
|
||||
- Remapped all configuration properties to use the Config object (familiar to those who use the Container collection of controls). Property names are the same as their previous counterparts, but wrapped into Calendar.cfg, allowing for runtime reconfiguration of most properties
|
||||
- Added "title" property for setting the Calendar title
|
||||
- Added "close" property for enabling and disabling the close icon
|
||||
- Added "iframe" property for enabling an iframe shim in Internet Explorer 6 and below to fix the select bleed-through bug
|
||||
- pageDate moved to property: "pagedate"
|
||||
- selectedDates moved to property: "selected"
|
||||
- minDate moved to property : "mindate", which accepts a JavaScript Date object like its predecessor, but also supports string dates
|
||||
- maxDate moved to property : "maxdate", which accepts a JavaScript Date object like its predecessor, but also supports string dates
|
||||
- Moved style declarations to initStyles function
|
||||
- Optimized event handling in doSelectCell/doCellMouseOver/doCellMouseOut by only attaching the listener to the outer Calendar container, and only reacting to events on cells with the "selectable" CSS class.
|
||||
- Added domEventMap field for applying DOM event listeners to cells containing specific class and tag combinations.
|
||||
- Moved all cell DOM event attachment to applyListeners function
|
||||
- Added getDateByCellId / getDateFieldsByCellId helper functions
|
||||
- Corrected DateMath.getWeekNumber to comply with ISO week number handling
|
||||
- Separated renderCellDefault style portions into styleCellDefault function for easy extension
|
||||
- Deprecated onBeforeSelect. Created beforeSelectEvent which automatically subscribes to its deprecated predecessor.
|
||||
- Deprecated onSelect. Created selectEvent, which automatically subscribes to its deprecated predecessor.
|
||||
- Deprecated onBeforeDeselect. Created beforeSelectEvent which automatically subscribes to its deprecated predecessor.
|
||||
- Deprecated onDeselect. Created beforeDeselectEvent, which automatically subscribes to its deprecated predecessor.
|
||||
- Deprecated onChangePage. Created changePageEvent, which automatically subscribes to its deprecated predecessor.
|
||||
- Deprecated onRender. Created renderEvent, which automatically subscribes to its deprecated predecessor.
|
||||
- Deprecated onReset. Created resetEvent, which automatically subscribes to its deprecated predecessor.
|
||||
- Deprecated onClear. Created clearEvent, which automatically subscribes to its deprecated predecessor.
|
||||
- Corrected setMonth documentation to refer to 0-11 indexed months.
|
||||
- Added show and hide methods to Calendar for setting the Calendar's display property.
|
||||
- Optimized internal render classes to use innerHTML and string buffers
|
||||
- Removed wireCustomEvents function
|
||||
- Removed wireDefaultEvents function
|
||||
- Removed doNextMonth / doPreviousMonth
|
||||
- Removed all buildShell (header, body, footer) functions, since the Calendar shell is now built dynamically on each render
|
||||
- Wired all CalendarGroup events and configuration properties to be properly delegated to Calendar
|
||||
- Augmented CalendarGroup with all built-in renderers, label functions, hide, show, and initStyles, creating API transparency between Calendar and CalendarGroup.
|
||||
- Made all tagName, createElement, and entity references XHTML compliant
|
||||
- Fixed Daylight Saving Time bug for Brazilian time zone
|
||||
|
||||
*** version 0.11.3 ***
|
||||
|
||||
- Calendar_Core: Added arguments for selected/deselected dates to onSelect/onDeselect
|
||||
- CalendarGroup: Fixed bug where selected dates passed to constructor were not represented in selectedDates
|
||||
- Calendar2up: Now displays correctly in Opera 9
|
||||
|
||||
*** version 0.11.0 ***
|
||||
|
||||
- DateMath: DateMath.add now properly adds weeks
|
||||
- DateMath: between() function added
|
||||
- DateMath: getWeekNumber() fixed to take starting day of week into account
|
||||
- All references to Calendar's built in CSS class handlers are removed, replaced with calls to Dom utility (addClass, removeClass)
|
||||
- Several CSS class constants now have clearer names
|
||||
- All CSS classes are now properly namespaced to avoid CSS conflicts
|
||||
- Fixed table:hover bug in CSS
|
||||
- Calendar no longer requires the container ID and variable name to match in order for month navigation to function properly
|
||||
- Calendar month navigation arrows are now represented as background images
|
||||
|
||||
*** version 0.10.0 ***
|
||||
|
||||
- Major performance improvements from attaching DOM events to associated table cells only once, when the Calendar shell is built
|
||||
- DOM events for mouseover/mouseout are now fired for all browsers (not just Internet Explorer)
|
||||
- Reset functionality bug fixed for 2-up Calendar view
|
||||
|
||||
*** version 0.9.0 ***
|
||||
|
||||
* Initial release
|
||||
|
|
@ -1,197 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 2.2.2
|
||||
*/
|
||||
.yui-calcontainer {
|
||||
position:relative;
|
||||
padding:5px;
|
||||
background-color:#F7F9FB;
|
||||
border:1px solid #7B9EBD;
|
||||
float:left;
|
||||
overflow:hidden;
|
||||
}
|
||||
|
||||
.yui-calcontainer iframe {
|
||||
position:absolute;
|
||||
border:none;
|
||||
margin:0;padding:0;
|
||||
left:-1px;
|
||||
top:-1px;
|
||||
z-index:0;
|
||||
width:50em;
|
||||
height:50em;
|
||||
}
|
||||
|
||||
.yui-calcontainer.multi {
|
||||
padding:0;
|
||||
}
|
||||
|
||||
.yui-calcontainer.multi .groupcal {
|
||||
padding:5px;
|
||||
background-color:transparent;
|
||||
z-index:1;
|
||||
float:left;
|
||||
position:relative;
|
||||
border:none;
|
||||
}
|
||||
|
||||
.yui-calcontainer .title {
|
||||
font:100% sans-serif;
|
||||
color:#000;
|
||||
font-weight:bold;
|
||||
margin-bottom:5px;
|
||||
height:25px;
|
||||
position:absolute;
|
||||
top:3px;left:5px;
|
||||
z-index:1;
|
||||
}
|
||||
|
||||
.yui-calcontainer .close-icon {
|
||||
position:absolute;
|
||||
right:3px;
|
||||
top:3px;
|
||||
border:none;
|
||||
z-index:1;
|
||||
}
|
||||
|
||||
.yui-calcontainer .calclose {
|
||||
background: url("calx.gif") no-repeat;
|
||||
width:17px;
|
||||
height:13px;
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
/* Calendar element styles */
|
||||
|
||||
.yui-calendar {
|
||||
font:100% sans-serif;
|
||||
text-align:center;
|
||||
border-spacing:0;
|
||||
border-collapse:separate;
|
||||
position:relative;
|
||||
}
|
||||
|
||||
.yui-calcontainer.withtitle {
|
||||
padding-top:1.5em;
|
||||
}
|
||||
|
||||
.yui-calendar .calnavleft {
|
||||
position:absolute;
|
||||
cursor:pointer;
|
||||
top:2px;
|
||||
bottom:0;
|
||||
width:9px;
|
||||
height:12px;
|
||||
left:2px;
|
||||
z-index:1;
|
||||
background: url("callt.gif") no-repeat;
|
||||
}
|
||||
|
||||
.yui-calendar .calnavright {
|
||||
position:absolute;
|
||||
cursor:pointer;
|
||||
top:2px;
|
||||
bottom:0;
|
||||
width:9px;
|
||||
height:12px;
|
||||
right:2px;
|
||||
z-index:1;
|
||||
background: url("calrt.gif") no-repeat;
|
||||
}
|
||||
|
||||
.yui-calendar td.calcell {
|
||||
padding:.1em .2em;
|
||||
border:1px solid #E0E0E0;
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
.yui-calendar td.calcell a {
|
||||
color:#003DB8;
|
||||
text-decoration:none;
|
||||
}
|
||||
|
||||
.yui-calendar td.calcell.today {
|
||||
border:1px solid #000;
|
||||
}
|
||||
|
||||
.yui-calendar td.calcell.oom {
|
||||
cursor:default;
|
||||
color:#999;
|
||||
background-color:#EEE;
|
||||
border:1px solid #E0E0E0;
|
||||
}
|
||||
|
||||
.yui-calendar td.calcell.selected {
|
||||
color:#003DB8;
|
||||
background-color:#FFF19F;
|
||||
border:1px solid #FF9900;
|
||||
}
|
||||
|
||||
.yui-calendar td.calcell.calcellhover {
|
||||
cursor:pointer;
|
||||
color:#FFF;
|
||||
background-color:#FF9900;
|
||||
border:1px solid #FF9900;
|
||||
}
|
||||
|
||||
.yui-calendar td.calcell.calcellhover a {
|
||||
color:#FFF;
|
||||
}
|
||||
|
||||
.yui-calendar td.calcell.restricted {
|
||||
text-decoration:line-through;
|
||||
}
|
||||
|
||||
.yui-calendar td.calcell.previous {
|
||||
color:#CCC;
|
||||
}
|
||||
|
||||
.yui-calendar td.calcell.highlight1 { background-color:#CCFF99; }
|
||||
.yui-calendar td.calcell.highlight2 { background-color:#99CCFF; }
|
||||
.yui-calendar td.calcell.highlight3 { background-color:#FFCCCC; }
|
||||
.yui-calendar td.calcell.highlight4 { background-color:#CCFF99; }
|
||||
|
||||
.yui-calendar .calhead {
|
||||
border:1px solid #E0E0E0;
|
||||
vertical-align:middle;
|
||||
background-color:#FFF;
|
||||
}
|
||||
|
||||
.yui-calendar .calheader {
|
||||
position:relative;
|
||||
width:100%;
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
.yui-calendar .calheader img {
|
||||
border:none;
|
||||
}
|
||||
|
||||
.yui-calendar .calweekdaycell {
|
||||
color:#666;
|
||||
font-weight:normal;
|
||||
text-align:center;
|
||||
width:1.5em;
|
||||
}
|
||||
|
||||
.yui-calendar .calfoot {
|
||||
background-color:#EEE;
|
||||
}
|
||||
|
||||
.yui-calendar .calrowhead, .yui-calendar .calrowfoot {
|
||||
color:#666;
|
||||
font-size:9px;
|
||||
font-style:italic;
|
||||
font-weight:normal;
|
||||
width:15px;
|
||||
}
|
||||
|
||||
.yui-calendar .calrowhead {
|
||||
border-right-width:2px;
|
||||
}
|
||||
|
||||
/* Specific changes for calendar running under fonts/reset */
|
||||
.yui-calendar .calbody a:hover {background:inherit;}
|
||||
p#clear {clear:left; padding-top:10px;}
|
||||
|
Before Width: | Height: | Size: 93 B |
|
Before Width: | Height: | Size: 94 B |
|
Before Width: | Height: | Size: 88 B |
4570
www/extras/yui/build/calendar/calendar-debug.js
vendored
118
www/extras/yui/build/calendar/calendar-min.js
vendored
4548
www/extras/yui/build/calendar/calendar.js
vendored
|
|
@ -1,206 +0,0 @@
|
|||
Connection Manager Release Notes
|
||||
|
||||
*** version 2.2.2 ***
|
||||
|
||||
* No revisions.
|
||||
|
||||
*** version 2.2.1 ***
|
||||
|
||||
* setForm() will include the correct name-value of the HTML Submit button
|
||||
clicked where multiple HTML Submit button options are present in an HTML form.
|
||||
To enable this feature, include the Event utility source file as a dependency
|
||||
before the Connection Manager source file.
|
||||
|
||||
* The XHR implementation in IE6 and IE7, Opera, and Safari do not properly
|
||||
handle an HTTP 204 response. IE6/7 will instead return a Win error 1223.
|
||||
handleTransactionResponse() will treat 1223 as an HTTP 204, and route the
|
||||
response appropriately to the success callback. createResponseObject() will
|
||||
normalize the response object's status and statusText values to 204 and "No
|
||||
Content" respectively. However, no headers are returned.
|
||||
|
||||
Opera and Safari provide no discernable response with HTTP 204(e.g., response
|
||||
object's properties are undefined). This response will trigger the failure
|
||||
callback with a status of 0 and statusText of "communication failure".
|
||||
|
||||
*** version 2.2.0 ***
|
||||
|
||||
* initHeader() now accepts a third argument as a boolean. When set to true,
|
||||
this specific header will automatically be sent with each transaction.
|
||||
Otherwise, the header will be set and sent for the specific transaction only.
|
||||
Example: initHeader('X-YUI-State','Beta', true); all transactions will send this
|
||||
header.
|
||||
* resetDefaultHeaders() will clear the default headers collection.
|
||||
|
||||
* All Connection Mananger transactions will broadcast the header: "X-Requested-
|
||||
With: XMLHttpRequest".
|
||||
* This can be turned off: YAHOO.util.Connect.setDefaultXhrHeader(false);
|
||||
|
||||
* The HTTP method argument in asyncRequest is now case-insensitive.
|
||||
|
||||
* uploadFile() will now correctly handle the absence of a callback object,
|
||||
allowing the transaction to complete silently.
|
||||
|
||||
*** version 0.12.2 ***
|
||||
|
||||
* The Opera/Connection Manager concurrent object condition, described in version
|
||||
0.12.0, no longer tests applies for Opera, version 9.10.
|
||||
|
||||
*** version 0.12.1 ***
|
||||
|
||||
* connection-debug.js corrected and synchronized with connection.js. Code
|
||||
inconsistencies between the two files existed in 0.12.0.
|
||||
|
||||
*** version 0.12.0 ***
|
||||
|
||||
* When uploading files via setForm() and asyncRequest includes a POST data
|
||||
argument, appendPostData() will create hidden input fields for each postData
|
||||
label/value and append each field to the form object.
|
||||
|
||||
* setForm() returns the assembled label/value string of the parsed HTML form
|
||||
fields.
|
||||
|
||||
* NOTE: Opera 9.02 does not allow for more than 12 concurrent Connection Manager
|
||||
objects.
|
||||
|
||||
The following example creates 12 requests in a loop:
|
||||
for(var n=0; n<=12; i++){
|
||||
conn[n] = YAHOO.util.Connect.asyncRequest('GET', sUrl, callback);
|
||||
}
|
||||
|
||||
If n > 13, Opera 9.02 will crash. Connection manager objects count n must be <=
|
||||
12 at all times. This condition was not present in Opera version 9.01.
|
||||
|
||||
This condition does not apply to other A-Grade browsers (
|
||||
http://developer.yahoo.com/yui/articles/gbs/gbs_browser-chart.html)
|
||||
|
||||
*** version 0.11.3 ***
|
||||
|
||||
* YUI Event dependency for file uploading is now optional.
|
||||
|
||||
* uploadFile() now sets unique IDs for each file upload transaction to prevent
|
||||
iframe collisions with parallel uploads.
|
||||
|
||||
* The callback object now has property responseXML to provide support for file
|
||||
upload transactions that return an XML document.
|
||||
|
||||
* setForm() will verify if a select option value attribute is present and use
|
||||
its value, including empty string, before using the text node value.
|
||||
|
||||
* Modified polling mechanism in handleReadyState() and
|
||||
handleTransactionResponse() to prevent infinite polling if JavaScript errors
|
||||
occur in the user-defined callback.
|
||||
|
||||
* createFrame() will now accept a boolean argument of true to set the frame
|
||||
source to "javascript:false" to prevent IE from throwing security warnings in an
|
||||
HTTPS environment.
|
||||
|
||||
* setHeader() now enumerates through the _http_header object using
|
||||
hasOwnProperty() to prevent collisions with members added to Object via
|
||||
prototype.
|
||||
|
||||
* If using setForm() and asyncRequest includes a POST data argument, the data
|
||||
will be concatenated to the HTML form POST message.
|
||||
|
||||
*** version 0.11.2 ***
|
||||
|
||||
* No revisions.
|
||||
|
||||
*** version 0.11.1 ***
|
||||
|
||||
* uploadFile() now verifies the existence of callback.upload before invoking
|
||||
callback, with or without object scope.
|
||||
|
||||
*** version 0.11.0 ***
|
||||
|
||||
* Each transaction can be defined with a timeout threshold, in milliseconds,
|
||||
through the callback object. If the threshold is reached, and the transaction
|
||||
hasn't yet completed, the transaction will call abort().
|
||||
|
||||
* abort() will now accept a callback object as the second argument. The
|
||||
failure callback will receive a response object to indicate the transaction was
|
||||
aborted.
|
||||
|
||||
* setForm() will now support file uploads by setting the second argument to
|
||||
true (e.g., YAHOO.util.Connect.setForm(formObject, true). File upload does not
|
||||
use the callback success or failure handler. Instead, it uses a new callback
|
||||
object handler: upload.
|
||||
|
||||
* HTML form submit will no longer submit form fields without a defined name
|
||||
attribute.
|
||||
|
||||
* The default POST header of 'Content-Type','application/x-www-form-urlencoded'
|
||||
can be overridden by calling setDefaultPostHeader(false). This
|
||||
will remove the default header from non-HTML form, POST submissions.
|
||||
|
||||
* setHeader() now enumerates through the _http_header object with
|
||||
propertyIsEnumerable to prevent collisions with members added to Object via
|
||||
prototype.
|
||||
|
||||
*** version 0.10.0 ***
|
||||
|
||||
* handleTransactionResponse() now treats the full HTTP 2xx range as a success
|
||||
case, instead of just HTTP 200.
|
||||
|
||||
* To accommodate multiple field values in Mozilla/Firefox, multiple initHeader
|
||||
calls with the same label will now result in the values concatenated to a
|
||||
comma- delimited string value.
|
||||
Example:
|
||||
Setting Content-Type:'application/x-www-form-urlencoded' and Content-
|
||||
Type:'text/xml' will result in Content-Type:'application/x-www-form-urlencoded,
|
||||
text/xml'.
|
||||
|
||||
* Default polling interval lowered to 50ms.
|
||||
|
||||
* YAHOO.util.Connect.setPollingInterval() will allow you to set a polling
|
||||
interval -- in milliseconds -- to override the default value.
|
||||
|
||||
* YAHOO.util.Connect.getResponseHeader[headerLabel] now supported as a response
|
||||
object property to provide symmetry with the native XHR object's property.
|
||||
Example:
|
||||
YAHOO.util.Connect.getResponseHeader['Content-Length'] will return the value
|
||||
for the Content-Length header, if the header is available.
|
||||
|
||||
* YAHOO.util.Connect.allResponseHeaders property renamed to
|
||||
getAllResponseHeaders to provide symmetry with the native XHR object's
|
||||
property.
|
||||
|
||||
* YAHOO.util.Connect.setForm() now supports HTTP GET as well as HTTP POST.
|
||||
|
||||
* YAHOO.util.Connect.setForm() now accepts an HTML form object as well as its
|
||||
name attribute value.
|
||||
|
||||
* YAHOO.util.Connect.setForm() will not submit HTML form fields that are
|
||||
disabled or do not have a name attribute value.
|
||||
|
||||
* [FIXED] Response exceptions result in infinite callback loop in
|
||||
Mozilla/Firefox.
|
||||
|
||||
* [FIXED] YAHOO.util.Connect.abort() now properly clears polling interval.
|
||||
|
||||
* [FIXED] isCallInProgress() now verifies whether XHR instance still exists,
|
||||
and returns false if the connection object is no longer available.
|
||||
|
||||
*** version 0.9.0 ***
|
||||
|
||||
* Initial release
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1129
www/extras/yui/build/connection/connection-debug.js
vendored
109
www/extras/yui/build/connection/connection-min.js
vendored
|
|
@ -1,109 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 2.2.2
|
||||
*/
|
||||
|
||||
YAHOO.util.Connect={_msxml_progid:['MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP','Microsoft.XMLHTTP'],_http_headers:{},_has_http_headers:false,_use_default_post_header:true,_default_post_header:'application/x-www-form-urlencoded; charset=UTF-8',_use_default_xhr_header:true,_default_xhr_header:'XMLHttpRequest',_has_default_headers:true,_default_headers:{},_isFormSubmit:false,_isFileUpload:false,_formNode:null,_sFormData:null,_poll:{},_timeOut:{},_polling_interval:50,_transaction_id:0,_submitElementValue:null,_hasSubmitListener:(function()
|
||||
{if(YAHOO.util.Event){YAHOO.util.Event.addListener(document,'click',function(e){var obj=YAHOO.util.Event.getTarget(e);if(obj.type=='submit'){YAHOO.util.Connect._submitElementValue=encodeURIComponent(obj.name)+"="+encodeURIComponent(obj.value);}})
|
||||
return true;}
|
||||
return false;})(),setProgId:function(id)
|
||||
{this._msxml_progid.unshift(id);},setDefaultPostHeader:function(b)
|
||||
{this._use_default_post_header=b;},setDefaultXhrHeader:function(b)
|
||||
{this._use_default_xhr_header=b;},setPollingInterval:function(i)
|
||||
{if(typeof i=='number'&&isFinite(i)){this._polling_interval=i;}},createXhrObject:function(transactionId)
|
||||
{var obj,http;try
|
||||
{http=new XMLHttpRequest();obj={conn:http,tId:transactionId};}
|
||||
catch(e)
|
||||
{for(var i=0;i<this._msxml_progid.length;++i){try
|
||||
{http=new ActiveXObject(this._msxml_progid[i]);obj={conn:http,tId:transactionId};break;}
|
||||
catch(e){}}}
|
||||
finally
|
||||
{return obj;}},getConnectionObject:function()
|
||||
{var o;var tId=this._transaction_id;try
|
||||
{o=this.createXhrObject(tId);if(o){this._transaction_id++;}}
|
||||
catch(e){}
|
||||
finally
|
||||
{return o;}},asyncRequest:function(method,uri,callback,postData)
|
||||
{var o=this.getConnectionObject();if(!o){return null;}
|
||||
else{if(this._isFormSubmit){if(this._isFileUpload){this.uploadFile(o.tId,callback,uri,postData);this.releaseObject(o);return;}
|
||||
if(method.toUpperCase()=='GET'){if(this._sFormData.length!=0){uri+=((uri.indexOf('?')==-1)?'?':'&')+this._sFormData;}
|
||||
else{uri+="?"+this._sFormData;}}
|
||||
else if(method.toUpperCase()=='POST'){postData=postData?this._sFormData+"&"+postData:this._sFormData;}}
|
||||
o.conn.open(method,uri,true);if(this._use_default_xhr_header){if(!this._default_headers['X-Requested-With']){this.initHeader('X-Requested-With',this._default_xhr_header,true);}}
|
||||
if(this._isFormSubmit||(postData&&this._use_default_post_header)){this.initHeader('Content-Type',this._default_post_header);if(this._isFormSubmit){this.resetFormState();}}
|
||||
if(this._has_default_headers||this._has_http_headers){this.setHeader(o);}
|
||||
this.handleReadyState(o,callback);o.conn.send(postData||null);return o;}},handleReadyState:function(o,callback)
|
||||
{var oConn=this;if(callback&&callback.timeout){this._timeOut[o.tId]=window.setTimeout(function(){oConn.abort(o,callback,true);},callback.timeout);}
|
||||
this._poll[o.tId]=window.setInterval(function(){if(o.conn&&o.conn.readyState===4){window.clearInterval(oConn._poll[o.tId]);delete oConn._poll[o.tId];if(callback&&callback.timeout){delete oConn._timeOut[o.tId];}
|
||||
oConn.handleTransactionResponse(o,callback);}},this._polling_interval);},handleTransactionResponse:function(o,callback,isAbort)
|
||||
{if(!callback){this.releaseObject(o);return;}
|
||||
var httpStatus,responseObject;try
|
||||
{if(o.conn.status!==undefined&&o.conn.status!==0){httpStatus=o.conn.status;}
|
||||
else{httpStatus=13030;}}
|
||||
catch(e){httpStatus=13030;}
|
||||
if(httpStatus>=200&&httpStatus<300||httpStatus===1223){responseObject=this.createResponseObject(o,callback.argument);if(callback.success){if(!callback.scope){callback.success(responseObject);}
|
||||
else{callback.success.apply(callback.scope,[responseObject]);}}}
|
||||
else{switch(httpStatus){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:responseObject=this.createExceptionObject(o.tId,callback.argument,(isAbort?isAbort:false));if(callback.failure){if(!callback.scope){callback.failure(responseObject);}
|
||||
else{callback.failure.apply(callback.scope,[responseObject]);}}
|
||||
break;default:responseObject=this.createResponseObject(o,callback.argument);if(callback.failure){if(!callback.scope){callback.failure(responseObject);}
|
||||
else{callback.failure.apply(callback.scope,[responseObject]);}}}}
|
||||
this.releaseObject(o);responseObject=null;},createResponseObject:function(o,callbackArg)
|
||||
{var obj={};var headerObj={};try
|
||||
{var headerStr=o.conn.getAllResponseHeaders();var header=headerStr.split('\n');for(var i=0;i<header.length;i++){var delimitPos=header[i].indexOf(':');if(delimitPos!=-1){headerObj[header[i].substring(0,delimitPos)]=header[i].substring(delimitPos+2);}}}
|
||||
catch(e){}
|
||||
obj.tId=o.tId;obj.status=(o.conn.status==1223)?204:o.conn.status;obj.statusText=(o.conn.status==1223)?"No Content":o.conn.statusText;obj.getResponseHeader=headerObj;obj.getAllResponseHeaders=headerStr;obj.responseText=o.conn.responseText;obj.responseXML=o.conn.responseXML;if(typeof callbackArg!==undefined){obj.argument=callbackArg;}
|
||||
return obj;},createExceptionObject:function(tId,callbackArg,isAbort)
|
||||
{var COMM_CODE=0;var COMM_ERROR='communication failure';var ABORT_CODE=-1;var ABORT_ERROR='transaction aborted';var obj={};obj.tId=tId;if(isAbort){obj.status=ABORT_CODE;obj.statusText=ABORT_ERROR;}
|
||||
else{obj.status=COMM_CODE;obj.statusText=COMM_ERROR;}
|
||||
if(callbackArg){obj.argument=callbackArg;}
|
||||
return obj;},initHeader:function(label,value,isDefault)
|
||||
{var headerObj=(isDefault)?this._default_headers:this._http_headers;if(headerObj[label]===undefined){headerObj[label]=value;}
|
||||
else{headerObj[label]=value+","+headerObj[label];}
|
||||
if(isDefault){this._has_default_headers=true;}
|
||||
else{this._has_http_headers=true;}},setHeader:function(o)
|
||||
{if(this._has_default_headers){for(var prop in this._default_headers){if(YAHOO.lang.hasOwnProperty(this._default_headers,prop)){o.conn.setRequestHeader(prop,this._default_headers[prop]);}}}
|
||||
if(this._has_http_headers){for(var prop in this._http_headers){if(YAHOO.lang.hasOwnProperty(this._http_headers,prop)){o.conn.setRequestHeader(prop,this._http_headers[prop]);}}
|
||||
delete this._http_headers;this._http_headers={};this._has_http_headers=false;}},resetDefaultHeaders:function(){delete this._default_headers
|
||||
this._default_headers={};this._has_default_headers=false;},setForm:function(formId,isUpload,secureUri)
|
||||
{this.resetFormState();var oForm;if(typeof formId=='string'){oForm=(document.getElementById(formId)||document.forms[formId]);}
|
||||
else if(typeof formId=='object'){oForm=formId;}
|
||||
else{return;}
|
||||
if(isUpload){this.createFrame(secureUri?secureUri:null);this._isFormSubmit=true;this._isFileUpload=true;this._formNode=oForm;return;}
|
||||
var oElement,oName,oValue,oDisabled;var hasSubmit=false;for(var i=0;i<oForm.elements.length;i++){oElement=oForm.elements[i];oDisabled=oForm.elements[i].disabled;oName=oForm.elements[i].name;oValue=oForm.elements[i].value;if(!oDisabled&&oName)
|
||||
{switch(oElement.type)
|
||||
{case'select-one':case'select-multiple':for(var j=0;j<oElement.options.length;j++){if(oElement.options[j].selected){if(window.ActiveXObject){this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oElement.options[j].attributes['value'].specified?oElement.options[j].value:oElement.options[j].text)+'&';}
|
||||
else{this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oElement.options[j].hasAttribute('value')?oElement.options[j].value:oElement.options[j].text)+'&';}}}
|
||||
break;case'radio':case'checkbox':if(oElement.checked){this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';}
|
||||
break;case'file':case undefined:case'reset':case'button':break;case'submit':if(hasSubmit===false){if(this._hasSubmitListener){this._sFormData+=this._submitElementValue+'&';}
|
||||
else{this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';}
|
||||
hasSubmit=true;}
|
||||
break;default:this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';break;}}}
|
||||
this._isFormSubmit=true;this._sFormData=this._sFormData.substr(0,this._sFormData.length-1);return this._sFormData;},resetFormState:function(){this._isFormSubmit=false;this._isFileUpload=false;this._formNode=null;this._sFormData="";},createFrame:function(secureUri){var frameId='yuiIO'+this._transaction_id;if(window.ActiveXObject){var io=document.createElement('<iframe id="'+frameId+'" name="'+frameId+'" />');if(typeof secureUri=='boolean'){io.src='javascript:false';}
|
||||
else if(typeof secureURI=='string'){io.src=secureUri;}}
|
||||
else{var io=document.createElement('iframe');io.id=frameId;io.name=frameId;}
|
||||
io.style.position='absolute';io.style.top='-1000px';io.style.left='-1000px';document.body.appendChild(io);},appendPostData:function(postData)
|
||||
{var formElements=[];var postMessage=postData.split('&');for(var i=0;i<postMessage.length;i++){var delimitPos=postMessage[i].indexOf('=');if(delimitPos!=-1){formElements[i]=document.createElement('input');formElements[i].type='hidden';formElements[i].name=postMessage[i].substring(0,delimitPos);formElements[i].value=postMessage[i].substring(delimitPos+1);this._formNode.appendChild(formElements[i]);}}
|
||||
return formElements;},uploadFile:function(id,callback,uri,postData){var frameId='yuiIO'+id;var uploadEncoding='multipart/form-data';var io=document.getElementById(frameId);this._formNode.setAttribute('action',uri);this._formNode.setAttribute('method','POST');this._formNode.setAttribute("target",frameId);if(this._formNode.encoding){this._formNode.encoding=uploadEncoding;}
|
||||
else{this._formNode.enctype=uploadEncoding;}
|
||||
if(postData){var oElements=this.appendPostData(postData);}
|
||||
this._formNode.submit();if(oElements&&oElements.length>0){for(var i=0;i<oElements.length;i++){this._formNode.removeChild(oElements[i]);}}
|
||||
this.resetFormState();var uploadCallback=function()
|
||||
{var obj={};obj.tId=id;obj.argument=callback.argument;try
|
||||
{obj.responseText=io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:null;obj.responseXML=io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document;}
|
||||
catch(e){}
|
||||
if(callback&&callback.upload){if(!callback.scope){callback.upload(obj);}
|
||||
else{callback.upload.apply(callback.scope,[obj]);}}
|
||||
if(YAHOO.util.Event){YAHOO.util.Event.removeListener(io,"load",uploadCallback);}
|
||||
else if(window.detachEvent){io.detachEvent('onload',uploadCallback);}
|
||||
else{io.removeEventListener('load',uploadCallback,false);}
|
||||
setTimeout(function(){document.body.removeChild(io);},100);};if(YAHOO.util.Event){YAHOO.util.Event.addListener(io,"load",uploadCallback);}
|
||||
else if(window.attachEvent){io.attachEvent('onload',uploadCallback);}
|
||||
else{io.addEventListener('load',uploadCallback,false);}},abort:function(o,callback,isTimeout)
|
||||
{if(this.isCallInProgress(o)){o.conn.abort();window.clearInterval(this._poll[o.tId]);delete this._poll[o.tId];if(isTimeout){delete this._timeOut[o.tId];}
|
||||
this.handleTransactionResponse(o,callback,true);return true;}
|
||||
else{return false;}},isCallInProgress:function(o)
|
||||
{if(o.conn){return o.conn.readyState!==4&&o.conn.readyState!==0;}
|
||||
else{return false;}},releaseObject:function(o)
|
||||
{o.conn=null;o=null;}};YAHOO.register("connection",YAHOO.util.Connect,{version:"2.2.2",build:"204"});
|
||||
1102
www/extras/yui/build/connection/connection.js
vendored
|
|
@ -1,277 +0,0 @@
|
|||
Container Release Notes
|
||||
|
||||
*** version 2.2.2 ***
|
||||
|
||||
+ Clicking the close button of a Panel (or any instance of a Panel subclass)
|
||||
registered with an OverlayManager will no longer result in the Panel
|
||||
receiving focus.
|
||||
|
||||
+ Overlay instances registered with an OverlayManager will now correctly
|
||||
blur themselves when hidden.
|
||||
|
||||
+ Calling the "destroy" method of an Overlay instance will now result in it
|
||||
being removed from its OverlayManager instance(s).
|
||||
|
||||
+ The DOM event listener for the event defined by the "focusevent"
|
||||
configuration property of an OverlayManager instance is now removed from each
|
||||
Overlay instance when it is removed from its OverlayManager.
|
||||
|
||||
+ All subscribers for an Overlay instance's "focus" and "blur" events are
|
||||
now unsubscribed when it is removed from its OverlayManager.
|
||||
|
||||
|
||||
*** version 2.2.1 ***
|
||||
|
||||
+ Made the default scope for all Custom Events published by Module, Overlay,
|
||||
Panel, Tooltip, Dialog and SimpleDialog the widget instance. Previously the
|
||||
default scope for Custom Events was inconsistent across classes; the default
|
||||
scope for Custom Events published by Overlay was always the Overlay instance
|
||||
whereas the Custom Events published by all of the other classes had no
|
||||
default scope.
|
||||
|
||||
+ Added default scope for CustomEvents published by YAHOO.util.Config:
|
||||
- Default scope for the "configChangedEvent" is now the Config instance.
|
||||
- Default scope for Config property events is now the Config's owner (widget).
|
||||
|
||||
+ Panel and Tooltip now always convert the value of a DOM element's "tagName"
|
||||
property to uppercase before evaluating it. This improves
|
||||
XHTML compatibility.
|
||||
|
||||
+ Pressing the enter key while focused on a form field inside a Dialog will
|
||||
now trigger the "click" event handler defined by the Dialog's default
|
||||
button in IE and Firefox. Previously, this behavior only worked in Safari
|
||||
and Opera.
|
||||
|
||||
+ Added a "yui" prefix to the default CSS class name for Module to be
|
||||
consistent with the other Container family widgets.
|
||||
|
||||
+ Container/Panel's underlay shadow is now defined as partially-transparent
|
||||
black rather than gray. This prevents the shadow from lightening the
|
||||
background color of elements beneath it.
|
||||
|
||||
+ Fixed memory leaks in Panel and Dialog.
|
||||
|
||||
+ The Drag and Drop library is now a truly optional dependency for Panel and its
|
||||
subclasses.
|
||||
|
||||
+ Panel "focus" and "blur" events are now fired when Panels are focused and
|
||||
blurred via the "focus" and "blurAll" methods of YAHOO.widget.OverlayManager.
|
||||
|
||||
+ Panel instances rendered without setting the value for the "width"
|
||||
configuration property will now have their "width" configuration
|
||||
property set to the value of the Panel's element's "offsetWidth" property
|
||||
when rendered. This fixes an issue in IE 6 and 7 where Panels that are
|
||||
rendered without setting the "width" configuration property will only be
|
||||
draggable by mousing down on the text inside the header, rather than anywhere
|
||||
inside the header.
|
||||
|
||||
+ Refactored the Container family including the Config class to improve
|
||||
performance, especially when working with a large number of instances in IE6.
|
||||
|
||||
|
||||
|
||||
*** version 2.2.0 ***
|
||||
|
||||
Module
|
||||
- Removed hardcoded file paths for image roots. Affected properties
|
||||
include:
|
||||
- YAHOO.widget.Module.IMG_ROOT
|
||||
- YAHOO.widget.Module.IMG_ROOT_SSL
|
||||
- HTML elements, created via createElement, now use lowercase.
|
||||
|
||||
Panel
|
||||
- To shield against CSS class collision, the following references now
|
||||
have a "yui-" prefix:
|
||||
- YAHOO.widget.Panel.CSS_PANEL now references CSS class "yui-
|
||||
panel".
|
||||
- YAHOO.widget.Panel.CSS_PANEL_CONTAINER now references CSS class
|
||||
"yui-panel-container".
|
||||
- Close button can now be configured via the CSS class "container-
|
||||
close".
|
||||
- HTML elements, created via createElement, now use lowercase.
|
||||
|
||||
Dialog
|
||||
- To shield against CSS class collision, the following references now
|
||||
have a "yui-" prefix:
|
||||
- YAHOO.widget.Dialog.CSS_DIALOG now references CSS class "yui-
|
||||
dialog".
|
||||
- HTML elements, created via createElement, now use lowercase.
|
||||
|
||||
SimpleDialog
|
||||
- Removed hardcoded file paths for SimpleDialog icons, which are now
|
||||
configurable in CSS:
|
||||
- YAHOO.widget.SimpleDialog.ICON_BLOCK now references CSS class
|
||||
"blckicon".
|
||||
- YAHOO.widget.SimpleDialog.ICON_ALARM now references CSS class
|
||||
"alrticon".
|
||||
- YAHOO.widget.SimpleDialog.ICON_HELP now references CSS class
|
||||
"hlpicon".
|
||||
- YAHOO.widget.SimpleDialog.ICON_INFO now references CSS class
|
||||
"infoicon".
|
||||
- YAHOO.widget.SimpleDialog.ICON_WARN now references CSS class
|
||||
"warnicon".
|
||||
- YAHOO.widget.SimpleDialog.ICON_TIP now references CSS class
|
||||
"tipicon".
|
||||
- To provide shield against CSS class collision the following
|
||||
references now have a "yui-" prefix:
|
||||
- YAHOO.widget.SimpleDialog.CSS_SIMPLEDIALOG now references CSS
|
||||
class "yui-simple-dialog";
|
||||
|
||||
Tooltip
|
||||
- To shield against CSS class collision, the following references now
|
||||
have a "yui-" prefix:
|
||||
- YAHOO.widget.Tooltip.CSS_TOOLTIP now references CSS class "yui-
|
||||
tipicon" "yui-tt";
|
||||
|
||||
*** version 0.12.2 ***
|
||||
|
||||
Module
|
||||
- Corrected issue where listener was not properly removed from resize
|
||||
monitor element when "monitorresize" is disabled
|
||||
|
||||
Panel
|
||||
- Fixed issue that would sometimes prevent select lists from working
|
||||
properly in Firefox
|
||||
|
||||
Dialog
|
||||
- Fixed error that would occur when trying to create a Dialog where
|
||||
the first form element is set to "disabled"
|
||||
- Modified "close" property handler for Dialog/SimpleDialog to call
|
||||
"cancel" instead of "hide"
|
||||
|
||||
*** version 0.12.1 ***
|
||||
|
||||
All Classes
|
||||
- "monitorresize" property now functions in situations where
|
||||
document.domain has been modified.
|
||||
- YAHOO.widget.Module.textResizeEvent now fires when the font size is
|
||||
changed (except for Opera, which uses "zoom" functionality that
|
||||
prevents this)
|
||||
- Event listeners attached to container elements are now properly
|
||||
purged on destroy using YAHOO.util.Event.purgeElement
|
||||
|
||||
Panel
|
||||
- Fixed issue where focus events were broken on the page when a modal
|
||||
Panel was created
|
||||
|
||||
Dialog
|
||||
- Fixed bug where hitting "enter" on a Dialog was forcing the default
|
||||
submission behavior of the form's action to execute
|
||||
- Dialog no longer tries to give focus to hidden form elements.
|
||||
- Replaced references in Panel with   for XHTML
|
||||
compliance.
|
||||
- Fixed issue that was preventing Safari from successfully using the
|
||||
getData() function
|
||||
|
||||
*** version 0.12 ***
|
||||
|
||||
All Classes
|
||||
- New documentation format implemented, and removed unnecessary
|
||||
prototype null references previously used for generating
|
||||
documentation
|
||||
|
||||
Config
|
||||
- Added 'undefined' check when reading initial properties for
|
||||
.reset()
|
||||
- Fixed Firefox warning on .resetProperty()
|
||||
- Fixed issue preventing resetProperty() from resetting values
|
||||
correctly
|
||||
|
||||
Module
|
||||
- Removed unused "childNodesInDom" property
|
||||
|
||||
Overlay
|
||||
- Converted center() to use Dom utility
|
||||
- Fixed configVisible() to properly detect actual visible/hidden
|
||||
status in Internet Explorer, which reports "inherit" for all elements
|
||||
by default.
|
||||
- Updated onDomResize to properly reapply "context" property
|
||||
- Unified scroll/resize handlers so that they fire properly (when the
|
||||
event has completed) as opposed to constantly (as seen in Mozilla-
|
||||
based browsers)
|
||||
|
||||
Panel
|
||||
- Modified modality mask to show before Panel is shown (prior to any
|
||||
animation)
|
||||
- Modified buildWrapper to eliminate cloning of the initial markup
|
||||
module, which fixes issues with select options not maintaining their
|
||||
default selections in IE
|
||||
- Modality mask is now z-indexed properly so that the mask z-index is
|
||||
always one less than the Panel z-index
|
||||
|
||||
Dialog
|
||||
- Fixed Connection to get "action" attribute using getAttribute, to
|
||||
allow for form fields named "action"
|
||||
- Added support for "GET" by retrieving the form "method" rather than
|
||||
always defaulting to "POST"
|
||||
|
||||
KeyListener
|
||||
- Fixed to work properly with Safari 2.0 by matching against keyCode
|
||||
or charCode
|
||||
|
||||
*** version 0.11.4 ***
|
||||
|
||||
- Panel: Modality mask is now properly removed from DOM on Panel
|
||||
destroy.
|
||||
|
||||
*** version 0.11.3 ***
|
||||
|
||||
- Module: Fixed SSL warning issue in IE
|
||||
- Overlay: Fixed memory leak related to iframe shim in IE
|
||||
- Panel: No focusable elements under the mask can now be tabbed to
|
||||
- Panel: Set Panel container overflow to hidden to fix scrolling issue
|
||||
in Opera 9
|
||||
|
||||
*** version 0.11.2 ***
|
||||
|
||||
- All: JsLint optimization
|
||||
- Overlay: Fixed SSL issues with monitorresize property
|
||||
- OverlayManager: Fixed z-index incrementing issues
|
||||
- Dialog: Form elements called "name" will now function properly
|
||||
- Dialog: Removed unnecessary scope:this reference
|
||||
|
||||
*** version 0.11.1 ***
|
||||
|
||||
- Tooltip: Removed incorrect logger statement
|
||||
- Dialog: Corrected logic that was causing browser lockup in IE for
|
||||
SimpleDialog
|
||||
- Dialog: Fixed "firstButtom" typo
|
||||
|
||||
*** version 0.11.0 ***
|
||||
|
||||
- toString function added to all classes for easy logging
|
||||
- YAHOO.extend is now being used for inheritance on all container
|
||||
classes
|
||||
- Module: monitorresize feature now works on all browsers
|
||||
- Module: Fixed bug with image root and isSecure
|
||||
- Overlay: Fixed bugs related to IFRAME shim positioning
|
||||
- Overlay: center() now works in quirks mode
|
||||
- Overlay: Overlay now has a custom destroy() method that also removes
|
||||
the IFRAME shim
|
||||
- OverlayManager: Fixed bug in the prototype that was preventing
|
||||
multiple Managers on one page
|
||||
- OverlayManager: focusEvent now fires at all appropriate times
|
||||
- Tooltip: context can now be specified as an array, so Tooltips can be
|
||||
reused across multiple context elements
|
||||
- Tooltip: preventoverlap now functions properly for large context
|
||||
elements (i.e, images)
|
||||
- Tooltip: fixed bugs regarding setTimeout
|
||||
- Tooltip: added mousemove event to allow for more accurate Tooltip
|
||||
positioning
|
||||
- Panel: added dragEvent for monitoring all event handlers for drag and
|
||||
drop
|
||||
- Panel: modality mask is now resized on scroll
|
||||
- Panel: KeyListeners are now properly destroyed when the Panel is
|
||||
destroyed
|
||||
- Panel: Header is now sized properly in quirks mode
|
||||
- Dialog: Blinking cursor issue is fixed for Firefox
|
||||
- Dialog: callback object for Connection is now public (this.callback)
|
||||
- Dialog: onsuccess/onfailure properties removed (as a result of the
|
||||
public callback object)
|
||||
- Dialog: Dialog is now invisible by default
|
||||
- Dialog: Buttons are now properly cleaned up on destroy
|
||||
|
||||
*** version 0.10.0 ***
|
||||
|
||||
* Initial release
|
||||
|
||||
|
Before Width: | Height: | Size: 971 B |
|
Before Width: | Height: | Size: 591 B |
|
Before Width: | Height: | Size: 85 B |
|
|
@ -1,233 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 2.2.2
|
||||
*/
|
||||
.yui-overlay {
|
||||
position:absolute;
|
||||
display:block;
|
||||
}
|
||||
|
||||
.yui-tt {
|
||||
visibility:hidden;
|
||||
position:absolute;
|
||||
color:#333;
|
||||
background-color:#FDFFB4;
|
||||
font-family:arial,helvetica,verdana,sans-serif;
|
||||
padding:2px;
|
||||
border:1px solid #FCC90D;
|
||||
font:100% sans-serif;
|
||||
width:auto;
|
||||
}
|
||||
|
||||
* html body.masked select {
|
||||
visibility:hidden;
|
||||
}
|
||||
|
||||
* html div.yui-panel-container select {
|
||||
visibility:inherit;
|
||||
}
|
||||
|
||||
* html div.drag select {
|
||||
visibility:hidden;
|
||||
}
|
||||
|
||||
* html div.hide-select select {
|
||||
visibility:hidden;
|
||||
}
|
||||
|
||||
.mask {
|
||||
z-index:0;
|
||||
display:none;
|
||||
position:absolute;
|
||||
top:0;
|
||||
left:0;
|
||||
-moz-opacity: 0.5;
|
||||
opacity:.50;
|
||||
filter: alpha(opacity=50);
|
||||
background-color:#CCC;
|
||||
}
|
||||
|
||||
.hide-scrollbars * {
|
||||
overflow:hidden;
|
||||
}
|
||||
|
||||
.hide-scrollbars textarea, .hide-scrollbars select {
|
||||
overflow:hidden;
|
||||
display:none;
|
||||
}
|
||||
|
||||
.show-scrollbars textarea, .show-scrollbars select {
|
||||
overflow:visible;
|
||||
}
|
||||
|
||||
.yui-panel-container {
|
||||
position:absolute;
|
||||
background-color:transparent;
|
||||
z-index:6;
|
||||
visibility:hidden;
|
||||
overflow:visible;
|
||||
width:auto;
|
||||
}
|
||||
|
||||
.yui-panel-container.focused {
|
||||
}
|
||||
|
||||
|
||||
.yui-panel-container.matte {
|
||||
padding:3px;
|
||||
background-color:#FFF;
|
||||
}
|
||||
|
||||
.yui-panel-container.matte .underlay {
|
||||
display:none;
|
||||
}
|
||||
|
||||
.yui-panel-container.shadow {
|
||||
padding:0px;
|
||||
background-color:transparent;
|
||||
}
|
||||
|
||||
.yui-panel-container.shadow .underlay {
|
||||
visibility:inherit;
|
||||
position:absolute;
|
||||
background-color:#000;
|
||||
top:3px;left:3px;
|
||||
z-index:0;
|
||||
width:100%;
|
||||
height:100%;
|
||||
-moz-opacity: 0.12;
|
||||
opacity:.12;
|
||||
filter:alpha(opacity=12);
|
||||
zoom:1;
|
||||
}
|
||||
|
||||
.yui-panel {
|
||||
visibility:hidden;
|
||||
border-collapse:separate;
|
||||
position:relative;
|
||||
left:0px;top:0px;
|
||||
font:1em Arial;
|
||||
background-color:#FFF;
|
||||
border:1px solid #000;
|
||||
z-index:1;
|
||||
overflow:hidden;
|
||||
}
|
||||
|
||||
.yui-panel .hd {
|
||||
background-color:#3d77cb;
|
||||
color:#FFF;
|
||||
font-size:100%;
|
||||
line-height:100%;
|
||||
border:1px solid #FFF;
|
||||
border-bottom:1px solid #000;
|
||||
font-weight:bold;
|
||||
overflow:hidden;
|
||||
padding:4px;
|
||||
}
|
||||
|
||||
.yui-panel .bd {
|
||||
overflow:hidden;
|
||||
padding:4px;
|
||||
}
|
||||
|
||||
.yui-panel .bd p {
|
||||
margin:0 0 1em;
|
||||
}
|
||||
|
||||
.yui-panel .container-close {
|
||||
position:absolute;
|
||||
top:5px;
|
||||
right:4px;
|
||||
z-index:6;
|
||||
height:12px;
|
||||
width:12px;
|
||||
margin:0px;
|
||||
padding:0px;
|
||||
background:url(close12_1.gif) no-repeat;
|
||||
cursor:pointer;
|
||||
visibility:inherit;
|
||||
}
|
||||
|
||||
.yui-panel .ft {
|
||||
padding:4px;
|
||||
overflow:hidden;
|
||||
}
|
||||
|
||||
.yui-simple-dialog .bd .yui-icon {
|
||||
background-repeat:no-repeat;
|
||||
width:16px;
|
||||
height:16px;
|
||||
margin-right:10px;
|
||||
float:left;
|
||||
}
|
||||
|
||||
.yui-simple-dialog .bd span.blckicon {
|
||||
background: url("blck16_1.gif") no-repeat;
|
||||
}
|
||||
|
||||
.yui-simple-dialog .bd span.alrticon {
|
||||
background: url("alrt16_1.gif") no-repeat;
|
||||
}
|
||||
|
||||
.yui-simple-dialog .bd span.hlpicon {
|
||||
background: url("hlp16_1.gif") no-repeat;
|
||||
}
|
||||
|
||||
.yui-simple-dialog .bd span.infoicon {
|
||||
background: url("info16_1.gif") no-repeat;
|
||||
}
|
||||
|
||||
.yui-simple-dialog .bd span.warnicon {
|
||||
background: url("warn16_1.gif") no-repeat;
|
||||
}
|
||||
|
||||
.yui-simple-dialog .bd span.tipicon {
|
||||
background: url("tip16_1.gif") no-repeat;
|
||||
}
|
||||
|
||||
.yui-dialog .ft,
|
||||
.yui-simple-dialog .ft {
|
||||
padding-bottom:5px;
|
||||
padding-right:5px;
|
||||
text-align:right;
|
||||
}
|
||||
|
||||
.yui-dialog form,
|
||||
.yui-simple-dialog form {
|
||||
margin:0;
|
||||
}
|
||||
|
||||
.button-group button {
|
||||
font:100 76% verdana;
|
||||
text-decoration:none;
|
||||
background-color: #E4E4E4;
|
||||
color: #333;
|
||||
cursor: hand;
|
||||
vertical-align: middle;
|
||||
border: 2px solid #797979;
|
||||
border-top-color:#FFF;
|
||||
border-left-color:#FFF;
|
||||
margin:2px;
|
||||
padding:2px;
|
||||
}
|
||||
|
||||
.button-group button.default {
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
.button-group button:hover,
|
||||
.button-group button.hover {
|
||||
border:2px solid #90A029;
|
||||
background-color:#EBF09E;
|
||||
border-top-color:#FFF;
|
||||
border-left-color:#FFF;
|
||||
}
|
||||
|
||||
.button-group button:active {
|
||||
border:2px solid #E4E4E4;
|
||||
background-color:#BBB;
|
||||
border-top-color:#333;
|
||||
border-left-color:#333;
|
||||
}
|
||||
|
Before Width: | Height: | Size: 928 B |
|
Before Width: | Height: | Size: 601 B |
|
Before Width: | Height: | Size: 552 B |
|
Before Width: | Height: | Size: 580 B |
5487
www/extras/yui/build/container/container-debug.js
vendored
162
www/extras/yui/build/container/container-min.js
vendored
|
|
@ -1,162 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 2.2.2
|
||||
*/
|
||||
|
||||
YAHOO.util.Config=function(owner){if(owner){this.init(owner);}};YAHOO.util.Config.CONFIG_CHANGED_EVENT="configChanged";YAHOO.util.Config.BOOLEAN_TYPE="boolean";YAHOO.util.Config.prototype={owner:null,queueInProgress:false,config:null,initialConfig:null,eventQueue:null,configChangedEvent:null,checkBoolean:function(val){return(typeof val==YAHOO.util.Config.BOOLEAN_TYPE);},checkNumber:function(val){return(!isNaN(val));},fireEvent:function(key,value){var property=this.config[key];if(property&&property.event){property.event.fire(value);}},addProperty:function(key,propertyObject){key=key.toLowerCase();this.config[key]=propertyObject;propertyObject.event=new YAHOO.util.CustomEvent(key,this.owner);propertyObject.key=key;if(propertyObject.handler){propertyObject.event.subscribe(propertyObject.handler,this.owner);}
|
||||
this.setProperty(key,propertyObject.value,true);if(!propertyObject.suppressEvent){this.queueProperty(key,propertyObject.value);}},getConfig:function(){var cfg={};for(var prop in this.config){var property=this.config[prop];if(property&&property.event){cfg[prop]=property.value;}}
|
||||
return cfg;},getProperty:function(key){var property=this.config[key.toLowerCase()];if(property&&property.event){return property.value;}else{return undefined;}},resetProperty:function(key){key=key.toLowerCase();var property=this.config[key];if(property&&property.event){if(this.initialConfig[key]&&!YAHOO.lang.isUndefined(this.initialConfig[key])){this.setProperty(key,this.initialConfig[key]);}
|
||||
return true;}else{return false;}},setProperty:function(key,value,silent){key=key.toLowerCase();if(this.queueInProgress&&!silent){this.queueProperty(key,value);return true;}else{var property=this.config[key];if(property&&property.event){if(property.validator&&!property.validator(value)){return false;}else{property.value=value;if(!silent){this.fireEvent(key,value);this.configChangedEvent.fire([key,value]);}
|
||||
return true;}}else{return false;}}},queueProperty:function(key,value){key=key.toLowerCase();var property=this.config[key];if(property&&property.event){if(!YAHOO.lang.isUndefined(value)&&property.validator&&!property.validator(value)){return false;}else{if(!YAHOO.lang.isUndefined(value)){property.value=value;}else{value=property.value;}
|
||||
var foundDuplicate=false;var iLen=this.eventQueue.length;for(var i=0;i<iLen;i++){var queueItem=this.eventQueue[i];if(queueItem){var queueItemKey=queueItem[0];var queueItemValue=queueItem[1];if(queueItemKey==key){this.eventQueue[i]=null;this.eventQueue.push([key,(!YAHOO.lang.isUndefined(value)?value:queueItemValue)]);foundDuplicate=true;break;}}}
|
||||
if(!foundDuplicate&&!YAHOO.lang.isUndefined(value)){this.eventQueue.push([key,value]);}}
|
||||
if(property.supercedes){var sLen=property.supercedes.length;for(var s=0;s<sLen;s++){var supercedesCheck=property.supercedes[s];var qLen=this.eventQueue.length;for(var q=0;q<qLen;q++){var queueItemCheck=this.eventQueue[q];if(queueItemCheck){var queueItemCheckKey=queueItemCheck[0];var queueItemCheckValue=queueItemCheck[1];if(queueItemCheckKey==supercedesCheck.toLowerCase()){this.eventQueue.push([queueItemCheckKey,queueItemCheckValue]);this.eventQueue[q]=null;break;}}}}}
|
||||
return true;}else{return false;}},refireEvent:function(key){key=key.toLowerCase();var property=this.config[key];if(property&&property.event&&!YAHOO.lang.isUndefined(property.value)){if(this.queueInProgress){this.queueProperty(key);}else{this.fireEvent(key,property.value);}}},applyConfig:function(userConfig,init){if(init){this.initialConfig=userConfig;}
|
||||
for(var prop in userConfig){this.queueProperty(prop,userConfig[prop]);}},refresh:function(){for(var prop in this.config){this.refireEvent(prop);}},fireQueue:function(){this.queueInProgress=true;for(var i=0;i<this.eventQueue.length;i++){var queueItem=this.eventQueue[i];if(queueItem){var key=queueItem[0];var value=queueItem[1];var property=this.config[key];property.value=value;this.fireEvent(key,value);}}
|
||||
this.queueInProgress=false;this.eventQueue=[];},subscribeToConfigEvent:function(key,handler,obj,override){var property=this.config[key.toLowerCase()];if(property&&property.event){if(!YAHOO.util.Config.alreadySubscribed(property.event,handler,obj)){property.event.subscribe(handler,obj,override);}
|
||||
return true;}else{return false;}},unsubscribeFromConfigEvent:function(key,handler,obj){var property=this.config[key.toLowerCase()];if(property&&property.event){return property.event.unsubscribe(handler,obj);}else{return false;}},toString:function(){var output="Config";if(this.owner){output+=" ["+this.owner.toString()+"]";}
|
||||
return output;},outputEventQueue:function(){var output="";for(var q=0;q<this.eventQueue.length;q++){var queueItem=this.eventQueue[q];if(queueItem){output+=queueItem[0]+"="+queueItem[1]+", ";}}
|
||||
return output;}};YAHOO.util.Config.prototype.init=function(owner){this.owner=owner;this.configChangedEvent=new YAHOO.util.CustomEvent(YAHOO.util.CONFIG_CHANGED_EVENT,this);this.queueInProgress=false;this.config={};this.initialConfig={};this.eventQueue=[];};YAHOO.util.Config.alreadySubscribed=function(evt,fn,obj){for(var e=0;e<evt.subscribers.length;e++){var subsc=evt.subscribers[e];if(subsc&&subsc.obj==obj&&subsc.fn==fn){return true;}}
|
||||
return false;};YAHOO.widget.Module=function(el,userConfig){if(el){this.init(el,userConfig);}else{}};YAHOO.widget.Module.IMG_ROOT=null;YAHOO.widget.Module.IMG_ROOT_SSL=null;YAHOO.widget.Module.CSS_MODULE="yui-module";YAHOO.widget.Module.CSS_HEADER="hd";YAHOO.widget.Module.CSS_BODY="bd";YAHOO.widget.Module.CSS_FOOTER="ft";YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL="javascript:false;";YAHOO.widget.Module.textResizeEvent=new YAHOO.util.CustomEvent("textResize");YAHOO.widget.Module._EVENT_TYPES={"BEFORE_INIT":"beforeInit","INIT":"init","APPEND":"append","BEFORE_RENDER":"beforeRender","RENDER":"render","CHANGE_HEADER":"changeHeader","CHANGE_BODY":"changeBody","CHANGE_FOOTER":"changeFooter","CHANGE_CONTENT":"changeContent","DESTORY":"destroy","BEFORE_SHOW":"beforeShow","SHOW":"show","BEFORE_HIDE":"beforeHide","HIDE":"hide"};YAHOO.widget.Module._DEFAULT_CONFIG={"VISIBLE":{key:"visible",value:true,validator:YAHOO.lang.isBoolean},"EFFECT":{key:"effect",suppressEvent:true,supercedes:["visible"]},"MONITOR_RESIZE":{key:"monitorresize",value:true}};YAHOO.widget.Module.prototype={constructor:YAHOO.widget.Module,element:null,header:null,body:null,footer:null,id:null,imageRoot:YAHOO.widget.Module.IMG_ROOT,initEvents:function(){var EVENT_TYPES=YAHOO.widget.Module._EVENT_TYPES;this.beforeInitEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.BEFORE_INIT,this);this.initEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.INIT,this);this.appendEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.APPEND,this);this.beforeRenderEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.BEFORE_RENDER,this);this.renderEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.RENDER,this);this.changeHeaderEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.CHANGE_HEADER,this);this.changeBodyEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.CHANGE_BODY,this);this.changeFooterEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.CHANGE_FOOTER,this);this.changeContentEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.CHANGE_CONTENT,this);this.destroyEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.DESTORY,this);this.beforeShowEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.BEFORE_SHOW,this);this.showEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.SHOW,this);this.beforeHideEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.BEFORE_HIDE,this);this.hideEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.HIDE,this);},platform:function(){var ua=navigator.userAgent.toLowerCase();if(ua.indexOf("windows")!=-1||ua.indexOf("win32")!=-1){return"windows";}else if(ua.indexOf("macintosh")!=-1){return"mac";}else{return false;}}(),browser:function(){var ua=navigator.userAgent.toLowerCase();if(ua.indexOf('opera')!=-1){return'opera';}else if(ua.indexOf('msie 7')!=-1){return'ie7';}else if(ua.indexOf('msie')!=-1){return'ie';}else if(ua.indexOf('safari')!=-1){return'safari';}else if(ua.indexOf('gecko')!=-1){return'gecko';}else{return false;}}(),isSecure:function(){if(window.location.href.toLowerCase().indexOf("https")===0){return true;}else{return false;}}(),initDefaultConfig:function(){var DEFAULT_CONFIG=YAHOO.widget.Module._DEFAULT_CONFIG;this.cfg.addProperty(DEFAULT_CONFIG.VISIBLE.key,{handler:this.configVisible,value:DEFAULT_CONFIG.VISIBLE.value,validator:DEFAULT_CONFIG.VISIBLE.validator});this.cfg.addProperty(DEFAULT_CONFIG.EFFECT.key,{suppressEvent:DEFAULT_CONFIG.EFFECT.suppressEvent,supercedes:DEFAULT_CONFIG.EFFECT.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.MONITOR_RESIZE.key,{handler:this.configMonitorResize,value:DEFAULT_CONFIG.MONITOR_RESIZE.value});},init:function(el,userConfig){this.initEvents();this.beforeInitEvent.fire(YAHOO.widget.Module);this.cfg=new YAHOO.util.Config(this);if(this.isSecure){this.imageRoot=YAHOO.widget.Module.IMG_ROOT_SSL;}
|
||||
if(typeof el=="string"){var elId=el;el=document.getElementById(el);if(!el){el=document.createElement("div");el.id=elId;}}
|
||||
this.element=el;if(el.id){this.id=el.id;}
|
||||
var childNodes=this.element.childNodes;if(childNodes){for(var i=0;i<childNodes.length;i++){var child=childNodes[i];switch(child.className){case YAHOO.widget.Module.CSS_HEADER:this.header=child;break;case YAHOO.widget.Module.CSS_BODY:this.body=child;break;case YAHOO.widget.Module.CSS_FOOTER:this.footer=child;break;}}}
|
||||
this.initDefaultConfig();YAHOO.util.Dom.addClass(this.element,YAHOO.widget.Module.CSS_MODULE);if(userConfig){this.cfg.applyConfig(userConfig,true);}
|
||||
if(!YAHOO.util.Config.alreadySubscribed(this.renderEvent,this.cfg.fireQueue,this.cfg)){this.renderEvent.subscribe(this.cfg.fireQueue,this.cfg,true);}
|
||||
this.initEvent.fire(YAHOO.widget.Module);},initResizeMonitor:function(){if(this.browser!="opera"){var resizeMonitor=document.getElementById("_yuiResizeMonitor");if(!resizeMonitor){resizeMonitor=document.createElement("iframe");var bIE=(this.browser.indexOf("ie")===0);if(this.isSecure&&YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL&&bIE){resizeMonitor.src=YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL;}
|
||||
resizeMonitor.id="_yuiResizeMonitor";resizeMonitor.style.visibility="hidden";document.body.appendChild(resizeMonitor);resizeMonitor.style.width="10em";resizeMonitor.style.height="10em";resizeMonitor.style.position="absolute";var nLeft=-1*resizeMonitor.offsetWidth;var nTop=-1*resizeMonitor.offsetHeight;resizeMonitor.style.top=nTop+"px";resizeMonitor.style.left=nLeft+"px";resizeMonitor.style.borderStyle="none";resizeMonitor.style.borderWidth="0";YAHOO.util.Dom.setStyle(resizeMonitor,"opacity","0");resizeMonitor.style.visibility="visible";if(!bIE){var doc=resizeMonitor.contentWindow.document;doc.open();doc.close();}}
|
||||
var fireTextResize=function(){YAHOO.widget.Module.textResizeEvent.fire();};if(resizeMonitor&&resizeMonitor.contentWindow){this.resizeMonitor=resizeMonitor;YAHOO.widget.Module.textResizeEvent.subscribe(this.onDomResize,this,true);if(!YAHOO.widget.Module.textResizeInitialized){if(!YAHOO.util.Event.addListener(this.resizeMonitor.contentWindow,"resize",fireTextResize)){YAHOO.util.Event.addListener(this.resizeMonitor,"resize",fireTextResize);}
|
||||
YAHOO.widget.Module.textResizeInitialized=true;}}}},onDomResize:function(e,obj){var nLeft=-1*this.resizeMonitor.offsetWidth,nTop=-1*this.resizeMonitor.offsetHeight;this.resizeMonitor.style.top=nTop+"px";this.resizeMonitor.style.left=nLeft+"px";},setHeader:function(headerContent){if(!this.header){this.header=document.createElement("div");this.header.className=YAHOO.widget.Module.CSS_HEADER;}
|
||||
if(typeof headerContent=="string"){this.header.innerHTML=headerContent;}else{this.header.innerHTML="";this.header.appendChild(headerContent);}
|
||||
this.changeHeaderEvent.fire(headerContent);this.changeContentEvent.fire();},appendToHeader:function(element){if(!this.header){this.header=document.createElement("div");this.header.className=YAHOO.widget.Module.CSS_HEADER;}
|
||||
this.header.appendChild(element);this.changeHeaderEvent.fire(element);this.changeContentEvent.fire();},setBody:function(bodyContent){if(!this.body){this.body=document.createElement("div");this.body.className=YAHOO.widget.Module.CSS_BODY;}
|
||||
if(typeof bodyContent=="string")
|
||||
{this.body.innerHTML=bodyContent;}else{this.body.innerHTML="";this.body.appendChild(bodyContent);}
|
||||
this.changeBodyEvent.fire(bodyContent);this.changeContentEvent.fire();},appendToBody:function(element){if(!this.body){this.body=document.createElement("div");this.body.className=YAHOO.widget.Module.CSS_BODY;}
|
||||
this.body.appendChild(element);this.changeBodyEvent.fire(element);this.changeContentEvent.fire();},setFooter:function(footerContent){if(!this.footer){this.footer=document.createElement("div");this.footer.className=YAHOO.widget.Module.CSS_FOOTER;}
|
||||
if(typeof footerContent=="string"){this.footer.innerHTML=footerContent;}else{this.footer.innerHTML="";this.footer.appendChild(footerContent);}
|
||||
this.changeFooterEvent.fire(footerContent);this.changeContentEvent.fire();},appendToFooter:function(element){if(!this.footer){this.footer=document.createElement("div");this.footer.className=YAHOO.widget.Module.CSS_FOOTER;}
|
||||
this.footer.appendChild(element);this.changeFooterEvent.fire(element);this.changeContentEvent.fire();},render:function(appendToNode,moduleElement){this.beforeRenderEvent.fire();if(!moduleElement){moduleElement=this.element;}
|
||||
var me=this;var appendTo=function(element){if(typeof element=="string"){element=document.getElementById(element);}
|
||||
if(element){element.appendChild(me.element);me.appendEvent.fire();}};if(appendToNode){appendTo(appendToNode);}else{if(!YAHOO.util.Dom.inDocument(this.element)){return false;}}
|
||||
if(this.header&&!YAHOO.util.Dom.inDocument(this.header)){var firstChild=moduleElement.firstChild;if(firstChild){moduleElement.insertBefore(this.header,firstChild);}else{moduleElement.appendChild(this.header);}}
|
||||
if(this.body&&!YAHOO.util.Dom.inDocument(this.body)){if(this.footer&&YAHOO.util.Dom.isAncestor(this.moduleElement,this.footer)){moduleElement.insertBefore(this.body,this.footer);}else{moduleElement.appendChild(this.body);}}
|
||||
if(this.footer&&!YAHOO.util.Dom.inDocument(this.footer)){moduleElement.appendChild(this.footer);}
|
||||
this.renderEvent.fire();return true;},destroy:function(){var parent;if(this.element){YAHOO.util.Event.purgeElement(this.element,true);parent=this.element.parentNode;}
|
||||
if(parent){parent.removeChild(this.element);}
|
||||
this.element=null;this.header=null;this.body=null;this.footer=null;for(var e in this){if(e instanceof YAHOO.util.CustomEvent){e.unsubscribeAll();}}
|
||||
YAHOO.widget.Module.textResizeEvent.unsubscribe(this.onDomResize,this);this.destroyEvent.fire();},show:function(){this.cfg.setProperty("visible",true);},hide:function(){this.cfg.setProperty("visible",false);},configVisible:function(type,args,obj){var visible=args[0];if(visible){this.beforeShowEvent.fire();YAHOO.util.Dom.setStyle(this.element,"display","block");this.showEvent.fire();}else{this.beforeHideEvent.fire();YAHOO.util.Dom.setStyle(this.element,"display","none");this.hideEvent.fire();}},configMonitorResize:function(type,args,obj){var monitor=args[0];if(monitor){this.initResizeMonitor();}else{YAHOO.widget.Module.textResizeEvent.unsubscribe(this.onDomResize,this,true);this.resizeMonitor=null;}}};YAHOO.widget.Module.prototype.toString=function(){return"Module "+this.id;};YAHOO.widget.Overlay=function(el,userConfig){YAHOO.widget.Overlay.superclass.constructor.call(this,el,userConfig);};YAHOO.extend(YAHOO.widget.Overlay,YAHOO.widget.Module);YAHOO.widget.Overlay._EVENT_TYPES={"BEFORE_MOVE":"beforeMove","MOVE":"move"};YAHOO.widget.Overlay._DEFAULT_CONFIG={"X":{key:"x",validator:YAHOO.lang.isNumber,suppressEvent:true,supercedes:["iframe"]},"Y":{key:"y",validator:YAHOO.lang.isNumber,suppressEvent:true,supercedes:["iframe"]},"XY":{key:"xy",suppressEvent:true,supercedes:["iframe"]},"CONTEXT":{key:"context",suppressEvent:true,supercedes:["iframe"]},"FIXED_CENTER":{key:"fixedcenter",value:false,validator:YAHOO.lang.isBoolean,supercedes:["iframe","visible"]},"WIDTH":{key:"width",suppressEvent:true,supercedes:["iframe"]},"HEIGHT":{key:"height",suppressEvent:true,supercedes:["iframe"]},"ZINDEX":{key:"zindex",value:null},"CONSTRAIN_TO_VIEWPORT":{key:"constraintoviewport",value:false,validator:YAHOO.lang.isBoolean,supercedes:["iframe","x","y","xy"]},"IFRAME":{key:"iframe",value:(YAHOO.widget.Module.prototype.browser=="ie"?true:false),validator:YAHOO.lang.isBoolean,supercedes:["zIndex"]}};YAHOO.widget.Overlay.IFRAME_SRC="javascript:false;";YAHOO.widget.Overlay.TOP_LEFT="tl";YAHOO.widget.Overlay.TOP_RIGHT="tr";YAHOO.widget.Overlay.BOTTOM_LEFT="bl";YAHOO.widget.Overlay.BOTTOM_RIGHT="br";YAHOO.widget.Overlay.CSS_OVERLAY="yui-overlay";YAHOO.widget.Overlay.prototype.init=function(el,userConfig){YAHOO.widget.Overlay.superclass.init.call(this,el);this.beforeInitEvent.fire(YAHOO.widget.Overlay);YAHOO.util.Dom.addClass(this.element,YAHOO.widget.Overlay.CSS_OVERLAY);if(userConfig){this.cfg.applyConfig(userConfig,true);}
|
||||
if(this.platform=="mac"&&this.browser=="gecko"){if(!YAHOO.util.Config.alreadySubscribed(this.showEvent,this.showMacGeckoScrollbars,this)){this.showEvent.subscribe(this.showMacGeckoScrollbars,this,true);}
|
||||
if(!YAHOO.util.Config.alreadySubscribed(this.hideEvent,this.hideMacGeckoScrollbars,this)){this.hideEvent.subscribe(this.hideMacGeckoScrollbars,this,true);}}
|
||||
this.initEvent.fire(YAHOO.widget.Overlay);};YAHOO.widget.Overlay.prototype.initEvents=function(){YAHOO.widget.Overlay.superclass.initEvents.call(this);var EVENT_TYPES=YAHOO.widget.Overlay._EVENT_TYPES;this.beforeMoveEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.BEFORE_MOVE,this);this.moveEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.MOVE,this);};YAHOO.widget.Overlay.prototype.initDefaultConfig=function(){YAHOO.widget.Overlay.superclass.initDefaultConfig.call(this);var DEFAULT_CONFIG=YAHOO.widget.Overlay._DEFAULT_CONFIG;this.cfg.addProperty(DEFAULT_CONFIG.X.key,{handler:this.configX,validator:DEFAULT_CONFIG.X.validator,suppressEvent:DEFAULT_CONFIG.X.suppressEvent,supercedes:DEFAULT_CONFIG.X.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.Y.key,{handler:this.configY,validator:DEFAULT_CONFIG.Y.validator,suppressEvent:DEFAULT_CONFIG.Y.suppressEvent,supercedes:DEFAULT_CONFIG.Y.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.XY.key,{handler:this.configXY,suppressEvent:DEFAULT_CONFIG.XY.suppressEvent,supercedes:DEFAULT_CONFIG.XY.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.CONTEXT.key,{handler:this.configContext,suppressEvent:DEFAULT_CONFIG.CONTEXT.suppressEvent,supercedes:DEFAULT_CONFIG.CONTEXT.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.FIXED_CENTER.key,{handler:this.configFixedCenter,value:DEFAULT_CONFIG.FIXED_CENTER.value,validator:DEFAULT_CONFIG.FIXED_CENTER.validator,supercedes:DEFAULT_CONFIG.FIXED_CENTER.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.WIDTH.key,{handler:this.configWidth,suppressEvent:DEFAULT_CONFIG.WIDTH.suppressEvent,supercedes:DEFAULT_CONFIG.WIDTH.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.HEIGHT.key,{handler:this.configHeight,suppressEvent:DEFAULT_CONFIG.HEIGHT.suppressEvent,supercedes:DEFAULT_CONFIG.HEIGHT.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.ZINDEX.key,{handler:this.configzIndex,value:DEFAULT_CONFIG.ZINDEX.value});this.cfg.addProperty(DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.key,{handler:this.configConstrainToViewport,value:DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.value,validator:DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.validator,supercedes:DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.IFRAME.key,{handler:this.configIframe,value:DEFAULT_CONFIG.IFRAME.value,validator:DEFAULT_CONFIG.IFRAME.validator,supercedes:DEFAULT_CONFIG.IFRAME.supercedes});};YAHOO.widget.Overlay.prototype.moveTo=function(x,y){this.cfg.setProperty("xy",[x,y]);};YAHOO.widget.Overlay.prototype.hideMacGeckoScrollbars=function(){YAHOO.util.Dom.removeClass(this.element,"show-scrollbars");YAHOO.util.Dom.addClass(this.element,"hide-scrollbars");};YAHOO.widget.Overlay.prototype.showMacGeckoScrollbars=function(){YAHOO.util.Dom.removeClass(this.element,"hide-scrollbars");YAHOO.util.Dom.addClass(this.element,"show-scrollbars");};YAHOO.widget.Overlay.prototype.configVisible=function(type,args,obj){var visible=args[0];var currentVis=YAHOO.util.Dom.getStyle(this.element,"visibility");if(currentVis=="inherit"){var e=this.element.parentNode;while(e.nodeType!=9&&e.nodeType!=11){currentVis=YAHOO.util.Dom.getStyle(e,"visibility");if(currentVis!="inherit"){break;}
|
||||
e=e.parentNode;}
|
||||
if(currentVis=="inherit"){currentVis="visible";}}
|
||||
var effect=this.cfg.getProperty("effect");var effectInstances=[];if(effect){if(effect instanceof Array){for(var i=0;i<effect.length;i++){var eff=effect[i];effectInstances[effectInstances.length]=eff.effect(this,eff.duration);}}else{effectInstances[effectInstances.length]=effect.effect(this,effect.duration);}}
|
||||
var isMacGecko=(this.platform=="mac"&&this.browser=="gecko");if(visible){if(isMacGecko){this.showMacGeckoScrollbars();}
|
||||
if(effect){if(visible){if(currentVis!="visible"||currentVis===""){this.beforeShowEvent.fire();for(var j=0;j<effectInstances.length;j++){var ei=effectInstances[j];if(j===0&&!YAHOO.util.Config.alreadySubscribed(ei.animateInCompleteEvent,this.showEvent.fire,this.showEvent)){ei.animateInCompleteEvent.subscribe(this.showEvent.fire,this.showEvent,true);}
|
||||
ei.animateIn();}}}}else{if(currentVis!="visible"||currentVis===""){this.beforeShowEvent.fire();YAHOO.util.Dom.setStyle(this.element,"visibility","visible");this.cfg.refireEvent("iframe");this.showEvent.fire();}}}else{if(isMacGecko){this.hideMacGeckoScrollbars();}
|
||||
if(effect){if(currentVis=="visible"){this.beforeHideEvent.fire();for(var k=0;k<effectInstances.length;k++){var h=effectInstances[k];if(k===0&&!YAHOO.util.Config.alreadySubscribed(h.animateOutCompleteEvent,this.hideEvent.fire,this.hideEvent)){h.animateOutCompleteEvent.subscribe(this.hideEvent.fire,this.hideEvent,true);}
|
||||
h.animateOut();}}else if(currentVis===""){YAHOO.util.Dom.setStyle(this.element,"visibility","hidden");}}else{if(currentVis=="visible"||currentVis===""){this.beforeHideEvent.fire();YAHOO.util.Dom.setStyle(this.element,"visibility","hidden");this.cfg.refireEvent("iframe");this.hideEvent.fire();}}}};YAHOO.widget.Overlay.prototype.doCenterOnDOMEvent=function(){if(this.cfg.getProperty("visible")){this.center();}};YAHOO.widget.Overlay.prototype.configFixedCenter=function(type,args,obj){var val=args[0];if(val){this.center();if(!YAHOO.util.Config.alreadySubscribed(this.beforeShowEvent,this.center,this)){this.beforeShowEvent.subscribe(this.center,this,true);}
|
||||
if(!YAHOO.util.Config.alreadySubscribed(YAHOO.widget.Overlay.windowResizeEvent,this.doCenterOnDOMEvent,this)){YAHOO.widget.Overlay.windowResizeEvent.subscribe(this.doCenterOnDOMEvent,this,true);}
|
||||
if(!YAHOO.util.Config.alreadySubscribed(YAHOO.widget.Overlay.windowScrollEvent,this.doCenterOnDOMEvent,this)){YAHOO.widget.Overlay.windowScrollEvent.subscribe(this.doCenterOnDOMEvent,this,true);}}else{YAHOO.widget.Overlay.windowResizeEvent.unsubscribe(this.doCenterOnDOMEvent,this);YAHOO.widget.Overlay.windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent,this);}};YAHOO.widget.Overlay.prototype.configHeight=function(type,args,obj){var height=args[0];var el=this.element;YAHOO.util.Dom.setStyle(el,"height",height);this.cfg.refireEvent("iframe");};YAHOO.widget.Overlay.prototype.configWidth=function(type,args,obj){var width=args[0];var el=this.element;YAHOO.util.Dom.setStyle(el,"width",width);this.cfg.refireEvent("iframe");};YAHOO.widget.Overlay.prototype.configzIndex=function(type,args,obj){var zIndex=args[0];var el=this.element;if(!zIndex){zIndex=YAHOO.util.Dom.getStyle(el,"zIndex");if(!zIndex||isNaN(zIndex)){zIndex=0;}}
|
||||
if(this.iframe){if(zIndex<=0){zIndex=1;}
|
||||
YAHOO.util.Dom.setStyle(this.iframe,"zIndex",(zIndex-1));}
|
||||
YAHOO.util.Dom.setStyle(el,"zIndex",zIndex);this.cfg.setProperty("zIndex",zIndex,true);};YAHOO.widget.Overlay.prototype.configXY=function(type,args,obj){var pos=args[0];var x=pos[0];var y=pos[1];this.cfg.setProperty("x",x);this.cfg.setProperty("y",y);this.beforeMoveEvent.fire([x,y]);x=this.cfg.getProperty("x");y=this.cfg.getProperty("y");this.cfg.refireEvent("iframe");this.moveEvent.fire([x,y]);};YAHOO.widget.Overlay.prototype.configX=function(type,args,obj){var x=args[0];var y=this.cfg.getProperty("y");this.cfg.setProperty("x",x,true);this.cfg.setProperty("y",y,true);this.beforeMoveEvent.fire([x,y]);x=this.cfg.getProperty("x");y=this.cfg.getProperty("y");YAHOO.util.Dom.setX(this.element,x,true);this.cfg.setProperty("xy",[x,y],true);this.cfg.refireEvent("iframe");this.moveEvent.fire([x,y]);};YAHOO.widget.Overlay.prototype.configY=function(type,args,obj){var x=this.cfg.getProperty("x");var y=args[0];this.cfg.setProperty("x",x,true);this.cfg.setProperty("y",y,true);this.beforeMoveEvent.fire([x,y]);x=this.cfg.getProperty("x");y=this.cfg.getProperty("y");YAHOO.util.Dom.setY(this.element,y,true);this.cfg.setProperty("xy",[x,y],true);this.cfg.refireEvent("iframe");this.moveEvent.fire([x,y]);};YAHOO.widget.Overlay.prototype.showIframe=function(){if(this.iframe){this.iframe.style.display="block";}};YAHOO.widget.Overlay.prototype.hideIframe=function(){if(this.iframe){this.iframe.style.display="none";}};YAHOO.widget.Overlay.prototype.configIframe=function(type,args,obj){var val=args[0];if(val){if(!YAHOO.util.Config.alreadySubscribed(this.showEvent,this.showIframe,this)){this.showEvent.subscribe(this.showIframe,this,true);}
|
||||
if(!YAHOO.util.Config.alreadySubscribed(this.hideEvent,this.hideIframe,this)){this.hideEvent.subscribe(this.hideIframe,this,true);}
|
||||
var x=this.cfg.getProperty("x");var y=this.cfg.getProperty("y");if(!x||!y){this.syncPosition();x=this.cfg.getProperty("x");y=this.cfg.getProperty("y");}
|
||||
if(!isNaN(x)&&!isNaN(y)){if(!this.iframe){this.iframe=document.createElement("iframe");if(this.isSecure){this.iframe.src=YAHOO.widget.Overlay.IFRAME_SRC;}
|
||||
var parent=this.element.parentNode;if(parent){parent.appendChild(this.iframe);}else{document.body.appendChild(this.iframe);}
|
||||
YAHOO.util.Dom.setStyle(this.iframe,"position","absolute");YAHOO.util.Dom.setStyle(this.iframe,"border","none");YAHOO.util.Dom.setStyle(this.iframe,"margin","0");YAHOO.util.Dom.setStyle(this.iframe,"padding","0");YAHOO.util.Dom.setStyle(this.iframe,"opacity","0");if(this.cfg.getProperty("visible")){this.showIframe();}else{this.hideIframe();}}
|
||||
var iframeDisplay=YAHOO.util.Dom.getStyle(this.iframe,"display");if(iframeDisplay=="none"){this.iframe.style.display="block";}
|
||||
YAHOO.util.Dom.setXY(this.iframe,[x,y]);var width=this.element.clientWidth;var height=this.element.clientHeight;YAHOO.util.Dom.setStyle(this.iframe,"width",(width+2)+"px");YAHOO.util.Dom.setStyle(this.iframe,"height",(height+2)+"px");if(iframeDisplay=="none"){this.iframe.style.display="none";}}}else{if(this.iframe){this.iframe.style.display="none";}
|
||||
this.showEvent.unsubscribe(this.showIframe,this);this.hideEvent.unsubscribe(this.hideIframe,this);}};YAHOO.widget.Overlay.prototype.configConstrainToViewport=function(type,args,obj){var val=args[0];if(val){if(!YAHOO.util.Config.alreadySubscribed(this.beforeMoveEvent,this.enforceConstraints,this)){this.beforeMoveEvent.subscribe(this.enforceConstraints,this,true);}}else{this.beforeMoveEvent.unsubscribe(this.enforceConstraints,this);}};YAHOO.widget.Overlay.prototype.configContext=function(type,args,obj){var contextArgs=args[0];if(contextArgs){var contextEl=contextArgs[0];var elementMagnetCorner=contextArgs[1];var contextMagnetCorner=contextArgs[2];if(contextEl){if(typeof contextEl=="string"){this.cfg.setProperty("context",[document.getElementById(contextEl),elementMagnetCorner,contextMagnetCorner],true);}
|
||||
if(elementMagnetCorner&&contextMagnetCorner){this.align(elementMagnetCorner,contextMagnetCorner);}}}};YAHOO.widget.Overlay.prototype.align=function(elementAlign,contextAlign){var contextArgs=this.cfg.getProperty("context");if(contextArgs){var context=contextArgs[0];var element=this.element;var me=this;if(!elementAlign){elementAlign=contextArgs[1];}
|
||||
if(!contextAlign){contextAlign=contextArgs[2];}
|
||||
if(element&&context){var contextRegion=YAHOO.util.Dom.getRegion(context);var doAlign=function(v,h){switch(elementAlign){case YAHOO.widget.Overlay.TOP_LEFT:me.moveTo(h,v);break;case YAHOO.widget.Overlay.TOP_RIGHT:me.moveTo(h-element.offsetWidth,v);break;case YAHOO.widget.Overlay.BOTTOM_LEFT:me.moveTo(h,v-element.offsetHeight);break;case YAHOO.widget.Overlay.BOTTOM_RIGHT:me.moveTo(h-element.offsetWidth,v-element.offsetHeight);break;}};switch(contextAlign){case YAHOO.widget.Overlay.TOP_LEFT:doAlign(contextRegion.top,contextRegion.left);break;case YAHOO.widget.Overlay.TOP_RIGHT:doAlign(contextRegion.top,contextRegion.right);break;case YAHOO.widget.Overlay.BOTTOM_LEFT:doAlign(contextRegion.bottom,contextRegion.left);break;case YAHOO.widget.Overlay.BOTTOM_RIGHT:doAlign(contextRegion.bottom,contextRegion.right);break;}}}};YAHOO.widget.Overlay.prototype.enforceConstraints=function(type,args,obj){var pos=args[0];var x=pos[0];var y=pos[1];var offsetHeight=this.element.offsetHeight;var offsetWidth=this.element.offsetWidth;var viewPortWidth=YAHOO.util.Dom.getViewportWidth();var viewPortHeight=YAHOO.util.Dom.getViewportHeight();var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;var topConstraint=scrollY+10;var leftConstraint=scrollX+10;var bottomConstraint=scrollY+viewPortHeight-offsetHeight-10;var rightConstraint=scrollX+viewPortWidth-offsetWidth-10;if(x<leftConstraint){x=leftConstraint;}else if(x>rightConstraint){x=rightConstraint;}
|
||||
if(y<topConstraint){y=topConstraint;}else if(y>bottomConstraint){y=bottomConstraint;}
|
||||
this.cfg.setProperty("x",x,true);this.cfg.setProperty("y",y,true);this.cfg.setProperty("xy",[x,y],true);};YAHOO.widget.Overlay.prototype.center=function(){var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;var viewPortWidth=YAHOO.util.Dom.getClientWidth();var viewPortHeight=YAHOO.util.Dom.getClientHeight();var elementWidth=this.element.offsetWidth;var elementHeight=this.element.offsetHeight;var x=(viewPortWidth/2)-(elementWidth/2)+scrollX;var y=(viewPortHeight/2)-(elementHeight/2)+scrollY;this.cfg.setProperty("xy",[parseInt(x,10),parseInt(y,10)]);this.cfg.refireEvent("iframe");};YAHOO.widget.Overlay.prototype.syncPosition=function(){var pos=YAHOO.util.Dom.getXY(this.element);this.cfg.setProperty("x",pos[0],true);this.cfg.setProperty("y",pos[1],true);this.cfg.setProperty("xy",pos,true);};YAHOO.widget.Overlay.prototype.onDomResize=function(e,obj){YAHOO.widget.Overlay.superclass.onDomResize.call(this,e,obj);var me=this;setTimeout(function(){me.syncPosition();me.cfg.refireEvent("iframe");me.cfg.refireEvent("context");},0);};YAHOO.widget.Overlay.prototype.destroy=function(){if(this.iframe){this.iframe.parentNode.removeChild(this.iframe);}
|
||||
this.iframe=null;YAHOO.widget.Overlay.windowResizeEvent.unsubscribe(this.doCenterOnDOMEvent,this);YAHOO.widget.Overlay.windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent,this);YAHOO.widget.Overlay.superclass.destroy.call(this);};YAHOO.widget.Overlay.prototype.toString=function(){return"Overlay "+this.id;};YAHOO.widget.Overlay.windowScrollEvent=new YAHOO.util.CustomEvent("windowScroll");YAHOO.widget.Overlay.windowResizeEvent=new YAHOO.util.CustomEvent("windowResize");YAHOO.widget.Overlay.windowScrollHandler=function(e){if(YAHOO.widget.Module.prototype.browser=="ie"||YAHOO.widget.Module.prototype.browser=="ie7"){if(!window.scrollEnd){window.scrollEnd=-1;}
|
||||
clearTimeout(window.scrollEnd);window.scrollEnd=setTimeout(function(){YAHOO.widget.Overlay.windowScrollEvent.fire();},1);}else{YAHOO.widget.Overlay.windowScrollEvent.fire();}};YAHOO.widget.Overlay.windowResizeHandler=function(e){if(YAHOO.widget.Module.prototype.browser=="ie"||YAHOO.widget.Module.prototype.browser=="ie7"){if(!window.resizeEnd){window.resizeEnd=-1;}
|
||||
clearTimeout(window.resizeEnd);window.resizeEnd=setTimeout(function(){YAHOO.widget.Overlay.windowResizeEvent.fire();},100);}else{YAHOO.widget.Overlay.windowResizeEvent.fire();}};YAHOO.widget.Overlay._initialized=null;if(YAHOO.widget.Overlay._initialized===null){YAHOO.util.Event.addListener(window,"scroll",YAHOO.widget.Overlay.windowScrollHandler);YAHOO.util.Event.addListener(window,"resize",YAHOO.widget.Overlay.windowResizeHandler);YAHOO.widget.Overlay._initialized=true;}
|
||||
YAHOO.widget.OverlayManager=function(userConfig){this.init(userConfig);};YAHOO.widget.OverlayManager.CSS_FOCUSED="focused";YAHOO.widget.OverlayManager.prototype={constructor:YAHOO.widget.OverlayManager,overlays:null,initDefaultConfig:function(){this.cfg.addProperty("overlays",{suppressEvent:true});this.cfg.addProperty("focusevent",{value:"mousedown"});},init:function(userConfig){this.cfg=new YAHOO.util.Config(this);this.initDefaultConfig();if(userConfig){this.cfg.applyConfig(userConfig,true);}
|
||||
this.cfg.fireQueue();var activeOverlay=null;this.getActive=function(){return activeOverlay;};this.focus=function(overlay){var o=this.find(overlay);if(o){if(activeOverlay!=o){if(activeOverlay){activeOverlay.blur();}
|
||||
activeOverlay=o;YAHOO.util.Dom.addClass(activeOverlay.element,YAHOO.widget.OverlayManager.CSS_FOCUSED);this.overlays.sort(this.compareZIndexDesc);var topZIndex=YAHOO.util.Dom.getStyle(this.overlays[0].element,"zIndex");if(!isNaN(topZIndex)&&this.overlays[0]!=overlay){activeOverlay.cfg.setProperty("zIndex",(parseInt(topZIndex,10)+2));}
|
||||
this.overlays.sort(this.compareZIndexDesc);o.focusEvent.fire();}}};this.remove=function(overlay){var o=this.find(overlay);if(o){var originalZ=YAHOO.util.Dom.getStyle(o.element,"zIndex");o.cfg.setProperty("zIndex",-1000,true);this.overlays.sort(this.compareZIndexDesc);this.overlays=this.overlays.slice(0,this.overlays.length-1);o.hideEvent.unsubscribe(o.blur);o.destroyEvent.unsubscribe(this._onOverlayDestroy,o);if(o.element){YAHOO.util.Event.removeListener(o.element,this.cfg.getProperty("focusevent"),this._onOverlayElementFocus);}
|
||||
o.cfg.setProperty("zIndex",originalZ,true);o.cfg.setProperty("manager",null);o.focusEvent.unsubscribeAll();o.blurEvent.unsubscribeAll();o.focusEvent=null;o.blurEvent=null;o.focus=null;o.blur=null;}};this.blurAll=function(){for(var o=0;o<this.overlays.length;o++){this.overlays[o].blur();}};this._onOverlayBlur=function(p_sType,p_aArgs){activeOverlay=null;};var overlays=this.cfg.getProperty("overlays");if(!this.overlays){this.overlays=[];}
|
||||
if(overlays){this.register(overlays);this.overlays.sort(this.compareZIndexDesc);}},_onOverlayElementFocus:function(p_oEvent){var oTarget=YAHOO.util.Event.getTarget(p_oEvent),oClose=this.close;if(oClose&&(oTarget==oClose||YAHOO.util.Dom.isAncestor(oClose,oTarget))){this.blur();}
|
||||
else{this.focus();}},_onOverlayDestroy:function(p_sType,p_aArgs,p_oOverlay){this.remove(p_oOverlay);},register:function(overlay){if(overlay instanceof YAHOO.widget.Overlay){overlay.cfg.addProperty("manager",{value:this});overlay.focusEvent=new YAHOO.util.CustomEvent("focus",overlay);overlay.blurEvent=new YAHOO.util.CustomEvent("blur",overlay);var mgr=this;overlay.focus=function(){mgr.focus(this);};overlay.blur=function(){if(mgr.getActive()==this){YAHOO.util.Dom.removeClass(this.element,YAHOO.widget.OverlayManager.CSS_FOCUSED);this.blurEvent.fire();}};overlay.blurEvent.subscribe(mgr._onOverlayBlur);overlay.hideEvent.subscribe(overlay.blur);overlay.destroyEvent.subscribe(this._onOverlayDestroy,overlay,this);YAHOO.util.Event.addListener(overlay.element,this.cfg.getProperty("focusevent"),this._onOverlayElementFocus,null,overlay);var zIndex=YAHOO.util.Dom.getStyle(overlay.element,"zIndex");if(!isNaN(zIndex)){overlay.cfg.setProperty("zIndex",parseInt(zIndex,10));}else{overlay.cfg.setProperty("zIndex",0);}
|
||||
this.overlays.push(overlay);return true;}else if(overlay instanceof Array){var regcount=0;for(var i=0;i<overlay.length;i++){if(this.register(overlay[i])){regcount++;}}
|
||||
if(regcount>0){return true;}}else{return false;}},find:function(overlay){if(overlay instanceof YAHOO.widget.Overlay){for(var o=0;o<this.overlays.length;o++){if(this.overlays[o]==overlay){return this.overlays[o];}}}else if(typeof overlay=="string"){for(var p=0;p<this.overlays.length;p++){if(this.overlays[p].id==overlay){return this.overlays[p];}}}
|
||||
return null;},compareZIndexDesc:function(o1,o2){var zIndex1=o1.cfg.getProperty("zIndex");var zIndex2=o2.cfg.getProperty("zIndex");if(zIndex1>zIndex2){return-1;}else if(zIndex1<zIndex2){return 1;}else{return 0;}},showAll:function(){for(var o=0;o<this.overlays.length;o++){this.overlays[o].show();}},hideAll:function(){for(var o=0;o<this.overlays.length;o++){this.overlays[o].hide();}},toString:function(){return"OverlayManager";}};YAHOO.widget.Tooltip=function(el,userConfig){YAHOO.widget.Tooltip.superclass.constructor.call(this,el,userConfig);};YAHOO.extend(YAHOO.widget.Tooltip,YAHOO.widget.Overlay);YAHOO.widget.Tooltip.CSS_TOOLTIP="yui-tt";YAHOO.widget.Tooltip._DEFAULT_CONFIG={"PREVENT_OVERLAP":{key:"preventoverlap",value:true,validator:YAHOO.lang.isBoolean,supercedes:["x","y","xy"]},"SHOW_DELAY":{key:"showdelay",value:200,validator:YAHOO.lang.isNumber},"AUTO_DISMISS_DELAY":{key:"autodismissdelay",value:5000,validator:YAHOO.lang.isNumber},"HIDE_DELAY":{key:"hidedelay",value:250,validator:YAHOO.lang.isNumber},"TEXT":{key:"text",suppressEvent:true},"CONTAINER":{key:"container"}};YAHOO.widget.Tooltip.prototype.init=function(el,userConfig){if(document.readyState&&document.readyState!="complete"){var deferredInit=function(){this.init(el,userConfig);};YAHOO.util.Event.addListener(window,"load",deferredInit,this,true);}else{YAHOO.widget.Tooltip.superclass.init.call(this,el);this.beforeInitEvent.fire(YAHOO.widget.Tooltip);YAHOO.util.Dom.addClass(this.element,YAHOO.widget.Tooltip.CSS_TOOLTIP);if(userConfig){this.cfg.applyConfig(userConfig,true);}
|
||||
this.cfg.queueProperty("visible",false);this.cfg.queueProperty("constraintoviewport",true);this.setBody("");this.render(this.cfg.getProperty("container"));this.initEvent.fire(YAHOO.widget.Tooltip);}};YAHOO.widget.Tooltip.prototype.initDefaultConfig=function(){YAHOO.widget.Tooltip.superclass.initDefaultConfig.call(this);var DEFAULT_CONFIG=YAHOO.widget.Tooltip._DEFAULT_CONFIG;this.cfg.addProperty(DEFAULT_CONFIG.PREVENT_OVERLAP.key,{value:DEFAULT_CONFIG.PREVENT_OVERLAP.value,validator:DEFAULT_CONFIG.PREVENT_OVERLAP.validator,supercedes:DEFAULT_CONFIG.PREVENT_OVERLAP.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.SHOW_DELAY.key,{handler:this.configShowDelay,value:200,validator:DEFAULT_CONFIG.SHOW_DELAY.validator});this.cfg.addProperty(DEFAULT_CONFIG.AUTO_DISMISS_DELAY.key,{handler:this.configAutoDismissDelay,value:DEFAULT_CONFIG.AUTO_DISMISS_DELAY.value,validator:DEFAULT_CONFIG.AUTO_DISMISS_DELAY.validator});this.cfg.addProperty(DEFAULT_CONFIG.HIDE_DELAY.key,{handler:this.configHideDelay,value:DEFAULT_CONFIG.HIDE_DELAY.value,validator:DEFAULT_CONFIG.HIDE_DELAY.validator});this.cfg.addProperty(DEFAULT_CONFIG.TEXT.key,{handler:this.configText,suppressEvent:DEFAULT_CONFIG.TEXT.suppressEvent});this.cfg.addProperty(DEFAULT_CONFIG.CONTAINER.key,{handler:this.configContainer,value:document.body});};YAHOO.widget.Tooltip.prototype.configText=function(type,args,obj){var text=args[0];if(text){this.setBody(text);}};YAHOO.widget.Tooltip.prototype.configContainer=function(type,args,obj){var container=args[0];if(typeof container=='string'){this.cfg.setProperty("container",document.getElementById(container),true);}};YAHOO.widget.Tooltip.prototype._removeEventListeners=function(){var aElements=this._context;if(aElements){var nElements=aElements.length;if(nElements>0){var i=nElements-1,oElement;do{oElement=aElements[i];YAHOO.util.Event.removeListener(oElement,"mouseover",this.onContextMouseOver);YAHOO.util.Event.removeListener(oElement,"mousemove",this.onContextMouseMove);YAHOO.util.Event.removeListener(oElement,"mouseout",this.onContextMouseOut);}
|
||||
while(i--);}}};YAHOO.widget.Tooltip.prototype.configContext=function(type,args,obj){var context=args[0];if(context){if(!(context instanceof Array)){if(typeof context=="string"){this.cfg.setProperty("context",[document.getElementById(context)],true);}else{this.cfg.setProperty("context",[context],true);}
|
||||
context=this.cfg.getProperty("context");}
|
||||
this._removeEventListeners();this._context=context;var aElements=this._context;if(aElements){var nElements=aElements.length;if(nElements>0){var i=nElements-1,oElement;do{oElement=aElements[i];YAHOO.util.Event.addListener(oElement,"mouseover",this.onContextMouseOver,this);YAHOO.util.Event.addListener(oElement,"mousemove",this.onContextMouseMove,this);YAHOO.util.Event.addListener(oElement,"mouseout",this.onContextMouseOut,this);}
|
||||
while(i--);}}}};YAHOO.widget.Tooltip.prototype.onContextMouseMove=function(e,obj){obj.pageX=YAHOO.util.Event.getPageX(e);obj.pageY=YAHOO.util.Event.getPageY(e);};YAHOO.widget.Tooltip.prototype.onContextMouseOver=function(e,obj){if(obj.hideProcId){clearTimeout(obj.hideProcId);obj.hideProcId=null;}
|
||||
var context=this;YAHOO.util.Event.addListener(context,"mousemove",obj.onContextMouseMove,obj);if(context.title){obj._tempTitle=context.title;context.title="";}
|
||||
obj.showProcId=obj.doShow(e,context);};YAHOO.widget.Tooltip.prototype.onContextMouseOut=function(e,obj){var el=this;if(obj._tempTitle){el.title=obj._tempTitle;obj._tempTitle=null;}
|
||||
if(obj.showProcId){clearTimeout(obj.showProcId);obj.showProcId=null;}
|
||||
if(obj.hideProcId){clearTimeout(obj.hideProcId);obj.hideProcId=null;}
|
||||
obj.hideProcId=setTimeout(function(){obj.hide();},obj.cfg.getProperty("hidedelay"));};YAHOO.widget.Tooltip.prototype.doShow=function(e,context){var yOffset=25;if(this.browser=="opera"&&context.tagName&&context.tagName.toUpperCase()=="A"){yOffset+=12;}
|
||||
var me=this;return setTimeout(function(){if(me._tempTitle){me.setBody(me._tempTitle);}else{me.cfg.refireEvent("text");}
|
||||
me.moveTo(me.pageX,me.pageY+yOffset);if(me.cfg.getProperty("preventoverlap")){me.preventOverlap(me.pageX,me.pageY);}
|
||||
YAHOO.util.Event.removeListener(context,"mousemove",me.onContextMouseMove);me.show();me.hideProcId=me.doHide();},this.cfg.getProperty("showdelay"));};YAHOO.widget.Tooltip.prototype.doHide=function(){var me=this;return setTimeout(function(){me.hide();},this.cfg.getProperty("autodismissdelay"));};YAHOO.widget.Tooltip.prototype.preventOverlap=function(pageX,pageY){var height=this.element.offsetHeight;var elementRegion=YAHOO.util.Dom.getRegion(this.element);elementRegion.top-=5;elementRegion.left-=5;elementRegion.right+=5;elementRegion.bottom+=5;var mousePoint=new YAHOO.util.Point(pageX,pageY);if(elementRegion.contains(mousePoint)){this.cfg.setProperty("y",(pageY-height-5));}};YAHOO.widget.Tooltip.prototype.destroy=function(){this._removeEventListeners();YAHOO.widget.Tooltip.superclass.destroy.call(this);};YAHOO.widget.Tooltip.prototype.toString=function(){return"Tooltip "+this.id;};YAHOO.widget.Panel=function(el,userConfig){YAHOO.widget.Panel.superclass.constructor.call(this,el,userConfig);};YAHOO.extend(YAHOO.widget.Panel,YAHOO.widget.Overlay);YAHOO.widget.Panel.CSS_PANEL="yui-panel";YAHOO.widget.Panel.CSS_PANEL_CONTAINER="yui-panel-container";YAHOO.widget.Panel._EVENT_TYPES={"SHOW_MASK":"showMask","HIDE_MASK":"hideMask","DRAG":"drag"};YAHOO.widget.Panel._DEFAULT_CONFIG={"CLOSE":{key:"close",value:true,validator:YAHOO.lang.isBoolean,supercedes:["visible"]},"DRAGGABLE":{key:"draggable",value:(YAHOO.util.DD?true:false),validator:YAHOO.lang.isBoolean,supercedes:["visible"]},"UNDERLAY":{key:"underlay",value:"shadow",supercedes:["visible"]},"MODAL":{key:"modal",value:false,validator:YAHOO.lang.isBoolean,supercedes:["visible"]},"KEY_LISTENERS":{key:"keylisteners",suppressEvent:true,supercedes:["visible"]}};YAHOO.widget.Panel.prototype.init=function(el,userConfig){YAHOO.widget.Panel.superclass.init.call(this,el);this.beforeInitEvent.fire(YAHOO.widget.Panel);YAHOO.util.Dom.addClass(this.element,YAHOO.widget.Panel.CSS_PANEL);this.buildWrapper();if(userConfig){this.cfg.applyConfig(userConfig,true);}
|
||||
this.beforeRenderEvent.subscribe(function(){var draggable=this.cfg.getProperty("draggable");if(draggable){if(!this.header){this.setHeader(" ");}}},this,true);this.renderEvent.subscribe(function(){var sWidth=this.cfg.getProperty("width");if(!sWidth){this.cfg.setProperty("width",(this.element.offsetWidth+"px"));}});var me=this;var doBlur=function(){this.blur();};this.showMaskEvent.subscribe(function(){var checkFocusable=function(el){var sTagName=el.tagName.toUpperCase(),bFocusable=false;switch(sTagName){case"A":case"BUTTON":case"SELECT":case"TEXTAREA":if(!YAHOO.util.Dom.isAncestor(me.element,el)){YAHOO.util.Event.addListener(el,"focus",doBlur,el,true);bFocusable=true;}
|
||||
break;case"INPUT":if(el.type!="hidden"&&!YAHOO.util.Dom.isAncestor(me.element,el)){YAHOO.util.Event.addListener(el,"focus",doBlur,el,true);bFocusable=true;}
|
||||
break;}
|
||||
return bFocusable;};this.focusableElements=YAHOO.util.Dom.getElementsBy(checkFocusable);},this,true);this.hideMaskEvent.subscribe(function(){for(var i=0;i<this.focusableElements.length;i++){var el2=this.focusableElements[i];YAHOO.util.Event.removeListener(el2,"focus",doBlur);}},this,true);this.beforeShowEvent.subscribe(function(){this.cfg.refireEvent("underlay");},this,true);this.initEvent.fire(YAHOO.widget.Panel);};YAHOO.widget.Panel.prototype.initEvents=function(){YAHOO.widget.Panel.superclass.initEvents.call(this);var EVENT_TYPES=YAHOO.widget.Panel._EVENT_TYPES;this.showMaskEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.SHOW_MASK,this);this.hideMaskEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.HIDE_MASK,this);this.dragEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.DRAG,this);};YAHOO.widget.Panel.prototype.initDefaultConfig=function(){YAHOO.widget.Panel.superclass.initDefaultConfig.call(this);var DEFAULT_CONFIG=YAHOO.widget.Panel._DEFAULT_CONFIG;this.cfg.addProperty(DEFAULT_CONFIG.CLOSE.key,{handler:this.configClose,value:DEFAULT_CONFIG.CLOSE.value,validator:DEFAULT_CONFIG.CLOSE.validator,supercedes:DEFAULT_CONFIG.CLOSE.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.DRAGGABLE.key,{handler:this.configDraggable,value:DEFAULT_CONFIG.DRAGGABLE.value,validator:DEFAULT_CONFIG.DRAGGABLE.validator,supercedes:DEFAULT_CONFIG.DRAGGABLE.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.UNDERLAY.key,{handler:this.configUnderlay,value:DEFAULT_CONFIG.UNDERLAY.value,supercedes:DEFAULT_CONFIG.UNDERLAY.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.MODAL.key,{handler:this.configModal,value:DEFAULT_CONFIG.MODAL.value,validator:DEFAULT_CONFIG.MODAL.validator,supercedes:DEFAULT_CONFIG.MODAL.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.KEY_LISTENERS.key,{handler:this.configKeyListeners,suppressEvent:DEFAULT_CONFIG.KEY_LISTENERS.suppressEvent,supercedes:DEFAULT_CONFIG.KEY_LISTENERS.supercedes});};YAHOO.widget.Panel.prototype.configClose=function(type,args,obj){var val=args[0];var doHide=function(e,obj){obj.hide();};if(val){if(!this.close){this.close=document.createElement("span");YAHOO.util.Dom.addClass(this.close,"container-close");this.close.innerHTML=" ";this.innerElement.appendChild(this.close);YAHOO.util.Event.addListener(this.close,"click",doHide,this);}else{this.close.style.display="block";}}else{if(this.close){this.close.style.display="none";}}};YAHOO.widget.Panel.prototype.configDraggable=function(type,args,obj){var val=args[0];if(val){if(!YAHOO.util.DD){this.cfg.setProperty("draggable",false);return;}
|
||||
if(this.header){YAHOO.util.Dom.setStyle(this.header,"cursor","move");this.registerDragDrop();}}else{if(this.dd){this.dd.unreg();}
|
||||
if(this.header){YAHOO.util.Dom.setStyle(this.header,"cursor","auto");}}};YAHOO.widget.Panel.prototype.configUnderlay=function(type,args,obj){var val=args[0];switch(val.toLowerCase()){case"shadow":YAHOO.util.Dom.removeClass(this.element,"matte");YAHOO.util.Dom.addClass(this.element,"shadow");if(!this.underlay){this.underlay=document.createElement("div");this.underlay.className="underlay";this.underlay.innerHTML=" ";this.element.appendChild(this.underlay);}
|
||||
this.sizeUnderlay();break;case"matte":YAHOO.util.Dom.removeClass(this.element,"shadow");YAHOO.util.Dom.addClass(this.element,"matte");break;default:YAHOO.util.Dom.removeClass(this.element,"shadow");YAHOO.util.Dom.removeClass(this.element,"matte");break;}};YAHOO.widget.Panel.prototype.configModal=function(type,args,obj){var modal=args[0];if(modal){this.buildMask();if(!YAHOO.util.Config.alreadySubscribed(this.beforeShowEvent,this.showMask,this)){this.beforeShowEvent.subscribe(this.showMask,this,true);}
|
||||
if(!YAHOO.util.Config.alreadySubscribed(this.hideEvent,this.hideMask,this)){this.hideEvent.subscribe(this.hideMask,this,true);}
|
||||
if(!YAHOO.util.Config.alreadySubscribed(YAHOO.widget.Overlay.windowResizeEvent,this.sizeMask,this)){YAHOO.widget.Overlay.windowResizeEvent.subscribe(this.sizeMask,this,true);}
|
||||
if(!YAHOO.util.Config.alreadySubscribed(this.destroyEvent,this.removeMask,this)){this.destroyEvent.subscribe(this.removeMask,this,true);}
|
||||
this.cfg.refireEvent("zIndex");}else{this.beforeShowEvent.unsubscribe(this.showMask,this);this.hideEvent.unsubscribe(this.hideMask,this);YAHOO.widget.Overlay.windowResizeEvent.unsubscribe(this.sizeMask,this);this.destroyEvent.unsubscribe(this.removeMask,this);}};YAHOO.widget.Panel.prototype.removeMask=function(){var oMask=this.mask;if(oMask){this.hideMask();var oParentNode=oMask.parentNode;if(oParentNode){oParentNode.removeChild(oMask);}
|
||||
this.mask=null;}};YAHOO.widget.Panel.prototype.configKeyListeners=function(type,args,obj){var listeners=args[0];if(listeners){if(listeners instanceof Array){for(var i=0;i<listeners.length;i++){var listener=listeners[i];if(!YAHOO.util.Config.alreadySubscribed(this.showEvent,listener.enable,listener)){this.showEvent.subscribe(listener.enable,listener,true);}
|
||||
if(!YAHOO.util.Config.alreadySubscribed(this.hideEvent,listener.disable,listener)){this.hideEvent.subscribe(listener.disable,listener,true);this.destroyEvent.subscribe(listener.disable,listener,true);}}}else{if(!YAHOO.util.Config.alreadySubscribed(this.showEvent,listeners.enable,listeners)){this.showEvent.subscribe(listeners.enable,listeners,true);}
|
||||
if(!YAHOO.util.Config.alreadySubscribed(this.hideEvent,listeners.disable,listeners)){this.hideEvent.subscribe(listeners.disable,listeners,true);this.destroyEvent.subscribe(listeners.disable,listeners,true);}}}};YAHOO.widget.Panel.prototype.configHeight=function(type,args,obj){var height=args[0];var el=this.innerElement;YAHOO.util.Dom.setStyle(el,"height",height);this.cfg.refireEvent("underlay");this.cfg.refireEvent("iframe");};YAHOO.widget.Panel.prototype.configWidth=function(type,args,obj){var width=args[0];var el=this.innerElement;YAHOO.util.Dom.setStyle(el,"width",width);this.cfg.refireEvent("underlay");this.cfg.refireEvent("iframe");};YAHOO.widget.Panel.prototype.configzIndex=function(type,args,obj){YAHOO.widget.Panel.superclass.configzIndex.call(this,type,args,obj);var maskZ=0;var currentZ=YAHOO.util.Dom.getStyle(this.element,"zIndex");if(this.mask){if(!currentZ||isNaN(currentZ)){currentZ=0;}
|
||||
if(currentZ===0){this.cfg.setProperty("zIndex",1);}else{maskZ=currentZ-1;YAHOO.util.Dom.setStyle(this.mask,"zIndex",maskZ);}}};YAHOO.widget.Panel.prototype.buildWrapper=function(){var elementParent=this.element.parentNode;var originalElement=this.element;var wrapper=document.createElement("div");wrapper.className=YAHOO.widget.Panel.CSS_PANEL_CONTAINER;wrapper.id=originalElement.id+"_c";if(elementParent){elementParent.insertBefore(wrapper,originalElement);}
|
||||
wrapper.appendChild(originalElement);this.element=wrapper;this.innerElement=originalElement;YAHOO.util.Dom.setStyle(this.innerElement,"visibility","inherit");};YAHOO.widget.Panel.prototype.sizeUnderlay=function(){if(this.underlay&&this.browser!="gecko"&&this.browser!="safari"){this.underlay.style.width=this.innerElement.offsetWidth+"px";this.underlay.style.height=this.innerElement.offsetHeight+"px";}};YAHOO.widget.Panel.prototype.onDomResize=function(e,obj){YAHOO.widget.Panel.superclass.onDomResize.call(this,e,obj);var me=this;setTimeout(function(){me.sizeUnderlay();},0);};YAHOO.widget.Panel.prototype.registerDragDrop=function(){if(this.header){if(!YAHOO.util.DD){return;}
|
||||
this.dd=new YAHOO.util.DD(this.element.id,this.id);if(!this.header.id){this.header.id=this.id+"_h";}
|
||||
var me=this;this.dd.startDrag=function(){if(me.browser=="ie"){YAHOO.util.Dom.addClass(me.element,"drag");}
|
||||
if(me.cfg.getProperty("constraintoviewport")){var offsetHeight=me.element.offsetHeight;var offsetWidth=me.element.offsetWidth;var viewPortWidth=YAHOO.util.Dom.getViewportWidth();var viewPortHeight=YAHOO.util.Dom.getViewportHeight();var scrollX=window.scrollX||document.documentElement.scrollLeft;var scrollY=window.scrollY||document.documentElement.scrollTop;var topConstraint=scrollY+10;var leftConstraint=scrollX+10;var bottomConstraint=scrollY+viewPortHeight-offsetHeight-10;var rightConstraint=scrollX+viewPortWidth-offsetWidth-10;this.minX=leftConstraint;this.maxX=rightConstraint;this.constrainX=true;this.minY=topConstraint;this.maxY=bottomConstraint;this.constrainY=true;}else{this.constrainX=false;this.constrainY=false;}
|
||||
me.dragEvent.fire("startDrag",arguments);};this.dd.onDrag=function(){me.syncPosition();me.cfg.refireEvent("iframe");if(this.platform=="mac"&&this.browser=="gecko"){this.showMacGeckoScrollbars();}
|
||||
me.dragEvent.fire("onDrag",arguments);};this.dd.endDrag=function(){if(me.browser=="ie"){YAHOO.util.Dom.removeClass(me.element,"drag");}
|
||||
me.dragEvent.fire("endDrag",arguments);};this.dd.setHandleElId(this.header.id);this.dd.addInvalidHandleType("INPUT");this.dd.addInvalidHandleType("SELECT");this.dd.addInvalidHandleType("TEXTAREA");}};YAHOO.widget.Panel.prototype.buildMask=function(){if(!this.mask){this.mask=document.createElement("div");this.mask.id=this.id+"_mask";this.mask.className="mask";this.mask.innerHTML=" ";var maskClick=function(e,obj){YAHOO.util.Event.stopEvent(e);};var firstChild=document.body.firstChild;if(firstChild){document.body.insertBefore(this.mask,document.body.firstChild);}else{document.body.appendChild(this.mask);}}};YAHOO.widget.Panel.prototype.hideMask=function(){if(this.cfg.getProperty("modal")&&this.mask){this.mask.style.display="none";this.hideMaskEvent.fire();YAHOO.util.Dom.removeClass(document.body,"masked");}};YAHOO.widget.Panel.prototype.showMask=function(){if(this.cfg.getProperty("modal")&&this.mask){YAHOO.util.Dom.addClass(document.body,"masked");this.sizeMask();this.mask.style.display="block";this.showMaskEvent.fire();}};YAHOO.widget.Panel.prototype.sizeMask=function(){if(this.mask){this.mask.style.height=YAHOO.util.Dom.getDocumentHeight()+"px";this.mask.style.width=YAHOO.util.Dom.getDocumentWidth()+"px";}};YAHOO.widget.Panel.prototype.render=function(appendToNode){return YAHOO.widget.Panel.superclass.render.call(this,appendToNode,this.innerElement);};YAHOO.widget.Panel.prototype.destroy=function(){YAHOO.widget.Overlay.windowResizeEvent.unsubscribe(this.sizeMask,this);if(this.close){YAHOO.util.Event.purgeElement(this.close);}
|
||||
YAHOO.widget.Panel.superclass.destroy.call(this);};YAHOO.widget.Panel.prototype.toString=function(){return"Panel "+this.id;};YAHOO.widget.Dialog=function(el,userConfig){YAHOO.widget.Dialog.superclass.constructor.call(this,el,userConfig);};YAHOO.extend(YAHOO.widget.Dialog,YAHOO.widget.Panel);YAHOO.widget.Dialog.CSS_DIALOG="yui-dialog";YAHOO.widget.Dialog._EVENT_TYPES={"BEFORE_SUBMIT":"beforeSubmit","SUBMIT":"submit","MANUAL_SUBMIT":"manualSubmit","ASYNC_SUBMIT":"asyncSubmit","FORM_SUBMIT":"formSubmit","CANCEL":"cancel"};YAHOO.widget.Dialog._DEFAULT_CONFIG={"POST_METHOD":{key:"postmethod",value:"async"},"BUTTONS":{key:"buttons",value:"none"}};YAHOO.widget.Dialog.prototype.initDefaultConfig=function(){YAHOO.widget.Dialog.superclass.initDefaultConfig.call(this);this.callback={success:null,failure:null,argument:null};var DEFAULT_CONFIG=YAHOO.widget.Dialog._DEFAULT_CONFIG;this.cfg.addProperty(DEFAULT_CONFIG.POST_METHOD.key,{handler:this.configPostMethod,value:DEFAULT_CONFIG.POST_METHOD.value,validator:function(val){if(val!="form"&&val!="async"&&val!="none"&&val!="manual"){return false;}else{return true;}}});this.cfg.addProperty(DEFAULT_CONFIG.BUTTONS.key,{handler:this.configButtons,value:DEFAULT_CONFIG.BUTTONS.value});};YAHOO.widget.Dialog.prototype.initEvents=function(){YAHOO.widget.Dialog.superclass.initEvents.call(this);var EVENT_TYPES=YAHOO.widget.Dialog._EVENT_TYPES;this.beforeSubmitEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.BEFORE_SUBMIT,this);this.submitEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.SUBMIT,this);this.manualSubmitEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.MANUAL_SUBMIT,this);this.asyncSubmitEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.ASYNC_SUBMIT,this);this.formSubmitEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.FORM_SUBMIT,this);this.cancelEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.CANCEL,this);};YAHOO.widget.Dialog.prototype.init=function(el,userConfig){YAHOO.widget.Dialog.superclass.init.call(this,el);this.beforeInitEvent.fire(YAHOO.widget.Dialog);YAHOO.util.Dom.addClass(this.element,YAHOO.widget.Dialog.CSS_DIALOG);this.cfg.setProperty("visible",false);if(userConfig){this.cfg.applyConfig(userConfig,true);}
|
||||
this.showEvent.subscribe(this.focusFirst,this,true);this.beforeHideEvent.subscribe(this.blurButtons,this,true);this.beforeRenderEvent.subscribe(function(){var buttonCfg=this.cfg.getProperty("buttons");if(buttonCfg&&buttonCfg!="none"){if(!this.footer){this.setFooter("");}}},this,true);this.initEvent.fire(YAHOO.widget.Dialog);};YAHOO.widget.Dialog.prototype.doSubmit=function(){var pm=this.cfg.getProperty("postmethod");switch(pm){case"async":var method=this.form.getAttribute("method")||'POST';method=method.toUpperCase();YAHOO.util.Connect.setForm(this.form);var cObj=YAHOO.util.Connect.asyncRequest(method,this.form.getAttribute("action"),this.callback);this.asyncSubmitEvent.fire();break;case"form":this.form.submit();this.formSubmitEvent.fire();break;case"none":case"manual":this.manualSubmitEvent.fire();break;}};YAHOO.widget.Dialog.prototype._onFormKeyDown=function(p_oEvent){var oTarget=YAHOO.util.Event.getTarget(p_oEvent),nCharCode=YAHOO.util.Event.getCharCode(p_oEvent);if(nCharCode==13&&oTarget.tagName&&oTarget.tagName.toUpperCase()=="INPUT"){var sType=oTarget.type;if(sType=="text"||sType=="password"||sType=="checkbox"||sType=="radio"||sType=="file"){this.defaultHtmlButton.click();}}};YAHOO.widget.Dialog.prototype.registerForm=function(){var form=this.element.getElementsByTagName("form")[0];if(!form){var formHTML="<form name=\"frm_"+this.id+"\" action=\"\"></form>";this.body.innerHTML+=formHTML;form=this.element.getElementsByTagName("form")[0];}
|
||||
this.firstFormElement=function(){for(var f=0;f<form.elements.length;f++){var el=form.elements[f];if(el.focus&&!el.disabled){if(el.type&&el.type!="hidden"){return el;}}}
|
||||
return null;}();this.lastFormElement=function(){for(var f=form.elements.length-1;f>=0;f--){var el=form.elements[f];if(el.focus&&!el.disabled){if(el.type&&el.type!="hidden"){return el;}}}
|
||||
return null;}();this.form=form;if(this.form&&(this.browser=="ie"||this.browser=="ie7"||this.browser=="gecko")){YAHOO.util.Event.addListener(this.form,"keydown",this._onFormKeyDown,null,this);}
|
||||
if(this.cfg.getProperty("modal")&&this.form){var me=this;var firstElement=this.firstFormElement||this.firstButton;if(firstElement){this.preventBackTab=new YAHOO.util.KeyListener(firstElement,{shift:true,keys:9},{fn:me.focusLast,scope:me,correctScope:true});this.showEvent.subscribe(this.preventBackTab.enable,this.preventBackTab,true);this.hideEvent.subscribe(this.preventBackTab.disable,this.preventBackTab,true);}
|
||||
var lastElement=this.lastButton||this.lastFormElement;if(lastElement){this.preventTabOut=new YAHOO.util.KeyListener(lastElement,{shift:false,keys:9},{fn:me.focusFirst,scope:me,correctScope:true});this.showEvent.subscribe(this.preventTabOut.enable,this.preventTabOut,true);this.hideEvent.subscribe(this.preventTabOut.disable,this.preventTabOut,true);}}};YAHOO.widget.Dialog.prototype.configClose=function(type,args,obj){var val=args[0];var doCancel=function(e,obj){obj.cancel();};if(val){if(!this.close){this.close=document.createElement("div");YAHOO.util.Dom.addClass(this.close,"container-close");this.close.innerHTML=" ";this.innerElement.appendChild(this.close);YAHOO.util.Event.addListener(this.close,"click",doCancel,this);}else{this.close.style.display="block";}}else{if(this.close){this.close.style.display="none";}}};YAHOO.widget.Dialog.prototype.configButtons=function(type,args,obj){var buttons=args[0];if(buttons!="none"){this.buttonSpan=null;this.buttonSpan=document.createElement("span");this.buttonSpan.className="button-group";for(var b=0;b<buttons.length;b++){var button=buttons[b];var htmlButton=document.createElement("button");htmlButton.setAttribute("type","button");if(button.isDefault){htmlButton.className="default";this.defaultHtmlButton=htmlButton;}
|
||||
htmlButton.appendChild(document.createTextNode(button.text));YAHOO.util.Event.addListener(htmlButton,"click",button.handler,this,true);this.buttonSpan.appendChild(htmlButton);button.htmlButton=htmlButton;if(b===0){this.firstButton=button.htmlButton;}
|
||||
if(b==(buttons.length-1)){this.lastButton=button.htmlButton;}}
|
||||
this.setFooter(this.buttonSpan);this.cfg.refireEvent("iframe");this.cfg.refireEvent("underlay");}else{if(this.buttonSpan){if(this.buttonSpan.parentNode){this.buttonSpan.parentNode.removeChild(this.buttonSpan);}
|
||||
this.buttonSpan=null;this.firstButton=null;this.lastButton=null;this.defaultHtmlButton=null;}}};YAHOO.widget.Dialog.prototype.focusFirst=function(type,args,obj){if(args){var e=args[1];if(e){YAHOO.util.Event.stopEvent(e);}}
|
||||
if(this.firstFormElement){this.firstFormElement.focus();}else{this.focusDefaultButton();}};YAHOO.widget.Dialog.prototype.focusLast=function(type,args,obj){if(args){var e=args[1];if(e){YAHOO.util.Event.stopEvent(e);}}
|
||||
var buttons=this.cfg.getProperty("buttons");if(buttons&&buttons instanceof Array){this.focusLastButton();}else{if(this.lastFormElement){this.lastFormElement.focus();}}};YAHOO.widget.Dialog.prototype.focusDefaultButton=function(){if(this.defaultHtmlButton){this.defaultHtmlButton.focus();}};YAHOO.widget.Dialog.prototype.blurButtons=function(){var buttons=this.cfg.getProperty("buttons");if(buttons&&buttons instanceof Array){var html=buttons[0].htmlButton;if(html){html.blur();}}};YAHOO.widget.Dialog.prototype.focusFirstButton=function(){var buttons=this.cfg.getProperty("buttons");if(buttons&&buttons instanceof Array){var html=buttons[0].htmlButton;if(html){html.focus();}}};YAHOO.widget.Dialog.prototype.focusLastButton=function(){var buttons=this.cfg.getProperty("buttons");if(buttons&&buttons instanceof Array){var html=buttons[buttons.length-1].htmlButton;if(html){html.focus();}}};YAHOO.widget.Dialog.prototype.configPostMethod=function(type,args,obj){var postmethod=args[0];this.registerForm();YAHOO.util.Event.addListener(this.form,"submit",function(e){YAHOO.util.Event.stopEvent(e);this.submit();this.form.blur();},this,true);};YAHOO.widget.Dialog.prototype.validate=function(){return true;};YAHOO.widget.Dialog.prototype.submit=function(){if(this.validate()){this.beforeSubmitEvent.fire();this.doSubmit();this.submitEvent.fire();this.hide();return true;}else{return false;}};YAHOO.widget.Dialog.prototype.cancel=function(){this.cancelEvent.fire();this.hide();};YAHOO.widget.Dialog.prototype.getData=function(){var oForm=this.form;if(oForm){var aElements=oForm.elements,nTotalElements=aElements.length,oData={},sName,oElement,nElements;for(var i=0;i<nTotalElements;i++){sName=aElements[i].name;function isFormElement(p_oElement){var sTagName=p_oElement.tagName.toUpperCase();return((sTagName=="INPUT"||sTagName=="TEXTAREA"||sTagName=="SELECT")&&p_oElement.name==sName);}
|
||||
oElement=YAHOO.util.Dom.getElementsBy(isFormElement,"*",oForm);nElements=oElement.length;if(nElements>0){if(nElements==1){oElement=oElement[0];var sType=oElement.type,sTagName=oElement.tagName.toUpperCase();switch(sTagName){case"INPUT":if(sType=="checkbox"){oData[sName]=oElement.checked;}
|
||||
else if(sType!="radio"){oData[sName]=oElement.value;}
|
||||
break;case"TEXTAREA":oData[sName]=oElement.value;break;case"SELECT":var aOptions=oElement.options,nOptions=aOptions.length,aValues=[],oOption,sValue;for(var n=0;n<nOptions;n++){oOption=aOptions[n];if(oOption.selected){sValue=oOption.value;if(!sValue||sValue===""){sValue=oOption.text;}
|
||||
aValues[aValues.length]=sValue;}}
|
||||
oData[sName]=aValues;break;}}
|
||||
else{var sType=oElement[0].type;switch(sType){case"radio":var oRadio;for(var n=0;n<nElements;n++){oRadio=oElement[n];if(oRadio.checked){oData[sName]=oRadio.value;break;}}
|
||||
break;case"checkbox":var aValues=[],oCheckbox;for(var n=0;n<nElements;n++){oCheckbox=oElement[n];if(oCheckbox.checked){aValues[aValues.length]=oCheckbox.value;}}
|
||||
oData[sName]=aValues;break;}}}}}
|
||||
return oData;};YAHOO.widget.Dialog.prototype.destroy=function(){var Event=YAHOO.util.Event,oForm=this.form,oFooter=this.footer;if(oFooter){var aButtons=oFooter.getElementsByTagName("button");if(aButtons&&aButtons.length>0){var i=aButtons.length-1;do{Event.purgeElement(aButtons[i],false,"click");}
|
||||
while(i--);}}
|
||||
if(oForm){Event.purgeElement(oForm);this.body.removeChild(oForm);this.form=null;}
|
||||
YAHOO.widget.Dialog.superclass.destroy.call(this);};YAHOO.widget.Dialog.prototype.toString=function(){return"Dialog "+this.id;};YAHOO.widget.SimpleDialog=function(el,userConfig){YAHOO.widget.SimpleDialog.superclass.constructor.call(this,el,userConfig);};YAHOO.extend(YAHOO.widget.SimpleDialog,YAHOO.widget.Dialog);YAHOO.widget.SimpleDialog.ICON_BLOCK="blckicon";YAHOO.widget.SimpleDialog.ICON_ALARM="alrticon";YAHOO.widget.SimpleDialog.ICON_HELP="hlpicon";YAHOO.widget.SimpleDialog.ICON_INFO="infoicon";YAHOO.widget.SimpleDialog.ICON_WARN="warnicon";YAHOO.widget.SimpleDialog.ICON_TIP="tipicon";YAHOO.widget.SimpleDialog.CSS_SIMPLEDIALOG="yui-simple-dialog";YAHOO.widget.SimpleDialog._DEFAULT_CONFIG={"ICON":{key:"icon",value:"none",suppressEvent:true},"TEXT":{key:"text",value:"",suppressEvent:true,supercedes:["icon"]}};YAHOO.widget.SimpleDialog.prototype.initDefaultConfig=function(){YAHOO.widget.SimpleDialog.superclass.initDefaultConfig.call(this);var DEFAULT_CONFIG=YAHOO.widget.SimpleDialog._DEFAULT_CONFIG;this.cfg.addProperty(DEFAULT_CONFIG.ICON.key,{handler:this.configIcon,value:DEFAULT_CONFIG.ICON.value,suppressEvent:DEFAULT_CONFIG.ICON.suppressEvent});this.cfg.addProperty(DEFAULT_CONFIG.TEXT.key,{handler:this.configText,value:DEFAULT_CONFIG.TEXT.value,suppressEvent:DEFAULT_CONFIG.TEXT.suppressEvent,supercedes:DEFAULT_CONFIG.TEXT.supercedes});};YAHOO.widget.SimpleDialog.prototype.init=function(el,userConfig){YAHOO.widget.SimpleDialog.superclass.init.call(this,el);this.beforeInitEvent.fire(YAHOO.widget.SimpleDialog);YAHOO.util.Dom.addClass(this.element,YAHOO.widget.SimpleDialog.CSS_SIMPLEDIALOG);this.cfg.queueProperty("postmethod","manual");if(userConfig){this.cfg.applyConfig(userConfig,true);}
|
||||
this.beforeRenderEvent.subscribe(function(){if(!this.body){this.setBody("");}},this,true);this.initEvent.fire(YAHOO.widget.SimpleDialog);};YAHOO.widget.SimpleDialog.prototype.registerForm=function(){YAHOO.widget.SimpleDialog.superclass.registerForm.call(this);this.form.innerHTML+="<input type=\"hidden\" name=\""+this.id+"\" value=\"\"/>";};YAHOO.widget.SimpleDialog.prototype.configIcon=function(type,args,obj){var icon=args[0];if(icon&&icon!="none"){var iconHTML="";if(icon.indexOf(".")==-1){iconHTML="<span class=\"yui-icon "+icon+"\" > </span>";}else{iconHTML="<img src=\""+this.imageRoot+icon+"\" class=\"yui-icon\" />";}
|
||||
this.body.innerHTML=iconHTML+this.body.innerHTML;}};YAHOO.widget.SimpleDialog.prototype.configText=function(type,args,obj){var text=args[0];if(text){this.setBody(text);this.cfg.refireEvent("icon");}};YAHOO.widget.SimpleDialog.prototype.toString=function(){return"SimpleDialog "+this.id;};YAHOO.widget.ContainerEffect=function(overlay,attrIn,attrOut,targetElement,animClass){if(!animClass){animClass=YAHOO.util.Anim;}
|
||||
this.overlay=overlay;this.attrIn=attrIn;this.attrOut=attrOut;this.targetElement=targetElement||overlay.element;this.animClass=animClass;};YAHOO.widget.ContainerEffect.prototype.init=function(){this.beforeAnimateInEvent=new YAHOO.util.CustomEvent("beforeAnimateIn",this);this.beforeAnimateOutEvent=new YAHOO.util.CustomEvent("beforeAnimateOut",this);this.animateInCompleteEvent=new YAHOO.util.CustomEvent("animateInComplete",this);this.animateOutCompleteEvent=new YAHOO.util.CustomEvent("animateOutComplete",this);this.animIn=new this.animClass(this.targetElement,this.attrIn.attributes,this.attrIn.duration,this.attrIn.method);this.animIn.onStart.subscribe(this.handleStartAnimateIn,this);this.animIn.onTween.subscribe(this.handleTweenAnimateIn,this);this.animIn.onComplete.subscribe(this.handleCompleteAnimateIn,this);this.animOut=new this.animClass(this.targetElement,this.attrOut.attributes,this.attrOut.duration,this.attrOut.method);this.animOut.onStart.subscribe(this.handleStartAnimateOut,this);this.animOut.onTween.subscribe(this.handleTweenAnimateOut,this);this.animOut.onComplete.subscribe(this.handleCompleteAnimateOut,this);};YAHOO.widget.ContainerEffect.prototype.animateIn=function(){this.beforeAnimateInEvent.fire();this.animIn.animate();};YAHOO.widget.ContainerEffect.prototype.animateOut=function(){this.beforeAnimateOutEvent.fire();this.animOut.animate();};YAHOO.widget.ContainerEffect.prototype.handleStartAnimateIn=function(type,args,obj){};YAHOO.widget.ContainerEffect.prototype.handleTweenAnimateIn=function(type,args,obj){};YAHOO.widget.ContainerEffect.prototype.handleCompleteAnimateIn=function(type,args,obj){};YAHOO.widget.ContainerEffect.prototype.handleStartAnimateOut=function(type,args,obj){};YAHOO.widget.ContainerEffect.prototype.handleTweenAnimateOut=function(type,args,obj){};YAHOO.widget.ContainerEffect.prototype.handleCompleteAnimateOut=function(type,args,obj){};YAHOO.widget.ContainerEffect.prototype.toString=function(){var output="ContainerEffect";if(this.overlay){output+=" ["+this.overlay.toString()+"]";}
|
||||
return output;};YAHOO.widget.ContainerEffect.FADE=function(overlay,dur){var fade=new YAHOO.widget.ContainerEffect(overlay,{attributes:{opacity:{from:0,to:1}},duration:dur,method:YAHOO.util.Easing.easeIn},{attributes:{opacity:{to:0}},duration:dur,method:YAHOO.util.Easing.easeOut},overlay.element);fade.handleStartAnimateIn=function(type,args,obj){YAHOO.util.Dom.addClass(obj.overlay.element,"hide-select");if(!obj.overlay.underlay){obj.overlay.cfg.refireEvent("underlay");}
|
||||
if(obj.overlay.underlay){obj.initialUnderlayOpacity=YAHOO.util.Dom.getStyle(obj.overlay.underlay,"opacity");obj.overlay.underlay.style.filter=null;}
|
||||
YAHOO.util.Dom.setStyle(obj.overlay.element,"visibility","visible");YAHOO.util.Dom.setStyle(obj.overlay.element,"opacity",0);};fade.handleCompleteAnimateIn=function(type,args,obj){YAHOO.util.Dom.removeClass(obj.overlay.element,"hide-select");if(obj.overlay.element.style.filter){obj.overlay.element.style.filter=null;}
|
||||
if(obj.overlay.underlay){YAHOO.util.Dom.setStyle(obj.overlay.underlay,"opacity",obj.initialUnderlayOpacity);}
|
||||
obj.overlay.cfg.refireEvent("iframe");obj.animateInCompleteEvent.fire();};fade.handleStartAnimateOut=function(type,args,obj){YAHOO.util.Dom.addClass(obj.overlay.element,"hide-select");if(obj.overlay.underlay){obj.overlay.underlay.style.filter=null;}};fade.handleCompleteAnimateOut=function(type,args,obj){YAHOO.util.Dom.removeClass(obj.overlay.element,"hide-select");if(obj.overlay.element.style.filter){obj.overlay.element.style.filter=null;}
|
||||
YAHOO.util.Dom.setStyle(obj.overlay.element,"visibility","hidden");YAHOO.util.Dom.setStyle(obj.overlay.element,"opacity",1);obj.overlay.cfg.refireEvent("iframe");obj.animateOutCompleteEvent.fire();};fade.init();return fade;};YAHOO.widget.ContainerEffect.SLIDE=function(overlay,dur){var x=overlay.cfg.getProperty("x")||YAHOO.util.Dom.getX(overlay.element);var y=overlay.cfg.getProperty("y")||YAHOO.util.Dom.getY(overlay.element);var clientWidth=YAHOO.util.Dom.getClientWidth();var offsetWidth=overlay.element.offsetWidth;var slide=new YAHOO.widget.ContainerEffect(overlay,{attributes:{points:{to:[x,y]}},duration:dur,method:YAHOO.util.Easing.easeIn},{attributes:{points:{to:[(clientWidth+25),y]}},duration:dur,method:YAHOO.util.Easing.easeOut},overlay.element,YAHOO.util.Motion);slide.handleStartAnimateIn=function(type,args,obj){obj.overlay.element.style.left=(-25-offsetWidth)+"px";obj.overlay.element.style.top=y+"px";};slide.handleTweenAnimateIn=function(type,args,obj){var pos=YAHOO.util.Dom.getXY(obj.overlay.element);var currentX=pos[0];var currentY=pos[1];if(YAHOO.util.Dom.getStyle(obj.overlay.element,"visibility")=="hidden"&¤tX<x){YAHOO.util.Dom.setStyle(obj.overlay.element,"visibility","visible");}
|
||||
obj.overlay.cfg.setProperty("xy",[currentX,currentY],true);obj.overlay.cfg.refireEvent("iframe");};slide.handleCompleteAnimateIn=function(type,args,obj){obj.overlay.cfg.setProperty("xy",[x,y],true);obj.startX=x;obj.startY=y;obj.overlay.cfg.refireEvent("iframe");obj.animateInCompleteEvent.fire();};slide.handleStartAnimateOut=function(type,args,obj){var vw=YAHOO.util.Dom.getViewportWidth();var pos=YAHOO.util.Dom.getXY(obj.overlay.element);var yso=pos[1];var currentTo=obj.animOut.attributes.points.to;obj.animOut.attributes.points.to=[(vw+25),yso];};slide.handleTweenAnimateOut=function(type,args,obj){var pos=YAHOO.util.Dom.getXY(obj.overlay.element);var xto=pos[0];var yto=pos[1];obj.overlay.cfg.setProperty("xy",[xto,yto],true);obj.overlay.cfg.refireEvent("iframe");};slide.handleCompleteAnimateOut=function(type,args,obj){YAHOO.util.Dom.setStyle(obj.overlay.element,"visibility","hidden");obj.overlay.cfg.setProperty("xy",[x,y]);obj.animateOutCompleteEvent.fire();};slide.init();return slide;};YAHOO.register("container",YAHOO.widget.Module,{version:"2.2.2",build:"204"});
|
||||
5463
www/extras/yui/build/container/container.js
vendored
3107
www/extras/yui/build/container/container_core-debug.js
vendored
100
www/extras/yui/build/container/container_core-min.js
vendored
|
|
@ -1,100 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 2.2.2
|
||||
*/
|
||||
|
||||
YAHOO.util.Config=function(owner){if(owner){this.init(owner);}};YAHOO.util.Config.CONFIG_CHANGED_EVENT="configChanged";YAHOO.util.Config.BOOLEAN_TYPE="boolean";YAHOO.util.Config.prototype={owner:null,queueInProgress:false,config:null,initialConfig:null,eventQueue:null,configChangedEvent:null,checkBoolean:function(val){return(typeof val==YAHOO.util.Config.BOOLEAN_TYPE);},checkNumber:function(val){return(!isNaN(val));},fireEvent:function(key,value){var property=this.config[key];if(property&&property.event){property.event.fire(value);}},addProperty:function(key,propertyObject){key=key.toLowerCase();this.config[key]=propertyObject;propertyObject.event=new YAHOO.util.CustomEvent(key,this.owner);propertyObject.key=key;if(propertyObject.handler){propertyObject.event.subscribe(propertyObject.handler,this.owner);}
|
||||
this.setProperty(key,propertyObject.value,true);if(!propertyObject.suppressEvent){this.queueProperty(key,propertyObject.value);}},getConfig:function(){var cfg={};for(var prop in this.config){var property=this.config[prop];if(property&&property.event){cfg[prop]=property.value;}}
|
||||
return cfg;},getProperty:function(key){var property=this.config[key.toLowerCase()];if(property&&property.event){return property.value;}else{return undefined;}},resetProperty:function(key){key=key.toLowerCase();var property=this.config[key];if(property&&property.event){if(this.initialConfig[key]&&!YAHOO.lang.isUndefined(this.initialConfig[key])){this.setProperty(key,this.initialConfig[key]);}
|
||||
return true;}else{return false;}},setProperty:function(key,value,silent){key=key.toLowerCase();if(this.queueInProgress&&!silent){this.queueProperty(key,value);return true;}else{var property=this.config[key];if(property&&property.event){if(property.validator&&!property.validator(value)){return false;}else{property.value=value;if(!silent){this.fireEvent(key,value);this.configChangedEvent.fire([key,value]);}
|
||||
return true;}}else{return false;}}},queueProperty:function(key,value){key=key.toLowerCase();var property=this.config[key];if(property&&property.event){if(!YAHOO.lang.isUndefined(value)&&property.validator&&!property.validator(value)){return false;}else{if(!YAHOO.lang.isUndefined(value)){property.value=value;}else{value=property.value;}
|
||||
var foundDuplicate=false;var iLen=this.eventQueue.length;for(var i=0;i<iLen;i++){var queueItem=this.eventQueue[i];if(queueItem){var queueItemKey=queueItem[0];var queueItemValue=queueItem[1];if(queueItemKey==key){this.eventQueue[i]=null;this.eventQueue.push([key,(!YAHOO.lang.isUndefined(value)?value:queueItemValue)]);foundDuplicate=true;break;}}}
|
||||
if(!foundDuplicate&&!YAHOO.lang.isUndefined(value)){this.eventQueue.push([key,value]);}}
|
||||
if(property.supercedes){var sLen=property.supercedes.length;for(var s=0;s<sLen;s++){var supercedesCheck=property.supercedes[s];var qLen=this.eventQueue.length;for(var q=0;q<qLen;q++){var queueItemCheck=this.eventQueue[q];if(queueItemCheck){var queueItemCheckKey=queueItemCheck[0];var queueItemCheckValue=queueItemCheck[1];if(queueItemCheckKey==supercedesCheck.toLowerCase()){this.eventQueue.push([queueItemCheckKey,queueItemCheckValue]);this.eventQueue[q]=null;break;}}}}}
|
||||
return true;}else{return false;}},refireEvent:function(key){key=key.toLowerCase();var property=this.config[key];if(property&&property.event&&!YAHOO.lang.isUndefined(property.value)){if(this.queueInProgress){this.queueProperty(key);}else{this.fireEvent(key,property.value);}}},applyConfig:function(userConfig,init){if(init){this.initialConfig=userConfig;}
|
||||
for(var prop in userConfig){this.queueProperty(prop,userConfig[prop]);}},refresh:function(){for(var prop in this.config){this.refireEvent(prop);}},fireQueue:function(){this.queueInProgress=true;for(var i=0;i<this.eventQueue.length;i++){var queueItem=this.eventQueue[i];if(queueItem){var key=queueItem[0];var value=queueItem[1];var property=this.config[key];property.value=value;this.fireEvent(key,value);}}
|
||||
this.queueInProgress=false;this.eventQueue=[];},subscribeToConfigEvent:function(key,handler,obj,override){var property=this.config[key.toLowerCase()];if(property&&property.event){if(!YAHOO.util.Config.alreadySubscribed(property.event,handler,obj)){property.event.subscribe(handler,obj,override);}
|
||||
return true;}else{return false;}},unsubscribeFromConfigEvent:function(key,handler,obj){var property=this.config[key.toLowerCase()];if(property&&property.event){return property.event.unsubscribe(handler,obj);}else{return false;}},toString:function(){var output="Config";if(this.owner){output+=" ["+this.owner.toString()+"]";}
|
||||
return output;},outputEventQueue:function(){var output="";for(var q=0;q<this.eventQueue.length;q++){var queueItem=this.eventQueue[q];if(queueItem){output+=queueItem[0]+"="+queueItem[1]+", ";}}
|
||||
return output;}};YAHOO.util.Config.prototype.init=function(owner){this.owner=owner;this.configChangedEvent=new YAHOO.util.CustomEvent(YAHOO.util.CONFIG_CHANGED_EVENT,this);this.queueInProgress=false;this.config={};this.initialConfig={};this.eventQueue=[];};YAHOO.util.Config.alreadySubscribed=function(evt,fn,obj){for(var e=0;e<evt.subscribers.length;e++){var subsc=evt.subscribers[e];if(subsc&&subsc.obj==obj&&subsc.fn==fn){return true;}}
|
||||
return false;};YAHOO.widget.Module=function(el,userConfig){if(el){this.init(el,userConfig);}else{}};YAHOO.widget.Module.IMG_ROOT=null;YAHOO.widget.Module.IMG_ROOT_SSL=null;YAHOO.widget.Module.CSS_MODULE="yui-module";YAHOO.widget.Module.CSS_HEADER="hd";YAHOO.widget.Module.CSS_BODY="bd";YAHOO.widget.Module.CSS_FOOTER="ft";YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL="javascript:false;";YAHOO.widget.Module.textResizeEvent=new YAHOO.util.CustomEvent("textResize");YAHOO.widget.Module._EVENT_TYPES={"BEFORE_INIT":"beforeInit","INIT":"init","APPEND":"append","BEFORE_RENDER":"beforeRender","RENDER":"render","CHANGE_HEADER":"changeHeader","CHANGE_BODY":"changeBody","CHANGE_FOOTER":"changeFooter","CHANGE_CONTENT":"changeContent","DESTORY":"destroy","BEFORE_SHOW":"beforeShow","SHOW":"show","BEFORE_HIDE":"beforeHide","HIDE":"hide"};YAHOO.widget.Module._DEFAULT_CONFIG={"VISIBLE":{key:"visible",value:true,validator:YAHOO.lang.isBoolean},"EFFECT":{key:"effect",suppressEvent:true,supercedes:["visible"]},"MONITOR_RESIZE":{key:"monitorresize",value:true}};YAHOO.widget.Module.prototype={constructor:YAHOO.widget.Module,element:null,header:null,body:null,footer:null,id:null,imageRoot:YAHOO.widget.Module.IMG_ROOT,initEvents:function(){var EVENT_TYPES=YAHOO.widget.Module._EVENT_TYPES;this.beforeInitEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.BEFORE_INIT,this);this.initEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.INIT,this);this.appendEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.APPEND,this);this.beforeRenderEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.BEFORE_RENDER,this);this.renderEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.RENDER,this);this.changeHeaderEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.CHANGE_HEADER,this);this.changeBodyEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.CHANGE_BODY,this);this.changeFooterEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.CHANGE_FOOTER,this);this.changeContentEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.CHANGE_CONTENT,this);this.destroyEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.DESTORY,this);this.beforeShowEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.BEFORE_SHOW,this);this.showEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.SHOW,this);this.beforeHideEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.BEFORE_HIDE,this);this.hideEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.HIDE,this);},platform:function(){var ua=navigator.userAgent.toLowerCase();if(ua.indexOf("windows")!=-1||ua.indexOf("win32")!=-1){return"windows";}else if(ua.indexOf("macintosh")!=-1){return"mac";}else{return false;}}(),browser:function(){var ua=navigator.userAgent.toLowerCase();if(ua.indexOf('opera')!=-1){return'opera';}else if(ua.indexOf('msie 7')!=-1){return'ie7';}else if(ua.indexOf('msie')!=-1){return'ie';}else if(ua.indexOf('safari')!=-1){return'safari';}else if(ua.indexOf('gecko')!=-1){return'gecko';}else{return false;}}(),isSecure:function(){if(window.location.href.toLowerCase().indexOf("https")===0){return true;}else{return false;}}(),initDefaultConfig:function(){var DEFAULT_CONFIG=YAHOO.widget.Module._DEFAULT_CONFIG;this.cfg.addProperty(DEFAULT_CONFIG.VISIBLE.key,{handler:this.configVisible,value:DEFAULT_CONFIG.VISIBLE.value,validator:DEFAULT_CONFIG.VISIBLE.validator});this.cfg.addProperty(DEFAULT_CONFIG.EFFECT.key,{suppressEvent:DEFAULT_CONFIG.EFFECT.suppressEvent,supercedes:DEFAULT_CONFIG.EFFECT.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.MONITOR_RESIZE.key,{handler:this.configMonitorResize,value:DEFAULT_CONFIG.MONITOR_RESIZE.value});},init:function(el,userConfig){this.initEvents();this.beforeInitEvent.fire(YAHOO.widget.Module);this.cfg=new YAHOO.util.Config(this);if(this.isSecure){this.imageRoot=YAHOO.widget.Module.IMG_ROOT_SSL;}
|
||||
if(typeof el=="string"){var elId=el;el=document.getElementById(el);if(!el){el=document.createElement("div");el.id=elId;}}
|
||||
this.element=el;if(el.id){this.id=el.id;}
|
||||
var childNodes=this.element.childNodes;if(childNodes){for(var i=0;i<childNodes.length;i++){var child=childNodes[i];switch(child.className){case YAHOO.widget.Module.CSS_HEADER:this.header=child;break;case YAHOO.widget.Module.CSS_BODY:this.body=child;break;case YAHOO.widget.Module.CSS_FOOTER:this.footer=child;break;}}}
|
||||
this.initDefaultConfig();YAHOO.util.Dom.addClass(this.element,YAHOO.widget.Module.CSS_MODULE);if(userConfig){this.cfg.applyConfig(userConfig,true);}
|
||||
if(!YAHOO.util.Config.alreadySubscribed(this.renderEvent,this.cfg.fireQueue,this.cfg)){this.renderEvent.subscribe(this.cfg.fireQueue,this.cfg,true);}
|
||||
this.initEvent.fire(YAHOO.widget.Module);},initResizeMonitor:function(){if(this.browser!="opera"){var resizeMonitor=document.getElementById("_yuiResizeMonitor");if(!resizeMonitor){resizeMonitor=document.createElement("iframe");var bIE=(this.browser.indexOf("ie")===0);if(this.isSecure&&YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL&&bIE){resizeMonitor.src=YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL;}
|
||||
resizeMonitor.id="_yuiResizeMonitor";resizeMonitor.style.visibility="hidden";document.body.appendChild(resizeMonitor);resizeMonitor.style.width="10em";resizeMonitor.style.height="10em";resizeMonitor.style.position="absolute";var nLeft=-1*resizeMonitor.offsetWidth;var nTop=-1*resizeMonitor.offsetHeight;resizeMonitor.style.top=nTop+"px";resizeMonitor.style.left=nLeft+"px";resizeMonitor.style.borderStyle="none";resizeMonitor.style.borderWidth="0";YAHOO.util.Dom.setStyle(resizeMonitor,"opacity","0");resizeMonitor.style.visibility="visible";if(!bIE){var doc=resizeMonitor.contentWindow.document;doc.open();doc.close();}}
|
||||
var fireTextResize=function(){YAHOO.widget.Module.textResizeEvent.fire();};if(resizeMonitor&&resizeMonitor.contentWindow){this.resizeMonitor=resizeMonitor;YAHOO.widget.Module.textResizeEvent.subscribe(this.onDomResize,this,true);if(!YAHOO.widget.Module.textResizeInitialized){if(!YAHOO.util.Event.addListener(this.resizeMonitor.contentWindow,"resize",fireTextResize)){YAHOO.util.Event.addListener(this.resizeMonitor,"resize",fireTextResize);}
|
||||
YAHOO.widget.Module.textResizeInitialized=true;}}}},onDomResize:function(e,obj){var nLeft=-1*this.resizeMonitor.offsetWidth,nTop=-1*this.resizeMonitor.offsetHeight;this.resizeMonitor.style.top=nTop+"px";this.resizeMonitor.style.left=nLeft+"px";},setHeader:function(headerContent){if(!this.header){this.header=document.createElement("div");this.header.className=YAHOO.widget.Module.CSS_HEADER;}
|
||||
if(typeof headerContent=="string"){this.header.innerHTML=headerContent;}else{this.header.innerHTML="";this.header.appendChild(headerContent);}
|
||||
this.changeHeaderEvent.fire(headerContent);this.changeContentEvent.fire();},appendToHeader:function(element){if(!this.header){this.header=document.createElement("div");this.header.className=YAHOO.widget.Module.CSS_HEADER;}
|
||||
this.header.appendChild(element);this.changeHeaderEvent.fire(element);this.changeContentEvent.fire();},setBody:function(bodyContent){if(!this.body){this.body=document.createElement("div");this.body.className=YAHOO.widget.Module.CSS_BODY;}
|
||||
if(typeof bodyContent=="string")
|
||||
{this.body.innerHTML=bodyContent;}else{this.body.innerHTML="";this.body.appendChild(bodyContent);}
|
||||
this.changeBodyEvent.fire(bodyContent);this.changeContentEvent.fire();},appendToBody:function(element){if(!this.body){this.body=document.createElement("div");this.body.className=YAHOO.widget.Module.CSS_BODY;}
|
||||
this.body.appendChild(element);this.changeBodyEvent.fire(element);this.changeContentEvent.fire();},setFooter:function(footerContent){if(!this.footer){this.footer=document.createElement("div");this.footer.className=YAHOO.widget.Module.CSS_FOOTER;}
|
||||
if(typeof footerContent=="string"){this.footer.innerHTML=footerContent;}else{this.footer.innerHTML="";this.footer.appendChild(footerContent);}
|
||||
this.changeFooterEvent.fire(footerContent);this.changeContentEvent.fire();},appendToFooter:function(element){if(!this.footer){this.footer=document.createElement("div");this.footer.className=YAHOO.widget.Module.CSS_FOOTER;}
|
||||
this.footer.appendChild(element);this.changeFooterEvent.fire(element);this.changeContentEvent.fire();},render:function(appendToNode,moduleElement){this.beforeRenderEvent.fire();if(!moduleElement){moduleElement=this.element;}
|
||||
var me=this;var appendTo=function(element){if(typeof element=="string"){element=document.getElementById(element);}
|
||||
if(element){element.appendChild(me.element);me.appendEvent.fire();}};if(appendToNode){appendTo(appendToNode);}else{if(!YAHOO.util.Dom.inDocument(this.element)){return false;}}
|
||||
if(this.header&&!YAHOO.util.Dom.inDocument(this.header)){var firstChild=moduleElement.firstChild;if(firstChild){moduleElement.insertBefore(this.header,firstChild);}else{moduleElement.appendChild(this.header);}}
|
||||
if(this.body&&!YAHOO.util.Dom.inDocument(this.body)){if(this.footer&&YAHOO.util.Dom.isAncestor(this.moduleElement,this.footer)){moduleElement.insertBefore(this.body,this.footer);}else{moduleElement.appendChild(this.body);}}
|
||||
if(this.footer&&!YAHOO.util.Dom.inDocument(this.footer)){moduleElement.appendChild(this.footer);}
|
||||
this.renderEvent.fire();return true;},destroy:function(){var parent;if(this.element){YAHOO.util.Event.purgeElement(this.element,true);parent=this.element.parentNode;}
|
||||
if(parent){parent.removeChild(this.element);}
|
||||
this.element=null;this.header=null;this.body=null;this.footer=null;for(var e in this){if(e instanceof YAHOO.util.CustomEvent){e.unsubscribeAll();}}
|
||||
YAHOO.widget.Module.textResizeEvent.unsubscribe(this.onDomResize,this);this.destroyEvent.fire();},show:function(){this.cfg.setProperty("visible",true);},hide:function(){this.cfg.setProperty("visible",false);},configVisible:function(type,args,obj){var visible=args[0];if(visible){this.beforeShowEvent.fire();YAHOO.util.Dom.setStyle(this.element,"display","block");this.showEvent.fire();}else{this.beforeHideEvent.fire();YAHOO.util.Dom.setStyle(this.element,"display","none");this.hideEvent.fire();}},configMonitorResize:function(type,args,obj){var monitor=args[0];if(monitor){this.initResizeMonitor();}else{YAHOO.widget.Module.textResizeEvent.unsubscribe(this.onDomResize,this,true);this.resizeMonitor=null;}}};YAHOO.widget.Module.prototype.toString=function(){return"Module "+this.id;};YAHOO.widget.Overlay=function(el,userConfig){YAHOO.widget.Overlay.superclass.constructor.call(this,el,userConfig);};YAHOO.extend(YAHOO.widget.Overlay,YAHOO.widget.Module);YAHOO.widget.Overlay._EVENT_TYPES={"BEFORE_MOVE":"beforeMove","MOVE":"move"};YAHOO.widget.Overlay._DEFAULT_CONFIG={"X":{key:"x",validator:YAHOO.lang.isNumber,suppressEvent:true,supercedes:["iframe"]},"Y":{key:"y",validator:YAHOO.lang.isNumber,suppressEvent:true,supercedes:["iframe"]},"XY":{key:"xy",suppressEvent:true,supercedes:["iframe"]},"CONTEXT":{key:"context",suppressEvent:true,supercedes:["iframe"]},"FIXED_CENTER":{key:"fixedcenter",value:false,validator:YAHOO.lang.isBoolean,supercedes:["iframe","visible"]},"WIDTH":{key:"width",suppressEvent:true,supercedes:["iframe"]},"HEIGHT":{key:"height",suppressEvent:true,supercedes:["iframe"]},"ZINDEX":{key:"zindex",value:null},"CONSTRAIN_TO_VIEWPORT":{key:"constraintoviewport",value:false,validator:YAHOO.lang.isBoolean,supercedes:["iframe","x","y","xy"]},"IFRAME":{key:"iframe",value:(YAHOO.widget.Module.prototype.browser=="ie"?true:false),validator:YAHOO.lang.isBoolean,supercedes:["zIndex"]}};YAHOO.widget.Overlay.IFRAME_SRC="javascript:false;";YAHOO.widget.Overlay.TOP_LEFT="tl";YAHOO.widget.Overlay.TOP_RIGHT="tr";YAHOO.widget.Overlay.BOTTOM_LEFT="bl";YAHOO.widget.Overlay.BOTTOM_RIGHT="br";YAHOO.widget.Overlay.CSS_OVERLAY="yui-overlay";YAHOO.widget.Overlay.prototype.init=function(el,userConfig){YAHOO.widget.Overlay.superclass.init.call(this,el);this.beforeInitEvent.fire(YAHOO.widget.Overlay);YAHOO.util.Dom.addClass(this.element,YAHOO.widget.Overlay.CSS_OVERLAY);if(userConfig){this.cfg.applyConfig(userConfig,true);}
|
||||
if(this.platform=="mac"&&this.browser=="gecko"){if(!YAHOO.util.Config.alreadySubscribed(this.showEvent,this.showMacGeckoScrollbars,this)){this.showEvent.subscribe(this.showMacGeckoScrollbars,this,true);}
|
||||
if(!YAHOO.util.Config.alreadySubscribed(this.hideEvent,this.hideMacGeckoScrollbars,this)){this.hideEvent.subscribe(this.hideMacGeckoScrollbars,this,true);}}
|
||||
this.initEvent.fire(YAHOO.widget.Overlay);};YAHOO.widget.Overlay.prototype.initEvents=function(){YAHOO.widget.Overlay.superclass.initEvents.call(this);var EVENT_TYPES=YAHOO.widget.Overlay._EVENT_TYPES;this.beforeMoveEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.BEFORE_MOVE,this);this.moveEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.MOVE,this);};YAHOO.widget.Overlay.prototype.initDefaultConfig=function(){YAHOO.widget.Overlay.superclass.initDefaultConfig.call(this);var DEFAULT_CONFIG=YAHOO.widget.Overlay._DEFAULT_CONFIG;this.cfg.addProperty(DEFAULT_CONFIG.X.key,{handler:this.configX,validator:DEFAULT_CONFIG.X.validator,suppressEvent:DEFAULT_CONFIG.X.suppressEvent,supercedes:DEFAULT_CONFIG.X.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.Y.key,{handler:this.configY,validator:DEFAULT_CONFIG.Y.validator,suppressEvent:DEFAULT_CONFIG.Y.suppressEvent,supercedes:DEFAULT_CONFIG.Y.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.XY.key,{handler:this.configXY,suppressEvent:DEFAULT_CONFIG.XY.suppressEvent,supercedes:DEFAULT_CONFIG.XY.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.CONTEXT.key,{handler:this.configContext,suppressEvent:DEFAULT_CONFIG.CONTEXT.suppressEvent,supercedes:DEFAULT_CONFIG.CONTEXT.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.FIXED_CENTER.key,{handler:this.configFixedCenter,value:DEFAULT_CONFIG.FIXED_CENTER.value,validator:DEFAULT_CONFIG.FIXED_CENTER.validator,supercedes:DEFAULT_CONFIG.FIXED_CENTER.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.WIDTH.key,{handler:this.configWidth,suppressEvent:DEFAULT_CONFIG.WIDTH.suppressEvent,supercedes:DEFAULT_CONFIG.WIDTH.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.HEIGHT.key,{handler:this.configHeight,suppressEvent:DEFAULT_CONFIG.HEIGHT.suppressEvent,supercedes:DEFAULT_CONFIG.HEIGHT.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.ZINDEX.key,{handler:this.configzIndex,value:DEFAULT_CONFIG.ZINDEX.value});this.cfg.addProperty(DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.key,{handler:this.configConstrainToViewport,value:DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.value,validator:DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.validator,supercedes:DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.IFRAME.key,{handler:this.configIframe,value:DEFAULT_CONFIG.IFRAME.value,validator:DEFAULT_CONFIG.IFRAME.validator,supercedes:DEFAULT_CONFIG.IFRAME.supercedes});};YAHOO.widget.Overlay.prototype.moveTo=function(x,y){this.cfg.setProperty("xy",[x,y]);};YAHOO.widget.Overlay.prototype.hideMacGeckoScrollbars=function(){YAHOO.util.Dom.removeClass(this.element,"show-scrollbars");YAHOO.util.Dom.addClass(this.element,"hide-scrollbars");};YAHOO.widget.Overlay.prototype.showMacGeckoScrollbars=function(){YAHOO.util.Dom.removeClass(this.element,"hide-scrollbars");YAHOO.util.Dom.addClass(this.element,"show-scrollbars");};YAHOO.widget.Overlay.prototype.configVisible=function(type,args,obj){var visible=args[0];var currentVis=YAHOO.util.Dom.getStyle(this.element,"visibility");if(currentVis=="inherit"){var e=this.element.parentNode;while(e.nodeType!=9&&e.nodeType!=11){currentVis=YAHOO.util.Dom.getStyle(e,"visibility");if(currentVis!="inherit"){break;}
|
||||
e=e.parentNode;}
|
||||
if(currentVis=="inherit"){currentVis="visible";}}
|
||||
var effect=this.cfg.getProperty("effect");var effectInstances=[];if(effect){if(effect instanceof Array){for(var i=0;i<effect.length;i++){var eff=effect[i];effectInstances[effectInstances.length]=eff.effect(this,eff.duration);}}else{effectInstances[effectInstances.length]=effect.effect(this,effect.duration);}}
|
||||
var isMacGecko=(this.platform=="mac"&&this.browser=="gecko");if(visible){if(isMacGecko){this.showMacGeckoScrollbars();}
|
||||
if(effect){if(visible){if(currentVis!="visible"||currentVis===""){this.beforeShowEvent.fire();for(var j=0;j<effectInstances.length;j++){var ei=effectInstances[j];if(j===0&&!YAHOO.util.Config.alreadySubscribed(ei.animateInCompleteEvent,this.showEvent.fire,this.showEvent)){ei.animateInCompleteEvent.subscribe(this.showEvent.fire,this.showEvent,true);}
|
||||
ei.animateIn();}}}}else{if(currentVis!="visible"||currentVis===""){this.beforeShowEvent.fire();YAHOO.util.Dom.setStyle(this.element,"visibility","visible");this.cfg.refireEvent("iframe");this.showEvent.fire();}}}else{if(isMacGecko){this.hideMacGeckoScrollbars();}
|
||||
if(effect){if(currentVis=="visible"){this.beforeHideEvent.fire();for(var k=0;k<effectInstances.length;k++){var h=effectInstances[k];if(k===0&&!YAHOO.util.Config.alreadySubscribed(h.animateOutCompleteEvent,this.hideEvent.fire,this.hideEvent)){h.animateOutCompleteEvent.subscribe(this.hideEvent.fire,this.hideEvent,true);}
|
||||
h.animateOut();}}else if(currentVis===""){YAHOO.util.Dom.setStyle(this.element,"visibility","hidden");}}else{if(currentVis=="visible"||currentVis===""){this.beforeHideEvent.fire();YAHOO.util.Dom.setStyle(this.element,"visibility","hidden");this.cfg.refireEvent("iframe");this.hideEvent.fire();}}}};YAHOO.widget.Overlay.prototype.doCenterOnDOMEvent=function(){if(this.cfg.getProperty("visible")){this.center();}};YAHOO.widget.Overlay.prototype.configFixedCenter=function(type,args,obj){var val=args[0];if(val){this.center();if(!YAHOO.util.Config.alreadySubscribed(this.beforeShowEvent,this.center,this)){this.beforeShowEvent.subscribe(this.center,this,true);}
|
||||
if(!YAHOO.util.Config.alreadySubscribed(YAHOO.widget.Overlay.windowResizeEvent,this.doCenterOnDOMEvent,this)){YAHOO.widget.Overlay.windowResizeEvent.subscribe(this.doCenterOnDOMEvent,this,true);}
|
||||
if(!YAHOO.util.Config.alreadySubscribed(YAHOO.widget.Overlay.windowScrollEvent,this.doCenterOnDOMEvent,this)){YAHOO.widget.Overlay.windowScrollEvent.subscribe(this.doCenterOnDOMEvent,this,true);}}else{YAHOO.widget.Overlay.windowResizeEvent.unsubscribe(this.doCenterOnDOMEvent,this);YAHOO.widget.Overlay.windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent,this);}};YAHOO.widget.Overlay.prototype.configHeight=function(type,args,obj){var height=args[0];var el=this.element;YAHOO.util.Dom.setStyle(el,"height",height);this.cfg.refireEvent("iframe");};YAHOO.widget.Overlay.prototype.configWidth=function(type,args,obj){var width=args[0];var el=this.element;YAHOO.util.Dom.setStyle(el,"width",width);this.cfg.refireEvent("iframe");};YAHOO.widget.Overlay.prototype.configzIndex=function(type,args,obj){var zIndex=args[0];var el=this.element;if(!zIndex){zIndex=YAHOO.util.Dom.getStyle(el,"zIndex");if(!zIndex||isNaN(zIndex)){zIndex=0;}}
|
||||
if(this.iframe){if(zIndex<=0){zIndex=1;}
|
||||
YAHOO.util.Dom.setStyle(this.iframe,"zIndex",(zIndex-1));}
|
||||
YAHOO.util.Dom.setStyle(el,"zIndex",zIndex);this.cfg.setProperty("zIndex",zIndex,true);};YAHOO.widget.Overlay.prototype.configXY=function(type,args,obj){var pos=args[0];var x=pos[0];var y=pos[1];this.cfg.setProperty("x",x);this.cfg.setProperty("y",y);this.beforeMoveEvent.fire([x,y]);x=this.cfg.getProperty("x");y=this.cfg.getProperty("y");this.cfg.refireEvent("iframe");this.moveEvent.fire([x,y]);};YAHOO.widget.Overlay.prototype.configX=function(type,args,obj){var x=args[0];var y=this.cfg.getProperty("y");this.cfg.setProperty("x",x,true);this.cfg.setProperty("y",y,true);this.beforeMoveEvent.fire([x,y]);x=this.cfg.getProperty("x");y=this.cfg.getProperty("y");YAHOO.util.Dom.setX(this.element,x,true);this.cfg.setProperty("xy",[x,y],true);this.cfg.refireEvent("iframe");this.moveEvent.fire([x,y]);};YAHOO.widget.Overlay.prototype.configY=function(type,args,obj){var x=this.cfg.getProperty("x");var y=args[0];this.cfg.setProperty("x",x,true);this.cfg.setProperty("y",y,true);this.beforeMoveEvent.fire([x,y]);x=this.cfg.getProperty("x");y=this.cfg.getProperty("y");YAHOO.util.Dom.setY(this.element,y,true);this.cfg.setProperty("xy",[x,y],true);this.cfg.refireEvent("iframe");this.moveEvent.fire([x,y]);};YAHOO.widget.Overlay.prototype.showIframe=function(){if(this.iframe){this.iframe.style.display="block";}};YAHOO.widget.Overlay.prototype.hideIframe=function(){if(this.iframe){this.iframe.style.display="none";}};YAHOO.widget.Overlay.prototype.configIframe=function(type,args,obj){var val=args[0];if(val){if(!YAHOO.util.Config.alreadySubscribed(this.showEvent,this.showIframe,this)){this.showEvent.subscribe(this.showIframe,this,true);}
|
||||
if(!YAHOO.util.Config.alreadySubscribed(this.hideEvent,this.hideIframe,this)){this.hideEvent.subscribe(this.hideIframe,this,true);}
|
||||
var x=this.cfg.getProperty("x");var y=this.cfg.getProperty("y");if(!x||!y){this.syncPosition();x=this.cfg.getProperty("x");y=this.cfg.getProperty("y");}
|
||||
if(!isNaN(x)&&!isNaN(y)){if(!this.iframe){this.iframe=document.createElement("iframe");if(this.isSecure){this.iframe.src=YAHOO.widget.Overlay.IFRAME_SRC;}
|
||||
var parent=this.element.parentNode;if(parent){parent.appendChild(this.iframe);}else{document.body.appendChild(this.iframe);}
|
||||
YAHOO.util.Dom.setStyle(this.iframe,"position","absolute");YAHOO.util.Dom.setStyle(this.iframe,"border","none");YAHOO.util.Dom.setStyle(this.iframe,"margin","0");YAHOO.util.Dom.setStyle(this.iframe,"padding","0");YAHOO.util.Dom.setStyle(this.iframe,"opacity","0");if(this.cfg.getProperty("visible")){this.showIframe();}else{this.hideIframe();}}
|
||||
var iframeDisplay=YAHOO.util.Dom.getStyle(this.iframe,"display");if(iframeDisplay=="none"){this.iframe.style.display="block";}
|
||||
YAHOO.util.Dom.setXY(this.iframe,[x,y]);var width=this.element.clientWidth;var height=this.element.clientHeight;YAHOO.util.Dom.setStyle(this.iframe,"width",(width+2)+"px");YAHOO.util.Dom.setStyle(this.iframe,"height",(height+2)+"px");if(iframeDisplay=="none"){this.iframe.style.display="none";}}}else{if(this.iframe){this.iframe.style.display="none";}
|
||||
this.showEvent.unsubscribe(this.showIframe,this);this.hideEvent.unsubscribe(this.hideIframe,this);}};YAHOO.widget.Overlay.prototype.configConstrainToViewport=function(type,args,obj){var val=args[0];if(val){if(!YAHOO.util.Config.alreadySubscribed(this.beforeMoveEvent,this.enforceConstraints,this)){this.beforeMoveEvent.subscribe(this.enforceConstraints,this,true);}}else{this.beforeMoveEvent.unsubscribe(this.enforceConstraints,this);}};YAHOO.widget.Overlay.prototype.configContext=function(type,args,obj){var contextArgs=args[0];if(contextArgs){var contextEl=contextArgs[0];var elementMagnetCorner=contextArgs[1];var contextMagnetCorner=contextArgs[2];if(contextEl){if(typeof contextEl=="string"){this.cfg.setProperty("context",[document.getElementById(contextEl),elementMagnetCorner,contextMagnetCorner],true);}
|
||||
if(elementMagnetCorner&&contextMagnetCorner){this.align(elementMagnetCorner,contextMagnetCorner);}}}};YAHOO.widget.Overlay.prototype.align=function(elementAlign,contextAlign){var contextArgs=this.cfg.getProperty("context");if(contextArgs){var context=contextArgs[0];var element=this.element;var me=this;if(!elementAlign){elementAlign=contextArgs[1];}
|
||||
if(!contextAlign){contextAlign=contextArgs[2];}
|
||||
if(element&&context){var contextRegion=YAHOO.util.Dom.getRegion(context);var doAlign=function(v,h){switch(elementAlign){case YAHOO.widget.Overlay.TOP_LEFT:me.moveTo(h,v);break;case YAHOO.widget.Overlay.TOP_RIGHT:me.moveTo(h-element.offsetWidth,v);break;case YAHOO.widget.Overlay.BOTTOM_LEFT:me.moveTo(h,v-element.offsetHeight);break;case YAHOO.widget.Overlay.BOTTOM_RIGHT:me.moveTo(h-element.offsetWidth,v-element.offsetHeight);break;}};switch(contextAlign){case YAHOO.widget.Overlay.TOP_LEFT:doAlign(contextRegion.top,contextRegion.left);break;case YAHOO.widget.Overlay.TOP_RIGHT:doAlign(contextRegion.top,contextRegion.right);break;case YAHOO.widget.Overlay.BOTTOM_LEFT:doAlign(contextRegion.bottom,contextRegion.left);break;case YAHOO.widget.Overlay.BOTTOM_RIGHT:doAlign(contextRegion.bottom,contextRegion.right);break;}}}};YAHOO.widget.Overlay.prototype.enforceConstraints=function(type,args,obj){var pos=args[0];var x=pos[0];var y=pos[1];var offsetHeight=this.element.offsetHeight;var offsetWidth=this.element.offsetWidth;var viewPortWidth=YAHOO.util.Dom.getViewportWidth();var viewPortHeight=YAHOO.util.Dom.getViewportHeight();var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;var topConstraint=scrollY+10;var leftConstraint=scrollX+10;var bottomConstraint=scrollY+viewPortHeight-offsetHeight-10;var rightConstraint=scrollX+viewPortWidth-offsetWidth-10;if(x<leftConstraint){x=leftConstraint;}else if(x>rightConstraint){x=rightConstraint;}
|
||||
if(y<topConstraint){y=topConstraint;}else if(y>bottomConstraint){y=bottomConstraint;}
|
||||
this.cfg.setProperty("x",x,true);this.cfg.setProperty("y",y,true);this.cfg.setProperty("xy",[x,y],true);};YAHOO.widget.Overlay.prototype.center=function(){var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;var viewPortWidth=YAHOO.util.Dom.getClientWidth();var viewPortHeight=YAHOO.util.Dom.getClientHeight();var elementWidth=this.element.offsetWidth;var elementHeight=this.element.offsetHeight;var x=(viewPortWidth/2)-(elementWidth/2)+scrollX;var y=(viewPortHeight/2)-(elementHeight/2)+scrollY;this.cfg.setProperty("xy",[parseInt(x,10),parseInt(y,10)]);this.cfg.refireEvent("iframe");};YAHOO.widget.Overlay.prototype.syncPosition=function(){var pos=YAHOO.util.Dom.getXY(this.element);this.cfg.setProperty("x",pos[0],true);this.cfg.setProperty("y",pos[1],true);this.cfg.setProperty("xy",pos,true);};YAHOO.widget.Overlay.prototype.onDomResize=function(e,obj){YAHOO.widget.Overlay.superclass.onDomResize.call(this,e,obj);var me=this;setTimeout(function(){me.syncPosition();me.cfg.refireEvent("iframe");me.cfg.refireEvent("context");},0);};YAHOO.widget.Overlay.prototype.destroy=function(){if(this.iframe){this.iframe.parentNode.removeChild(this.iframe);}
|
||||
this.iframe=null;YAHOO.widget.Overlay.windowResizeEvent.unsubscribe(this.doCenterOnDOMEvent,this);YAHOO.widget.Overlay.windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent,this);YAHOO.widget.Overlay.superclass.destroy.call(this);};YAHOO.widget.Overlay.prototype.toString=function(){return"Overlay "+this.id;};YAHOO.widget.Overlay.windowScrollEvent=new YAHOO.util.CustomEvent("windowScroll");YAHOO.widget.Overlay.windowResizeEvent=new YAHOO.util.CustomEvent("windowResize");YAHOO.widget.Overlay.windowScrollHandler=function(e){if(YAHOO.widget.Module.prototype.browser=="ie"||YAHOO.widget.Module.prototype.browser=="ie7"){if(!window.scrollEnd){window.scrollEnd=-1;}
|
||||
clearTimeout(window.scrollEnd);window.scrollEnd=setTimeout(function(){YAHOO.widget.Overlay.windowScrollEvent.fire();},1);}else{YAHOO.widget.Overlay.windowScrollEvent.fire();}};YAHOO.widget.Overlay.windowResizeHandler=function(e){if(YAHOO.widget.Module.prototype.browser=="ie"||YAHOO.widget.Module.prototype.browser=="ie7"){if(!window.resizeEnd){window.resizeEnd=-1;}
|
||||
clearTimeout(window.resizeEnd);window.resizeEnd=setTimeout(function(){YAHOO.widget.Overlay.windowResizeEvent.fire();},100);}else{YAHOO.widget.Overlay.windowResizeEvent.fire();}};YAHOO.widget.Overlay._initialized=null;if(YAHOO.widget.Overlay._initialized===null){YAHOO.util.Event.addListener(window,"scroll",YAHOO.widget.Overlay.windowScrollHandler);YAHOO.util.Event.addListener(window,"resize",YAHOO.widget.Overlay.windowResizeHandler);YAHOO.widget.Overlay._initialized=true;}
|
||||
YAHOO.widget.OverlayManager=function(userConfig){this.init(userConfig);};YAHOO.widget.OverlayManager.CSS_FOCUSED="focused";YAHOO.widget.OverlayManager.prototype={constructor:YAHOO.widget.OverlayManager,overlays:null,initDefaultConfig:function(){this.cfg.addProperty("overlays",{suppressEvent:true});this.cfg.addProperty("focusevent",{value:"mousedown"});},init:function(userConfig){this.cfg=new YAHOO.util.Config(this);this.initDefaultConfig();if(userConfig){this.cfg.applyConfig(userConfig,true);}
|
||||
this.cfg.fireQueue();var activeOverlay=null;this.getActive=function(){return activeOverlay;};this.focus=function(overlay){var o=this.find(overlay);if(o){if(activeOverlay!=o){if(activeOverlay){activeOverlay.blur();}
|
||||
activeOverlay=o;YAHOO.util.Dom.addClass(activeOverlay.element,YAHOO.widget.OverlayManager.CSS_FOCUSED);this.overlays.sort(this.compareZIndexDesc);var topZIndex=YAHOO.util.Dom.getStyle(this.overlays[0].element,"zIndex");if(!isNaN(topZIndex)&&this.overlays[0]!=overlay){activeOverlay.cfg.setProperty("zIndex",(parseInt(topZIndex,10)+2));}
|
||||
this.overlays.sort(this.compareZIndexDesc);o.focusEvent.fire();}}};this.remove=function(overlay){var o=this.find(overlay);if(o){var originalZ=YAHOO.util.Dom.getStyle(o.element,"zIndex");o.cfg.setProperty("zIndex",-1000,true);this.overlays.sort(this.compareZIndexDesc);this.overlays=this.overlays.slice(0,this.overlays.length-1);o.hideEvent.unsubscribe(o.blur);o.destroyEvent.unsubscribe(this._onOverlayDestroy,o);if(o.element){YAHOO.util.Event.removeListener(o.element,this.cfg.getProperty("focusevent"),this._onOverlayElementFocus);}
|
||||
o.cfg.setProperty("zIndex",originalZ,true);o.cfg.setProperty("manager",null);o.focusEvent.unsubscribeAll();o.blurEvent.unsubscribeAll();o.focusEvent=null;o.blurEvent=null;o.focus=null;o.blur=null;}};this.blurAll=function(){for(var o=0;o<this.overlays.length;o++){this.overlays[o].blur();}};this._onOverlayBlur=function(p_sType,p_aArgs){activeOverlay=null;};var overlays=this.cfg.getProperty("overlays");if(!this.overlays){this.overlays=[];}
|
||||
if(overlays){this.register(overlays);this.overlays.sort(this.compareZIndexDesc);}},_onOverlayElementFocus:function(p_oEvent){var oTarget=YAHOO.util.Event.getTarget(p_oEvent),oClose=this.close;if(oClose&&(oTarget==oClose||YAHOO.util.Dom.isAncestor(oClose,oTarget))){this.blur();}
|
||||
else{this.focus();}},_onOverlayDestroy:function(p_sType,p_aArgs,p_oOverlay){this.remove(p_oOverlay);},register:function(overlay){if(overlay instanceof YAHOO.widget.Overlay){overlay.cfg.addProperty("manager",{value:this});overlay.focusEvent=new YAHOO.util.CustomEvent("focus",overlay);overlay.blurEvent=new YAHOO.util.CustomEvent("blur",overlay);var mgr=this;overlay.focus=function(){mgr.focus(this);};overlay.blur=function(){if(mgr.getActive()==this){YAHOO.util.Dom.removeClass(this.element,YAHOO.widget.OverlayManager.CSS_FOCUSED);this.blurEvent.fire();}};overlay.blurEvent.subscribe(mgr._onOverlayBlur);overlay.hideEvent.subscribe(overlay.blur);overlay.destroyEvent.subscribe(this._onOverlayDestroy,overlay,this);YAHOO.util.Event.addListener(overlay.element,this.cfg.getProperty("focusevent"),this._onOverlayElementFocus,null,overlay);var zIndex=YAHOO.util.Dom.getStyle(overlay.element,"zIndex");if(!isNaN(zIndex)){overlay.cfg.setProperty("zIndex",parseInt(zIndex,10));}else{overlay.cfg.setProperty("zIndex",0);}
|
||||
this.overlays.push(overlay);return true;}else if(overlay instanceof Array){var regcount=0;for(var i=0;i<overlay.length;i++){if(this.register(overlay[i])){regcount++;}}
|
||||
if(regcount>0){return true;}}else{return false;}},find:function(overlay){if(overlay instanceof YAHOO.widget.Overlay){for(var o=0;o<this.overlays.length;o++){if(this.overlays[o]==overlay){return this.overlays[o];}}}else if(typeof overlay=="string"){for(var p=0;p<this.overlays.length;p++){if(this.overlays[p].id==overlay){return this.overlays[p];}}}
|
||||
return null;},compareZIndexDesc:function(o1,o2){var zIndex1=o1.cfg.getProperty("zIndex");var zIndex2=o2.cfg.getProperty("zIndex");if(zIndex1>zIndex2){return-1;}else if(zIndex1<zIndex2){return 1;}else{return 0;}},showAll:function(){for(var o=0;o<this.overlays.length;o++){this.overlays[o].show();}},hideAll:function(){for(var o=0;o<this.overlays.length;o++){this.overlays[o].hide();}},toString:function(){return"OverlayManager";}};YAHOO.widget.ContainerEffect=function(overlay,attrIn,attrOut,targetElement,animClass){if(!animClass){animClass=YAHOO.util.Anim;}
|
||||
this.overlay=overlay;this.attrIn=attrIn;this.attrOut=attrOut;this.targetElement=targetElement||overlay.element;this.animClass=animClass;};YAHOO.widget.ContainerEffect.prototype.init=function(){this.beforeAnimateInEvent=new YAHOO.util.CustomEvent("beforeAnimateIn",this);this.beforeAnimateOutEvent=new YAHOO.util.CustomEvent("beforeAnimateOut",this);this.animateInCompleteEvent=new YAHOO.util.CustomEvent("animateInComplete",this);this.animateOutCompleteEvent=new YAHOO.util.CustomEvent("animateOutComplete",this);this.animIn=new this.animClass(this.targetElement,this.attrIn.attributes,this.attrIn.duration,this.attrIn.method);this.animIn.onStart.subscribe(this.handleStartAnimateIn,this);this.animIn.onTween.subscribe(this.handleTweenAnimateIn,this);this.animIn.onComplete.subscribe(this.handleCompleteAnimateIn,this);this.animOut=new this.animClass(this.targetElement,this.attrOut.attributes,this.attrOut.duration,this.attrOut.method);this.animOut.onStart.subscribe(this.handleStartAnimateOut,this);this.animOut.onTween.subscribe(this.handleTweenAnimateOut,this);this.animOut.onComplete.subscribe(this.handleCompleteAnimateOut,this);};YAHOO.widget.ContainerEffect.prototype.animateIn=function(){this.beforeAnimateInEvent.fire();this.animIn.animate();};YAHOO.widget.ContainerEffect.prototype.animateOut=function(){this.beforeAnimateOutEvent.fire();this.animOut.animate();};YAHOO.widget.ContainerEffect.prototype.handleStartAnimateIn=function(type,args,obj){};YAHOO.widget.ContainerEffect.prototype.handleTweenAnimateIn=function(type,args,obj){};YAHOO.widget.ContainerEffect.prototype.handleCompleteAnimateIn=function(type,args,obj){};YAHOO.widget.ContainerEffect.prototype.handleStartAnimateOut=function(type,args,obj){};YAHOO.widget.ContainerEffect.prototype.handleTweenAnimateOut=function(type,args,obj){};YAHOO.widget.ContainerEffect.prototype.handleCompleteAnimateOut=function(type,args,obj){};YAHOO.widget.ContainerEffect.prototype.toString=function(){var output="ContainerEffect";if(this.overlay){output+=" ["+this.overlay.toString()+"]";}
|
||||
return output;};YAHOO.widget.ContainerEffect.FADE=function(overlay,dur){var fade=new YAHOO.widget.ContainerEffect(overlay,{attributes:{opacity:{from:0,to:1}},duration:dur,method:YAHOO.util.Easing.easeIn},{attributes:{opacity:{to:0}},duration:dur,method:YAHOO.util.Easing.easeOut},overlay.element);fade.handleStartAnimateIn=function(type,args,obj){YAHOO.util.Dom.addClass(obj.overlay.element,"hide-select");if(!obj.overlay.underlay){obj.overlay.cfg.refireEvent("underlay");}
|
||||
if(obj.overlay.underlay){obj.initialUnderlayOpacity=YAHOO.util.Dom.getStyle(obj.overlay.underlay,"opacity");obj.overlay.underlay.style.filter=null;}
|
||||
YAHOO.util.Dom.setStyle(obj.overlay.element,"visibility","visible");YAHOO.util.Dom.setStyle(obj.overlay.element,"opacity",0);};fade.handleCompleteAnimateIn=function(type,args,obj){YAHOO.util.Dom.removeClass(obj.overlay.element,"hide-select");if(obj.overlay.element.style.filter){obj.overlay.element.style.filter=null;}
|
||||
if(obj.overlay.underlay){YAHOO.util.Dom.setStyle(obj.overlay.underlay,"opacity",obj.initialUnderlayOpacity);}
|
||||
obj.overlay.cfg.refireEvent("iframe");obj.animateInCompleteEvent.fire();};fade.handleStartAnimateOut=function(type,args,obj){YAHOO.util.Dom.addClass(obj.overlay.element,"hide-select");if(obj.overlay.underlay){obj.overlay.underlay.style.filter=null;}};fade.handleCompleteAnimateOut=function(type,args,obj){YAHOO.util.Dom.removeClass(obj.overlay.element,"hide-select");if(obj.overlay.element.style.filter){obj.overlay.element.style.filter=null;}
|
||||
YAHOO.util.Dom.setStyle(obj.overlay.element,"visibility","hidden");YAHOO.util.Dom.setStyle(obj.overlay.element,"opacity",1);obj.overlay.cfg.refireEvent("iframe");obj.animateOutCompleteEvent.fire();};fade.init();return fade;};YAHOO.widget.ContainerEffect.SLIDE=function(overlay,dur){var x=overlay.cfg.getProperty("x")||YAHOO.util.Dom.getX(overlay.element);var y=overlay.cfg.getProperty("y")||YAHOO.util.Dom.getY(overlay.element);var clientWidth=YAHOO.util.Dom.getClientWidth();var offsetWidth=overlay.element.offsetWidth;var slide=new YAHOO.widget.ContainerEffect(overlay,{attributes:{points:{to:[x,y]}},duration:dur,method:YAHOO.util.Easing.easeIn},{attributes:{points:{to:[(clientWidth+25),y]}},duration:dur,method:YAHOO.util.Easing.easeOut},overlay.element,YAHOO.util.Motion);slide.handleStartAnimateIn=function(type,args,obj){obj.overlay.element.style.left=(-25-offsetWidth)+"px";obj.overlay.element.style.top=y+"px";};slide.handleTweenAnimateIn=function(type,args,obj){var pos=YAHOO.util.Dom.getXY(obj.overlay.element);var currentX=pos[0];var currentY=pos[1];if(YAHOO.util.Dom.getStyle(obj.overlay.element,"visibility")=="hidden"&¤tX<x){YAHOO.util.Dom.setStyle(obj.overlay.element,"visibility","visible");}
|
||||
obj.overlay.cfg.setProperty("xy",[currentX,currentY],true);obj.overlay.cfg.refireEvent("iframe");};slide.handleCompleteAnimateIn=function(type,args,obj){obj.overlay.cfg.setProperty("xy",[x,y],true);obj.startX=x;obj.startY=y;obj.overlay.cfg.refireEvent("iframe");obj.animateInCompleteEvent.fire();};slide.handleStartAnimateOut=function(type,args,obj){var vw=YAHOO.util.Dom.getViewportWidth();var pos=YAHOO.util.Dom.getXY(obj.overlay.element);var yso=pos[1];var currentTo=obj.animOut.attributes.points.to;obj.animOut.attributes.points.to=[(vw+25),yso];};slide.handleTweenAnimateOut=function(type,args,obj){var pos=YAHOO.util.Dom.getXY(obj.overlay.element);var xto=pos[0];var yto=pos[1];obj.overlay.cfg.setProperty("xy",[xto,yto],true);obj.overlay.cfg.refireEvent("iframe");};slide.handleCompleteAnimateOut=function(type,args,obj){YAHOO.util.Dom.setStyle(obj.overlay.element,"visibility","hidden");obj.overlay.cfg.setProperty("xy",[x,y]);obj.animateOutCompleteEvent.fire();};slide.init();return slide;};YAHOO.register("container_core",YAHOO.widget.Module,{version:"2.2.2",build:"204"});
|
||||
3097
www/extras/yui/build/container/container_core.js
vendored
|
|
@ -1,27 +0,0 @@
|
|||
DataSource Release Notes
|
||||
|
||||
**** version 2.2.2 ***
|
||||
|
||||
* No changes.
|
||||
|
||||
|
||||
|
||||
**** version 2.2.1 ***
|
||||
|
||||
* Fixed parseTextData() to longer reverse-order data or truncate first record.
|
||||
* Fixed bug where data values of 0 (zero) were being converted to empty string.
|
||||
* Fixed erroneous undefined values created by parseDataArray().
|
||||
* Callback functions now receive an additional argument in the form of a boolean
|
||||
to indicate data error.
|
||||
* Support for nested JSON data.
|
||||
* Support for responseShema.fields.converter to take string response and custom
|
||||
convert data type.
|
||||
* Added static converter methods YAHOO.util.DataSource.convertNumber and
|
||||
YAHOO.util.DataSource.convertDate.
|
||||
* Improved type checking with YAHOO.lang.
|
||||
|
||||
|
||||
|
||||
**** version 2.2.0 ***
|
||||
|
||||
* Beta release.
|
||||
1030
www/extras/yui/build/datasource/datasource-beta-debug.js
vendored
|
|
@ -1,68 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 2.2.2
|
||||
*/
|
||||
|
||||
YAHOO.util.DataSource=function(oLiveData,oConfigs){if(oConfigs&&(oConfigs.constructor==Object)){for(var sConfig in oConfigs){if(sConfig){this[sConfig]=oConfigs[sConfig];}}}
|
||||
if(!oLiveData){return;}
|
||||
if(YAHOO.lang.isArray(oLiveData)){this.dataType=YAHOO.util.DataSource.TYPE_JSARRAY;}
|
||||
else if(YAHOO.lang.isString(oLiveData)){this.dataType=YAHOO.util.DataSource.TYPE_XHR;}
|
||||
else if(YAHOO.lang.isFunction(oLiveData)){this.dataType=YAHOO.util.DataSource.TYPE_JSFUNCTION;}
|
||||
else if(YAHOO.lang.isObject(oLiveData)){this.dataType=YAHOO.util.DataSource.TYPE_JSON;}
|
||||
else{this.dataType=YAHOO.util.DataSource.TYPE_UNKNOWN;}
|
||||
this.liveData=oLiveData;var maxCacheEntries=this.maxCacheEntries;if(!YAHOO.lang.isNumber(maxCacheEntries)||(maxCacheEntries<0)){maxCacheEntries=0;}
|
||||
if(maxCacheEntries>0&&!this._aCache){this._aCache=[];}
|
||||
this._sName="instance"+YAHOO.util.DataSource._nIndex;YAHOO.util.DataSource._nIndex++;this.createEvent("cacheRequestEvent");this.createEvent("cacheResponseEvent");this.createEvent("requestEvent");this.createEvent("responseEvent");this.createEvent("responseParseEvent");this.createEvent("responseCacheEvent");this.createEvent("dataErrorEvent");this.createEvent("cacheFlushEvent");};YAHOO.augment(YAHOO.util.DataSource,YAHOO.util.EventProvider);YAHOO.util.DataSource.TYPE_UNKNOWN=-1;YAHOO.util.DataSource.TYPE_JSARRAY=0;YAHOO.util.DataSource.TYPE_JSFUNCTION=1;YAHOO.util.DataSource.TYPE_XHR=2;YAHOO.util.DataSource.TYPE_JSON=3;YAHOO.util.DataSource.TYPE_XML=4;YAHOO.util.DataSource.TYPE_TEXT=5;YAHOO.util.DataSource.ERROR_DATAINVALID="Invalid data";YAHOO.util.DataSource.ERROR_DATANULL="Null data";YAHOO.util.DataSource._nIndex=0;YAHOO.util.DataSource.prototype._sName=null;YAHOO.util.DataSource.prototype._aCache=null;YAHOO.util.DataSource.prototype.maxCacheEntries=0;YAHOO.util.DataSource.prototype.liveData=null;YAHOO.util.DataSource.prototype.connTimeout=null;YAHOO.util.DataSource.prototype.connMgr=YAHOO.util.Connect||null;YAHOO.util.DataSource.prototype.dataType=YAHOO.util.DataSource.TYPE_UNKNOWN;YAHOO.util.DataSource.prototype.responseType=YAHOO.util.DataSource.TYPE_UNKNOWN;YAHOO.util.DataSource.prototype.responseSchema=null;YAHOO.util.DataSource.convertNumber=function(sData){return sData*1;};YAHOO.util.DataSource.convertDate=function(sData){var mm=sMarkup.substring(0,sMarkup.indexOf("/"));sMarkup=sMarkup.substring(sMarkup.indexOf("/")+1);var dd=sMarkup.substring(0,sMarkup.indexOf("/"));var yy=sMarkup.substring(sMarkup.indexOf("/")+1);return new Date(yy,mm,dd);};YAHOO.util.DataSource.prototype.toString=function(){return"DataSource "+this._sName;};YAHOO.util.DataSource.prototype.getCachedResponse=function(oRequest,oCallback,oCaller){var aCache=this._aCache;var nCacheLength=(aCache)?aCache.length:0;var oResponse=null;if((this.maxCacheEntries>0)&&aCache&&(nCacheLength>0)){this.fireEvent("cacheRequestEvent",{request:oRequest,callback:oCallback,caller:oCaller});for(var i=nCacheLength-1;i>=0;i--){var oCacheElem=aCache[i];if(this.isCacheHit(oRequest,oCacheElem.request)){oResponse=oCacheElem.response;aCache.splice(i,1);this.addToCache(oRequest,oResponse);this.fireEvent("cacheResponseEvent",{request:oRequest,response:oResponse,callback:oCallback,caller:oCaller});break;}}}
|
||||
return oResponse;};YAHOO.util.DataSource.prototype.isCacheHit=function(oRequest,oCachedRequest){return(oRequest===oCachedRequest);};YAHOO.util.DataSource.prototype.addToCache=function(oRequest,oResponse){var aCache=this._aCache;if(!aCache){return;}
|
||||
while(aCache.length>=this.maxCacheEntries){aCache.shift();}
|
||||
var oCacheElem={request:oRequest,response:oResponse};aCache.push(oCacheElem);this.fireEvent("responseCacheEvent",{request:oRequest,response:oResponse});};YAHOO.util.DataSource.prototype.flushCache=function(){if(this._aCache){this._aCache=[];this.fireEvent("cacheFlushEvent");}};YAHOO.util.DataSource.prototype.sendRequest=function(oRequest,oCallback,oCaller){var oCachedResponse=this.getCachedResponse(oRequest,oCallback,oCaller);if(oCachedResponse){oCallback.call(oCaller,oRequest,oCachedResponse);return;}
|
||||
this.makeConnection(oRequest,oCallback,oCaller);};YAHOO.util.DataSource.prototype.makeConnection=function(oRequest,oCallback,oCaller){this.fireEvent("requestEvent",{request:oRequest,callback:oCallback,caller:oCaller});var oRawResponse=null;switch(this.dataType){case YAHOO.util.DataSource.TYPE_JSARRAY:case YAHOO.util.DataSource.TYPE_JSON:oRawResponse=this.liveData;this.handleResponse(oRequest,oRawResponse,oCallback,oCaller);break;case YAHOO.util.DataSource.TYPE_JSFUNCTION:oRawResponse=this.liveData(oRequest);this.handleResponse(oRequest,oRawResponse,oCallback,oCaller);break;case YAHOO.util.DataSource.TYPE_XHR:var _xhrSuccess=function(oResponse){if(oResponse&&(!this._oConn||(oResponse.tId!=this._oConn.tId))){this.fireEvent("dataErrorEvent",{request:oRequest,callback:oCallback,caller:oCaller,message:YAHOO.util.DataSource.ERROR_DATAINVALID});return null;}
|
||||
else if(!oResponse){this.fireEvent("dataErrorEvent",{request:oRequest,callback:oCallback,caller:oCaller,message:YAHOO.util.DataSource.ERROR_DATANULL});oCallback.call(oCaller,oRequest,oResponse,true);return null;}
|
||||
else{this.handleResponse(oRequest,oResponse,oCallback,oCaller);}};var _xhrFailure=function(oResponse){this.fireEvent("dataErrorEvent",{request:oRequest,callback:oCallback,caller:oCaller,message:YAHOO.util.DataSource.ERROR_DATAINVALID});oCallback.call(oCaller,oRequest,oResponse,true);return null;};var _xhrCallback={success:_xhrSuccess,failure:_xhrFailure,scope:this};if(YAHOO.lang.isNumber(this.connTimeout)&&(this.connTimeout>0)){_xhrCallback.timeout=this.connTimeout;}
|
||||
if(this._oConn&&this.connMgr){this.connMgr.abort(this._oConn);}
|
||||
var sUri=this.liveData+"?"+oRequest;if(this.connMgr){this._oConn=this.connMgr.asyncRequest("GET",sUri,_xhrCallback,null);}
|
||||
else{oCallback.call(oCaller,oRequest,null,true);}
|
||||
break;default:break;}};YAHOO.util.DataSource.prototype.handleResponse=function(oRequest,oRawResponse,oCallback,oCaller){this.fireEvent("responseEvent",{request:oRequest,response:oRawResponse,callback:oCallback,caller:oCaller});var xhr=(this.dataType==YAHOO.util.DataSource.TYPE_XHR)?true:false;var oParsedResponse=null;switch(this.responseType){case YAHOO.util.DataSource.TYPE_JSARRAY:if(xhr&&oRawResponse.responseText){oRawResponse=oRawResponse.responseText;}
|
||||
oParsedResponse=this.parseArrayData(oRequest,oRawResponse);break;case YAHOO.util.DataSource.TYPE_JSON:if(xhr&&oRawResponse.responseText){oRawResponse=oRawResponse.responseText;}
|
||||
oParsedResponse=this.parseJSONData(oRequest,oRawResponse);break;case YAHOO.util.DataSource.TYPE_XML:if(xhr&&oRawResponse.responseXML){oRawResponse=oRawResponse.responseXML;}
|
||||
oParsedResponse=this.parseXMLData(oRequest,oRawResponse);break;case YAHOO.util.DataSource.TYPE_TEXT:if(xhr&&oRawResponse.responseText){oRawResponse=oRawResponse.responseText;}
|
||||
oParsedResponse=this.parseTextData(oRequest,oRawResponse);break;default:break;}
|
||||
if(oParsedResponse){this.fireEvent("responseParseEvent",{request:oRequest,response:oParsedResponse,callback:oCallback,caller:oCaller});this.addToCache(oRequest,oParsedResponse);oCallback.call(oCaller,oRequest,oParsedResponse);}
|
||||
else{this.fireEvent("dataErrorEvent",{request:oRequest,callback:oCallback,caller:oCaller,message:YAHOO.util.DataSource.ERROR_DATANULL});oCallback.call(oCaller,oRequest,null,true);}};YAHOO.util.DataSource.prototype.parseArrayData=function(oRequest,oRawResponse){if(YAHOO.lang.isArray(oRawResponse)&&YAHOO.lang.isArray(this.responseSchema.fields)){var oParsedResponse=[];var fields=this.responseSchema.fields;for(var i=oRawResponse.length-1;i>-1;i--){var oResult={};for(var j=fields.length-1;j>-1;j--){var field=fields[j];var key=field.key||field;var data=oRawResponse[i][j]||oRawResponse[i][key];if(field.converter){data=field.converter(data);}
|
||||
oResult[key]=data;}
|
||||
oParsedResponse.unshift(oResult);}
|
||||
return oParsedResponse;}
|
||||
else{return null;}};YAHOO.util.DataSource.prototype.parseTextData=function(oRequest,oRawResponse){if(YAHOO.lang.isString(oRawResponse)&&YAHOO.lang.isArray(this.responseSchema.fields)&&YAHOO.lang.isString(this.responseSchema.recordDelim)&&YAHOO.lang.isString(this.responseSchema.fieldDelim)){var oParsedResponse=[];var recDelim=this.responseSchema.recordDelim;var fieldDelim=this.responseSchema.fieldDelim;var fields=this.responseSchema.fields;if(oRawResponse.length>0){var newLength=oRawResponse.length-recDelim.length;if(oRawResponse.substr(newLength)==recDelim){oRawResponse=oRawResponse.substr(0,newLength);}
|
||||
var recordsarray=oRawResponse.split(recDelim);for(var i=recordsarray.length-1;i>-1;i--){var oResult={};for(var j=fields.length-1;j>-1;j--){var fielddataarray=recordsarray[i].split(fieldDelim);var data=fielddataarray[j];if(data.charAt(0)=="\""){data=data.substr(1);}
|
||||
if(data.charAt(data.length-1)=="\""){data=data.substr(0,data.length-1);}
|
||||
var field=fields[j];var key=field.key||field;if(field.converter){data=field.converter(data);}
|
||||
oResult[key]=data;}
|
||||
oParsedResponse.unshift(oResult);}}
|
||||
return oParsedResponse;}
|
||||
else{return null;}};YAHOO.util.DataSource.prototype.parseXMLData=function(oRequest,oRawResponse){var bError=false;var oParsedResponse=[];var xmlList=(this.responseSchema.resultNode)?oRawResponse.getElementsByTagName(this.responseSchema.resultNode):null;if(!xmlList||!YAHOO.lang.isArray(this.responseSchema.fields)){bError=true;}
|
||||
else{for(var k=xmlList.length-1;k>=0;k--){var result=xmlList.item(k);var oResult={};for(var m=this.responseSchema.fields.length-1;m>=0;m--){var field=this.responseSchema.fields[m];var key=field.key||field;var data=null;var xmlAttr=result.attributes.getNamedItem(key);if(xmlAttr){data=xmlAttr.value;}
|
||||
else{var xmlNode=result.getElementsByTagName(key);if(xmlNode&&xmlNode.item(0)&&xmlNode.item(0).firstChild){data=xmlNode.item(0).firstChild.nodeValue;}
|
||||
else{data="";}}
|
||||
if(field.converter){data=field.converter(data);}
|
||||
oResult[key]=data;}
|
||||
oParsedResponse.unshift(oResult);}}
|
||||
if(bError){return null;}
|
||||
return oParsedResponse;};YAHOO.util.DataSource.prototype.parseJSONData=function(oRequest,oRawResponse){if(oRawResponse&&YAHOO.lang.isArray(this.responseSchema.fields)){var fields=this.responseSchema.fields;var bError=false;var oParsedResponse=[];var jsonObj,jsonList;if(YAHOO.lang.isString(oRawResponse)){var isNotMac=(navigator.userAgent.toLowerCase().indexOf('khtml')==-1);if(oRawResponse.parseJSON&&isNotMac){jsonObj=oRawResponse.parseJSON();if(!jsonObj){bError=true;}}
|
||||
else if(window.JSON&&JSON.parse&&isNotMac){jsonObj=JSON.parse(oRawResponse);if(!jsonObj){bError=true;}}
|
||||
else{try{while(oRawResponse.length>0&&(oRawResponse.charAt(0)!="{")&&(oRawResponse.charAt(0)!="[")){oRawResponse=oRawResponse.substring(1,oResponse.length);}
|
||||
if(oRawResponse.length>0){var objEnd=Math.max(oRawResponse.lastIndexOf("]"),oRawResponse.lastIndexOf("}"));oRawResponse=oRawResponse.substring(0,objEnd+1);jsonObj=eval("("+oRawResponse+")");if(!jsonObj){bError=true;}}}
|
||||
catch(e){bError=true;}}}
|
||||
else if(oRawResponse.constructor==Object){jsonObj=oRawResponse;}
|
||||
else{bError=true;}
|
||||
if(jsonObj&&jsonObj.constructor==Object){try{jsonList=eval("jsonObj."+this.responseSchema.resultsList);}
|
||||
catch(e){bError=true;}}
|
||||
if(bError||!jsonList){return null;}
|
||||
else if(!YAHOO.lang.isArray(jsonList)){jsonList=[jsonList];}
|
||||
for(var i=jsonList.length-1;i>=0;i--){var oResult={};var jsonResult=jsonList[i];for(var j=fields.length-1;j>=0;j--){var field=fields[j];var key=field.key||field;var data=eval("jsonResult."+key);if((typeof data=="undefined")||(data===null)){data="";}
|
||||
if(field.converter){data=field.converter(data);}
|
||||
oResult[key]=data;}
|
||||
oParsedResponse.unshift(oResult);}
|
||||
return oParsedResponse;}
|
||||
else{return null;}};YAHOO.register("datasource",YAHOO.util.DataSource,{version:"2.2.2",build:"204"});
|
||||
1006
www/extras/yui/build/datasource/datasource-beta.js
vendored
|
|
@ -1,68 +0,0 @@
|
|||
DataTable Release Notes
|
||||
|
||||
*** version 2.2.2 ***
|
||||
|
||||
* Removed workaround for a fixed Dom.getXY() bug that was causing a positioning
|
||||
problem for inline editors on scrolled pages.
|
||||
|
||||
|
||||
|
||||
**** version 2.2.1 ***
|
||||
|
||||
* Changed default pagination from enabled to disabled. Must set property
|
||||
paginator to true to enable built-in client-side pagination.
|
||||
* Removed deleteSelectedRows() and added deleteRows().
|
||||
* Deprecated properties isEmpty and isLoading, and methods showLoadingMessage(),
|
||||
showEmptyMessage(), and hideTableMessages(). Implementers should now use
|
||||
showTableMessage() and hideTableMessage().
|
||||
* Deprecated methods paginateRows() and onDataReturnPaginateRows(). Implementers
|
||||
should now use popualateTable() and onDataReturnPopulateTable().
|
||||
* Deprecated pagination properties pageCurrent, rowsPerPage, startRecordIndex,
|
||||
pageLinksLength, rowsPerPageDropdown, pageLinksStart, and pagers.
|
||||
* Fixed unclickable links.
|
||||
* Fix to support data values of 0 (zero).
|
||||
* Fixed broken validation in multiple places when the value 0 (zero) is passed
|
||||
in as an argument.
|
||||
* Fixed incorrect month output in formatDate().
|
||||
* Fixed broken empty message when there are zero rows.
|
||||
* Allow implementers to use data with field name "id".
|
||||
* Fixed Column resizeability in -min builds.
|
||||
* Fixed Column sorting of null, undefined, and empty values.
|
||||
* Fixed Column sorting of nested headers.
|
||||
* Fixed paginator dropdowns to stay in sync when paginating.
|
||||
* Fixed rowSingleSelect for paginated DataTable.
|
||||
* Fix for currency values with more than 2 decimal places.
|
||||
* Fixed broken TR ID assignments in replaceRows().
|
||||
* Fixed Opera UI artifacting problem when repaginating via dropdowns.
|
||||
* Fixed orphaned ColumnEditor during pagination or other de facto blur
|
||||
interaction. Data gets saved.
|
||||
* Extracted non-foundational CSS for scrollable DataTables to make UI easier to
|
||||
customize.
|
||||
* Updated methods select() and unselect() to also accept an array of elements or
|
||||
an array of strings.
|
||||
* Improved row selection behavior to model the desktop paradigm (i.e., require
|
||||
CONTROL and/or SHIFT keys to multi-select).
|
||||
* Tweaked inline editing for better Mac performance.
|
||||
* Refactored pagination code to be easier to implement, configure, and extend.
|
||||
* Accept an error boolean from DataSource in case of data error and show error
|
||||
message.
|
||||
* The CustomEvent rowDeleteEvent now sends argument rowIndexes as an Array of
|
||||
row index values.
|
||||
* Added selectRow(), rowSelectEvent, unselectRow(), rowUnselectEvent, and
|
||||
rowUpdateEvent.
|
||||
* Added constants CLASS_TABLE, CLASS_EDITOR, CLASS_FIRST, and CLASS_LAST.
|
||||
* Added ColumnEditor class moveContainerTo().
|
||||
* Add IDs and class hooks to TABLE element and ColumnEditor's container DIV.
|
||||
* Add class hooks to first and last TR elements.
|
||||
* Added hook to doBeforeLoadData() for the not-from-markup constructor flow.
|
||||
* Added properties paginator and paginatorOptions, as well as method getPaginator().
|
||||
* Added methods saveEditorData() and cancelEditorData().
|
||||
* Improved type checking with YAHOO.lang.
|
||||
|
||||
|
||||
|
||||
**** version 2.2.0 ***
|
||||
|
||||
* Beta release.
|
||||
* Caption is not supported when scrolling is enabled.
|
||||
* Resizeability is not supported for fixed-width DataTables.
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 2.2.2
|
||||
*/
|
||||
/*foundational css*/
|
||||
td {
|
||||
overflow:hidden;
|
||||
}
|
||||
|
||||
.yui-dt-headcontainer {
|
||||
position:relative;
|
||||
|
||||
}
|
||||
|
||||
.yui-dt-headtext {
|
||||
position:relative;
|
||||
border-right:10px;
|
||||
}
|
||||
|
||||
.yui-dt-headresizer {
|
||||
position:absolute;
|
||||
margin-right:-6px;
|
||||
right:0;
|
||||
bottom:0;
|
||||
width:6px;
|
||||
height:100%;
|
||||
cursor:w-resize;
|
||||
cursor:col-resize;
|
||||
}
|
||||
|
||||
.yui-dt-firstlink,.yui-dt-prevlink,.yui-dt-nextlink,.yui-dt-lastlink,.yui-dt-pagelink {
|
||||
cursor:hand;
|
||||
cursor:pointer;
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
/* foundational scrolling css */
|
||||
.yui-dt-scrollable {
|
||||
*overflow-y:auto; /* for ie */
|
||||
}
|
||||
.yui-dt-scrollable thead {
|
||||
display:block; /* for safari and opera */
|
||||
}
|
||||
.yui-dt-scrollable thead tr {
|
||||
position:relative; /* for ie */
|
||||
}
|
||||
.yui-dt-scrollbody {
|
||||
display:block; /* for safari and opera */
|
||||
overflow:auto; /* for gecko */
|
||||
}
|
||||
5882
www/extras/yui/build/datatable/datatable-beta-debug.js
vendored
269
www/extras/yui/build/datatable/datatable-beta-min.js
vendored
|
|
@ -1,269 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 2.2.2
|
||||
*/
|
||||
|
||||
YAHOO.widget.DataTable=function(elContainer,oColumnSet,oDataSource,oConfigs){var i,ok;this._nIndex=YAHOO.widget.DataTable._nCount;this._sName="instance"+this._nIndex;this.id="yui-dt"+this._nIndex;if(oConfigs&&(oConfigs.constructor==Object)){for(var sConfig in oConfigs){this[sConfig]=oConfigs[sConfig];}}
|
||||
if(oDataSource){if(oDataSource instanceof YAHOO.util.DataSource){this.dataSource=oDataSource;}
|
||||
else{}}
|
||||
if(oColumnSet&&(oColumnSet instanceof YAHOO.widget.ColumnSet)){this._oColumnSet=oColumnSet;}
|
||||
else{return;}
|
||||
this._oRecordSet=new YAHOO.widget.RecordSet();var elTable=null;elContainer=YAHOO.util.Dom.get(elContainer);if(elContainer&&elContainer.tagName&&(elContainer.tagName.toLowerCase()=="div")){this._elContainer=elContainer;if(elContainer.hasChildNodes()){var children=elContainer.childNodes;for(i=0;i<children.length;i++){if(children[i].tagName&&children[i].tagName.toLowerCase()=="table"){elTable=children[i];break;}}}
|
||||
if(elTable&&!this.dataSource){var aRecords=[];for(i=0;i<elTable.tBodies.length;i++){var elBody=elTable.tBodies[i];for(var j=0;j<elBody.rows.length;j++){var elRow=elBody.rows[j];var oRecord={};for(var k=0;k<elRow.cells.length;k++){oRecord[oColumnSet.keys[k].key]=oColumnSet.keys[k].parse(elRow.cells[k].innerHTML);}
|
||||
aRecords.push(oRecord);}}
|
||||
this._initTable();ok=this.doBeforeLoadData(null,aRecords);if(ok){this._oRecordSet.addRecords(aRecords);this.populateTable();}
|
||||
else{}}
|
||||
else if(this.dataSource){this._initTable();ok=this.doBeforeLoadData(this.initialRequest,aRecords);if(ok){oDataSource.sendRequest(this.initialRequest,this.onDataReturnPopulateTable,this);}
|
||||
else{}}
|
||||
else{this._initTable();this.showTableMessage();}}
|
||||
else{return;}
|
||||
this.subscribe("headCellClickEvent",this.onEventSortColumn);if(this.contextMenu&&this.contextMenuOptions){this.contextMenu=new YAHOO.widget.ContextMenu(this.id+"-cm",{trigger:this._elBody.rows});this.contextMenu.addItem("delete item");this.contextMenu.render(document.body);}
|
||||
elTable=this._elTable;elTable.className=YAHOO.widget.DataTable.CLASS_TABLE;YAHOO.util.Event.addListener(elTable,"click",this._onClick,this);YAHOO.util.Event.addListener(elTable,"dblclick",this._onDoubleclick,this);YAHOO.util.Event.addListener(elTable,"mouseout",this._onMouseout,this);YAHOO.util.Event.addListener(elTable,"mouseover",this._onMouseover,this);YAHOO.util.Event.addListener(elTable,"mousedown",this._onMousedown,this);YAHOO.util.Event.addListener(elTable,"keydown",this._onKeydown,this);YAHOO.util.Event.addListener(elTable,"keypress",this._onKeypress,this);YAHOO.util.Event.addListener(document,"keydown",this._onDocumentKeydown,this);YAHOO.util.Event.addListener(document,"click",this._onDocumentClick,this);YAHOO.util.Event.addListener(elTable,"keyup",this._onKeyup,this);YAHOO.util.Event.addListener(elTable,"blur",this._onBlur,this);this.createEvent("cellMouseoverEvent");this.createEvent("cellMouseoutEvent");this.createEvent("headCellMouseoverEvent");this.createEvent("headCellMouseoutEvent");this.createEvent("tableMouseoverEvent");this.createEvent("tableMouseoutEvent");this.createEvent("cellMousedownEvent");this.createEvent("headCellMousedownEvent");this.createEvent("tableMousedownEvent");this.checkboxClickEvent=this.createEvent("checkboxClickEvent");this.createEvent("radioClickEvent");this.createEvent("cellClickEvent");this.createEvent("headCellClickEvent");this.createEvent("tableClickEvent");this.createEvent("cellDoubleclickEvent");this.createEvent("headCellDoubleclickEvent");this.createEvent("tableDoubleclickEvent");this.createEvent("columnSortEvent");this.createEvent("editorShowEvent");this.createEvent("cellEditEvent");this.createEvent("columnResizeEvent");this.createEvent("tableInitEvent");this.createEvent("tableFocusEvent");this.createEvent("dataReturnEvent");this.createEvent("paginateEvent");this.createEvent("cellFormatEvent");this.createEvent("selectEvent");this.createEvent("unselectEvent");this.createEvent("highlightEvent");this.createEvent("unhighlightEvent");this.createEvent("rowSelectEvent");this.createEvent("rowUnselectEvent");this.createEvent("rowDeleteEvent");this.subscribe("rowDeleteEvent",this._onRowDelete);this.createEvent("rowAppendEvent");this.createEvent("rowUpdateEvent");this.createEvent("recordSetUpdateEvent");this._oRecordSet.subscribe("recordUpdateEvent",this._onRecordUpdate,this,true);YAHOO.widget.DataTable._nCount++;this.fireEvent("tableInitEvent");};if(YAHOO.util.EventProvider){YAHOO.augment(YAHOO.widget.DataTable,YAHOO.util.EventProvider);}
|
||||
else{}
|
||||
YAHOO.widget.DataTable.CLASS_TABLE="yui-dt-table";YAHOO.widget.DataTable.CLASS_BODY="yui-dt-body";YAHOO.widget.DataTable.CLASS_HEADCONTAINER="yui-dt-headcontainer";YAHOO.widget.DataTable.CLASS_HEADRESIZER="yui-dt-headresizer";YAHOO.widget.DataTable.CLASS_HEADTEXT="yui-dt-headtext";YAHOO.widget.DataTable.CLASS_FIRST="yui-dt-first";YAHOO.widget.DataTable.CLASS_LAST="yui-dt-last";YAHOO.widget.DataTable.CLASS_EVEN="yui-dt-even";YAHOO.widget.DataTable.CLASS_ODD="yui-dt-odd";YAHOO.widget.DataTable.CLASS_EMPTY="yui-dt-empty";YAHOO.widget.DataTable.CLASS_LOADING="yui-dt-loading";YAHOO.widget.DataTable.CLASS_ERROR="yui-dt-error";YAHOO.widget.DataTable.CLASS_SELECTED="yui-dt-selected";YAHOO.widget.DataTable.CLASS_HIGHLIGHT="yui-dt-highlight";YAHOO.widget.DataTable.CLASS_SCROLLABLE="yui-dt-scrollable";YAHOO.widget.DataTable.CLASS_SCROLLBODY="yui-dt-scrollbody";YAHOO.widget.DataTable.CLASS_SORTABLE="yui-dt-sortable";YAHOO.widget.DataTable.CLASS_SORTEDBYASC="yui-dt-sortedbyasc";YAHOO.widget.DataTable.CLASS_SORTEDBYDESC="yui-dt-sortedbydesc";YAHOO.widget.DataTable.CLASS_PAGINATOR="yui-dt-paginator";YAHOO.widget.DataTable.CLASS_FIRSTLINK="yui-dt-firstlink";YAHOO.widget.DataTable.CLASS_FIRSTPAGE="yui-dt-firstpage";YAHOO.widget.DataTable.CLASS_LASTLINK="yui-dt-lastlink";YAHOO.widget.DataTable.CLASS_LASTPAGE="yui-dt-lastpage";YAHOO.widget.DataTable.CLASS_PREVLINK="yui-dt-prevlink";YAHOO.widget.DataTable.CLASS_PREVPAGE="yui-dt-prevpage";YAHOO.widget.DataTable.CLASS_NEXTLINK="yui-dt-nextlink";YAHOO.widget.DataTable.CLASS_NEXTPAGE="yui-dt-nextpage";YAHOO.widget.DataTable.CLASS_PAGELINK="yui-dt-pagelink";YAHOO.widget.DataTable.CLASS_CURRENTPAGE="yui-dt-currentpage";YAHOO.widget.DataTable.CLASS_PAGESELECT="yui-dt-pageselect";YAHOO.widget.DataTable.CLASS_PAGELINKS="yui-dt-pagelinks";YAHOO.widget.DataTable.CLASS_EDITABLE="yui-dt-editable";YAHOO.widget.DataTable.CLASS_EDITOR="yui-dt-editor";YAHOO.widget.DataTable.CLASS_CHECKBOX="yui-dt-checkbox";YAHOO.widget.DataTable.CLASS_CURRENCY="yui-dt-currency";YAHOO.widget.DataTable.CLASS_DATE="yui-dt-date";YAHOO.widget.DataTable.CLASS_EMAIL="yui-dt-email";YAHOO.widget.DataTable.CLASS_LINK="yui-dt-link";YAHOO.widget.DataTable.CLASS_NUMBER="yui-dt-number";YAHOO.widget.DataTable.CLASS_STRING="yui-dt-string";YAHOO.widget.DataTable.MSG_EMPTY="No records found.";YAHOO.widget.DataTable.MSG_LOADING="Loading data...";YAHOO.widget.DataTable.MSG_ERROR="Data error.";YAHOO.widget.DataTable._nCount=0;YAHOO.widget.DataTable.prototype._nIndex=null;YAHOO.widget.DataTable.prototype._sName=null;YAHOO.widget.DataTable.prototype._elContainer=null;YAHOO.widget.DataTable.prototype._elTable=null;YAHOO.widget.DataTable.prototype._elBody=null;YAHOO.widget.DataTable.prototype._elFirstRow=null;YAHOO.widget.DataTable.prototype._elLastRow=null;YAHOO.widget.DataTable.prototype._oColumnSet=null;YAHOO.widget.DataTable.prototype._oRecordSet=null;YAHOO.widget.DataTable.prototype._selectRowAnchorId=null;YAHOO.widget.DataTable.prototype._aSelectedRecords=null;YAHOO.widget.DataTable.prototype._bFocused=false;YAHOO.widget.DataTable.prototype._paginator=null;YAHOO.widget.DataTable.prototype._initTable=function(){this._elContainer.innerHTML="";if(this.scrollable){YAHOO.util.Dom.addClass(this._elContainer,YAHOO.widget.DataTable.CLASS_SCROLLABLE);}
|
||||
this._elTable=this._elContainer.appendChild(document.createElement("table"));var elTable=this._elTable;elTable.tabIndex=0;elTable.id="yui-dt-table"+this._nIndex;if(this.summary){elTable.summary=this.summary;}
|
||||
if(this.caption){this._elCaption=elTable.appendChild(document.createElement("caption"));this._elCaption.innerHTML=this.caption;}
|
||||
this._initHead(elTable,this._oColumnSet);var elMsgBody=document.createElement("tbody");elMsgBody.tabIndex=-1;this._elMsgRow=elMsgBody.appendChild(document.createElement("tr"));var elMsgRow=this._elMsgRow;var elMsgCell=elMsgRow.appendChild(document.createElement("td"));elMsgCell.colSpan=this._oColumnSet.keys.length;this._elMsgCell=elMsgCell;this._elMsgBody=elTable.appendChild(elMsgBody);this.showTableMessage(YAHOO.widget.DataTable.MSG_LOADING,YAHOO.widget.DataTable.CLASS_LOADING);this._elBody=elTable.appendChild(document.createElement("tbody"));this._elBody.tabIndex=-1;YAHOO.util.Dom.addClass(this._elBody,YAHOO.widget.DataTable.CLASS_BODY);if(this.scrollable){YAHOO.util.Dom.addClass(this._elBody,YAHOO.widget.DataTable.CLASS_SCROLLBODY);}};YAHOO.widget.DataTable.prototype._initHead=function(){var i,oColumn;var elHead=document.createElement("thead");elHead.tabIndex=-1;var colTree=this._oColumnSet.tree;for(i=0;i<colTree.length;i++){var elHeadRow=elHead.appendChild(document.createElement("tr"));elHeadRow.id=this.id+"-hdrow"+i;for(var j=0;j<colTree[i].length;j++){oColumn=colTree[i][j];var elHeadCell=elHeadRow.appendChild(document.createElement("th"));elHeadCell.id=oColumn.getId();this._initHeadCell(elHeadCell,oColumn,i,j);}}
|
||||
this._elHead=this._elTable.appendChild(elHead);for(i=0;i<this._oColumnSet.keys.length;i++){oColumn=this._oColumnSet.keys[i];if(oColumn.resizeable&&YAHOO.util.DD){if(!this.fixedWidth||(this.fixedWidth&&(oColumn.getIndex()!=this._oColumnSet.keys.length-1))){var elHeadContainer=(YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.DataTable.CLASS_HEADCONTAINER,"div",YAHOO.util.Dom.get(oColumn.getId())))[0];var elHeadResizer=elHeadContainer.appendChild(document.createElement("span"));elHeadResizer.id=oColumn.getId()+"-resizer";YAHOO.util.Dom.addClass(elHeadResizer,YAHOO.widget.DataTable.CLASS_HEADRESIZER);oColumn.ddResizer=new YAHOO.util.WidthResizer(this,oColumn.getId(),elHeadResizer.id,elHeadResizer.id);var cancelClick=function(e){YAHOO.util.Event.stopPropagation(e);};YAHOO.util.Event.addListener(elHeadResizer,"click",cancelClick);}
|
||||
if(this.fixedWidth){var elHeadText=(YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.DataTable.CLASS_HEADTEXT,"span",YAHOO.util.Dom.get(oColumn.getId())))[0];elHeadText.style.overflow="hidden";}}}};YAHOO.widget.DataTable.prototype._initHeadCell=function(elHeadCell,oColumn,row,col){var index=this._nIndex;elHeadCell.columnIndex=oColumn.getIndex();if(oColumn.abbr){elHeadCell.abbr=oColumn.abbr;}
|
||||
if(oColumn.width){elHeadCell.style.width=oColumn.width;}
|
||||
if(oColumn.className){YAHOO.util.Dom.addClass(elHeadCell,oColumn.className);}
|
||||
if(this.sortedBy&&this.sortedBy.colKey){if(this.sortedBy.colKey==oColumn.key){var sortClass=(this.sortedBy.dir&&(this.sortedBy.dir!="asc"))?YAHOO.widget.DataTable.CLASS_SORTEDBYDESC:YAHOO.widget.DataTable.CLASS_SORTEDBYASC;YAHOO.util.Dom.addClass(elHeadCell,sortClass);this.sortedBy._id=elHeadCell.id;}}
|
||||
elHeadCell.innerHTML="";elHeadCell.rowSpan=oColumn.getRowSpan();elHeadCell.colSpan=oColumn.getColSpan();var elHeadContainer=elHeadCell.appendChild(document.createElement("div"));elHeadContainer.id=this.id+"-hdrow"+row+"-container"+col;YAHOO.util.Dom.addClass(elHeadContainer,YAHOO.widget.DataTable.CLASS_HEADCONTAINER);var elHeadContent=elHeadContainer.appendChild(document.createElement("span"));elHeadContent.id=this.id+"-hdrow"+row+"-text"+col;YAHOO.util.Dom.addClass(elHeadContent,YAHOO.widget.DataTable.CLASS_HEADTEXT);var contentText=oColumn.text||oColumn.key||"";if(oColumn.sortable){YAHOO.util.Dom.addClass(elHeadContent,YAHOO.widget.DataTable.CLASS_SORTABLE);var sortLink="?key="+oColumn.key;elHeadContent.innerHTML="<a href=\""+sortLink+"\" title=\"Click to sort\" class=\""+YAHOO.widget.DataTable.CLASS_SORTABLE+"\">"+contentText+"</a>";}
|
||||
else{elHeadContent.innerHTML=contentText;}};YAHOO.widget.DataTable.prototype._initPaginator=function(){var i,j;var paginator={elements:[],pageLinks:0,dropdownOptions:null,rowsPerPage:500,currentPage:1};var elements=paginator.elements;if(this.startRecordIndex!=1){}
|
||||
if(this.pageLinksStart!=1){}
|
||||
if(this.rowsPerPage&&YAHOO.util.Lang.isNumber(this.rowsPerPage)){paginator.rowsPerPage=this.rowsPerPage;}
|
||||
if(this.paginatorOptions&&YAHOO.util.Lang.isNumber(this.paginatorOptions.rowsPerPage)){paginator.rowsPerPage=this.paginatorOptions.rowsPerPage;}
|
||||
if(this.pageCurrent&&YAHOO.util.Lang.isNumber(this.pageCurrent)){paginator.currentPage=this.pageCurrent;}
|
||||
if(this.paginatorOptions&&YAHOO.util.Lang.isNumber(this.paginatorOptions.currentPage)){paginator.currentPage=this.paginatorOptions.currentPage;}
|
||||
if(this.pagers&&YAHOO.util.Lang.isArray(this.pagers)){var dep_containers=this.pagers;for(i=0;i<dep_containers.length;i++){if(YAHOO.util.Dom.inDocument(dep_containers[i])){elements.push({container:YAHOO.util.Dom.get(dep_containers[i])});}}}
|
||||
if(this.paginatorOptions&&YAHOO.util.Lang.isArray(this.paginatorOptions.containers)){var containers=this.paginatorOptions.containers;for(i=0;i<containers.length;i++){if(YAHOO.util.Dom.inDocument(containers[i])){elements.push({container:YAHOO.util.Dom.get(containers[i])});}}}
|
||||
if(elements.length===0){var pag0=document.createElement("span");pag0.id="yui-dt-pagcontainer0";pag0.className=YAHOO.widget.DataTable.CLASS_PAGINATOR;pag0=this._elContainer.insertBefore(pag0,this._elTable);var pag1=document.createElement("span");pag1.id="yui-dt-pagcontainer1";pag1.className=YAHOO.widget.DataTable.CLASS_PAGINATOR;pag1=this._elContainer.insertBefore(pag1,this._elTable.nextSibling);elements=[{container:pag0},{container:pag1}];}
|
||||
if(this.pageLinksLength&&YAHOO.util.Lang.isNumber(this.pageLinksLength)){paginator.pageLinks=this.pageLinksLength;if(this.pageLinksLength<0){paginator.pageLinks=0;}}
|
||||
if(this.paginatorOptions&&YAHOO.util.Lang.isNumber(this.paginatorOptions.pageLinks)){paginator.pageLinks=this.paginatorOptions.pageLinks;}
|
||||
if(paginator.pageLinks>-1){for(i=0;i<elements.length;i++){var links=document.createElement("span");links.id="yui-dt-pagselect"+i;links.className=YAHOO.widget.DataTable.CLASS_PAGELINKS;links=elements[i].container.appendChild(links);YAHOO.util.Event.addListener(links,"click",this._onPagerClick,this);elements[i].links=links;}}
|
||||
if(this.rowsPerPageDropdown&&YAHOO.util.Lang.isArray(this.rowsPerPageDropdown)){paginator.dropdownOptions=this.rowsPerPageDropdown;}
|
||||
if(this.paginatorOptions&&YAHOO.util.Lang.isArray(this.paginatorOptions.dropdownOptions)){paginator.dropdownOptions=this.paginatorOptions.dropdownOptions;}
|
||||
if(paginator.dropdownOptions!==null){var dropdownOptions=paginator.dropdownOptions;for(i=0;i<elements.length;i++){var select=document.createElement("select");select.id="yui-dt-pagselect"+i;select.className=YAHOO.widget.DataTable.CLASS_PAGESELECT;select=elements[i].container.appendChild(select);for(j=0;j<dropdownOptions.length;j++){var option=document.createElement("option");option.value=dropdownOptions[j].value||dropdownOptions[j];option.innerHTML=dropdownOptions[j].text||dropdownOptions[j];option=select.appendChild(option);}
|
||||
YAHOO.util.Event.addListener(select,"change",this._onPagerSelect,this);elements[i].select=select;}}
|
||||
this._paginator=paginator;this._paginator.elements=elements;};YAHOO.widget.DataTable.prototype._addRow=function(oRecord,index){this.hideTableMessage();var insert=(!YAHOO.lang.isNumber(index)||(index<0))?false:true;if(!insert||!this._elBody.rows[index]){index=this._elBody.rows.length;insert=false;}
|
||||
var oColumnSet=this._oColumnSet;var oRecordSet=this._oRecordSet;var elRow=(insert)?this._elBody.insertBefore(document.createElement("tr"),this._elBody.rows[index]):this._elBody.appendChild(document.createElement("tr"));var recId=oRecord.yuiRecordId;elRow.id=this.id+"-bdrow"+index;elRow.yuiRecordId=recId;for(var j=0;j<oColumnSet.keys.length;j++){var oColumn=oColumnSet.keys[j];var elCell=elRow.appendChild(document.createElement("td"));elCell.id=this.id+"-bdrow"+index+"-cell"+j;elCell.headers=oColumn.id;elCell.columnIndex=j;elCell.headers=oColumnSet.headers[j];this.formatCell(elCell,oRecord);if(this.fixedWidth){elCell.style.overflow="hidden";}}
|
||||
if(!insert){if(index%2){YAHOO.util.Dom.addClass(elRow,YAHOO.widget.DataTable.CLASS_ODD);}
|
||||
else{YAHOO.util.Dom.addClass(elRow,YAHOO.widget.DataTable.CLASS_EVEN);}}
|
||||
else{this._restripeRows();}
|
||||
return elRow.id;};YAHOO.widget.DataTable.prototype._resetFirstRow=function(){if(this._elBody.rows.length>0){YAHOO.util.Dom.removeClass(this.getFirstRow(),YAHOO.widget.DataTable.CLASS_FIRST);var elFirstRow=this._elBody.rows[0];YAHOO.util.Dom.addClass(elFirstRow,YAHOO.widget.DataTable.CLASS_FIRST);this._elFirstRow=elFirstRow;}
|
||||
else{this._elFirstRow=null;}};YAHOO.widget.DataTable.prototype._resetLastRow=function(){if(this._elBody.rows.length>0){YAHOO.util.Dom.removeClass(this.getLastRow(),YAHOO.widget.DataTable.CLASS_LAST);var elLastRow=this._elBody.rows[this._elBody.rows.length-1];YAHOO.util.Dom.addClass(elLastRow,YAHOO.widget.DataTable.CLASS_LAST);this._elLastRow=elLastRow;}
|
||||
else{this._elLastRow=null;}};YAHOO.widget.DataTable.prototype._restripeRows=function(range){if(!range){var rows=this._elBody.rows;for(var i=0;i<rows.length;i++){if(i%2){YAHOO.util.Dom.removeClass(rows[i],YAHOO.widget.DataTable.CLASS_EVEN);YAHOO.util.Dom.addClass(rows[i],YAHOO.widget.DataTable.CLASS_ODD);}
|
||||
else{YAHOO.util.Dom.removeClass(rows[i],YAHOO.widget.DataTable.CLASS_ODD);YAHOO.util.Dom.addClass(rows[i],YAHOO.widget.DataTable.CLASS_EVEN);}}}
|
||||
else{}};YAHOO.widget.DataTable.prototype._updateRow=function(oRecord,index){this.hideTableMessage();var elRow=this._elBody.rows[index];elRow.yuiRecordId=oRecord.yuiRecordId;for(var j=0;j<elRow.cells.length;j++){this.formatCell(elRow.cells[j]);}
|
||||
return elRow.id;};YAHOO.widget.DataTable.prototype._select=function(els){if(!YAHOO.lang.isArray(els)){els=[els];}
|
||||
for(var i=0;i<els.length;i++){YAHOO.util.Dom.addClass(YAHOO.util.Dom.get(els[i]),YAHOO.widget.DataTable.CLASS_SELECTED);}
|
||||
this._lastSelectedId=els[els.length-1].id;};YAHOO.widget.DataTable.prototype._unselect=function(els){if(!YAHOO.lang.isArray(els)){els=[els];}
|
||||
for(var i=0;i<els.length;i++){YAHOO.util.Dom.removeClass(YAHOO.util.Dom.get(els[i]),YAHOO.widget.DataTable.CLASS_SELECTED);}};YAHOO.widget.DataTable.prototype._unselectAllRows=function(){var selectedRows=YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.DataTable.CLASS_SELECTED,"tr",this._elBody);this._unselect(selectedRows);};YAHOO.widget.DataTable.prototype._unselectAllCells=function(){var selectedCells=YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.DataTable.CLASS_SELECTED,"td",this._elBody);this._unselect(selectedCells);};YAHOO.widget.DataTable.prototype._deleteRow=function(elRow){var allRows=this._elBody.rows;var id=elRow.id;var recordId=elRow.yuiRecordId;for(var i=0;i<allRows.length;i++){if(id==allRows[i].id){this._elBody.deleteRow(i);this._oRecordSet.deleteRecord(i);break;}}
|
||||
if(this._elBody.rows.length===0){this.showTableMessage(YAHOO.widget.DataTable.MSG_EMPTY,YAHOO.widget.DataTable.CLASS_EMPTY);}};YAHOO.widget.DataTable.prototype._onBlur=function(e,oSelf){this._bFocused=false;};YAHOO.widget.DataTable.prototype._onMouseover=function(e,oSelf){var elTarget=YAHOO.util.Event.getTarget(e);var elTag=elTarget.tagName.toLowerCase();var knownTag=false;if(elTag!="table"){while(!knownTag){switch(elTag){case"body":knownTag=true;break;case"a":knownTag=true;break;case"td":oSelf.fireEvent("cellMouseoverEvent",{target:elTarget,event:e});knownTag=true;break;case"th":oSelf.fireEvent("headCellMouseoverEvent",{target:elTarget,event:e});knownTag=true;break;default:break;}
|
||||
elTarget=elTarget.parentNode;if(elTarget){elTag=elTarget.tagName.toLowerCase();}
|
||||
else{break;}}}
|
||||
oSelf.fireEvent("tableMouseoverEvent",{target:elTarget,event:e});};YAHOO.widget.DataTable.prototype._onMouseout=function(e,oSelf){var elTarget=YAHOO.util.Event.getTarget(e);var elTag=elTarget.tagName.toLowerCase();var knownTag=false;if(elTag!="table"){while(!knownTag){switch(elTag){case"body":knownTag=true;break;case"a":knownTag=true;break;case"td":oSelf.fireEvent("cellMouseoutEvent",{target:elTarget,event:e});knownTag=true;break;case"th":oSelf.fireEvent("headCellMouseoutEvent",{target:elTarget,event:e});knownTag=true;break;default:break;}
|
||||
elTarget=elTarget.parentNode;if(elTarget){elTag=elTarget.tagName.toLowerCase();}
|
||||
else{break;}}}
|
||||
oSelf.fireEvent("tableMouseoutEvent",{target:elTarget,event:e});};YAHOO.widget.DataTable.prototype._onMousedown=function(e,oSelf){var elTarget=YAHOO.util.Event.getTarget(e);var elTag=elTarget.tagName.toLowerCase();var knownTag=false;if(elTag!="table"){while(!knownTag){switch(elTag){case"body":knownTag=true;break;case"a":knownTag=true;break;case"td":YAHOO.util.Event.stopEvent(e);oSelf.fireEvent("cellMousedownEvent",{target:elTarget,event:e});knownTag=true;break;case"th":YAHOO.util.Event.stopEvent(e);oSelf.fireEvent("headCellMousedownEvent",{target:elTarget,event:e});knownTag=true;break;default:break;}
|
||||
elTarget=elTarget.parentNode;if(elTarget){elTag=elTarget.tagName.toLowerCase();}
|
||||
else{break;}}}
|
||||
oSelf.fireEvent("tableMousedownEvent",{target:elTarget,event:e});};YAHOO.widget.DataTable.prototype._onClick=function(e,oSelf){oSelf.cancelEditorData();var elTarget=YAHOO.util.Event.getTarget(e);var elTag=elTarget.tagName.toLowerCase();var knownTag=false;if(elTag!="table"){while(!knownTag){switch(elTag){case"body":knownTag=true;break;case"input":if(elTarget.type.toLowerCase()=="checkbox"){oSelf.fireEvent("checkboxClickEvent",{target:elTarget,event:e});}
|
||||
else if(elTarget.type.toLowerCase()=="radio"){oSelf.fireEvent("radioClickEvent",{target:elTarget,event:e});}
|
||||
knownTag=true;break;case"a":if(!YAHOO.util.Dom.hasClass(elTarget,YAHOO.widget.DataTable.CLASS_SORTABLE)){knownTag=true;}
|
||||
break;case"td":YAHOO.util.Event.stopEvent(e);oSelf.fireEvent("cellClickEvent",{target:elTarget,event:e});knownTag=true;break;case"th":YAHOO.util.Event.stopEvent(e);oSelf.fireEvent("headCellClickEvent",{target:elTarget,event:e});knownTag=true;break;default:break;}
|
||||
elTarget=elTarget.parentNode;elTag=elTarget.tagName.toLowerCase();}}
|
||||
oSelf.fireEvent("tableClickEvent",{target:elTarget,event:e});};YAHOO.widget.DataTable.prototype._onDoubleclick=function(e,oSelf){var elTarget=YAHOO.util.Event.getTarget(e);var elTag=elTarget.tagName.toLowerCase();var knownTag=false;if(elTag!="table"){while(!knownTag){switch(elTag){case"body":knownTag=true;break;case"a":knownTag=true;break;case"td":YAHOO.util.Event.stopEvent(e);oSelf.fireEvent("cellDoubleclickEvent",{target:elTarget,event:e});knownTag=true;break;case"th":YAHOO.util.Event.stopEvent(e);oSelf.fireEvent("headCellDoubleclickEvent",{target:elTarget,event:e});knownTag=true;break;default:break;}
|
||||
elTarget=elTarget.parentNode;elTag=elTarget.tagName.toLowerCase();}}
|
||||
oSelf.fireEvent("tableDoubleclickEvent",{target:elTarget,event:e});};YAHOO.widget.DataTable.prototype._onKeypress=function(e,oSelf){var isMac=(navigator.userAgent.toLowerCase().indexOf("mac")!=-1);if(isMac){if(e.keyCode==40){YAHOO.util.Event.stopEvent(e);}
|
||||
else if(e.keyCode==38){YAHOO.util.Event.stopEvent(e);}}};YAHOO.widget.DataTable.prototype._onKeydown=function(e,oSelf){var oldSelectedId=oSelf._lastSelectedId;if(oldSelectedId&&oSelf.isSelected(oldSelectedId)){var oldSelected=YAHOO.util.Dom.get(oldSelectedId);var newSelected;if(e.keyCode==40){YAHOO.util.Event.stopEvent(e);if(oldSelected.tagName.toLowerCase()=="tr"){if(oldSelected.sectionRowIndex+1<oSelf._elBody.rows.length){if(!e.shiftKey||oSelf.rowSingleSelect){oSelf.unselectAllRows();}
|
||||
newSelected=oSelf._elBody.rows[oldSelected.sectionRowIndex+1];oSelf.selectRow(newSelected);}}
|
||||
else if(oldSelected.tagName.toLowerCase()=="td"){}}
|
||||
else if(e.keyCode==38){YAHOO.util.Event.stopEvent(e);if(oldSelected.tagName.toLowerCase()=="tr"){if((oldSelected.sectionRowIndex>0)){if(!e.shiftKey||oSelf.rowSingleSelect){oSelf.unselectAllRows();}
|
||||
newSelected=oSelf._elBody.rows[oldSelected.sectionRowIndex-1];oSelf.selectRow(newSelected);}}
|
||||
else if(oldSelected.tagName.toLowerCase()=="td"){if((oldSelected.sectionRowIndex>0)){if(!e.shiftKey){oSelf.unselectAllRows();}
|
||||
newSelected=oSelf._elBody.rows[oldSelected.sectionRowIndex-1];oSelf.select(newSelected);}}}}};YAHOO.widget.DataTable.prototype._onKeyup=function(e,oSelf){var key=YAHOO.util.Event.getCharCode(e);if(key==46){}};YAHOO.widget.DataTable.prototype._onDocumentKeydown=function(e,oSelf){if((e.keyCode==27)){oSelf.cancelEditorData();}
|
||||
if(e.keyCode==13){YAHOO.util.Event.stopEvent(e);oSelf.saveEditorData();}};YAHOO.widget.DataTable.prototype._onDocumentClick=function(e,oSelf){oSelf.saveEditorData();};YAHOO.widget.DataTable.prototype._onPagerClick=function(e,oSelf){oSelf.saveEditorData();var elTarget=YAHOO.util.Event.getTarget(e);var elTag=elTarget.tagName.toLowerCase();var knownTag=false;if(elTag!="table"){while(!knownTag){switch(elTag){case"body":knownTag=true;break;case"a":YAHOO.util.Event.stopEvent(e);switch(elTarget.className){case YAHOO.widget.DataTable.CLASS_PAGELINK:oSelf.showPage(parseInt(elTarget.innerHTML,10));break;case YAHOO.widget.DataTable.CLASS_FIRSTLINK:oSelf.showPage(1);break;case YAHOO.widget.DataTable.CLASS_LASTLINK:oSelf.showPage(oSelf._paginator.totalPages);break;case YAHOO.widget.DataTable.CLASS_PREVLINK:oSelf.showPage(oSelf._paginator.currentPage-1);break;case YAHOO.widget.DataTable.CLASS_NEXTLINK:oSelf.showPage(oSelf._paginator.currentPage+1);break;}
|
||||
knownTag=true;break;default:break;}
|
||||
elTarget=elTarget.parentNode;if(elTarget){elTag=elTarget.tagName.toLowerCase();}
|
||||
else{break;}}}};YAHOO.widget.DataTable.prototype._onPagerSelect=function(e,oSelf){var elTarget=YAHOO.util.Event.getTarget(e);var value=elTarget[elTarget.selectedIndex].value;var oldRowsPerPage=oSelf._paginator.rowsPerPage;var rowsPerPage=parseInt(value,10)||null;if(rowsPerPage&&(rowsPerPage!=oldRowsPerPage)){if(rowsPerPage>oldRowsPerPage){oSelf._paginator.currentPage=1;}
|
||||
oSelf._paginator.rowsPerPage=rowsPerPage;oSelf.populateTable();}};YAHOO.widget.DataTable.prototype._onRowDelete=function(oArgs){this._restripeRows();};YAHOO.widget.DataTable.prototype._onRecordUpdate=function(oArgs){this.fireEvent("recordSetUpdateEvent",oArgs);};YAHOO.widget.DataTable.prototype.dataSource=null;YAHOO.widget.DataTable.prototype.initialRequest="";YAHOO.widget.DataTable.prototype.caption=null;YAHOO.widget.DataTable.prototype.summary=null;YAHOO.widget.DataTable.prototype.fixedWidth=false;YAHOO.widget.DataTable.prototype.scrollable=false;YAHOO.widget.DataTable.prototype.rowSingleSelect=false;YAHOO.widget.DataTable.prototype.contextMenu=null;YAHOO.widget.DataTable.prototype.paginator=false;YAHOO.widget.DataTable.prototype.paginatorOptions=null;YAHOO.widget.DataTable.prototype.sortedBy=null;YAHOO.widget.DataTable.prototype.isEmpty=false;YAHOO.widget.DataTable.prototype.isLoading=false;YAHOO.widget.DataTable.prototype.startRecordIndex=1;YAHOO.widget.DataTable.prototype.pageLinksStart=1;YAHOO.widget.DataTable.prototype.pageCurrent=1;YAHOO.widget.DataTable.prototype.rowsPerPage=500;YAHOO.widget.DataTable.prototype.pageLinksLength=-1;YAHOO.widget.DataTable.prototype.rowsPerPageDropdown=null;YAHOO.widget.DataTable.prototype.pagers=null;YAHOO.widget.DataTable.prototype.toString=function(){return"DataTable "+this._sName;};YAHOO.widget.DataTable.prototype.getTable=function(){return(this._elTable);};YAHOO.widget.DataTable.prototype.getHead=function(){return(this._elHead);};YAHOO.widget.DataTable.prototype.getBody=function(){return(this._elBody);};YAHOO.widget.DataTable.prototype.getRow=function(index){if(YAHOO.lang.isNumber(index)&&(index>-1)){return(this._elBody.rows[index]);}
|
||||
return null;};YAHOO.widget.DataTable.prototype.getFirstRow=function(){return this._elFirstRow;};YAHOO.widget.DataTable.prototype.getLastRow=function(){return this._elLastRow;};YAHOO.widget.DataTable.prototype.getCell=function(rowIndex,colIndex){if(YAHOO.lang.isNumber(rowIndex)&&YAHOO.lang.isNumber(colIndex)&&(rowIndex>-1)&&(colIndex>-1)){return(this._elBody.rows[rowIndex].cells[colIndex]);}
|
||||
return null;};YAHOO.widget.DataTable.prototype.showTableMessage=function(sHTML,sClassName){var elCell=this._elMsgCell;if(YAHOO.lang.isString(sHTML)){elCell.innerHTML=sHTML;}
|
||||
if(YAHOO.lang.isString(sClassName)){elCell.className=sClassName;}
|
||||
this._elMsgBody.style.display="";};YAHOO.widget.DataTable.prototype.hideTableMessage=function(){this._elMsgBody.style.display="none";};YAHOO.widget.DataTable.prototype.showEmptyMessage=function(){if(this.isEmpty){return;}
|
||||
if(this.isLoading){this.hideTableMessages();}
|
||||
this._elMsgBody.style.display="";var elCell=this._elMsgCell;elCell.className=YAHOO.widget.DataTable.CLASS_EMPTY;elCell.innerHTML=YAHOO.widget.DataTable.MSG_EMPTY;this.isEmpty=true;};YAHOO.widget.DataTable.prototype.showLoadingMessage=function(){if(this.isLoading){return;}
|
||||
if(this.isEmpty){this.hideTableMessages();}
|
||||
this._elMsgBody.style.display="";var elCell=this._elMsgCell;elCell.className=YAHOO.widget.DataTable.CLASS_LOADING;elCell.innerHTML=YAHOO.widget.DataTable.MSG_LOADING;this.isLoading=true;};YAHOO.widget.DataTable.prototype.hideTableMessages=function(){if(!this.isEmpty&&!this.isLoading){return;}
|
||||
this._elMsgBody.style.display="none";this.isEmpty=false;this.isLoading=false;};YAHOO.widget.DataTable.prototype.focusTable=function(){var elTable=this._elTable;if(!this._bFocused){setTimeout(function(){elTable.focus();},0);this._bFocused=true;this.fireEvent("tableFocusEvent");}};YAHOO.widget.DataTable.prototype.doBeforeLoadData=function(sRequest,oResponse){return true;};YAHOO.widget.DataTable.prototype.appendRows=function(aRecords){if(YAHOO.lang.isArray(aRecords)&&(aRecords.length>0)){this.hideTableMessage();var rowIds=[];for(var i=0;i<aRecords.length;i++){var rowId=this._addRow(aRecords[i]);rowIds.push(rowId);}
|
||||
this._resetLastRow();this.fireEvent("rowAppendEvent",{rowIds:rowIds});}};YAHOO.widget.DataTable.prototype.insertRows=function(aRecords){if(YAHOO.lang.isArray(aRecords)&&(aRecords.length>0)){this.hideTableMessage();var rowIds=[];for(var i=0;i<aRecords.length;i++){var rowId=this._addRow(aRecords[i],0);rowIds.push(rowId);}
|
||||
this._resetFirstRow();this.fireEvent("rowInsertEvent",{rowIds:rowIds});}};YAHOO.widget.DataTable.prototype.replaceRows=function(aRecords){var i;if(YAHOO.lang.isArray(aRecords)&&(aRecords.length>0)){this.hideTableMessage();var elBody=this._elBody;var elRows=this._elBody.rows;while(elBody.hasChildNodes()&&(elRows.length>aRecords.length)){elBody.deleteRow(elRows.length-1);}
|
||||
var selectedRecords=this.getSelectedRecordIds();if(selectedRecords.length>0){this._unselectAllRows();}
|
||||
var rowIds=[];for(i=0;i<elRows.length;i++){if(aRecords[i]){rowIds.push(this._updateRow(aRecords[i],i));}}
|
||||
for(i=elRows.length;i<aRecords.length;i++){rowIds.push(this._addRow(aRecords[i]));}
|
||||
for(i=0;i<selectedRecords.length;i++){var allRows=elBody.rows;for(var j=0;j<allRows.length;j++){if(selectedRecords[i]==allRows[j].yuiRecordId){this._select([allRows[j]]);}}}
|
||||
this._resetFirstRow();this._resetLastRow();this.fireEvent("rowReplaceEvent",{rowIds:rowIds});}
|
||||
else{this.showTableMessage(YAHOO.widget.DataTable.MSG_EMPTY,YAHOO.widget.DataTable.CLASS_EMPTY);}};YAHOO.widget.DataTable.prototype.addRow=function(oRecord,index){if(oRecord&&(oRecord instanceof YAHOO.widget.Record)){var rowId=this._addRow(oRecord,index);if(YAHOO.lang.isNumber(index)){if(index===0){this._resetFirstRow();}
|
||||
this.fireEvent("rowInsertEvent",{rowIds:[rowId]});}
|
||||
else{this._resetLastRow();this.fireEvent("rowAppendEvent",{rowIds:[rowId]});}}};YAHOO.widget.DataTable.prototype.updateRow=function(oRecord,index){if(oRecord&&(oRecord instanceof YAHOO.widget.Record)){var rowId=this._updateRow(oRecord,index);this.fireEvent("rowUpdateEvent",{rowIds:[rowId]});}};YAHOO.widget.DataTable.prototype.deleteRows=function(elRows){var rowIndexes=[];for(var i=0;i<rows.length;i++){var rowIndex=(rows[i].sectionRowIndex!==undefined)?rows[i].sectionRowIndex:null;rowIndexes.push(rowIndex);this._deleteRow(rows[i]);this.fireEvent("rowDeleteEvent",{rowIndexes:rowIndexes});}
|
||||
this._resetFirstRow();this._resetLastRow();};YAHOO.widget.DataTable.prototype.deleteRow=function(elRow){if(elRow&&YAHOO.util.Dom.inDocument(elRow)){var rowIndex=(elRow.sectionRowIndex!==undefined)?elRow.sectionRowIndex:null;this._deleteRow(elRow);this.fireEvent("rowDeleteEvent",{rowIndexes:[rowIndex]});this._resetFirstRow();this._resetLastRow();}};YAHOO.widget.DataTable.prototype.selectRow=function(row){row=YAHOO.util.Dom.get(row);if(row&&row.yuiRecordId){var recordId=row.yuiRecordId;var tracker=this._aSelectedRecords||[];if(tracker.length>0){if(tracker.indexOf&&(tracker.indexOf(recordId)>-1)){tracker.splice(tracker.indexOf(recordId),1);}
|
||||
else{for(var i=0;i<tracker.length;i++){if(tracker[i]===recordId){tracker.splice(i,1);}}}}
|
||||
this._select(row);tracker.push(recordId);this._aSelectedRecords=tracker;this.fireEvent("rowSelectEvent",{el:row,record:this._oRecordSet.getRecord(recordId)});}};YAHOO.widget.DataTable.prototype.unselectRow=function(row){row=YAHOO.util.Dom.get(row);if(row&&row.yuiRecordId){var recordId=row.yuiRecordId;var tracker=this._aSelectedRecords||[];if(tracker.length>0){if(tracker.indexOf&&(tracker.indexOf(recordId)>-1)){tracker.splice(tracker.indexOf(recordId),1);}
|
||||
else{for(var i=0;i<tracker.length;i++){if(tracker[i]===recordId){tracker.splice(i,1);}}}}
|
||||
this._unselect(row);this.fireEvent("rowUnselectEvent",{el:row,record:this._oRecordSet.getRecord(recordId)});}};YAHOO.widget.DataTable.prototype.highlight=function(els){if(els){if(!YAHOO.lang.isArray(els)){els=[els];}
|
||||
YAHOO.util.Dom.addClass(els,YAHOO.widget.DataTable.CLASS_HIGHLIGHT);this.fireEvent("highlightEvent",{els:els});}};YAHOO.widget.DataTable.prototype.unhighlight=function(els){if(els){if(!YAHOO.lang.isArray(els)){els=[els];}
|
||||
YAHOO.util.Dom.removeClass(els,YAHOO.widget.DataTable.CLASS_HIGHLIGHT);this.fireEvent("unhighlightEvent",{els:els});}};YAHOO.widget.DataTable.prototype.select=function(els){if(els){if(!YAHOO.lang.isArray(els)){els=[els];}
|
||||
this._select(els);var tracker=this._aSelectedRecords||[];for(var i=0;i<els.length;i++){var id=els[i].yuiRecordId;if(tracker.indexOf&&(tracker.indexOf(id)>-1)){tracker.splice(tracker.indexOf(id),1);}
|
||||
else{for(var j=0;j<tracker.length;j++){if(tracker[j]===id){tracker.splice(j,1);}}}
|
||||
tracker.push(id);}
|
||||
this._aSelectedRecords=tracker;this.fireEvent("selectEvent",{els:els});}};YAHOO.widget.DataTable.prototype.unselect=function(els){if(els){if(!YAHOO.lang.isArray(els)){els=[els];}
|
||||
this._unselect(els);var tracker=this._aSelectedRecords||[];for(var i=0;i<els.length;i++){var id=els[i].yuiRecordId;if(tracker.indexOf&&(tracker.indexOf(id)>-1)){tracker.splice(tracker.indexOf(id),1);}
|
||||
else{for(var j=0;j<tracker.length;j++){if(tracker[j]===id){tracker.splice(j,1);}}}}
|
||||
this._aSelectedRecords=tracker;this.fireEvent("unselectEvent",{els:els});}};YAHOO.widget.DataTable.prototype.unselectAllRows=function(){var selectedRows=YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.DataTable.CLASS_SELECTED,"tr",this._elBody);this.unselect(selectedRows);this._aSelectedRecords=[];this.fireEvent("unselectEvent",{els:selectedRows});};YAHOO.widget.DataTable.prototype.unselectAllCells=function(){var selectedCells=YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.DataTable.CLASS_SELECTED,"td",this._elBody);this.unselect(selectedCells);this.fireEvent("unselectEvent",{els:selectedCells});};YAHOO.widget.DataTable.prototype.isSelected=function(el){return YAHOO.util.Dom.hasClass(el,YAHOO.widget.DataTable.CLASS_SELECTED);};YAHOO.widget.DataTable.prototype.getSelectedRecordIds=function(){return this._aSelectedRecords||[];};YAHOO.widget.DataTable.prototype.getSelectedRows=function(){return YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.DataTable.CLASS_SELECTED,"tr",this._elBody);};YAHOO.widget.DataTable.prototype.getSelectedCells=function(){return YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.DataTable.CLASS_SELECTED,"td",this._elBody);};YAHOO.widget.DataTable.prototype.getColumnSet=function(){return this._oColumnSet;};YAHOO.widget.DataTable.prototype.getRecordSet=function(){return this._oRecordSet;};YAHOO.widget.DataTable.prototype.getPaginator=function(){return this._paginator;};YAHOO.widget.DataTable.prototype.showPage=function(nPage){if(!YAHOO.lang.isNumber(nPage)||(nPage<1)||(nPage>this._paginator.totalPages)){nPage=1;}
|
||||
this._paginator.currentPage=nPage;this.populateTable();};YAHOO.widget.DataTable.prototype.formatPaginatorLinks=function(elLinksContainer,nCurrentPage,nPageLinksStart,nPageLinksLength,nTotalPages){var isFirstPage=(nCurrentPage==1)?true:false;var isLastPage=(nCurrentPage==nTotalPages)?true:false;var firstPageLink=(isFirstPage)?" <span class=\""+YAHOO.widget.DataTable.CLASS_FIRSTPAGE+"\"><<</span> ":" <a href=\"#\" class=\""+YAHOO.widget.DataTable.CLASS_FIRSTLINK+"\"><<</a> ";var prevPageLink=(isFirstPage)?" <span class=\""+YAHOO.widget.DataTable.CLASS_PREVPAGE+"\"><</span> ":" <a href=\"#\" class=\""+YAHOO.widget.DataTable.CLASS_PREVLINK+"\"><</a> ";var nextPageLink=(isLastPage)?" <span class=\""+YAHOO.widget.DataTable.CLASS_NEXTPAGE+"\">></span> ":" <a href=\"#\" class=\""+YAHOO.widget.DataTable.CLASS_NEXTLINK+"\">></a> ";var lastPageLink=(isLastPage)?" <span class=\""+YAHOO.widget.DataTable.CLASS_LASTPAGE+"\">>></span> ":" <a href=\"#\" class=\""+YAHOO.widget.DataTable.CLASS_LASTLINK+"\">>></a> ";markup=firstPageLink+prevPageLink;var maxLinks=(nPageLinksStart+nPageLinksLength<nTotalPages)?nPageLinksStart+nPageLinksLength-1:nTotalPages;for(var i=nPageLinksStart;i<=maxLinks;i++){if(i!=nCurrentPage){markup+=" <a href=\"#\" class=\""+YAHOO.widget.DataTable.CLASS_PAGELINK+"\">"+i+"</a> ";}
|
||||
else{markup+=" <span class=\""+YAHOO.widget.DataTable.CLASS_CURRENTPAGE+"\">"+i+"</span>";}}
|
||||
markup+=nextPageLink+lastPageLink;elLinksContainer.innerHTML=markup;};YAHOO.widget.DataTable.prototype.paginateRows=function(){this.populateTable();};YAHOO.widget.DataTable.prototype.populateTable=function(){var records;if(!this.paginator){if(this._paginator!==null){}}
|
||||
if(this.paginator){if(this._paginator===null){this._initPaginator();}
|
||||
var recordsLength=this._oRecordSet.getLength();var rowsPerPage=(this._paginator.rowsPerPage>0)?this._paginator.rowsPerPage:recordsLength;var maxRows=(rowsPerPage<recordsLength)?rowsPerPage:recordsLength;this._paginator.totalPages=Math.ceil(recordsLength/maxRows);var currentPage=this._paginator.currentPage;var startRecordIndex=(currentPage-1)*rowsPerPage;var pageLinksLength=this._paginator.pageLinks;if(pageLinksLength===0){pageLinksLength=this._paginator.totalPages;}
|
||||
if(pageLinksLength>-1){var pageLinksStart=(pageLinksLength==1)?currentPage:(Math.ceil(currentPage/pageLinksLength-1)*pageLinksLength)+1;}
|
||||
records=this._oRecordSet.getRecords(startRecordIndex,rowsPerPage);for(var i=0;i<this._paginator.elements.length;i++){if(this._paginator.elements[i].links&&(pageLinksLength>-1)){this.formatPaginatorLinks(this._paginator.elements[i].links,currentPage,pageLinksStart,pageLinksLength,this._paginator.totalPages);}
|
||||
if(this._paginator.elements[i].select&&this._paginator.elements[i].select.options){var options=this._paginator.elements[i].select.options;for(var j=0;j<options.length;j++){if((rowsPerPage+"")===options[j].value){options[j].selected=true;}}}}
|
||||
if(navigator.userAgent.toLowerCase().indexOf("opera")!=-1){document.body.style+='';}
|
||||
this.fireEvent("paginateEvent",{paginator:this._paginator});}
|
||||
else{records=this._oRecordSet.getRecords();}
|
||||
this.replaceRows(records);};YAHOO.widget.DataTable.prototype.sortColumn=function(oColumn){if(!oColumn){return;}
|
||||
if(!oColumn instanceof YAHOO.widget.Column){return;}
|
||||
if(oColumn.sortable){var sortDir=(oColumn.sortOptions&&oColumn.sortOptions.defaultOrder)?oColumn.sortOptions.defaultOrder:"asc";if(oColumn.key&&this.sortedBy&&(this.sortedBy.colKey==oColumn.key)){if(this.sortedBy.dir){sortDir=(this.sortedBy.dir=="asc")?"desc":"asc";}
|
||||
else{sortDir=(sortDir=="asc")?"desc":"asc";}}
|
||||
else if(!this.sortedBy){this.sortedBy={};}
|
||||
var sortFnc=null;if((sortDir=="desc")&&oColumn.sortOptions&&oColumn.sortOptions.descFunction){sortFnc=oColumn.sortOptions.descFunction;}
|
||||
else if((sortDir=="asc")&&oColumn.sortOptions&&oColumn.sortOptions.ascFunction){sortFnc=oColumn.sortOptions.ascFunction;}
|
||||
if(!sortFnc&&oColumn.key){var sorted;sortFnc=function(a,b){if(sortDir=="desc"){sorted=YAHOO.util.Sort.compareDesc(a[oColumn.key],b[oColumn.key]);if(sorted===0){return YAHOO.util.Sort.compareDesc(a.id,b.id);}
|
||||
else{return sorted;}}
|
||||
else{sorted=YAHOO.util.Sort.compareAsc(a[oColumn.key],b[oColumn.key]);if(sorted===0){return YAHOO.util.Sort.compareAsc(a.id,b.id);}
|
||||
else{return sorted;}}};}
|
||||
if(sortFnc){this._oRecordSet.sort(sortFnc);this.populateTable();YAHOO.util.Dom.removeClass(this.sortedBy._id,YAHOO.widget.DataTable.CLASS_SORTEDBYASC);YAHOO.util.Dom.removeClass(this.sortedBy._id,YAHOO.widget.DataTable.CLASS_SORTEDBYDESC);var newClass=(sortDir=="asc")?YAHOO.widget.DataTable.CLASS_SORTEDBYASC:YAHOO.widget.DataTable.CLASS_SORTEDBYDESC;YAHOO.util.Dom.addClass(oColumn.getId(),newClass);this.sortedBy.colKey=oColumn.key;this.sortedBy.dir=sortDir;this.sortedBy._id=oColumn.getId();this.fireEvent("columnSortEvent",{column:oColumn,dir:sortDir});}}
|
||||
else{}};YAHOO.widget.DataTable.prototype.editCell=function(elCell){if(elCell&&YAHOO.lang.isNumber(elCell.columnIndex)){var column=this._oColumnSet.keys[elCell.columnIndex];if(column&&column.editor){this.activeEditor=column.getEditor(elCell,this._oRecordSet.getRecord(elCell.parentNode.yuiRecordId));this._bFocused=true;if(this.activeEditor){if(YAHOO.util.Dom.hasClass(elCell,YAHOO.widget.DataTable.CLASS_HIGHLIGHT)){this.unhighlight(elCell);}
|
||||
this.fireEvent("editorShowEvent",{target:elCell,column:column});}}}};YAHOO.widget.DataTable.prototype.cancelEditorData=function(){if(this.activeEditor){this.activeEditor.hide();this.activeEditor=null;}};YAHOO.widget.DataTable.prototype.saveEditorData=function(){if(this.activeEditor){var elCell=this.activeEditor.cell;var oColumn=this.activeEditor.column;var oRecord=this.activeEditor.record;var oldValue=oRecord[oColumn.key];var newValue=this.activeEditor.getValue();if(YAHOO.util.Lang.isString(oColumn.key)){this._oRecordSet.updateRecord(oRecord,oColumn.key,newValue);this.formatCell(elCell);}
|
||||
else{}
|
||||
this.activeEditor.hide();this.activeEditor=null;this.fireEvent("cellEditEvent",{target:elCell,oldData:oldValue,newData:newValue});}};YAHOO.widget.DataTable.prototype.formatCell=function(elCell){if(elCell&&YAHOO.lang.isNumber(elCell.columnIndex)){var index=elCell.columnIndex;var column=this._oColumnSet.keys[index];column.format(elCell,this._oRecordSet.getRecord(elCell.parentNode.yuiRecordId));if(index===0){YAHOO.util.Dom.addClass(elCell,YAHOO.widget.DataTable.CLASS_FIRST);}
|
||||
else if(index===this._oColumnSet.keys.length-1){YAHOO.util.Dom.addClass(elCell,YAHOO.widget.DataTable.CLASS_LAST);}
|
||||
this.fireEvent("cellFormatEvent",{el:elCell});}};YAHOO.widget.DataTable.prototype.onEventSortColumn=function(oArgs){var evt=oArgs.event;var target=oArgs.target;YAHOO.util.Event.stopEvent(evt);if(YAHOO.lang.isNumber(target.columnIndex)){this.sortColumn(this._oColumnSet.keys[target.columnIndex]);}
|
||||
else{}};YAHOO.widget.DataTable.prototype.onEventSelectRow=function(oArgs){var evt=oArgs.event;var elTarget=oArgs.target;var elTag=elTarget.tagName.toLowerCase();var bSingleSelect=this.rowSingleSelect;var bSHIFT=evt.shiftKey;var bCTRL=evt.ctrlKey;var i;while(elTag!="tr"){if(elTag=="body"){return;}
|
||||
elTarget=elTarget.parentNode;elTag=elTarget.tagName.toLowerCase();}
|
||||
var sTargetId=elTarget.id;var rows=this._elBody.rows;var anchor=YAHOO.util.Dom.get(this._selectRowAnchorId);var anchorIndex;var targetIndex=elTarget.sectionRowIndex;if(!bSingleSelect&&bSHIFT&&bCTRL){if(anchor){anchorIndex=anchor.sectionRowIndex;if(this.isSelected(YAHOO.util.Dom.get(this._selectRowAnchorId))){if(anchorIndex<targetIndex){for(i=anchorIndex+1;i<=targetIndex;i++){if(!this.isSelected(rows[i])){this.selectRow(rows[i]);}}}
|
||||
else{for(i=targetIndex;i<=anchorIndex-1;i++){if(!this.isSelected(rows[i])){this.selectRow(rows[i]);}}}}
|
||||
else{if(anchorIndex<targetIndex){for(i=anchorIndex+1;i<=targetIndex-1;i++){if(this.isSelected(rows[i])){this.unselectRow(rows[i]);}}}
|
||||
else{for(i=targetIndex+1;i<=anchorIndex-1;i++){if(this.isSelected(rows[i])){this.unselectRow(rows[i]);}}}
|
||||
this.select(elTarget);}}
|
||||
else{this._selectRowAnchorId=sTargetId;if(this.isSelected(elTarget)){this.unselect(elTarget);}
|
||||
else{this.select(elTarget);}}}
|
||||
else if(!bSingleSelect&&bSHIFT){this.unselectAllRows();if(anchor){anchorIndex=anchor.sectionRowIndex;if(anchorIndex<targetIndex){for(i=anchorIndex;i<=targetIndex;i++){this.selectRow(rows[i]);}}
|
||||
else{for(i=targetIndex;i<=anchorIndex;i++){this.selectRow(rows[i]);}}}
|
||||
else{this._selectRowAnchorId=sTargetId;this.selectRow(elTarget);}}
|
||||
else if(!bSingleSelect&&bCTRL){this._selectRowAnchorId=sTargetId;if(this.isSelected(elTarget)){this.unselect(elTarget);}
|
||||
else{this.select(elTarget);}}
|
||||
else if(bSingleSelect){this.unselect(this._lastSelectedId);this.select(elTarget);}
|
||||
else{this._selectRowAnchorId=sTargetId;this.unselectAllRows();this.selectRow(elTarget);}};YAHOO.widget.DataTable.prototype.onEventSelectCell=function(oArgs){var evt=oArgs.event;var target=oArgs.target;var elTag=target.tagName.toLowerCase();while(elTag!="td"){if(elTag=="body"){return;}
|
||||
target=target.parentNode;elTag=target.tagName.toLowerCase();}
|
||||
if(this.isSelected(target)){this.unselect(target);}
|
||||
else{if(this.rowSingleSelect&&!evt.ctrlKey){this.unselectAllCells();}
|
||||
this.select(target);}};YAHOO.widget.DataTable.prototype.onEventFormatCell=function(oArgs){var evt=oArgs.event;var target=oArgs.target;var elTag=target.tagName.toLowerCase();while(elTag!="td"){if(elTag=="body"){return;}
|
||||
target=target.parentNode;elTag=target.tagName.toLowerCase();}
|
||||
this.formatCell(target);};YAHOO.widget.DataTable.prototype.onEventHighlightCell=function(oArgs){var evt=oArgs.event;var target=oArgs.target;var elTag=target.tagName.toLowerCase();while(elTag!="td"){if(elTag=="body"){return;}
|
||||
target=target.parentNode;elTag=target.tagName.toLowerCase();}
|
||||
this.highlight(target);};YAHOO.widget.DataTable.prototype.onEventUnhighlightCell=function(oArgs){var evt=oArgs.event;var target=oArgs.target;var elTag=target.tagName.toLowerCase();while(elTag!="td"){if(elTag=="body"){return;}
|
||||
target=target.parentNode;elTag=target.tagName.toLowerCase();}
|
||||
this.unhighlight(target);};YAHOO.widget.DataTable.prototype.onEventEditCell=function(oArgs){var evt=oArgs.event;var target=oArgs.target;var elTag=target.tagName.toLowerCase();while(elTag!="td"){if(elTag=="body"){return;}
|
||||
target=target.parentNode;elTag=target.tagName.toLowerCase();}
|
||||
this.editCell(target);};YAHOO.widget.DataTable.prototype.onDataReturnPaginateRows=function(sRequest,oResponse,bError){};YAHOO.widget.DataTable.prototype.onDataReturnPopulateTable=function(sRequest,oResponse,bError){this.fireEvent("dataReturnEvent",{request:sRequest,response:oResponse});var ok=this.doBeforeLoadData(sRequest,oResponse,bError);if(ok&&oResponse&&!bError){var newRecords=this._oRecordSet.append(oResponse);if(newRecords){this.populateTable();}}
|
||||
else if(bError){this.showTableMessage(YAHOO.widget.DataTable.MSG_ERROR,YAHOO.widget.DataTable.CLASS_ERROR);}
|
||||
else{this.showTableMessage(YAHOO.widget.DataTable.MSG_EMPTY,YAHOO.widget.DataTable.CLASS_EMPTY);}};YAHOO.widget.DataTable.prototype.onDataReturnAppendRows=function(sRequest,oResponse,bError){this.fireEvent("dataReturnEvent",{request:sRequest,response:oResponse});var ok=this.doBeforeLoadData(sRequest,oResponse,bError);if(ok){var newRecords=this._oRecordSet.append(oResponse);if(newRecords){this.appendRows(newRecords);}}};YAHOO.widget.DataTable.prototype.onDataReturnInsertRows=function(sRequest,oResponse,bError){this.fireEvent("dataReturnEvent",{request:sRequest,response:oResponse});var ok=this.doBeforeLoadData(sRequest,oResponse,bError);if(ok){var newRecords=this._oRecordSet.insert(oResponse);if(newRecords){this.insertRows(newRecords);}}};YAHOO.widget.DataTable.prototype.onDataReturnReplaceRows=function(sRequest,oResponse,bError){this.fireEvent("dataReturnEvent",{request:sRequest,response:oResponse});var ok=this.doBeforeLoadData(sRequest,oResponse,bError);if(ok){var newRecords=this._oRecordSet.replace(oResponse);if(newRecords){this.replaceRows(newRecords);}}};YAHOO.widget.ColumnSet=function(aHeaders){this._sName="instance"+YAHOO.widget.ColumnSet._nCount;var tree=[];var flat=[];var keys=[];var headers=[];var nodelevel=-1;var parseColumns=function(nodeList,parent){nodelevel++;if(!tree[nodelevel]){tree[nodelevel]=[];}
|
||||
var nodeLevelMaxChildren=0;var recurseChildren=function(nodeList){var tmpMax=0;for(var i=0;i<nodeList.length;i++){if(nodeList[i].children){tmpMax++;recurseChildren(nodeList[i].children);}
|
||||
if(tmpMax>nodeLevelMaxChildren){nodeLevelMaxChildren=tmpMax;}}};recurseChildren(nodeList);for(var j=0;j<nodeList.length;j++){var oColumn=new YAHOO.widget.Column(nodeList[j]);flat.push(oColumn);if(parent){oColumn._parent=parent;}
|
||||
oColumn._rowspan=1;oColumn._colspan=1;if(nodeList[j].children){var children=nodeList[j].children;var length=children.length;for(var k=0;k<length;k++){var child=children[k];if(oColumn.className&&(child.className===undefined)){child.className=oColumn.className;}
|
||||
if(oColumn.editor&&(child.editor===undefined)){child.editor=oColumn.editor;}
|
||||
if(oColumn.formatter&&(child.formatter===undefined)){child.formatter=oColumn.formatter;}
|
||||
if(oColumn.parser&&(child.parser===undefined)){child.parser=oColumn.parser;}
|
||||
if(oColumn.resizeable&&(child.resizeable===undefined)){child.resizeable=oColumn.resizeable;}
|
||||
if(oColumn.type&&(child.type===undefined)){child.type=oColumn.type;}
|
||||
if(oColumn.width&&(child.width===undefined)){child.width=oColumn.width;}}
|
||||
oColumn._colspan=length;if(parent&&parent._colspan){parent._colspan+=length-1;parent._children=[];parent._children.push(oColumn);}
|
||||
if(!tree[nodelevel+1]){tree[nodelevel+1]=[];}
|
||||
parseColumns(children,oColumn);}
|
||||
else if(nodeLevelMaxChildren>0){oColumn._rowspan+=nodeLevelMaxChildren;oColumn._index=keys.length;keys.push(oColumn);}
|
||||
else{oColumn._index=keys.length;keys.push(oColumn);}
|
||||
tree[nodelevel].push(oColumn);}
|
||||
nodelevel--;};if(aHeaders.length>0){parseColumns(aHeaders);}
|
||||
var recurseAncestors=function(i,oColumn){headers[i].push(oColumn._id);if(oColumn._parent){recurseAncestors(i,oColumn._parent);}};for(var i=0;i<keys.length;i++){headers[i]=[];recurseAncestors(i,keys[i]);headers[i]=headers[i].reverse();headers[i]=headers[i].join(" ");}
|
||||
this.tree=tree;this.flat=flat;this.keys=keys;this.headers=headers;YAHOO.widget.ColumnSet._nCount++;};YAHOO.widget.ColumnSet._nCount=0;YAHOO.widget.ColumnSet.prototype._sName=null;YAHOO.widget.ColumnSet.prototype.tree=null;YAHOO.widget.ColumnSet.prototype.flat=null;YAHOO.widget.ColumnSet.prototype.keys=null;YAHOO.widget.ColumnSet.prototype.headers=null;YAHOO.widget.ColumnSet.prototype.toString=function(){return"ColumnSet "+this._sName;};YAHOO.widget.Column=function(oConfigs){this._id="yui-dtcol"+YAHOO.widget.Column._nCount;if(oConfigs&&(oConfigs.constructor==Object)){for(var sConfig in oConfigs){if(sConfig){this[sConfig]=oConfigs[sConfig];}}}
|
||||
YAHOO.widget.Column._nCount++;};YAHOO.widget.Column._nCount=0;YAHOO.widget.Column.prototype._id=null;YAHOO.widget.Column.prototype._index=null;YAHOO.widget.Column.prototype._colspan=1;YAHOO.widget.Column.prototype._rowspan=1;YAHOO.widget.Column.prototype._parent=null;YAHOO.widget.Column.prototype._children=null;YAHOO.widget.Column.prototype._width=null;YAHOO.widget.Column.prototype._minWidth=null;YAHOO.widget.Column.prototype.key=null;YAHOO.widget.Column.prototype.text=null;YAHOO.widget.Column.prototype.type="string";YAHOO.widget.Column.prototype.abbr=null;YAHOO.widget.Column.prototype.children=null;YAHOO.widget.Column.prototype.width=null;YAHOO.widget.Column.prototype.className=null;YAHOO.widget.Column.prototype.formatter=null;YAHOO.widget.Column.prototype.parser=null;YAHOO.widget.Column.prototype.editor=null;YAHOO.widget.Column.prototype.resizeable=false;YAHOO.widget.Column.prototype.sortable=false;YAHOO.widget.Column.prototype.descFunction=null;YAHOO.widget.Column.prototype.ascFunction=null;YAHOO.widget.Column.prototype.getId=function(){return this._id;};YAHOO.widget.Column.prototype.getIndex=function(){return this._index;};YAHOO.widget.Column.prototype.getColSpan=function(){return this._colspan;};YAHOO.widget.Column.prototype.getRowSpan=function(){return this._rowspan;};YAHOO.widget.Column.prototype.format=function(elCell,oRecord){var oData=(this.key)?oRecord[this.key]:null;if(this.formatter){this.formatter(elCell,oRecord,this,oData);}
|
||||
else{var type=this.type;var markup="";var classname="";switch(type){case"checkbox":YAHOO.widget.Column.formatCheckbox(elCell,oRecord,this,oData);classname=YAHOO.widget.DataTable.CLASS_CHECKBOX;break;case"currency":YAHOO.widget.Column.formatCurrency(elCell,oRecord,this,oData);classname=YAHOO.widget.DataTable.CLASS_CURRENCY;break;case"date":YAHOO.widget.Column.formatDate(elCell,oRecord,this,oData);classname=YAHOO.widget.DataTable.CLASS_DATE;break;case"email":YAHOO.widget.Column.formatEmail(elCell,oRecord,this,oData);classname=YAHOO.widget.DataTable.CLASS_EMAIL;break;case"link":YAHOO.widget.Column.formatLink(elCell,oRecord,this,oData);classname=YAHOO.widget.DataTable.CLASS_LINK;break;case"number":YAHOO.widget.Column.formatNumber(elCell,oRecord,this,oData);classname=YAHOO.widget.DataTable.CLASS_NUMBER;break;case"select":YAHOO.widget.Column.formatSelect(elCell,oRecord,this,oData);classname=YAHOO.widget.DataTable.CLASS_SELECT;break;default:elCell.innerHTML=(oData)?oData.toString():"";classname=YAHOO.widget.DataTable.CLASS_STRING;break;}
|
||||
YAHOO.util.Dom.addClass(elCell,classname);if(this.className){YAHOO.util.Dom.addClass(elCell,this.className);}}
|
||||
if(this.editor){YAHOO.util.Dom.addClass(elCell,YAHOO.widget.DataTable.CLASS_EDITABLE);}};YAHOO.widget.Column.formatCheckbox=function(elCell,oRecord,oColumn,oData){var bChecked=oData;bChecked=(bChecked)?" checked":"";elCell.innerHTML="<input type=\"checkbox\""+bChecked+" class=\""+YAHOO.widget.DataTable.CLASS_CHECKBOX+"\">";};YAHOO.widget.Column.formatCurrency=function(elCell,oRecord,oColumn,oData){var nAmount=oData;var markup;if((nAmount!==undefined)&&(nAmount!==null)&&!isNaN(parseFloat(nAmount))){nAmount=Math.round(nAmount*100)/100;markup="$"+nAmount;var dotIndex=markup.indexOf(".");if(dotIndex<0){markup+=".00";}
|
||||
else{while(dotIndex>markup.length-3){markup+="0";}}}
|
||||
else{markup="";}
|
||||
elCell.innerHTML=markup;};YAHOO.widget.Column.formatDate=function(elCell,oRecord,oColumn,oData){var oDate=oData;if(oDate instanceof Date){elCell.innerHTML=(oDate.getMonth()+1)+"/"+oDate.getDate()+"/"+oDate.getFullYear();}
|
||||
else{elCell.innerHTML="";}};YAHOO.widget.Column.formatEmail=function(elCell,oRecord,oColumn,oData){var sEmail=oData;if(sEmail){elCell.innerHTML="<a href=\"mailto:"+sEmail+"\">"+sEmail+"</a>";}
|
||||
else{elCell.innerHTML="";}};YAHOO.widget.Column.formatLink=function(elCell,oRecord,oColumn,oData){var sLink=oData;if(sLink){elCell.innerHTML="<a href=\""+sLink+"\">"+sLink+"</a>";}
|
||||
else{elCell.innerHTML="";}};YAHOO.widget.Column.formatNumber=function(elCell,oRecord,oColumn,oData){var nNumber=oData;if((nNumber!==undefined)&&(nNumber!==null)){elCell.innerHTML=nNumber.toString();}
|
||||
else{elCell.innerHTML="";}};YAHOO.widget.Column.formatSelect=function(elCell,oRecord,oColumn,oData){var selectedValue=oData;var options=oColumn.selectOptions;var markup="<select>";if(options){for(var i=0;i<options.length;i++){var option=options[i];markup+="<option value=\""+option+"\"";if(selectedValue===option){markup+=" selected";}
|
||||
markup+=">"+option+"</option>";}}
|
||||
else{if(selectedValue){markup+="<option value=\""+selectedValue+"\" selected>"+selectedValue+"</option>";}}
|
||||
markup+="</select>";elCell.innerHTML=markup;};YAHOO.widget.Column.prototype.parse=function(sMarkup){if(this.parser){return this.parser(sMarkup);}
|
||||
else{var data=null;switch(this.type){case"checkbox":data=YAHOO.widget.Column.parseCheckbox(sMarkup);break;case"currency":data=YAHOO.widget.Column.parseCurrency(sMarkup);break;case"date":data=YAHOO.widget.Column.parseDate(sMarkup);break;case"number":data=YAHOO.widget.Column.parseNumber(sMarkup);break;case"select":data=YAHOO.widget.Column.parseSelect(sMarkup);break;default:if(sMarkup){data=sMarkup;}
|
||||
break;}
|
||||
return data;}};YAHOO.widget.Column.parseCheckbox=function(sMarkup){return(sMarkup.indexOf("checked")<0)?false:true;};YAHOO.widget.Column.parseCurrency=function(sMarkup){return parseFloat(sMarkup.substring(1));};YAHOO.widget.Column.parseDate=function(sMarkup){var mm=sMarkup.substring(0,sMarkup.indexOf("/"));sMarkup=sMarkup.substring(sMarkup.indexOf("/")+1);var dd=sMarkup.substring(0,sMarkup.indexOf("/"));var yy=sMarkup.substring(sMarkup.indexOf("/")+1);return new Date(yy,mm,dd);};YAHOO.widget.Column.parseNumber=function(sMarkup){return parseFloat(sMarkup);};YAHOO.widget.Column.parseSelect=function(sMarkup){};YAHOO.widget.Column.prototype.getEditor=function(elCell,oRecord){var oEditor=this.editor;if(YAHOO.lang.isString(oEditor)){oEditor=new YAHOO.widget.ColumnEditor(this.editor);oEditor.show(elCell,oRecord,this);this.editor=oEditor;}
|
||||
else if(oEditor instanceof YAHOO.widget.ColumnEditor){oEditor.show(elCell,oRecord,this);}
|
||||
return oEditor;};YAHOO.widget.ColumnEditor=function(sType){this.type=sType;var container=document.body.appendChild(document.createElement("div"));container.style.position="absolute";container.style.zIndex=9000;container.id="yui-dt-editor"+YAHOO.widget.ColumnEditor._nCount;container.className=YAHOO.widget.DataTable.CLASS_EDITOR;this.container=container;switch(this.type){case"textbox":this.createTextboxEditor();break;case"textarea":this.createTextareaEditor();break;default:break;}
|
||||
YAHOO.widget.ColumnEditor._nCount++;};YAHOO.widget.ColumnEditor._nCount=0;YAHOO.widget.ColumnEditor.prototype.container=null;YAHOO.widget.ColumnEditor.prototype.column=null;YAHOO.widget.ColumnEditor.prototype.type=null;YAHOO.widget.ColumnEditor.prototype.input=null;YAHOO.widget.ColumnEditor.prototype.show=function(elCell,oRecord,oColumn){this.cell=elCell;this.record=oRecord;this.column=oColumn;switch(this.type){case"textbox":this.showTextboxEditor(elCell,oRecord,oColumn);break;case"textarea":this.showTextareaEditor(elCell,oRecord,oColumn);break;default:break;}};YAHOO.widget.ColumnEditor.prototype.moveContainerTo=function(el){var x,y;if(navigator.userAgent.toLowerCase().indexOf("opera")!=-1){x=el.offsetLeft;y=el.offsetTop;while(el.offsetParent){x+=el.offsetParent.offsetLeft;y+=el.offsetParent.offsetTop;el=el.offsetParent;}}
|
||||
else{x=parseInt(YAHOO.util.Dom.getX(el),10);y=parseInt(YAHOO.util.Dom.getY(el),10);}
|
||||
this.container.style.left=x+"px";this.container.style.top=y+"px";};YAHOO.widget.ColumnEditor.prototype.getValue=function(){var value;switch(this.type){case"textbox":value=this.getTextboxEditorValue();break;case"textarea":value=this.getTextareaEditorValue();break;default:break;}
|
||||
return value;};YAHOO.widget.ColumnEditor.prototype.createTextboxEditor=function(){var elTextbox=this.container.appendChild(document.createElement("input"));elTextbox.setAttribute("autocomplete","off");this.input=elTextbox;};YAHOO.widget.ColumnEditor.prototype.createTextareaEditor=function(){var elTextarea=this.container.appendChild(document.createElement("textarea"));this.input=elTextarea;};YAHOO.widget.ColumnEditor.prototype.showTextboxEditor=function(elCell,oRecord,oColumn){this.moveContainerTo(elCell);this.input.style.width=(parseInt(elCell.offsetWidth,10))+"px";this.input.style.height=(parseInt(elCell.offsetHeight,10))+"px";this.input.value=elCell.innerHTML||"";this.input.tabIndex=0;this.container.style.display="block";this.input.focus();this.input.select();};YAHOO.widget.ColumnEditor.prototype.showTextareaEditor=function(elCell,oRecord,oColumn){this.moveContainerTo(elCell);this.input.style.width=(parseInt(elCell.offsetWidth,10))+"px";this.input.style.height=4*(parseInt(elCell.offsetHeight,10))+"px";this.input.value=elCell.innerHTML||"";this.input.tabIndex=0;this.container.style.display="block";this.input.focus();this.input.select();};YAHOO.widget.ColumnEditor.prototype.hide=function(){this.input.tabIndex=-1;this.container.style.display="none";};YAHOO.widget.ColumnEditor.prototype.getTextboxEditorValue=function(){return this.input.value;};YAHOO.widget.ColumnEditor.prototype.getTextareaEditorValue=function(){return this.input.value;};YAHOO.util.Sort={compareAsc:function(a,b){if((a===null)||(typeof a=="undefined")){if((b===null)||(typeof b=="undefined")){return 0;}
|
||||
else{return 1;}}
|
||||
else if((b===null)||(typeof b=="undefined")){return-1;}
|
||||
if(a.constructor==String){a=a.toLowerCase();}
|
||||
if(b.constructor==String){b=b.toLowerCase();}
|
||||
if(a<b){return-1;}
|
||||
else if(a>b){return 1;}
|
||||
else{return 0;}},compareDesc:function(a,b){if((a===null)||(typeof a=="undefined")){if((b===null)||(typeof b=="undefined")){return 0;}
|
||||
else{return-1;}}
|
||||
else if((b===null)||(typeof b=="undefined")){return 1;}
|
||||
if(a.constructor==String){a=a.toLowerCase();}
|
||||
if(b.constructor==String){b=b.toLowerCase();}
|
||||
if(a<b){return 1;}
|
||||
else if(a>b){return-1;}
|
||||
else{return 0;}}};YAHOO.util.WidthResizer=function(oDataTable,colId,handleId,sGroup,config){if(colId){this.cell=YAHOO.util.Dom.get(colId);this.init(handleId,sGroup,config);this.datatable=oDataTable;this.setYConstraint(0,0);}
|
||||
else{}};if(YAHOO.util.DD){YAHOO.extend(YAHOO.util.WidthResizer,YAHOO.util.DD);}
|
||||
YAHOO.util.WidthResizer.prototype.onMouseDown=function(e){this.startWidth=this.cell.offsetWidth;this.startPos=YAHOO.util.Dom.getX(this.getDragEl());if(this.datatable.fixedWidth){var cellText=YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.DataTable.CLASS_HEADTEXT,"span",this.cell)[0];this.minWidth=cellText.offsetWidth+6;var sib=this.cell.nextSibling;var sibCellText=YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.DataTable.CLASS_HEADTEXT,"span",sib)[0];this.sibMinWidth=sibCellText.offsetWidth+6;var left=((this.startWidth-this.minWidth)<0)?0:(this.startWidth-this.minWidth);var right=((sib.offsetWidth-this.sibMinWidth)<0)?0:(sib.offsetWidth-this.sibMinWidth);this.setXConstraint(left,right);}};YAHOO.util.WidthResizer.prototype.onMouseUp=function(e){var resizeStyle=YAHOO.util.Dom.get(this.handleElId).style;resizeStyle.left="auto";resizeStyle.right=0;resizeStyle.marginRight="-6px";resizeStyle.width="6px";this.datatable.fireEvent("columnResizeEvent",{datatable:this.datatable,target:YAHOO.util.Dom.get(this.id)});};YAHOO.util.WidthResizer.prototype.onDrag=function(e){var newPos=YAHOO.util.Dom.getX(this.getDragEl());var offsetX=newPos-this.startPos;var newWidth=this.startWidth+offsetX;if(newWidth<this.minWidth){newWidth=this.minWidth;}
|
||||
var oDataTable=this.datatable;var elCell=this.cell;if(oDataTable.fixedWidth){var sib=elCell.nextSibling;var sibnewwidth=sib.offsetWidth-offsetX;if(sibnewwidth<this.sibMinWidth){sibnewwidth=this.sibMinWidth;}
|
||||
for(var i=0;i<oDataTable._oColumnSet.length;i++){if((i!=elCell.index)&&(i!=sibIndex)){YAHOO.util.Dom.get(oDataTable._oColumnSet.keys[i].id).style.width=oDataTable._oColumnSet.keys[i].width+"px";}}
|
||||
sib.style.width=sibnewwidth;elCell.style.width=newWidth+"px";}
|
||||
else{elCell.style.width=newWidth+"px";}};YAHOO.widget.RecordSet=function(data){this._nIndex=YAHOO.widget.RecordSet._nCount;this._records=[];if(data){if(YAHOO.lang.isArray(data)){this.addRecords(data);}
|
||||
else if(data.constructor==Object){this.addRecord(data);}}
|
||||
this.createEvent("recordUpdateEvent");YAHOO.widget.RecordSet._nCount++;};if(YAHOO.util.EventProvider){YAHOO.augment(YAHOO.widget.RecordSet,YAHOO.util.EventProvider);}
|
||||
else{}
|
||||
YAHOO.widget.RecordSet._nCount=0;YAHOO.widget.RecordSet.prototype._nIndex=null;YAHOO.widget.RecordSet.prototype._length=null;YAHOO.widget.RecordSet.prototype.toString=function(){return"RecordSet instance "+this._nIndex;};YAHOO.widget.RecordSet.prototype.getLength=function(){return this._length;};YAHOO.widget.RecordSet.prototype.getRecord=function(identifier){if(YAHOO.lang.isNumber(identifier)){return this._records[identifier];}
|
||||
else if(YAHOO.lang.isString(identifier)){for(var i=0;i<this._records.length;i++){if(this._records[i].yuiRecordId==identifier){return this._records[i];}}}
|
||||
return null;};YAHOO.widget.RecordSet.prototype.getRecords=function(i,range){if(!YAHOO.lang.isNumber(i)){return this._records;}
|
||||
if(!YAHOO.lang.isNumber(range)){return this._records.slice(i);}
|
||||
return this._records.slice(i,i+range);};YAHOO.widget.RecordSet.prototype.updateRecord=function(oRecord,sKey,oData){var oldData=oRecord[sKey];oRecord[sKey]=oData;this.fireEvent("recordUpdateEvent",{record:oRecord,key:sKey,newData:oData,oldData:oldData});};YAHOO.widget.RecordSet.prototype.addRecord=function(oObjectLiteral,index){if(oObjectLiteral&&(oObjectLiteral.constructor==Object)){var oRecord=new YAHOO.widget.Record(oObjectLiteral);if(YAHOO.lang.isNumber(index)&&(index>-1)){this._records.splice(index,0,oRecord);}
|
||||
else{this._records.push(oRecord);}
|
||||
this._length++;return oRecord;}
|
||||
else{return null;}};YAHOO.widget.RecordSet.prototype.addRecords=function(data,index){if(YAHOO.lang.isArray(data)){var newRecords=[];for(var i=0;i<data.length;i++){var record=this.addRecord(data[i],index);newRecords.push(record);}
|
||||
return newRecords;}
|
||||
else if(data&&(data.constructor==Object)){return this.addRecord(data);}
|
||||
else{return null;}};YAHOO.widget.RecordSet.prototype.append=function(data){if(YAHOO.lang.isArray(data)){var newRecords=[];for(var i=0;i<data.length;i++){var record=this.addRecord(data[i]);newRecords.push(record);}
|
||||
return newRecords;}
|
||||
else if(data&&(data.constructor==Object)){return this.addRecord(data);}
|
||||
else{return null;}};YAHOO.widget.RecordSet.prototype.insert=function(data){if(YAHOO.lang.isArray(data)){var newRecords=[];for(var i=data.length-1;i>-1;i--){var record=this.addRecord(data[i],0);newRecords.push(record);}
|
||||
return newRecords;}
|
||||
else if(data&&(data.constructor==Object)){return this.addRecord(data,0);}
|
||||
else{return null;}};YAHOO.widget.RecordSet.prototype.replace=function(data){if(data){this.reset();return this.append(data);}
|
||||
else{return null;}};YAHOO.widget.RecordSet.prototype.sort=function(fnSort){return this._records.sort(fnSort);};YAHOO.widget.RecordSet.prototype.deleteRecord=function(i,range){if(!YAHOO.lang.isNumber(range)){range=1;}
|
||||
if(!YAHOO.lang.isNumber(i)){this._records.splice(i,range);this._length=this._length-range;}};YAHOO.widget.RecordSet.prototype.reset=function(){this._records=[];this._length=0;};YAHOO.widget.Record=function(oLiteral){if(oLiteral&&(oLiteral.constructor==Object)){for(var sKey in oLiteral){this[sKey]=oLiteral[sKey];}
|
||||
this.yuiRecordId="yui-dtrec"+YAHOO.widget.Record._nCount;YAHOO.widget.Record._nCount++;}};YAHOO.widget.Record._nCount=0;YAHOO.widget.Record.prototype.yuiRecordId=null;YAHOO.register("datatable",YAHOO.widget.DataTable,{version:"2.2.2",build:"204"});
|
||||
5824
www/extras/yui/build/datatable/datatable-beta.js
vendored
|
|
@ -1,91 +0,0 @@
|
|||
Dom Release Notes
|
||||
|
||||
*** version 2.2.2 ***
|
||||
|
||||
* fixed getXY scroll regression
|
||||
|
||||
*** version 2.2.1 ***
|
||||
* fixed toCamel propertyCache used by set/getStyle
|
||||
* added set/getStyle support for float property
|
||||
* optimized get() for common use case
|
||||
* fixed getXY for safari when el has absolute ancestors
|
||||
* using className property instead of string literal for class mgmt methods
|
||||
* added getXY/getRegion support for body element
|
||||
|
||||
*** version 2.2.0 ***
|
||||
* no change
|
||||
|
||||
|
||||
*** version 0.12.2 ***
|
||||
* no change
|
||||
|
||||
*** version 0.12.1 ***
|
||||
|
||||
* getElementsByClassName no longer reverts to document when "root" not found
|
||||
* setXY no longer makes a second call to getXY unless noRetry is false
|
||||
* minified version no longer strips line breaks
|
||||
|
||||
*** version 0.12.0 ***
|
||||
|
||||
* fixed getXY for IE null parent
|
||||
* branching set/getStyle at load time instead of run time
|
||||
|
||||
*** version 0.11.3 ***
|
||||
|
||||
* fixed getX and getY returning incorrect values for collections
|
||||
* fixed getXY incorrectly calculated for Opera inline elements
|
||||
* fixed isAncestor failure in safari when 2nd arg is document.documentElement
|
||||
* fixed infinite loop in replaceClass when oldClassName == newClassName
|
||||
* getDocumentWidth no longer includes scrollbars
|
||||
|
||||
|
||||
*** version 0.11.2 ***
|
||||
* limit depth of parent.document crawl to 1 for getXY
|
||||
* test offsetParent instead of parentNode for getXY
|
||||
* return null if no el fo r get
|
||||
* just addClass if no class to replace for replaceClass
|
||||
|
||||
|
||||
*** version 0.11.1 ***
|
||||
|
||||
* return null if el is null for get()
|
||||
* test offsetParent rather than parentNode for getXY()
|
||||
* limit depth of parent.document crawl for IE getXY() to 1
|
||||
* if no oldClassName to replace, just addClass for replaceClass()
|
||||
|
||||
|
||||
*** version 0.11.0 ***
|
||||
* Work around Opera 9 broken currentStyle
|
||||
* Removed timeout wrapper from setXY retry
|
||||
* Tagname tests now case-insensitive
|
||||
* Internal "this" references changed to allow for method shorthand
|
||||
* get/setStyle now accept both camel and hyphen case
|
||||
* Gecko reverted to crawling offsets for getXY
|
||||
|
||||
|
||||
*** version 0.10.0 ***
|
||||
|
||||
* Safari now fails gracefully when querying computedStyle of an unavailable element
|
||||
|
||||
* Class management functions added (hasClass, addClass, removeClass, replaceClass, getElementsByClassName)
|
||||
|
||||
* All methods that accept HTMLElements or IDs now also accept arrays of HTMLElements and/or IDs
|
||||
|
||||
* GenerateId method added
|
||||
|
||||
* isAncestor method added
|
||||
|
||||
* inDocument method added
|
||||
|
||||
* getElementsBy method added
|
||||
|
||||
* batch method added
|
||||
|
||||
* getClientHeight/Width deprecated in favor of getViewportHeight/Width
|
||||
|
||||
* getDocumentHeight/Width methods added
|
||||
|
||||
*** version 0.9.0 ***
|
||||
|
||||
* Initial release
|
||||
|
||||
949
www/extras/yui/build/dom/dom-debug.js
vendored
|
|
@ -1,949 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 2.2.2
|
||||
*/
|
||||
/**
|
||||
* The dom module provides helper methods for manipulating Dom elements.
|
||||
* @module dom
|
||||
*
|
||||
*/
|
||||
|
||||
(function() {
|
||||
var Y = YAHOO.util, // internal shorthand
|
||||
getStyle, // for load time browser branching
|
||||
setStyle, // ditto
|
||||
id_counter = 0, // for use with generateId
|
||||
propertyCache = {}; // for faster hyphen converts
|
||||
|
||||
// brower detection
|
||||
var ua = navigator.userAgent.toLowerCase(),
|
||||
isOpera = (ua.indexOf('opera') > -1),
|
||||
isSafari = (ua.indexOf('safari') > -1),
|
||||
isGecko = (!isOpera && !isSafari && ua.indexOf('gecko') > -1),
|
||||
isIE = (!isOpera && ua.indexOf('msie') > -1);
|
||||
|
||||
// regex cache
|
||||
var patterns = {
|
||||
HYPHEN: /(-[a-z])/i, // to normalize get/setStyle
|
||||
ROOT_TAG: /body|html/i // body for quirks mode, html for standards
|
||||
};
|
||||
|
||||
var toCamel = function(property) {
|
||||
if ( !patterns.HYPHEN.test(property) ) {
|
||||
return property; // no hyphens
|
||||
}
|
||||
|
||||
if (propertyCache[property]) { // already converted
|
||||
return propertyCache[property];
|
||||
}
|
||||
|
||||
var converted = property;
|
||||
|
||||
while( patterns.HYPHEN.exec(converted) ) {
|
||||
converted = converted.replace(RegExp.$1,
|
||||
RegExp.$1.substr(1).toUpperCase());
|
||||
}
|
||||
|
||||
propertyCache[property] = converted;
|
||||
return converted;
|
||||
//return property.replace(/-([a-z])/gi, function(m0, m1) {return m1.toUpperCase()}) // cant use function as 2nd arg yet due to safari bug
|
||||
};
|
||||
|
||||
// branching at load instead of runtime
|
||||
if (document.defaultView && document.defaultView.getComputedStyle) { // W3C DOM method
|
||||
getStyle = function(el, property) {
|
||||
var value = null;
|
||||
|
||||
if (property == 'float') { // fix reserved word
|
||||
property = 'cssFloat';
|
||||
}
|
||||
|
||||
var computed = document.defaultView.getComputedStyle(el, '');
|
||||
if (computed) { // test computed before touching for safari
|
||||
value = computed[toCamel(property)];
|
||||
}
|
||||
|
||||
return el.style[property] || value;
|
||||
};
|
||||
} else if (document.documentElement.currentStyle && isIE) { // IE method
|
||||
getStyle = function(el, property) {
|
||||
switch( toCamel(property) ) {
|
||||
case 'opacity' :// IE opacity uses filter
|
||||
var val = 100;
|
||||
try { // will error if no DXImageTransform
|
||||
val = el.filters['DXImageTransform.Microsoft.Alpha'].opacity;
|
||||
|
||||
} catch(e) {
|
||||
try { // make sure its in the document
|
||||
val = el.filters('alpha').opacity;
|
||||
} catch(e) {
|
||||
YAHOO.log('getStyle: IE filter failed',
|
||||
'error', 'Dom');
|
||||
}
|
||||
}
|
||||
return val / 100;
|
||||
break;
|
||||
case 'float': // fix reserved word
|
||||
property = 'styleFloat'; // fall through
|
||||
default:
|
||||
// test currentStyle before touching
|
||||
var value = el.currentStyle ? el.currentStyle[property] : null;
|
||||
return ( el.style[property] || value );
|
||||
}
|
||||
};
|
||||
} else { // default to inline only
|
||||
getStyle = function(el, property) { return el.style[property]; };
|
||||
}
|
||||
|
||||
if (isIE) {
|
||||
setStyle = function(el, property, val) {
|
||||
switch (property) {
|
||||
case 'opacity':
|
||||
if ( YAHOO.lang.isString(el.style.filter) ) { // in case not appended
|
||||
el.style.filter = 'alpha(opacity=' + val * 100 + ')';
|
||||
|
||||
if (!el.currentStyle || !el.currentStyle.hasLayout) {
|
||||
el.style.zoom = 1; // when no layout or cant tell
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'float':
|
||||
property = 'styleFloat';
|
||||
default:
|
||||
el.style[property] = val;
|
||||
}
|
||||
};
|
||||
} else {
|
||||
setStyle = function(el, property, val) {
|
||||
if (property == 'float') {
|
||||
property = 'cssFloat';
|
||||
}
|
||||
el.style[property] = val;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides helper methods for DOM elements.
|
||||
* @namespace YAHOO.util
|
||||
* @class Dom
|
||||
*/
|
||||
YAHOO.util.Dom = {
|
||||
/**
|
||||
* Returns an HTMLElement reference.
|
||||
* @method get
|
||||
* @param {String | HTMLElement |Array} el Accepts a string to use as an ID for getting a DOM reference, an actual DOM reference, or an Array of IDs and/or HTMLElements.
|
||||
* @return {HTMLElement | Array} A DOM reference to an HTML element or an array of HTMLElements.
|
||||
*/
|
||||
get: function(el) {
|
||||
if ( YAHOO.lang.isString(el) ) { // ID
|
||||
YAHOO.log('get(' + el + ') returning ' + document.getElementById(el), 'info', 'Dom');
|
||||
return document.getElementById(el);
|
||||
}
|
||||
|
||||
if ( YAHOO.lang.isArray(el) ) { // Array of IDs and/or HTMLElements
|
||||
var c = [];
|
||||
for (var i = 0, len = el.length; i < len; ++i) {
|
||||
c[c.length] = Y.Dom.get(el[i]);
|
||||
}
|
||||
|
||||
YAHOO.log('get("' + el + '") returning ' + c, 'info', 'Dom');
|
||||
return c;
|
||||
}
|
||||
|
||||
if (el) { // assuming HTMLElement or HTMLCollection, just pass back
|
||||
YAHOO.log('get("' + el + '") returning ' + el, 'info', 'Dom');
|
||||
return el;
|
||||
}
|
||||
|
||||
YAHOO.log('element ' + el + ' not found', 'error', 'Dom');
|
||||
return null; // el is likely null or undefined
|
||||
},
|
||||
|
||||
/**
|
||||
* Normalizes currentStyle and ComputedStyle.
|
||||
* @method getStyle
|
||||
* @param {String | HTMLElement |Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
|
||||
* @param {String} property The style property whose value is returned.
|
||||
* @return {String | Array} The current value of the style property for the element(s).
|
||||
*/
|
||||
getStyle: function(el, property) {
|
||||
property = toCamel(property);
|
||||
|
||||
var f = function(element) {
|
||||
return getStyle(element, property);
|
||||
};
|
||||
|
||||
return Y.Dom.batch(el, f, Y.Dom, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Wrapper for setting style properties of HTMLElements. Normalizes "opacity" across modern browsers.
|
||||
* @method setStyle
|
||||
* @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
|
||||
* @param {String} property The style property to be set.
|
||||
* @param {String} val The value to apply to the given property.
|
||||
*/
|
||||
setStyle: function(el, property, val) {
|
||||
property = toCamel(property);
|
||||
|
||||
var f = function(element) {
|
||||
setStyle(element, property, val);
|
||||
YAHOO.log('setStyle setting ' + property + ' to ' + val, 'info', 'Dom');
|
||||
|
||||
};
|
||||
|
||||
Y.Dom.batch(el, f, Y.Dom, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the current position of an element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
|
||||
* @method getXY
|
||||
* @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
|
||||
* @return {Array} The XY position of the element(s)
|
||||
*/
|
||||
getXY: function(el) {
|
||||
var f = function(el) {
|
||||
|
||||
// has to be part of document to have pageXY
|
||||
if ( (el.parentNode === null || el.offsetParent === null ||
|
||||
this.getStyle(el, 'display') == 'none') && el != document.body) {
|
||||
YAHOO.log('getXY failed: element not available', 'error', 'Dom');
|
||||
return false;
|
||||
}
|
||||
|
||||
var parentNode = null;
|
||||
var pos = [];
|
||||
var box;
|
||||
|
||||
if (el.getBoundingClientRect) { // IE
|
||||
box = el.getBoundingClientRect();
|
||||
var doc = document;
|
||||
if ( !this.inDocument(el) && parent.document != document) {// might be in a frame, need to get its scroll
|
||||
doc = parent.document;
|
||||
|
||||
if ( !this.isAncestor(doc.documentElement, el) ) {
|
||||
YAHOO.log('getXY failed: element not available', 'error', 'Dom');
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var scrollTop = Math.max(doc.documentElement.scrollTop, doc.body.scrollTop);
|
||||
var scrollLeft = Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft);
|
||||
|
||||
return [box.left + scrollLeft, box.top + scrollTop];
|
||||
}
|
||||
else { // safari, opera, & gecko
|
||||
pos = [el.offsetLeft, el.offsetTop];
|
||||
parentNode = el.offsetParent;
|
||||
|
||||
// safari: if el is abs or any parent is abs, subtract body offsets
|
||||
var hasAbs = this.getStyle(el, 'position') == 'absolute';
|
||||
|
||||
if (parentNode != el) {
|
||||
while (parentNode) {
|
||||
pos[0] += parentNode.offsetLeft;
|
||||
pos[1] += parentNode.offsetTop;
|
||||
if (isSafari && !hasAbs &&
|
||||
this.getStyle(parentNode,'position') == 'absolute' ) {
|
||||
hasAbs = true; // we need to offset if any parent is absolutely positioned
|
||||
}
|
||||
parentNode = parentNode.offsetParent;
|
||||
}
|
||||
}
|
||||
|
||||
if (isSafari && hasAbs) { //safari doubles in this case
|
||||
pos[0] -= document.body.offsetLeft;
|
||||
pos[1] -= document.body.offsetTop;
|
||||
}
|
||||
}
|
||||
|
||||
parentNode = el.parentNode;
|
||||
|
||||
// account for any scrolled ancestors
|
||||
while ( parentNode.tagName && !patterns.ROOT_TAG.test(parentNode.tagName) )
|
||||
{
|
||||
// work around opera inline scrollLeft/Top bug
|
||||
if (Y.Dom.getStyle(parentNode, 'display') != 'inline') {
|
||||
pos[0] -= parentNode.scrollLeft;
|
||||
pos[1] -= parentNode.scrollTop;
|
||||
}
|
||||
|
||||
parentNode = parentNode.parentNode;
|
||||
}
|
||||
|
||||
YAHOO.log('getXY returning ' + pos, 'info', 'Dom');
|
||||
|
||||
return pos;
|
||||
};
|
||||
|
||||
return Y.Dom.batch(el, f, Y.Dom, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the current X position of an element based on page coordinates. The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
|
||||
* @method getX
|
||||
* @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
|
||||
* @return {String | Array} The X position of the element(s)
|
||||
*/
|
||||
getX: function(el) {
|
||||
var f = function(el) {
|
||||
return Y.Dom.getXY(el)[0];
|
||||
};
|
||||
|
||||
return Y.Dom.batch(el, f, Y.Dom, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the current Y position of an element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
|
||||
* @method getY
|
||||
* @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
|
||||
* @return {String | Array} The Y position of the element(s)
|
||||
*/
|
||||
getY: function(el) {
|
||||
var f = function(el) {
|
||||
return Y.Dom.getXY(el)[1];
|
||||
};
|
||||
|
||||
return Y.Dom.batch(el, f, Y.Dom, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Set the position of an html element in page coordinates, regardless of how the element is positioned.
|
||||
* The element(s) must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
|
||||
* @method setXY
|
||||
* @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
|
||||
* @param {Array} pos Contains X & Y values for new position (coordinates are page-based)
|
||||
* @param {Boolean} noRetry By default we try and set the position a second time if the first fails
|
||||
*/
|
||||
setXY: function(el, pos, noRetry) {
|
||||
var f = function(el) {
|
||||
var style_pos = this.getStyle(el, 'position');
|
||||
if (style_pos == 'static') { // default to relative
|
||||
this.setStyle(el, 'position', 'relative');
|
||||
style_pos = 'relative';
|
||||
}
|
||||
|
||||
var pageXY = this.getXY(el);
|
||||
if (pageXY === false) { // has to be part of doc to have pageXY
|
||||
YAHOO.log('setXY failed: element not available', 'error', 'Dom');
|
||||
return false;
|
||||
}
|
||||
|
||||
var delta = [ // assuming pixels; if not we will have to retry
|
||||
parseInt( this.getStyle(el, 'left'), 10 ),
|
||||
parseInt( this.getStyle(el, 'top'), 10 )
|
||||
];
|
||||
|
||||
if ( isNaN(delta[0]) ) {// in case of 'auto'
|
||||
delta[0] = (style_pos == 'relative') ? 0 : el.offsetLeft;
|
||||
}
|
||||
if ( isNaN(delta[1]) ) { // in case of 'auto'
|
||||
delta[1] = (style_pos == 'relative') ? 0 : el.offsetTop;
|
||||
}
|
||||
|
||||
if (pos[0] !== null) { el.style.left = pos[0] - pageXY[0] + delta[0] + 'px'; }
|
||||
if (pos[1] !== null) { el.style.top = pos[1] - pageXY[1] + delta[1] + 'px'; }
|
||||
|
||||
if (!noRetry) {
|
||||
var newXY = this.getXY(el);
|
||||
|
||||
// if retry is true, try one more time if we miss
|
||||
if ( (pos[0] !== null && newXY[0] != pos[0]) ||
|
||||
(pos[1] !== null && newXY[1] != pos[1]) ) {
|
||||
this.setXY(el, pos, true);
|
||||
}
|
||||
}
|
||||
|
||||
YAHOO.log('setXY setting position to ' + pos, 'info', 'Dom');
|
||||
};
|
||||
|
||||
Y.Dom.batch(el, f, Y.Dom, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Set the X position of an html element in page coordinates, regardless of how the element is positioned.
|
||||
* The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
|
||||
* @method setX
|
||||
* @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
|
||||
* @param {Int} x The value to use as the X coordinate for the element(s).
|
||||
*/
|
||||
setX: function(el, x) {
|
||||
Y.Dom.setXY(el, [x, null]);
|
||||
},
|
||||
|
||||
/**
|
||||
* Set the Y position of an html element in page coordinates, regardless of how the element is positioned.
|
||||
* The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
|
||||
* @method setY
|
||||
* @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
|
||||
* @param {Int} x To use as the Y coordinate for the element(s).
|
||||
*/
|
||||
setY: function(el, y) {
|
||||
Y.Dom.setXY(el, [null, y]);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the region position of the given element.
|
||||
* The element must be part of the DOM tree to have a region (display:none or elements not appended return false).
|
||||
* @method getRegion
|
||||
* @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
|
||||
* @return {Region | Array} A Region or array of Region instances containing "top, left, bottom, right" member data.
|
||||
*/
|
||||
getRegion: function(el) {
|
||||
var f = function(el) {
|
||||
var region = new Y.Region.getRegion(el);
|
||||
YAHOO.log('getRegion returning ' + region, 'info', 'Dom');
|
||||
return region;
|
||||
};
|
||||
|
||||
return Y.Dom.batch(el, f, Y.Dom, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the width of the client (viewport).
|
||||
* @method getClientWidth
|
||||
* @deprecated Now using getViewportWidth. This interface left intact for back compat.
|
||||
* @return {Int} The width of the viewable area of the page.
|
||||
*/
|
||||
getClientWidth: function() {
|
||||
return Y.Dom.getViewportWidth();
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the height of the client (viewport).
|
||||
* @method getClientHeight
|
||||
* @deprecated Now using getViewportHeight. This interface left intact for back compat.
|
||||
* @return {Int} The height of the viewable area of the page.
|
||||
*/
|
||||
getClientHeight: function() {
|
||||
return Y.Dom.getViewportHeight();
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a array of HTMLElements with the given class.
|
||||
* For optimized performance, include a tag and/or root node when possible.
|
||||
* @method getElementsByClassName
|
||||
* @param {String} className The class name to match against
|
||||
* @param {String} tag (optional) The tag name of the elements being collected
|
||||
* @param {String | HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point
|
||||
* @return {Array} An array of elements that have the given class name
|
||||
*/
|
||||
getElementsByClassName: function(className, tag, root) {
|
||||
var method = function(el) { return Y.Dom.hasClass(el, className); };
|
||||
return Y.Dom.getElementsBy(method, tag, root);
|
||||
},
|
||||
|
||||
/**
|
||||
* Determines whether an HTMLElement has the given className.
|
||||
* @method hasClass
|
||||
* @param {String | HTMLElement | Array} el The element or collection to test
|
||||
* @param {String} className the class name to search for
|
||||
* @return {Boolean | Array} A boolean value or array of boolean values
|
||||
*/
|
||||
hasClass: function(el, className) {
|
||||
var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)');
|
||||
|
||||
var f = function(el) {
|
||||
YAHOO.log('hasClass returning ' + re.test(el.className), 'info', 'Dom');
|
||||
return re.test(el.className);
|
||||
};
|
||||
|
||||
return Y.Dom.batch(el, f, Y.Dom, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Adds a class name to a given element or collection of elements.
|
||||
* @method addClass
|
||||
* @param {String | HTMLElement | Array} el The element or collection to add the class to
|
||||
* @param {String} className the class name to add to the class attribute
|
||||
*/
|
||||
addClass: function(el, className) {
|
||||
var f = function(el) {
|
||||
if (this.hasClass(el, className)) { return; } // already present
|
||||
|
||||
YAHOO.log('addClass adding ' + className, 'info', 'Dom');
|
||||
|
||||
el.className = [el.className, className].join(' ');
|
||||
};
|
||||
|
||||
Y.Dom.batch(el, f, Y.Dom, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Removes a class name from a given element or collection of elements.
|
||||
* @method removeClass
|
||||
* @param {String | HTMLElement | Array} el The element or collection to remove the class from
|
||||
* @param {String} className the class name to remove from the class attribute
|
||||
*/
|
||||
removeClass: function(el, className) {
|
||||
var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)', 'g');
|
||||
|
||||
var f = function(el) {
|
||||
if (!this.hasClass(el, className)) {
|
||||
return; // not present
|
||||
}
|
||||
|
||||
YAHOO.log('removeClass removing ' + className, 'info', 'Dom');
|
||||
|
||||
var c = el.className;
|
||||
el.className = c.replace(re, ' ');
|
||||
if ( this.hasClass(el, className) ) { // in case of multiple adjacent
|
||||
this.removeClass(el, className);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Y.Dom.batch(el, f, Y.Dom, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Replace a class with another class for a given element or collection of elements.
|
||||
* If no oldClassName is present, the newClassName is simply added.
|
||||
* @method replaceClass
|
||||
* @param {String | HTMLElement | Array} el The element or collection to remove the class from
|
||||
* @param {String} oldClassName the class name to be replaced
|
||||
* @param {String} newClassName the class name that will be replacing the old class name
|
||||
*/
|
||||
replaceClass: function(el, oldClassName, newClassName) {
|
||||
if (oldClassName === newClassName) { // avoid infinite loop
|
||||
return false;
|
||||
}
|
||||
|
||||
var re = new RegExp('(?:^|\\s+)' + oldClassName + '(?:\\s+|$)', 'g');
|
||||
|
||||
var f = function(el) {
|
||||
YAHOO.log('replaceClass replacing ' + oldClassName + ' with ' + newClassName, 'info', 'Dom');
|
||||
|
||||
if ( !this.hasClass(el, oldClassName) ) {
|
||||
this.addClass(el, newClassName); // just add it if nothing to replace
|
||||
return; // note return
|
||||
}
|
||||
|
||||
el.className = el.className.replace(re, ' ' + newClassName + ' ');
|
||||
|
||||
if ( this.hasClass(el, oldClassName) ) { // in case of multiple adjacent
|
||||
this.replaceClass(el, oldClassName, newClassName);
|
||||
}
|
||||
};
|
||||
|
||||
Y.Dom.batch(el, f, Y.Dom, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Generates a unique ID
|
||||
* @method generateId
|
||||
* @param {String | HTMLElement | Array} el (optional) An optional element array of elements to add an ID to (no ID is added if one is already present).
|
||||
* @param {String} prefix (optional) an optional prefix to use (defaults to "yui-gen").
|
||||
* @return {String | Array} The generated ID, or array of generated IDs (or original ID if already present on an element)
|
||||
*/
|
||||
generateId: function(el, prefix) {
|
||||
prefix = prefix || 'yui-gen';
|
||||
el = el || {};
|
||||
|
||||
var f = function(el) {
|
||||
if (el) {
|
||||
el = Y.Dom.get(el);
|
||||
} else {
|
||||
el = {}; // just generating ID in this case
|
||||
}
|
||||
|
||||
if (!el.id) {
|
||||
el.id = prefix + id_counter++;
|
||||
YAHOO.log('generateId generating ' + el.id, 'info', 'Dom');
|
||||
} // dont override existing
|
||||
|
||||
YAHOO.log('generateId returning ' + el.id, 'info', 'Dom');
|
||||
|
||||
return el.id;
|
||||
};
|
||||
|
||||
return Y.Dom.batch(el, f, Y.Dom, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Determines whether an HTMLElement is an ancestor of another HTML element in the DOM hierarchy.
|
||||
* @method isAncestor
|
||||
* @param {String | HTMLElement} haystack The possible ancestor
|
||||
* @param {String | HTMLElement} needle The possible descendent
|
||||
* @return {Boolean} Whether or not the haystack is an ancestor of needle
|
||||
*/
|
||||
isAncestor: function(haystack, needle) {
|
||||
haystack = Y.Dom.get(haystack);
|
||||
if (!haystack || !needle) { return false; }
|
||||
|
||||
var f = function(needle) {
|
||||
if (haystack.contains && !isSafari) { // safari "contains" is broken
|
||||
YAHOO.log('isAncestor returning ' + haystack.contains(needle), 'info', 'Dom');
|
||||
return haystack.contains(needle);
|
||||
}
|
||||
else if ( haystack.compareDocumentPosition ) {
|
||||
YAHOO.log('isAncestor returning ' + !!(haystack.compareDocumentPosition(needle) & 16), 'info', 'Dom');
|
||||
return !!(haystack.compareDocumentPosition(needle) & 16);
|
||||
}
|
||||
else { // loop up and test each parent
|
||||
var parent = needle.parentNode;
|
||||
|
||||
while (parent) {
|
||||
if (parent == haystack) {
|
||||
YAHOO.log('isAncestor returning true', 'info', 'Dom');
|
||||
return true;
|
||||
}
|
||||
else if (!parent.tagName || parent.tagName.toUpperCase() == 'HTML') {
|
||||
YAHOO.log('isAncestor returning false', 'info', 'Dom');
|
||||
return false;
|
||||
}
|
||||
|
||||
parent = parent.parentNode;
|
||||
}
|
||||
YAHOO.log('isAncestor returning false', 'info', 'Dom');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
return Y.Dom.batch(needle, f, Y.Dom, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Determines whether an HTMLElement is present in the current document.
|
||||
* @method inDocument
|
||||
* @param {String | HTMLElement} el The element to search for
|
||||
* @return {Boolean} Whether or not the element is present in the current document
|
||||
*/
|
||||
inDocument: function(el) {
|
||||
var f = function(el) {
|
||||
return this.isAncestor(document.documentElement, el);
|
||||
};
|
||||
|
||||
return Y.Dom.batch(el, f, Y.Dom, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a array of HTMLElements that pass the test applied by supplied boolean method.
|
||||
* For optimized performance, include a tag and/or root node when possible.
|
||||
* @method getElementsBy
|
||||
* @param {Function} method - A boolean method for testing elements which receives the element as its only argument.
|
||||
|
||||
* @param {String} tag (optional) The tag name of the elements being collected
|
||||
* @param {String | HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point
|
||||
* @return {Array} Array of HTMLElements
|
||||
*/
|
||||
getElementsBy: function(method, tag, root) {
|
||||
tag = tag || '*';
|
||||
|
||||
var nodes = [];
|
||||
|
||||
if (root) {
|
||||
root = Y.Dom.get(root);
|
||||
if (!root) { // if no root node, then no children
|
||||
return nodes;
|
||||
}
|
||||
} else {
|
||||
root = document;
|
||||
}
|
||||
|
||||
var elements = root.getElementsByTagName(tag);
|
||||
|
||||
if ( !elements.length && (tag == '*' && root.all) ) {
|
||||
elements = root.all; // IE < 6
|
||||
}
|
||||
|
||||
for (var i = 0, len = elements.length; i < len; ++i) {
|
||||
if ( method(elements[i]) ) { nodes[nodes.length] = elements[i]; }
|
||||
}
|
||||
|
||||
YAHOO.log('getElementsBy returning ' + nodes, 'info', 'Dom');
|
||||
|
||||
return nodes;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns an array of elements that have had the supplied method applied.
|
||||
* The method is called with the element(s) as the first arg, and the optional param as the second ( method(el, o) ).
|
||||
* @method batch
|
||||
* @param {String | HTMLElement | Array} el (optional) An element or array of elements to apply the method to
|
||||
* @param {Function} method The method to apply to the element(s)
|
||||
* @param {Any} o (optional) An optional arg that is passed to the supplied method
|
||||
* @param {Boolean} override (optional) Whether or not to override the scope of "method" with "o"
|
||||
* @return {HTMLElement | Array} The element(s) with the method applied
|
||||
*/
|
||||
batch: function(el, method, o, override) {
|
||||
var id = el;
|
||||
el = Y.Dom.get(el);
|
||||
|
||||
var scope = (override) ? o : window;
|
||||
|
||||
if (!el || el.tagName || !el.length) { // is null or not a collection (tagName for SELECT and others that can be both an element and a collection)
|
||||
if (!el) {
|
||||
YAHOO.log(id + ' not available', 'error', 'Dom');
|
||||
return false;
|
||||
}
|
||||
return method.call(scope, el, o);
|
||||
}
|
||||
|
||||
var collection = [];
|
||||
|
||||
for (var i = 0, len = el.length; i < len; ++i) {
|
||||
if (!el[i]) {
|
||||
id = el[i];
|
||||
YAHOO.log(id + ' not available', 'error', 'Dom');
|
||||
}
|
||||
collection[collection.length] = method.call(scope, el[i], o);
|
||||
}
|
||||
|
||||
return collection;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the height of the document.
|
||||
* @method getDocumentHeight
|
||||
* @return {Int} The height of the actual document (which includes the body and its margin).
|
||||
*/
|
||||
getDocumentHeight: function() {
|
||||
var scrollHeight = (document.compatMode != 'CSS1Compat') ? document.body.scrollHeight : document.documentElement.scrollHeight;
|
||||
|
||||
var h = Math.max(scrollHeight, Y.Dom.getViewportHeight());
|
||||
YAHOO.log('getDocumentHeight returning ' + h, 'info', 'Dom');
|
||||
return h;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the width of the document.
|
||||
* @method getDocumentWidth
|
||||
* @return {Int} The width of the actual document (which includes the body and its margin).
|
||||
*/
|
||||
getDocumentWidth: function() {
|
||||
var scrollWidth = (document.compatMode != 'CSS1Compat') ? document.body.scrollWidth : document.documentElement.scrollWidth;
|
||||
var w = Math.max(scrollWidth, Y.Dom.getViewportWidth());
|
||||
YAHOO.log('getDocumentWidth returning ' + w, 'info', 'Dom');
|
||||
return w;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the current height of the viewport.
|
||||
* @method getViewportHeight
|
||||
* @return {Int} The height of the viewable area of the page (excludes scrollbars).
|
||||
*/
|
||||
getViewportHeight: function() {
|
||||
var height = self.innerHeight; // Safari, Opera
|
||||
var mode = document.compatMode;
|
||||
|
||||
if ( (mode || isIE) && !isOpera ) { // IE, Gecko
|
||||
height = (mode == 'CSS1Compat') ?
|
||||
document.documentElement.clientHeight : // Standards
|
||||
document.body.clientHeight; // Quirks
|
||||
}
|
||||
|
||||
YAHOO.log('getViewportHeight returning ' + height, 'info', 'Dom');
|
||||
return height;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the current width of the viewport.
|
||||
* @method getViewportWidth
|
||||
* @return {Int} The width of the viewable area of the page (excludes scrollbars).
|
||||
*/
|
||||
|
||||
getViewportWidth: function() {
|
||||
var width = self.innerWidth; // Safari
|
||||
var mode = document.compatMode;
|
||||
|
||||
if (mode || isIE) { // IE, Gecko, Opera
|
||||
width = (mode == 'CSS1Compat') ?
|
||||
document.documentElement.clientWidth : // Standards
|
||||
document.body.clientWidth; // Quirks
|
||||
}
|
||||
YAHOO.log('getViewportWidth returning ' + width, 'info', 'Dom');
|
||||
return width;
|
||||
}
|
||||
};
|
||||
})();
|
||||
/**
|
||||
* A region is a representation of an object on a grid. It is defined
|
||||
* by the top, right, bottom, left extents, so is rectangular by default. If
|
||||
* other shapes are required, this class could be extended to support it.
|
||||
* @namespace YAHOO.util
|
||||
* @class Region
|
||||
* @param {Int} t the top extent
|
||||
* @param {Int} r the right extent
|
||||
* @param {Int} b the bottom extent
|
||||
* @param {Int} l the left extent
|
||||
* @constructor
|
||||
*/
|
||||
YAHOO.util.Region = function(t, r, b, l) {
|
||||
|
||||
/**
|
||||
* The region's top extent
|
||||
* @property top
|
||||
* @type Int
|
||||
*/
|
||||
this.top = t;
|
||||
|
||||
/**
|
||||
* The region's top extent as index, for symmetry with set/getXY
|
||||
* @property 1
|
||||
* @type Int
|
||||
*/
|
||||
this[1] = t;
|
||||
|
||||
/**
|
||||
* The region's right extent
|
||||
* @property right
|
||||
* @type int
|
||||
*/
|
||||
this.right = r;
|
||||
|
||||
/**
|
||||
* The region's bottom extent
|
||||
* @property bottom
|
||||
* @type Int
|
||||
*/
|
||||
this.bottom = b;
|
||||
|
||||
/**
|
||||
* The region's left extent
|
||||
* @property left
|
||||
* @type Int
|
||||
*/
|
||||
this.left = l;
|
||||
|
||||
/**
|
||||
* The region's left extent as index, for symmetry with set/getXY
|
||||
* @property 0
|
||||
* @type Int
|
||||
*/
|
||||
this[0] = l;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns true if this region contains the region passed in
|
||||
* @method contains
|
||||
* @param {Region} region The region to evaluate
|
||||
* @return {Boolean} True if the region is contained with this region,
|
||||
* else false
|
||||
*/
|
||||
YAHOO.util.Region.prototype.contains = function(region) {
|
||||
return ( region.left >= this.left &&
|
||||
region.right <= this.right &&
|
||||
region.top >= this.top &&
|
||||
region.bottom <= this.bottom );
|
||||
|
||||
// this.logger.debug("does " + this + " contain " + region + " ... " + ret);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the area of the region
|
||||
* @method getArea
|
||||
* @return {Int} the region's area
|
||||
*/
|
||||
YAHOO.util.Region.prototype.getArea = function() {
|
||||
return ( (this.bottom - this.top) * (this.right - this.left) );
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the region where the passed in region overlaps with this one
|
||||
* @method intersect
|
||||
* @param {Region} region The region that intersects
|
||||
* @return {Region} The overlap region, or null if there is no overlap
|
||||
*/
|
||||
YAHOO.util.Region.prototype.intersect = function(region) {
|
||||
var t = Math.max( this.top, region.top );
|
||||
var r = Math.min( this.right, region.right );
|
||||
var b = Math.min( this.bottom, region.bottom );
|
||||
var l = Math.max( this.left, region.left );
|
||||
|
||||
if (b >= t && r >= l) {
|
||||
return new YAHOO.util.Region(t, r, b, l);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the region representing the smallest region that can contain both
|
||||
* the passed in region and this region.
|
||||
* @method union
|
||||
* @param {Region} region The region that to create the union with
|
||||
* @return {Region} The union region
|
||||
*/
|
||||
YAHOO.util.Region.prototype.union = function(region) {
|
||||
var t = Math.min( this.top, region.top );
|
||||
var r = Math.max( this.right, region.right );
|
||||
var b = Math.max( this.bottom, region.bottom );
|
||||
var l = Math.min( this.left, region.left );
|
||||
|
||||
return new YAHOO.util.Region(t, r, b, l);
|
||||
};
|
||||
|
||||
/**
|
||||
* toString
|
||||
* @method toString
|
||||
* @return string the region properties
|
||||
*/
|
||||
YAHOO.util.Region.prototype.toString = function() {
|
||||
return ( "Region {" +
|
||||
"top: " + this.top +
|
||||
", right: " + this.right +
|
||||
", bottom: " + this.bottom +
|
||||
", left: " + this.left +
|
||||
"}" );
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a region that is occupied by the DOM element
|
||||
* @method getRegion
|
||||
* @param {HTMLElement} el The element
|
||||
* @return {Region} The region that the element occupies
|
||||
* @static
|
||||
*/
|
||||
YAHOO.util.Region.getRegion = function(el) {
|
||||
var p = YAHOO.util.Dom.getXY(el);
|
||||
|
||||
var t = p[1];
|
||||
var r = p[0] + el.offsetWidth;
|
||||
var b = p[1] + el.offsetHeight;
|
||||
var l = p[0];
|
||||
|
||||
return new YAHOO.util.Region(t, r, b, l);
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/**
|
||||
* A point is a region that is special in that it represents a single point on
|
||||
* the grid.
|
||||
* @namespace YAHOO.util
|
||||
* @class Point
|
||||
* @param {Int} x The X position of the point
|
||||
* @param {Int} y The Y position of the point
|
||||
* @constructor
|
||||
* @extends YAHOO.util.Region
|
||||
*/
|
||||
YAHOO.util.Point = function(x, y) {
|
||||
if (x instanceof Array) { // accept output from Dom.getXY
|
||||
y = x[1];
|
||||
x = x[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* The X position of the point, which is also the right, left and index zero (for Dom.getXY symmetry)
|
||||
* @property x
|
||||
* @type Int
|
||||
*/
|
||||
|
||||
this.x = this.right = this.left = this[0] = x;
|
||||
|
||||
/**
|
||||
* The Y position of the point, which is also the top, bottom and index one (for Dom.getXY symmetry)
|
||||
* @property y
|
||||
* @type Int
|
||||
*/
|
||||
this.y = this.top = this.bottom = this[1] = y;
|
||||
};
|
||||
|
||||
YAHOO.util.Point.prototype = new YAHOO.util.Region();
|
||||
|
||||
YAHOO.register("dom", YAHOO.util.Dom, {version: "2.2.2", build: "204"});
|
||||
59
www/extras/yui/build/dom/dom-min.js
vendored
|
|
@ -1,59 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 2.2.2
|
||||
*/
|
||||
|
||||
(function(){var Y=YAHOO.util,getStyle,setStyle,id_counter=0,propertyCache={};var ua=navigator.userAgent.toLowerCase(),isOpera=(ua.indexOf('opera')>-1),isSafari=(ua.indexOf('safari')>-1),isGecko=(!isOpera&&!isSafari&&ua.indexOf('gecko')>-1),isIE=(!isOpera&&ua.indexOf('msie')>-1);var patterns={HYPHEN:/(-[a-z])/i,ROOT_TAG:/body|html/i};var toCamel=function(property){if(!patterns.HYPHEN.test(property)){return property;}
|
||||
if(propertyCache[property]){return propertyCache[property];}
|
||||
var converted=property;while(patterns.HYPHEN.exec(converted)){converted=converted.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase());}
|
||||
propertyCache[property]=converted;return converted;};if(document.defaultView&&document.defaultView.getComputedStyle){getStyle=function(el,property){var value=null;if(property=='float'){property='cssFloat';}
|
||||
var computed=document.defaultView.getComputedStyle(el,'');if(computed){value=computed[toCamel(property)];}
|
||||
return el.style[property]||value;};}else if(document.documentElement.currentStyle&&isIE){getStyle=function(el,property){switch(toCamel(property)){case'opacity':var val=100;try{val=el.filters['DXImageTransform.Microsoft.Alpha'].opacity;}catch(e){try{val=el.filters('alpha').opacity;}catch(e){}}
|
||||
return val/100;break;case'float':property='styleFloat';default:var value=el.currentStyle?el.currentStyle[property]:null;return(el.style[property]||value);}};}else{getStyle=function(el,property){return el.style[property];};}
|
||||
if(isIE){setStyle=function(el,property,val){switch(property){case'opacity':if(YAHOO.lang.isString(el.style.filter)){el.style.filter='alpha(opacity='+val*100+')';if(!el.currentStyle||!el.currentStyle.hasLayout){el.style.zoom=1;}}
|
||||
break;case'float':property='styleFloat';default:el.style[property]=val;}};}else{setStyle=function(el,property,val){if(property=='float'){property='cssFloat';}
|
||||
el.style[property]=val;};}
|
||||
YAHOO.util.Dom={get:function(el){if(YAHOO.lang.isString(el)){return document.getElementById(el);}
|
||||
if(YAHOO.lang.isArray(el)){var c=[];for(var i=0,len=el.length;i<len;++i){c[c.length]=Y.Dom.get(el[i]);}
|
||||
return c;}
|
||||
if(el){return el;}
|
||||
return null;},getStyle:function(el,property){property=toCamel(property);var f=function(element){return getStyle(element,property);};return Y.Dom.batch(el,f,Y.Dom,true);},setStyle:function(el,property,val){property=toCamel(property);var f=function(element){setStyle(element,property,val);};Y.Dom.batch(el,f,Y.Dom,true);},getXY:function(el){var f=function(el){if((el.parentNode===null||el.offsetParent===null||this.getStyle(el,'display')=='none')&&el!=document.body){return false;}
|
||||
var parentNode=null;var pos=[];var box;if(el.getBoundingClientRect){box=el.getBoundingClientRect();var doc=document;if(!this.inDocument(el)&&parent.document!=document){doc=parent.document;if(!this.isAncestor(doc.documentElement,el)){return false;}}
|
||||
var scrollTop=Math.max(doc.documentElement.scrollTop,doc.body.scrollTop);var scrollLeft=Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft);return[box.left+scrollLeft,box.top+scrollTop];}
|
||||
else{pos=[el.offsetLeft,el.offsetTop];parentNode=el.offsetParent;var hasAbs=this.getStyle(el,'position')=='absolute';if(parentNode!=el){while(parentNode){pos[0]+=parentNode.offsetLeft;pos[1]+=parentNode.offsetTop;if(isSafari&&!hasAbs&&this.getStyle(parentNode,'position')=='absolute'){hasAbs=true;}
|
||||
parentNode=parentNode.offsetParent;}}
|
||||
if(isSafari&&hasAbs){pos[0]-=document.body.offsetLeft;pos[1]-=document.body.offsetTop;}}
|
||||
parentNode=el.parentNode;while(parentNode.tagName&&!patterns.ROOT_TAG.test(parentNode.tagName))
|
||||
{if(Y.Dom.getStyle(parentNode,'display')!='inline'){pos[0]-=parentNode.scrollLeft;pos[1]-=parentNode.scrollTop;}
|
||||
parentNode=parentNode.parentNode;}
|
||||
return pos;};return Y.Dom.batch(el,f,Y.Dom,true);},getX:function(el){var f=function(el){return Y.Dom.getXY(el)[0];};return Y.Dom.batch(el,f,Y.Dom,true);},getY:function(el){var f=function(el){return Y.Dom.getXY(el)[1];};return Y.Dom.batch(el,f,Y.Dom,true);},setXY:function(el,pos,noRetry){var f=function(el){var style_pos=this.getStyle(el,'position');if(style_pos=='static'){this.setStyle(el,'position','relative');style_pos='relative';}
|
||||
var pageXY=this.getXY(el);if(pageXY===false){return false;}
|
||||
var delta=[parseInt(this.getStyle(el,'left'),10),parseInt(this.getStyle(el,'top'),10)];if(isNaN(delta[0])){delta[0]=(style_pos=='relative')?0:el.offsetLeft;}
|
||||
if(isNaN(delta[1])){delta[1]=(style_pos=='relative')?0:el.offsetTop;}
|
||||
if(pos[0]!==null){el.style.left=pos[0]-pageXY[0]+delta[0]+'px';}
|
||||
if(pos[1]!==null){el.style.top=pos[1]-pageXY[1]+delta[1]+'px';}
|
||||
if(!noRetry){var newXY=this.getXY(el);if((pos[0]!==null&&newXY[0]!=pos[0])||(pos[1]!==null&&newXY[1]!=pos[1])){this.setXY(el,pos,true);}}};Y.Dom.batch(el,f,Y.Dom,true);},setX:function(el,x){Y.Dom.setXY(el,[x,null]);},setY:function(el,y){Y.Dom.setXY(el,[null,y]);},getRegion:function(el){var f=function(el){var region=new Y.Region.getRegion(el);return region;};return Y.Dom.batch(el,f,Y.Dom,true);},getClientWidth:function(){return Y.Dom.getViewportWidth();},getClientHeight:function(){return Y.Dom.getViewportHeight();},getElementsByClassName:function(className,tag,root){var method=function(el){return Y.Dom.hasClass(el,className);};return Y.Dom.getElementsBy(method,tag,root);},hasClass:function(el,className){var re=new RegExp('(?:^|\\s+)'+className+'(?:\\s+|$)');var f=function(el){return re.test(el.className);};return Y.Dom.batch(el,f,Y.Dom,true);},addClass:function(el,className){var f=function(el){if(this.hasClass(el,className)){return;}
|
||||
el.className=[el.className,className].join(' ');};Y.Dom.batch(el,f,Y.Dom,true);},removeClass:function(el,className){var re=new RegExp('(?:^|\\s+)'+className+'(?:\\s+|$)','g');var f=function(el){if(!this.hasClass(el,className)){return;}
|
||||
var c=el.className;el.className=c.replace(re,' ');if(this.hasClass(el,className)){this.removeClass(el,className);}};Y.Dom.batch(el,f,Y.Dom,true);},replaceClass:function(el,oldClassName,newClassName){if(oldClassName===newClassName){return false;}
|
||||
var re=new RegExp('(?:^|\\s+)'+oldClassName+'(?:\\s+|$)','g');var f=function(el){if(!this.hasClass(el,oldClassName)){this.addClass(el,newClassName);return;}
|
||||
el.className=el.className.replace(re,' '+newClassName+' ');if(this.hasClass(el,oldClassName)){this.replaceClass(el,oldClassName,newClassName);}};Y.Dom.batch(el,f,Y.Dom,true);},generateId:function(el,prefix){prefix=prefix||'yui-gen';el=el||{};var f=function(el){if(el){el=Y.Dom.get(el);}else{el={};}
|
||||
if(!el.id){el.id=prefix+id_counter++;}
|
||||
return el.id;};return Y.Dom.batch(el,f,Y.Dom,true);},isAncestor:function(haystack,needle){haystack=Y.Dom.get(haystack);if(!haystack||!needle){return false;}
|
||||
var f=function(needle){if(haystack.contains&&!isSafari){return haystack.contains(needle);}
|
||||
else if(haystack.compareDocumentPosition){return!!(haystack.compareDocumentPosition(needle)&16);}
|
||||
else{var parent=needle.parentNode;while(parent){if(parent==haystack){return true;}
|
||||
else if(!parent.tagName||parent.tagName.toUpperCase()=='HTML'){return false;}
|
||||
parent=parent.parentNode;}
|
||||
return false;}};return Y.Dom.batch(needle,f,Y.Dom,true);},inDocument:function(el){var f=function(el){return this.isAncestor(document.documentElement,el);};return Y.Dom.batch(el,f,Y.Dom,true);},getElementsBy:function(method,tag,root){tag=tag||'*';var nodes=[];if(root){root=Y.Dom.get(root);if(!root){return nodes;}}else{root=document;}
|
||||
var elements=root.getElementsByTagName(tag);if(!elements.length&&(tag=='*'&&root.all)){elements=root.all;}
|
||||
for(var i=0,len=elements.length;i<len;++i){if(method(elements[i])){nodes[nodes.length]=elements[i];}}
|
||||
return nodes;},batch:function(el,method,o,override){var id=el;el=Y.Dom.get(el);var scope=(override)?o:window;if(!el||el.tagName||!el.length){if(!el){return false;}
|
||||
return method.call(scope,el,o);}
|
||||
var collection=[];for(var i=0,len=el.length;i<len;++i){if(!el[i]){id=el[i];}
|
||||
collection[collection.length]=method.call(scope,el[i],o);}
|
||||
return collection;},getDocumentHeight:function(){var scrollHeight=(document.compatMode!='CSS1Compat')?document.body.scrollHeight:document.documentElement.scrollHeight;var h=Math.max(scrollHeight,Y.Dom.getViewportHeight());return h;},getDocumentWidth:function(){var scrollWidth=(document.compatMode!='CSS1Compat')?document.body.scrollWidth:document.documentElement.scrollWidth;var w=Math.max(scrollWidth,Y.Dom.getViewportWidth());return w;},getViewportHeight:function(){var height=self.innerHeight;var mode=document.compatMode;if((mode||isIE)&&!isOpera){height=(mode=='CSS1Compat')?document.documentElement.clientHeight:document.body.clientHeight;}
|
||||
return height;},getViewportWidth:function(){var width=self.innerWidth;var mode=document.compatMode;if(mode||isIE){width=(mode=='CSS1Compat')?document.documentElement.clientWidth:document.body.clientWidth;}
|
||||
return width;}};})();YAHOO.util.Region=function(t,r,b,l){this.top=t;this[1]=t;this.right=r;this.bottom=b;this.left=l;this[0]=l;};YAHOO.util.Region.prototype.contains=function(region){return(region.left>=this.left&®ion.right<=this.right&®ion.top>=this.top&®ion.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(region){var t=Math.max(this.top,region.top);var r=Math.min(this.right,region.right);var b=Math.min(this.bottom,region.bottom);var l=Math.max(this.left,region.left);if(b>=t&&r>=l){return new YAHOO.util.Region(t,r,b,l);}else{return null;}};YAHOO.util.Region.prototype.union=function(region){var t=Math.min(this.top,region.top);var r=Math.max(this.right,region.right);var b=Math.max(this.bottom,region.bottom);var l=Math.min(this.left,region.left);return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Region.prototype.toString=function(){return("Region {"+"top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+"}");};YAHOO.util.Region.getRegion=function(el){var p=YAHOO.util.Dom.getXY(el);var t=p[1];var r=p[0]+el.offsetWidth;var b=p[1]+el.offsetHeight;var l=p[0];return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Point=function(x,y){if(x instanceof Array){y=x[1];x=x[0];}
|
||||
this.x=this.right=this.left=this[0]=x;this.y=this.top=this.bottom=this[1]=y;};YAHOO.util.Point.prototype=new YAHOO.util.Region();YAHOO.register("dom",YAHOO.util.Dom,{version:"2.2.2",build:"204"});
|
||||
917
www/extras/yui/build/dom/dom.js
vendored
|
|
@ -1,917 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 2.2.2
|
||||
*/
|
||||
/**
|
||||
* The dom module provides helper methods for manipulating Dom elements.
|
||||
* @module dom
|
||||
*
|
||||
*/
|
||||
|
||||
(function() {
|
||||
var Y = YAHOO.util, // internal shorthand
|
||||
getStyle, // for load time browser branching
|
||||
setStyle, // ditto
|
||||
id_counter = 0, // for use with generateId
|
||||
propertyCache = {}; // for faster hyphen converts
|
||||
|
||||
// brower detection
|
||||
var ua = navigator.userAgent.toLowerCase(),
|
||||
isOpera = (ua.indexOf('opera') > -1),
|
||||
isSafari = (ua.indexOf('safari') > -1),
|
||||
isGecko = (!isOpera && !isSafari && ua.indexOf('gecko') > -1),
|
||||
isIE = (!isOpera && ua.indexOf('msie') > -1);
|
||||
|
||||
// regex cache
|
||||
var patterns = {
|
||||
HYPHEN: /(-[a-z])/i, // to normalize get/setStyle
|
||||
ROOT_TAG: /body|html/i // body for quirks mode, html for standards
|
||||
};
|
||||
|
||||
var toCamel = function(property) {
|
||||
if ( !patterns.HYPHEN.test(property) ) {
|
||||
return property; // no hyphens
|
||||
}
|
||||
|
||||
if (propertyCache[property]) { // already converted
|
||||
return propertyCache[property];
|
||||
}
|
||||
|
||||
var converted = property;
|
||||
|
||||
while( patterns.HYPHEN.exec(converted) ) {
|
||||
converted = converted.replace(RegExp.$1,
|
||||
RegExp.$1.substr(1).toUpperCase());
|
||||
}
|
||||
|
||||
propertyCache[property] = converted;
|
||||
return converted;
|
||||
//return property.replace(/-([a-z])/gi, function(m0, m1) {return m1.toUpperCase()}) // cant use function as 2nd arg yet due to safari bug
|
||||
};
|
||||
|
||||
// branching at load instead of runtime
|
||||
if (document.defaultView && document.defaultView.getComputedStyle) { // W3C DOM method
|
||||
getStyle = function(el, property) {
|
||||
var value = null;
|
||||
|
||||
if (property == 'float') { // fix reserved word
|
||||
property = 'cssFloat';
|
||||
}
|
||||
|
||||
var computed = document.defaultView.getComputedStyle(el, '');
|
||||
if (computed) { // test computed before touching for safari
|
||||
value = computed[toCamel(property)];
|
||||
}
|
||||
|
||||
return el.style[property] || value;
|
||||
};
|
||||
} else if (document.documentElement.currentStyle && isIE) { // IE method
|
||||
getStyle = function(el, property) {
|
||||
switch( toCamel(property) ) {
|
||||
case 'opacity' :// IE opacity uses filter
|
||||
var val = 100;
|
||||
try { // will error if no DXImageTransform
|
||||
val = el.filters['DXImageTransform.Microsoft.Alpha'].opacity;
|
||||
|
||||
} catch(e) {
|
||||
try { // make sure its in the document
|
||||
val = el.filters('alpha').opacity;
|
||||
} catch(e) {
|
||||
}
|
||||
}
|
||||
return val / 100;
|
||||
break;
|
||||
case 'float': // fix reserved word
|
||||
property = 'styleFloat'; // fall through
|
||||
default:
|
||||
// test currentStyle before touching
|
||||
var value = el.currentStyle ? el.currentStyle[property] : null;
|
||||
return ( el.style[property] || value );
|
||||
}
|
||||
};
|
||||
} else { // default to inline only
|
||||
getStyle = function(el, property) { return el.style[property]; };
|
||||
}
|
||||
|
||||
if (isIE) {
|
||||
setStyle = function(el, property, val) {
|
||||
switch (property) {
|
||||
case 'opacity':
|
||||
if ( YAHOO.lang.isString(el.style.filter) ) { // in case not appended
|
||||
el.style.filter = 'alpha(opacity=' + val * 100 + ')';
|
||||
|
||||
if (!el.currentStyle || !el.currentStyle.hasLayout) {
|
||||
el.style.zoom = 1; // when no layout or cant tell
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'float':
|
||||
property = 'styleFloat';
|
||||
default:
|
||||
el.style[property] = val;
|
||||
}
|
||||
};
|
||||
} else {
|
||||
setStyle = function(el, property, val) {
|
||||
if (property == 'float') {
|
||||
property = 'cssFloat';
|
||||
}
|
||||
el.style[property] = val;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides helper methods for DOM elements.
|
||||
* @namespace YAHOO.util
|
||||
* @class Dom
|
||||
*/
|
||||
YAHOO.util.Dom = {
|
||||
/**
|
||||
* Returns an HTMLElement reference.
|
||||
* @method get
|
||||
* @param {String | HTMLElement |Array} el Accepts a string to use as an ID for getting a DOM reference, an actual DOM reference, or an Array of IDs and/or HTMLElements.
|
||||
* @return {HTMLElement | Array} A DOM reference to an HTML element or an array of HTMLElements.
|
||||
*/
|
||||
get: function(el) {
|
||||
if ( YAHOO.lang.isString(el) ) { // ID
|
||||
return document.getElementById(el);
|
||||
}
|
||||
|
||||
if ( YAHOO.lang.isArray(el) ) { // Array of IDs and/or HTMLElements
|
||||
var c = [];
|
||||
for (var i = 0, len = el.length; i < len; ++i) {
|
||||
c[c.length] = Y.Dom.get(el[i]);
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
if (el) { // assuming HTMLElement or HTMLCollection, just pass back
|
||||
return el;
|
||||
}
|
||||
|
||||
return null; // el is likely null or undefined
|
||||
},
|
||||
|
||||
/**
|
||||
* Normalizes currentStyle and ComputedStyle.
|
||||
* @method getStyle
|
||||
* @param {String | HTMLElement |Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
|
||||
* @param {String} property The style property whose value is returned.
|
||||
* @return {String | Array} The current value of the style property for the element(s).
|
||||
*/
|
||||
getStyle: function(el, property) {
|
||||
property = toCamel(property);
|
||||
|
||||
var f = function(element) {
|
||||
return getStyle(element, property);
|
||||
};
|
||||
|
||||
return Y.Dom.batch(el, f, Y.Dom, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Wrapper for setting style properties of HTMLElements. Normalizes "opacity" across modern browsers.
|
||||
* @method setStyle
|
||||
* @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
|
||||
* @param {String} property The style property to be set.
|
||||
* @param {String} val The value to apply to the given property.
|
||||
*/
|
||||
setStyle: function(el, property, val) {
|
||||
property = toCamel(property);
|
||||
|
||||
var f = function(element) {
|
||||
setStyle(element, property, val);
|
||||
|
||||
};
|
||||
|
||||
Y.Dom.batch(el, f, Y.Dom, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the current position of an element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
|
||||
* @method getXY
|
||||
* @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
|
||||
* @return {Array} The XY position of the element(s)
|
||||
*/
|
||||
getXY: function(el) {
|
||||
var f = function(el) {
|
||||
|
||||
// has to be part of document to have pageXY
|
||||
if ( (el.parentNode === null || el.offsetParent === null ||
|
||||
this.getStyle(el, 'display') == 'none') && el != document.body) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var parentNode = null;
|
||||
var pos = [];
|
||||
var box;
|
||||
|
||||
if (el.getBoundingClientRect) { // IE
|
||||
box = el.getBoundingClientRect();
|
||||
var doc = document;
|
||||
if ( !this.inDocument(el) && parent.document != document) {// might be in a frame, need to get its scroll
|
||||
doc = parent.document;
|
||||
|
||||
if ( !this.isAncestor(doc.documentElement, el) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var scrollTop = Math.max(doc.documentElement.scrollTop, doc.body.scrollTop);
|
||||
var scrollLeft = Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft);
|
||||
|
||||
return [box.left + scrollLeft, box.top + scrollTop];
|
||||
}
|
||||
else { // safari, opera, & gecko
|
||||
pos = [el.offsetLeft, el.offsetTop];
|
||||
parentNode = el.offsetParent;
|
||||
|
||||
// safari: if el is abs or any parent is abs, subtract body offsets
|
||||
var hasAbs = this.getStyle(el, 'position') == 'absolute';
|
||||
|
||||
if (parentNode != el) {
|
||||
while (parentNode) {
|
||||
pos[0] += parentNode.offsetLeft;
|
||||
pos[1] += parentNode.offsetTop;
|
||||
if (isSafari && !hasAbs &&
|
||||
this.getStyle(parentNode,'position') == 'absolute' ) {
|
||||
hasAbs = true; // we need to offset if any parent is absolutely positioned
|
||||
}
|
||||
parentNode = parentNode.offsetParent;
|
||||
}
|
||||
}
|
||||
|
||||
if (isSafari && hasAbs) { //safari doubles in this case
|
||||
pos[0] -= document.body.offsetLeft;
|
||||
pos[1] -= document.body.offsetTop;
|
||||
}
|
||||
}
|
||||
|
||||
parentNode = el.parentNode;
|
||||
|
||||
// account for any scrolled ancestors
|
||||
while ( parentNode.tagName && !patterns.ROOT_TAG.test(parentNode.tagName) )
|
||||
{
|
||||
// work around opera inline scrollLeft/Top bug
|
||||
if (Y.Dom.getStyle(parentNode, 'display') != 'inline') {
|
||||
pos[0] -= parentNode.scrollLeft;
|
||||
pos[1] -= parentNode.scrollTop;
|
||||
}
|
||||
|
||||
parentNode = parentNode.parentNode;
|
||||
}
|
||||
|
||||
|
||||
return pos;
|
||||
};
|
||||
|
||||
return Y.Dom.batch(el, f, Y.Dom, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the current X position of an element based on page coordinates. The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
|
||||
* @method getX
|
||||
* @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
|
||||
* @return {String | Array} The X position of the element(s)
|
||||
*/
|
||||
getX: function(el) {
|
||||
var f = function(el) {
|
||||
return Y.Dom.getXY(el)[0];
|
||||
};
|
||||
|
||||
return Y.Dom.batch(el, f, Y.Dom, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the current Y position of an element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
|
||||
* @method getY
|
||||
* @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
|
||||
* @return {String | Array} The Y position of the element(s)
|
||||
*/
|
||||
getY: function(el) {
|
||||
var f = function(el) {
|
||||
return Y.Dom.getXY(el)[1];
|
||||
};
|
||||
|
||||
return Y.Dom.batch(el, f, Y.Dom, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Set the position of an html element in page coordinates, regardless of how the element is positioned.
|
||||
* The element(s) must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
|
||||
* @method setXY
|
||||
* @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements
|
||||
* @param {Array} pos Contains X & Y values for new position (coordinates are page-based)
|
||||
* @param {Boolean} noRetry By default we try and set the position a second time if the first fails
|
||||
*/
|
||||
setXY: function(el, pos, noRetry) {
|
||||
var f = function(el) {
|
||||
var style_pos = this.getStyle(el, 'position');
|
||||
if (style_pos == 'static') { // default to relative
|
||||
this.setStyle(el, 'position', 'relative');
|
||||
style_pos = 'relative';
|
||||
}
|
||||
|
||||
var pageXY = this.getXY(el);
|
||||
if (pageXY === false) { // has to be part of doc to have pageXY
|
||||
return false;
|
||||
}
|
||||
|
||||
var delta = [ // assuming pixels; if not we will have to retry
|
||||
parseInt( this.getStyle(el, 'left'), 10 ),
|
||||
parseInt( this.getStyle(el, 'top'), 10 )
|
||||
];
|
||||
|
||||
if ( isNaN(delta[0]) ) {// in case of 'auto'
|
||||
delta[0] = (style_pos == 'relative') ? 0 : el.offsetLeft;
|
||||
}
|
||||
if ( isNaN(delta[1]) ) { // in case of 'auto'
|
||||
delta[1] = (style_pos == 'relative') ? 0 : el.offsetTop;
|
||||
}
|
||||
|
||||
if (pos[0] !== null) { el.style.left = pos[0] - pageXY[0] + delta[0] + 'px'; }
|
||||
if (pos[1] !== null) { el.style.top = pos[1] - pageXY[1] + delta[1] + 'px'; }
|
||||
|
||||
if (!noRetry) {
|
||||
var newXY = this.getXY(el);
|
||||
|
||||
// if retry is true, try one more time if we miss
|
||||
if ( (pos[0] !== null && newXY[0] != pos[0]) ||
|
||||
(pos[1] !== null && newXY[1] != pos[1]) ) {
|
||||
this.setXY(el, pos, true);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Y.Dom.batch(el, f, Y.Dom, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Set the X position of an html element in page coordinates, regardless of how the element is positioned.
|
||||
* The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
|
||||
* @method setX
|
||||
* @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
|
||||
* @param {Int} x The value to use as the X coordinate for the element(s).
|
||||
*/
|
||||
setX: function(el, x) {
|
||||
Y.Dom.setXY(el, [x, null]);
|
||||
},
|
||||
|
||||
/**
|
||||
* Set the Y position of an html element in page coordinates, regardless of how the element is positioned.
|
||||
* The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
|
||||
* @method setY
|
||||
* @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
|
||||
* @param {Int} x To use as the Y coordinate for the element(s).
|
||||
*/
|
||||
setY: function(el, y) {
|
||||
Y.Dom.setXY(el, [null, y]);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the region position of the given element.
|
||||
* The element must be part of the DOM tree to have a region (display:none or elements not appended return false).
|
||||
* @method getRegion
|
||||
* @param {String | HTMLElement | Array} el Accepts a string to use as an ID, an actual DOM reference, or an Array of IDs and/or HTMLElements.
|
||||
* @return {Region | Array} A Region or array of Region instances containing "top, left, bottom, right" member data.
|
||||
*/
|
||||
getRegion: function(el) {
|
||||
var f = function(el) {
|
||||
var region = new Y.Region.getRegion(el);
|
||||
return region;
|
||||
};
|
||||
|
||||
return Y.Dom.batch(el, f, Y.Dom, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the width of the client (viewport).
|
||||
* @method getClientWidth
|
||||
* @deprecated Now using getViewportWidth. This interface left intact for back compat.
|
||||
* @return {Int} The width of the viewable area of the page.
|
||||
*/
|
||||
getClientWidth: function() {
|
||||
return Y.Dom.getViewportWidth();
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the height of the client (viewport).
|
||||
* @method getClientHeight
|
||||
* @deprecated Now using getViewportHeight. This interface left intact for back compat.
|
||||
* @return {Int} The height of the viewable area of the page.
|
||||
*/
|
||||
getClientHeight: function() {
|
||||
return Y.Dom.getViewportHeight();
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a array of HTMLElements with the given class.
|
||||
* For optimized performance, include a tag and/or root node when possible.
|
||||
* @method getElementsByClassName
|
||||
* @param {String} className The class name to match against
|
||||
* @param {String} tag (optional) The tag name of the elements being collected
|
||||
* @param {String | HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point
|
||||
* @return {Array} An array of elements that have the given class name
|
||||
*/
|
||||
getElementsByClassName: function(className, tag, root) {
|
||||
var method = function(el) { return Y.Dom.hasClass(el, className); };
|
||||
return Y.Dom.getElementsBy(method, tag, root);
|
||||
},
|
||||
|
||||
/**
|
||||
* Determines whether an HTMLElement has the given className.
|
||||
* @method hasClass
|
||||
* @param {String | HTMLElement | Array} el The element or collection to test
|
||||
* @param {String} className the class name to search for
|
||||
* @return {Boolean | Array} A boolean value or array of boolean values
|
||||
*/
|
||||
hasClass: function(el, className) {
|
||||
var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)');
|
||||
|
||||
var f = function(el) {
|
||||
return re.test(el.className);
|
||||
};
|
||||
|
||||
return Y.Dom.batch(el, f, Y.Dom, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Adds a class name to a given element or collection of elements.
|
||||
* @method addClass
|
||||
* @param {String | HTMLElement | Array} el The element or collection to add the class to
|
||||
* @param {String} className the class name to add to the class attribute
|
||||
*/
|
||||
addClass: function(el, className) {
|
||||
var f = function(el) {
|
||||
if (this.hasClass(el, className)) { return; } // already present
|
||||
|
||||
|
||||
el.className = [el.className, className].join(' ');
|
||||
};
|
||||
|
||||
Y.Dom.batch(el, f, Y.Dom, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Removes a class name from a given element or collection of elements.
|
||||
* @method removeClass
|
||||
* @param {String | HTMLElement | Array} el The element or collection to remove the class from
|
||||
* @param {String} className the class name to remove from the class attribute
|
||||
*/
|
||||
removeClass: function(el, className) {
|
||||
var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)', 'g');
|
||||
|
||||
var f = function(el) {
|
||||
if (!this.hasClass(el, className)) {
|
||||
return; // not present
|
||||
}
|
||||
|
||||
|
||||
var c = el.className;
|
||||
el.className = c.replace(re, ' ');
|
||||
if ( this.hasClass(el, className) ) { // in case of multiple adjacent
|
||||
this.removeClass(el, className);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Y.Dom.batch(el, f, Y.Dom, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Replace a class with another class for a given element or collection of elements.
|
||||
* If no oldClassName is present, the newClassName is simply added.
|
||||
* @method replaceClass
|
||||
* @param {String | HTMLElement | Array} el The element or collection to remove the class from
|
||||
* @param {String} oldClassName the class name to be replaced
|
||||
* @param {String} newClassName the class name that will be replacing the old class name
|
||||
*/
|
||||
replaceClass: function(el, oldClassName, newClassName) {
|
||||
if (oldClassName === newClassName) { // avoid infinite loop
|
||||
return false;
|
||||
}
|
||||
|
||||
var re = new RegExp('(?:^|\\s+)' + oldClassName + '(?:\\s+|$)', 'g');
|
||||
|
||||
var f = function(el) {
|
||||
|
||||
if ( !this.hasClass(el, oldClassName) ) {
|
||||
this.addClass(el, newClassName); // just add it if nothing to replace
|
||||
return; // note return
|
||||
}
|
||||
|
||||
el.className = el.className.replace(re, ' ' + newClassName + ' ');
|
||||
|
||||
if ( this.hasClass(el, oldClassName) ) { // in case of multiple adjacent
|
||||
this.replaceClass(el, oldClassName, newClassName);
|
||||
}
|
||||
};
|
||||
|
||||
Y.Dom.batch(el, f, Y.Dom, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Generates a unique ID
|
||||
* @method generateId
|
||||
* @param {String | HTMLElement | Array} el (optional) An optional element array of elements to add an ID to (no ID is added if one is already present).
|
||||
* @param {String} prefix (optional) an optional prefix to use (defaults to "yui-gen").
|
||||
* @return {String | Array} The generated ID, or array of generated IDs (or original ID if already present on an element)
|
||||
*/
|
||||
generateId: function(el, prefix) {
|
||||
prefix = prefix || 'yui-gen';
|
||||
el = el || {};
|
||||
|
||||
var f = function(el) {
|
||||
if (el) {
|
||||
el = Y.Dom.get(el);
|
||||
} else {
|
||||
el = {}; // just generating ID in this case
|
||||
}
|
||||
|
||||
if (!el.id) {
|
||||
el.id = prefix + id_counter++;
|
||||
} // dont override existing
|
||||
|
||||
|
||||
return el.id;
|
||||
};
|
||||
|
||||
return Y.Dom.batch(el, f, Y.Dom, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Determines whether an HTMLElement is an ancestor of another HTML element in the DOM hierarchy.
|
||||
* @method isAncestor
|
||||
* @param {String | HTMLElement} haystack The possible ancestor
|
||||
* @param {String | HTMLElement} needle The possible descendent
|
||||
* @return {Boolean} Whether or not the haystack is an ancestor of needle
|
||||
*/
|
||||
isAncestor: function(haystack, needle) {
|
||||
haystack = Y.Dom.get(haystack);
|
||||
if (!haystack || !needle) { return false; }
|
||||
|
||||
var f = function(needle) {
|
||||
if (haystack.contains && !isSafari) { // safari "contains" is broken
|
||||
return haystack.contains(needle);
|
||||
}
|
||||
else if ( haystack.compareDocumentPosition ) {
|
||||
return !!(haystack.compareDocumentPosition(needle) & 16);
|
||||
}
|
||||
else { // loop up and test each parent
|
||||
var parent = needle.parentNode;
|
||||
|
||||
while (parent) {
|
||||
if (parent == haystack) {
|
||||
return true;
|
||||
}
|
||||
else if (!parent.tagName || parent.tagName.toUpperCase() == 'HTML') {
|
||||
return false;
|
||||
}
|
||||
|
||||
parent = parent.parentNode;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
return Y.Dom.batch(needle, f, Y.Dom, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Determines whether an HTMLElement is present in the current document.
|
||||
* @method inDocument
|
||||
* @param {String | HTMLElement} el The element to search for
|
||||
* @return {Boolean} Whether or not the element is present in the current document
|
||||
*/
|
||||
inDocument: function(el) {
|
||||
var f = function(el) {
|
||||
return this.isAncestor(document.documentElement, el);
|
||||
};
|
||||
|
||||
return Y.Dom.batch(el, f, Y.Dom, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a array of HTMLElements that pass the test applied by supplied boolean method.
|
||||
* For optimized performance, include a tag and/or root node when possible.
|
||||
* @method getElementsBy
|
||||
* @param {Function} method - A boolean method for testing elements which receives the element as its only argument.
|
||||
|
||||
* @param {String} tag (optional) The tag name of the elements being collected
|
||||
* @param {String | HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point
|
||||
* @return {Array} Array of HTMLElements
|
||||
*/
|
||||
getElementsBy: function(method, tag, root) {
|
||||
tag = tag || '*';
|
||||
|
||||
var nodes = [];
|
||||
|
||||
if (root) {
|
||||
root = Y.Dom.get(root);
|
||||
if (!root) { // if no root node, then no children
|
||||
return nodes;
|
||||
}
|
||||
} else {
|
||||
root = document;
|
||||
}
|
||||
|
||||
var elements = root.getElementsByTagName(tag);
|
||||
|
||||
if ( !elements.length && (tag == '*' && root.all) ) {
|
||||
elements = root.all; // IE < 6
|
||||
}
|
||||
|
||||
for (var i = 0, len = elements.length; i < len; ++i) {
|
||||
if ( method(elements[i]) ) { nodes[nodes.length] = elements[i]; }
|
||||
}
|
||||
|
||||
|
||||
return nodes;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns an array of elements that have had the supplied method applied.
|
||||
* The method is called with the element(s) as the first arg, and the optional param as the second ( method(el, o) ).
|
||||
* @method batch
|
||||
* @param {String | HTMLElement | Array} el (optional) An element or array of elements to apply the method to
|
||||
* @param {Function} method The method to apply to the element(s)
|
||||
* @param {Any} o (optional) An optional arg that is passed to the supplied method
|
||||
* @param {Boolean} override (optional) Whether or not to override the scope of "method" with "o"
|
||||
* @return {HTMLElement | Array} The element(s) with the method applied
|
||||
*/
|
||||
batch: function(el, method, o, override) {
|
||||
var id = el;
|
||||
el = Y.Dom.get(el);
|
||||
|
||||
var scope = (override) ? o : window;
|
||||
|
||||
if (!el || el.tagName || !el.length) { // is null or not a collection (tagName for SELECT and others that can be both an element and a collection)
|
||||
if (!el) {
|
||||
return false;
|
||||
}
|
||||
return method.call(scope, el, o);
|
||||
}
|
||||
|
||||
var collection = [];
|
||||
|
||||
for (var i = 0, len = el.length; i < len; ++i) {
|
||||
if (!el[i]) {
|
||||
id = el[i];
|
||||
}
|
||||
collection[collection.length] = method.call(scope, el[i], o);
|
||||
}
|
||||
|
||||
return collection;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the height of the document.
|
||||
* @method getDocumentHeight
|
||||
* @return {Int} The height of the actual document (which includes the body and its margin).
|
||||
*/
|
||||
getDocumentHeight: function() {
|
||||
var scrollHeight = (document.compatMode != 'CSS1Compat') ? document.body.scrollHeight : document.documentElement.scrollHeight;
|
||||
|
||||
var h = Math.max(scrollHeight, Y.Dom.getViewportHeight());
|
||||
return h;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the width of the document.
|
||||
* @method getDocumentWidth
|
||||
* @return {Int} The width of the actual document (which includes the body and its margin).
|
||||
*/
|
||||
getDocumentWidth: function() {
|
||||
var scrollWidth = (document.compatMode != 'CSS1Compat') ? document.body.scrollWidth : document.documentElement.scrollWidth;
|
||||
var w = Math.max(scrollWidth, Y.Dom.getViewportWidth());
|
||||
return w;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the current height of the viewport.
|
||||
* @method getViewportHeight
|
||||
* @return {Int} The height of the viewable area of the page (excludes scrollbars).
|
||||
*/
|
||||
getViewportHeight: function() {
|
||||
var height = self.innerHeight; // Safari, Opera
|
||||
var mode = document.compatMode;
|
||||
|
||||
if ( (mode || isIE) && !isOpera ) { // IE, Gecko
|
||||
height = (mode == 'CSS1Compat') ?
|
||||
document.documentElement.clientHeight : // Standards
|
||||
document.body.clientHeight; // Quirks
|
||||
}
|
||||
|
||||
return height;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the current width of the viewport.
|
||||
* @method getViewportWidth
|
||||
* @return {Int} The width of the viewable area of the page (excludes scrollbars).
|
||||
*/
|
||||
|
||||
getViewportWidth: function() {
|
||||
var width = self.innerWidth; // Safari
|
||||
var mode = document.compatMode;
|
||||
|
||||
if (mode || isIE) { // IE, Gecko, Opera
|
||||
width = (mode == 'CSS1Compat') ?
|
||||
document.documentElement.clientWidth : // Standards
|
||||
document.body.clientWidth; // Quirks
|
||||
}
|
||||
return width;
|
||||
}
|
||||
};
|
||||
})();
|
||||
/**
|
||||
* A region is a representation of an object on a grid. It is defined
|
||||
* by the top, right, bottom, left extents, so is rectangular by default. If
|
||||
* other shapes are required, this class could be extended to support it.
|
||||
* @namespace YAHOO.util
|
||||
* @class Region
|
||||
* @param {Int} t the top extent
|
||||
* @param {Int} r the right extent
|
||||
* @param {Int} b the bottom extent
|
||||
* @param {Int} l the left extent
|
||||
* @constructor
|
||||
*/
|
||||
YAHOO.util.Region = function(t, r, b, l) {
|
||||
|
||||
/**
|
||||
* The region's top extent
|
||||
* @property top
|
||||
* @type Int
|
||||
*/
|
||||
this.top = t;
|
||||
|
||||
/**
|
||||
* The region's top extent as index, for symmetry with set/getXY
|
||||
* @property 1
|
||||
* @type Int
|
||||
*/
|
||||
this[1] = t;
|
||||
|
||||
/**
|
||||
* The region's right extent
|
||||
* @property right
|
||||
* @type int
|
||||
*/
|
||||
this.right = r;
|
||||
|
||||
/**
|
||||
* The region's bottom extent
|
||||
* @property bottom
|
||||
* @type Int
|
||||
*/
|
||||
this.bottom = b;
|
||||
|
||||
/**
|
||||
* The region's left extent
|
||||
* @property left
|
||||
* @type Int
|
||||
*/
|
||||
this.left = l;
|
||||
|
||||
/**
|
||||
* The region's left extent as index, for symmetry with set/getXY
|
||||
* @property 0
|
||||
* @type Int
|
||||
*/
|
||||
this[0] = l;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns true if this region contains the region passed in
|
||||
* @method contains
|
||||
* @param {Region} region The region to evaluate
|
||||
* @return {Boolean} True if the region is contained with this region,
|
||||
* else false
|
||||
*/
|
||||
YAHOO.util.Region.prototype.contains = function(region) {
|
||||
return ( region.left >= this.left &&
|
||||
region.right <= this.right &&
|
||||
region.top >= this.top &&
|
||||
region.bottom <= this.bottom );
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the area of the region
|
||||
* @method getArea
|
||||
* @return {Int} the region's area
|
||||
*/
|
||||
YAHOO.util.Region.prototype.getArea = function() {
|
||||
return ( (this.bottom - this.top) * (this.right - this.left) );
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the region where the passed in region overlaps with this one
|
||||
* @method intersect
|
||||
* @param {Region} region The region that intersects
|
||||
* @return {Region} The overlap region, or null if there is no overlap
|
||||
*/
|
||||
YAHOO.util.Region.prototype.intersect = function(region) {
|
||||
var t = Math.max( this.top, region.top );
|
||||
var r = Math.min( this.right, region.right );
|
||||
var b = Math.min( this.bottom, region.bottom );
|
||||
var l = Math.max( this.left, region.left );
|
||||
|
||||
if (b >= t && r >= l) {
|
||||
return new YAHOO.util.Region(t, r, b, l);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the region representing the smallest region that can contain both
|
||||
* the passed in region and this region.
|
||||
* @method union
|
||||
* @param {Region} region The region that to create the union with
|
||||
* @return {Region} The union region
|
||||
*/
|
||||
YAHOO.util.Region.prototype.union = function(region) {
|
||||
var t = Math.min( this.top, region.top );
|
||||
var r = Math.max( this.right, region.right );
|
||||
var b = Math.max( this.bottom, region.bottom );
|
||||
var l = Math.min( this.left, region.left );
|
||||
|
||||
return new YAHOO.util.Region(t, r, b, l);
|
||||
};
|
||||
|
||||
/**
|
||||
* toString
|
||||
* @method toString
|
||||
* @return string the region properties
|
||||
*/
|
||||
YAHOO.util.Region.prototype.toString = function() {
|
||||
return ( "Region {" +
|
||||
"top: " + this.top +
|
||||
", right: " + this.right +
|
||||
", bottom: " + this.bottom +
|
||||
", left: " + this.left +
|
||||
"}" );
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a region that is occupied by the DOM element
|
||||
* @method getRegion
|
||||
* @param {HTMLElement} el The element
|
||||
* @return {Region} The region that the element occupies
|
||||
* @static
|
||||
*/
|
||||
YAHOO.util.Region.getRegion = function(el) {
|
||||
var p = YAHOO.util.Dom.getXY(el);
|
||||
|
||||
var t = p[1];
|
||||
var r = p[0] + el.offsetWidth;
|
||||
var b = p[1] + el.offsetHeight;
|
||||
var l = p[0];
|
||||
|
||||
return new YAHOO.util.Region(t, r, b, l);
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/**
|
||||
* A point is a region that is special in that it represents a single point on
|
||||
* the grid.
|
||||
* @namespace YAHOO.util
|
||||
* @class Point
|
||||
* @param {Int} x The X position of the point
|
||||
* @param {Int} y The Y position of the point
|
||||
* @constructor
|
||||
* @extends YAHOO.util.Region
|
||||
*/
|
||||
YAHOO.util.Point = function(x, y) {
|
||||
if (x instanceof Array) { // accept output from Dom.getXY
|
||||
y = x[1];
|
||||
x = x[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* The X position of the point, which is also the right, left and index zero (for Dom.getXY symmetry)
|
||||
* @property x
|
||||
* @type Int
|
||||
*/
|
||||
|
||||
this.x = this.right = this.left = this[0] = x;
|
||||
|
||||
/**
|
||||
* The Y position of the point, which is also the top, bottom and index one (for Dom.getXY symmetry)
|
||||
* @property y
|
||||
* @type Int
|
||||
*/
|
||||
this.y = this.top = this.bottom = this[1] = y;
|
||||
};
|
||||
|
||||
YAHOO.util.Point.prototype = new YAHOO.util.Region();
|
||||
|
||||
YAHOO.register("dom", YAHOO.util.Dom, {version: "2.2.2", build: "204"});
|
||||
|
|
@ -1,131 +0,0 @@
|
|||
Drag and Drop Release Notes
|
||||
|
||||
2.2.2
|
||||
* No change
|
||||
|
||||
2.2.1
|
||||
|
||||
* Added YAHOO.util.DragDropMgr.interactionInfo, which is
|
||||
a repository of interaction information accumulated during
|
||||
the current event loop result, and accessible from the
|
||||
handlers for the events.
|
||||
* The region for the dragged element is now cached while
|
||||
processing the drag and drop events
|
||||
* List example supports moving an item to an empty list
|
||||
* Fixed missing html tags in the examples
|
||||
* The debug version now works when included before the logger is included.
|
||||
|
||||
2.2.0
|
||||
|
||||
* onMouseDown event is executed before element positions are calculated
|
||||
* refreshCache refreshes everything if groups array is not provided
|
||||
* setX/setYConstraint doesn't fail when presented ints cast as strings
|
||||
|
||||
0.12.2
|
||||
|
||||
* No change
|
||||
|
||||
0.12.1
|
||||
|
||||
* Added a STRICT_INTERSECT drag and drop interaction mode. This alters the
|
||||
behavior of DDM::getBestMatch. INTERSECT mode first tests the cursor
|
||||
location, and if it is over the target that target wins, otherwise it
|
||||
tests the overlap of the elements. STRICT_INTERSECT mode tests only
|
||||
the overlap, the largest overlap wins.
|
||||
|
||||
* getBestMatch will work for targeted elements that have no overlap.
|
||||
|
||||
0.12.0
|
||||
|
||||
* The logic to determine if a drag should be initiated has been isolated
|
||||
to the clickValidator method. This method can be overridden to provide
|
||||
custom valdiation logic. For example, it is possible to specify hotspots
|
||||
of any dimension or shape. The provided example shows how to make only
|
||||
a circular region in the middle of the element initiate a drag.
|
||||
|
||||
* Added a new drag and drop event: onInvalidDrop. This is executed when
|
||||
the dragged element in dropped in a location without a target. Previously
|
||||
this condition could only detected by implementing handlers for three
|
||||
other events.
|
||||
|
||||
* Now accepts an element reference in lieu of an id. Ids will
|
||||
be generated if the element does not have one.
|
||||
|
||||
* Fixed horizontal autoscroll when scrollTop is zero.
|
||||
|
||||
* Added hasOuterHandles property to bypass the isOverTarget check in the
|
||||
mousedown validation routine. Fixes setOuterHandleElId.
|
||||
|
||||
0.11.4
|
||||
|
||||
* YAHOO.util.DragDropMgr.swapNode now handles adjacent nodes properly
|
||||
|
||||
* Fixed missing variable declarations
|
||||
|
||||
0.11.3
|
||||
|
||||
* Fixed a JavaScript error that would be generated when trying to implement
|
||||
DDProxy using the default settings and a tiny element.
|
||||
|
||||
* Fixed an error that resulted when constraints were applied to DragDrop
|
||||
instances.
|
||||
|
||||
0.11.2
|
||||
|
||||
* Drag and drop will no longer interfere with selecting text on elements
|
||||
that are not involved in drag and drop.
|
||||
|
||||
* The shared drag and drop proxy element now resizes correctly when autoResize
|
||||
is enabled.
|
||||
|
||||
0.11.1
|
||||
|
||||
* Fixes an issue where the setXY cache could get out of sync if the element's
|
||||
offsetParent is changed during onDragDrop.
|
||||
|
||||
0.11.0
|
||||
|
||||
* The Dom.util.setXY calculation for the initial placement of the dragged
|
||||
element is cached during the drag, enhancing the drag performance.
|
||||
|
||||
* DDProxy no longer enforces having a single proxy element for all instances.
|
||||
dragElId can be set in the config object in the constructor. If the
|
||||
element already exists it will use that element, otherwise a new one will
|
||||
be created with that id.
|
||||
|
||||
* DDProxy->borderWidth has been removed. The value is calculated on the fly
|
||||
instead.
|
||||
|
||||
* Added DragDrop->clearTicks and DragDrop->clearConstraints
|
||||
|
||||
* All drag and drop constructors now have an additional, optional parameter
|
||||
call "config". It is an object that can contain properties for a
|
||||
number of configuration settings.
|
||||
|
||||
* Drag and drop will not be disabled for elements that cannot have their
|
||||
location determined.
|
||||
|
||||
* isLegalTarget won't return dd objects that are not targetable.
|
||||
|
||||
* Added DragDrop->removeFromGroup.
|
||||
|
||||
* Constraints are now applied properly when determining which drag and drop
|
||||
events should fire.
|
||||
|
||||
|
||||
0.10.0
|
||||
|
||||
* Improved the performance when in intersect mode
|
||||
|
||||
* It was possible for the drag and drop initialization to be skipped
|
||||
for very slow loading pages. This was fixed.
|
||||
|
||||
* New methods to exclude regions within your drag and drop element:
|
||||
addInvalidHandleId(), addInvalidHandleClass()
|
||||
|
||||
* Added an onAvailable handler that is executed after the initial state is set.
|
||||
|
||||
* Drag and drop is more forgiving when the implementer attempts to create the
|
||||
instance prior to the element being in the document, but after the window
|
||||
load event has fired.
|
||||
|
||||
3126
www/extras/yui/build/dragdrop/dragdrop-debug.js
vendored
94
www/extras/yui/build/dragdrop/dragdrop-min.js
vendored
|
|
@ -1,94 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 2.2.2
|
||||
*/
|
||||
|
||||
if(!YAHOO.util.DragDropMgr){YAHOO.util.DragDropMgr=function(){var Event=YAHOO.util.Event;return{ids:{},handleIds:{},dragCurrent:null,dragOvers:{},deltaX:0,deltaY:0,preventDefault:true,stopPropagation:true,initalized:false,locked:false,interactionInfo:null,init:function(){this.initialized=true;},POINT:0,INTERSECT:1,STRICT_INTERSECT:2,mode:0,_execOnAll:function(sMethod,args){for(var i in this.ids){for(var j in this.ids[i]){var oDD=this.ids[i][j];if(!this.isTypeOfDD(oDD)){continue;}
|
||||
oDD[sMethod].apply(oDD,args);}}},_onLoad:function(){this.init();Event.on(document,"mouseup",this.handleMouseUp,this,true);Event.on(document,"mousemove",this.handleMouseMove,this,true);Event.on(window,"unload",this._onUnload,this,true);Event.on(window,"resize",this._onResize,this,true);},_onResize:function(e){this._execOnAll("resetConstraints",[]);},lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isLocked:function(){return this.locked;},locationCache:{},useCache:true,clickPixelThresh:3,clickTimeThresh:1000,dragThreshMet:false,clickTimeout:null,startX:0,startY:0,regDragDrop:function(oDD,sGroup){if(!this.initialized){this.init();}
|
||||
if(!this.ids[sGroup]){this.ids[sGroup]={};}
|
||||
this.ids[sGroup][oDD.id]=oDD;},removeDDFromGroup:function(oDD,sGroup){if(!this.ids[sGroup]){this.ids[sGroup]={};}
|
||||
var obj=this.ids[sGroup];if(obj&&obj[oDD.id]){delete obj[oDD.id];}},_remove:function(oDD){for(var g in oDD.groups){if(g&&this.ids[g][oDD.id]){delete this.ids[g][oDD.id];}}
|
||||
delete this.handleIds[oDD.id];},regHandle:function(sDDId,sHandleId){if(!this.handleIds[sDDId]){this.handleIds[sDDId]={};}
|
||||
this.handleIds[sDDId][sHandleId]=sHandleId;},isDragDrop:function(id){return(this.getDDById(id))?true:false;},getRelated:function(p_oDD,bTargetsOnly){var oDDs=[];for(var i in p_oDD.groups){for(j in this.ids[i]){var dd=this.ids[i][j];if(!this.isTypeOfDD(dd)){continue;}
|
||||
if(!bTargetsOnly||dd.isTarget){oDDs[oDDs.length]=dd;}}}
|
||||
return oDDs;},isLegalTarget:function(oDD,oTargetDD){var targets=this.getRelated(oDD,true);for(var i=0,len=targets.length;i<len;++i){if(targets[i].id==oTargetDD.id){return true;}}
|
||||
return false;},isTypeOfDD:function(oDD){return(oDD&&oDD.__ygDragDrop);},isHandle:function(sDDId,sHandleId){return(this.handleIds[sDDId]&&this.handleIds[sDDId][sHandleId]);},getDDById:function(id){for(var i in this.ids){if(this.ids[i][id]){return this.ids[i][id];}}
|
||||
return null;},handleMouseDown:function(e,oDD){this.currentTarget=YAHOO.util.Event.getTarget(e);this.dragCurrent=oDD;var el=oDD.getEl();this.startX=YAHOO.util.Event.getPageX(e);this.startY=YAHOO.util.Event.getPageY(e);this.deltaX=this.startX-el.offsetLeft;this.deltaY=this.startY-el.offsetTop;this.dragThreshMet=false;this.clickTimeout=setTimeout(function(){var DDM=YAHOO.util.DDM;DDM.startDrag(DDM.startX,DDM.startY);},this.clickTimeThresh);},startDrag:function(x,y){clearTimeout(this.clickTimeout);if(this.dragCurrent){this.dragCurrent.b4StartDrag(x,y);this.dragCurrent.startDrag(x,y);}
|
||||
this.dragThreshMet=true;},handleMouseUp:function(e){if(!this.dragCurrent){return;}
|
||||
clearTimeout(this.clickTimeout);if(this.dragThreshMet){this.fireEvents(e,true);}else{}
|
||||
this.stopDrag(e);this.stopEvent(e);},stopEvent:function(e){if(this.stopPropagation){YAHOO.util.Event.stopPropagation(e);}
|
||||
if(this.preventDefault){YAHOO.util.Event.preventDefault(e);}},stopDrag:function(e){if(this.dragCurrent){if(this.dragThreshMet){this.dragCurrent.b4EndDrag(e);this.dragCurrent.endDrag(e);}
|
||||
this.dragCurrent.onMouseUp(e);}
|
||||
this.dragCurrent=null;this.dragOvers={};},handleMouseMove:function(e){if(!this.dragCurrent){return true;}
|
||||
if(YAHOO.util.Event.isIE&&!e.button){this.stopEvent(e);return this.handleMouseUp(e);}
|
||||
if(!this.dragThreshMet){var diffX=Math.abs(this.startX-YAHOO.util.Event.getPageX(e));var diffY=Math.abs(this.startY-YAHOO.util.Event.getPageY(e));if(diffX>this.clickPixelThresh||diffY>this.clickPixelThresh){this.startDrag(this.startX,this.startY);}}
|
||||
if(this.dragThreshMet){this.dragCurrent.b4Drag(e);this.dragCurrent.onDrag(e);this.fireEvents(e,false);}
|
||||
this.stopEvent(e);return true;},fireEvents:function(e,isDrop){var dc=this.dragCurrent;if(!dc||dc.isLocked()){return;}
|
||||
var x=YAHOO.util.Event.getPageX(e);var y=YAHOO.util.Event.getPageY(e);var pt=new YAHOO.util.Point(x,y);var pos=dc.getTargetCoord(pt.x,pt.y);var el=dc.getDragEl();curRegion=new YAHOO.util.Region(pos.y,pos.x+el.offsetWidth,pos.y+el.offsetHeight,pos.x);var oldOvers=[];var outEvts=[];var overEvts=[];var dropEvts=[];var enterEvts=[];for(var i in this.dragOvers){var ddo=this.dragOvers[i];if(!this.isTypeOfDD(ddo)){continue;}
|
||||
if(!this.isOverTarget(pt,ddo,this.mode,curRegion)){outEvts.push(ddo);}
|
||||
oldOvers[i]=true;delete this.dragOvers[i];}
|
||||
for(var sGroup in dc.groups){if("string"!=typeof sGroup){continue;}
|
||||
for(i in this.ids[sGroup]){var oDD=this.ids[sGroup][i];if(!this.isTypeOfDD(oDD)){continue;}
|
||||
if(oDD.isTarget&&!oDD.isLocked()&&oDD!=dc){if(this.isOverTarget(pt,oDD,this.mode,curRegion)){if(isDrop){dropEvts.push(oDD);}else{if(!oldOvers[oDD.id]){enterEvts.push(oDD);}else{overEvts.push(oDD);}
|
||||
this.dragOvers[oDD.id]=oDD;}}}}}
|
||||
this.interactionInfo={out:outEvts,enter:enterEvts,over:overEvts,drop:dropEvts,point:pt,draggedRegion:curRegion,sourceRegion:this.locationCache[dc.id],validDrop:isDrop};if(isDrop&&!dropEvts.length){this.interactionInfo.validDrop=false;dc.onInvalidDrop(e);}
|
||||
if(this.mode){if(outEvts.length){dc.b4DragOut(e,outEvts);dc.onDragOut(e,outEvts);}
|
||||
if(enterEvts.length){dc.onDragEnter(e,enterEvts);}
|
||||
if(overEvts.length){dc.b4DragOver(e,overEvts);dc.onDragOver(e,overEvts);}
|
||||
if(dropEvts.length){dc.b4DragDrop(e,dropEvts);dc.onDragDrop(e,dropEvts);}}else{var len=0;for(i=0,len=outEvts.length;i<len;++i){dc.b4DragOut(e,outEvts[i].id);dc.onDragOut(e,outEvts[i].id);}
|
||||
for(i=0,len=enterEvts.length;i<len;++i){dc.onDragEnter(e,enterEvts[i].id);}
|
||||
for(i=0,len=overEvts.length;i<len;++i){dc.b4DragOver(e,overEvts[i].id);dc.onDragOver(e,overEvts[i].id);}
|
||||
for(i=0,len=dropEvts.length;i<len;++i){dc.b4DragDrop(e,dropEvts[i].id);dc.onDragDrop(e,dropEvts[i].id);}}},getBestMatch:function(dds){var winner=null;var len=dds.length;if(len==1){winner=dds[0];}else{for(var i=0;i<len;++i){var dd=dds[i];if(this.mode==this.INTERSECT&&dd.cursorIsOver){winner=dd;break;}else{if(!winner||!winner.overlap||(dd.overlap&&winner.overlap.getArea()<dd.overlap.getArea())){winner=dd;}}}}
|
||||
return winner;},refreshCache:function(groups){var g=groups||this.ids;for(var sGroup in g){if("string"!=typeof sGroup){continue;}
|
||||
for(var i in this.ids[sGroup]){var oDD=this.ids[sGroup][i];if(this.isTypeOfDD(oDD)){var loc=this.getLocation(oDD);if(loc){this.locationCache[oDD.id]=loc;}else{delete this.locationCache[oDD.id];}}}}},verifyEl:function(el){try{if(el){var parent=el.offsetParent;if(parent){return true;}}}catch(e){}
|
||||
return false;},getLocation:function(oDD){if(!this.isTypeOfDD(oDD)){return null;}
|
||||
var el=oDD.getEl(),pos,x1,x2,y1,y2,t,r,b,l;try{pos=YAHOO.util.Dom.getXY(el);}catch(e){}
|
||||
if(!pos){return null;}
|
||||
x1=pos[0];x2=x1+el.offsetWidth;y1=pos[1];y2=y1+el.offsetHeight;t=y1-oDD.padding[0];r=x2+oDD.padding[1];b=y2+oDD.padding[2];l=x1-oDD.padding[3];return new YAHOO.util.Region(t,r,b,l);},isOverTarget:function(pt,oTarget,intersect,curRegion){var loc=this.locationCache[oTarget.id];if(!loc||!this.useCache){loc=this.getLocation(oTarget);this.locationCache[oTarget.id]=loc;}
|
||||
if(!loc){return false;}
|
||||
oTarget.cursorIsOver=loc.contains(pt);var dc=this.dragCurrent;if(!dc||(!intersect&&!dc.constrainX&&!dc.constrainY)){return oTarget.cursorIsOver;}
|
||||
oTarget.overlap=null;if(!curRegion){var pos=dc.getTargetCoord(pt.x,pt.y);var el=dc.getDragEl();curRegion=new YAHOO.util.Region(pos.y,pos.x+el.offsetWidth,pos.y+el.offsetHeight,pos.x);}
|
||||
var overlap=curRegion.intersect(loc);if(overlap){oTarget.overlap=overlap;return(intersect)?true:oTarget.cursorIsOver;}else{return false;}},_onUnload:function(e,me){this.unregAll();},unregAll:function(){if(this.dragCurrent){this.stopDrag();this.dragCurrent=null;}
|
||||
this._execOnAll("unreg",[]);for(i in this.elementCache){delete this.elementCache[i];}
|
||||
this.elementCache={};this.ids={};},elementCache:{},getElWrapper:function(id){var oWrapper=this.elementCache[id];if(!oWrapper||!oWrapper.el){oWrapper=this.elementCache[id]=new this.ElementWrapper(YAHOO.util.Dom.get(id));}
|
||||
return oWrapper;},getElement:function(id){return YAHOO.util.Dom.get(id);},getCss:function(id){var el=YAHOO.util.Dom.get(id);return(el)?el.style:null;},ElementWrapper:function(el){this.el=el||null;this.id=this.el&&el.id;this.css=this.el&&el.style;},getPosX:function(el){return YAHOO.util.Dom.getX(el);},getPosY:function(el){return YAHOO.util.Dom.getY(el);},swapNode:function(n1,n2){if(n1.swapNode){n1.swapNode(n2);}else{var p=n2.parentNode;var s=n2.nextSibling;if(s==n1){p.insertBefore(n1,n2);}else if(n2==n1.nextSibling){p.insertBefore(n2,n1);}else{n1.parentNode.replaceChild(n2,n1);p.insertBefore(n1,s);}}},getScroll:function(){var t,l,dde=document.documentElement,db=document.body;if(dde&&(dde.scrollTop||dde.scrollLeft)){t=dde.scrollTop;l=dde.scrollLeft;}else if(db){t=db.scrollTop;l=db.scrollLeft;}else{}
|
||||
return{top:t,left:l};},getStyle:function(el,styleProp){return YAHOO.util.Dom.getStyle(el,styleProp);},getScrollTop:function(){return this.getScroll().top;},getScrollLeft:function(){return this.getScroll().left;},moveToEl:function(moveEl,targetEl){var aCoord=YAHOO.util.Dom.getXY(targetEl);YAHOO.util.Dom.setXY(moveEl,aCoord);},getClientHeight:function(){return YAHOO.util.Dom.getViewportHeight();},getClientWidth:function(){return YAHOO.util.Dom.getViewportWidth();},numericSort:function(a,b){return(a-b);},_timeoutCount:0,_addListeners:function(){var DDM=YAHOO.util.DDM;if(YAHOO.util.Event&&document){DDM._onLoad();}else{if(DDM._timeoutCount>2000){}else{setTimeout(DDM._addListeners,10);if(document&&document.body){DDM._timeoutCount+=1;}}}},handleWasClicked:function(node,id){if(this.isHandle(id,node.id)){return true;}else{var p=node.parentNode;while(p){if(this.isHandle(id,p.id)){return true;}else{p=p.parentNode;}}}
|
||||
return false;}};}();YAHOO.util.DDM=YAHOO.util.DragDropMgr;YAHOO.util.DDM._addListeners();}
|
||||
(function(){var Event=YAHOO.util.Event;var Dom=YAHOO.util.Dom;YAHOO.util.DragDrop=function(id,sGroup,config){if(id){this.init(id,sGroup,config);}};YAHOO.util.DragDrop.prototype={id:null,config:null,dragElId:null,handleElId:null,invalidHandleTypes:null,invalidHandleIds:null,invalidHandleClasses:null,startPageX:0,startPageY:0,groups:null,locked:false,lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isTarget:true,padding:null,_domRef:null,__ygDragDrop:true,constrainX:false,constrainY:false,minX:0,maxX:0,minY:0,maxY:0,deltaX:0,deltaY:0,maintainOffset:false,xTicks:null,yTicks:null,primaryButtonOnly:true,available:false,hasOuterHandles:false,b4StartDrag:function(x,y){},startDrag:function(x,y){},b4Drag:function(e){},onDrag:function(e){},onDragEnter:function(e,id){},b4DragOver:function(e){},onDragOver:function(e,id){},b4DragOut:function(e){},onDragOut:function(e,id){},b4DragDrop:function(e){},onDragDrop:function(e,id){},onInvalidDrop:function(e){},b4EndDrag:function(e){},endDrag:function(e){},b4MouseDown:function(e){},onMouseDown:function(e){},onMouseUp:function(e){},onAvailable:function(){},getEl:function(){if(!this._domRef){this._domRef=Dom.get(this.id);}
|
||||
return this._domRef;},getDragEl:function(){return Dom.get(this.dragElId);},init:function(id,sGroup,config){this.initTarget(id,sGroup,config);Event.on(this.id,"mousedown",this.handleMouseDown,this,true);},initTarget:function(id,sGroup,config){this.config=config||{};this.DDM=YAHOO.util.DDM;this.groups={};if(typeof id!=="string"){id=Dom.generateId(id);}
|
||||
this.id=id;this.addToGroup((sGroup)?sGroup:"default");this.handleElId=id;Event.onAvailable(id,this.handleOnAvailable,this,true);this.setDragElId(id);this.invalidHandleTypes={A:"A"};this.invalidHandleIds={};this.invalidHandleClasses=[];this.applyConfig();},applyConfig:function(){this.padding=this.config.padding||[0,0,0,0];this.isTarget=(this.config.isTarget!==false);this.maintainOffset=(this.config.maintainOffset);this.primaryButtonOnly=(this.config.primaryButtonOnly!==false);},handleOnAvailable:function(){this.available=true;this.resetConstraints();this.onAvailable();},setPadding:function(iTop,iRight,iBot,iLeft){if(!iRight&&0!==iRight){this.padding=[iTop,iTop,iTop,iTop];}else if(!iBot&&0!==iBot){this.padding=[iTop,iRight,iTop,iRight];}else{this.padding=[iTop,iRight,iBot,iLeft];}},setInitPosition:function(diffX,diffY){var el=this.getEl();if(!this.DDM.verifyEl(el)){return;}
|
||||
var dx=diffX||0;var dy=diffY||0;var p=Dom.getXY(el);this.initPageX=p[0]-dx;this.initPageY=p[1]-dy;this.lastPageX=p[0];this.lastPageY=p[1];this.setStartPosition(p);},setStartPosition:function(pos){var p=pos||Dom.getXY(this.getEl());this.deltaSetXY=null;this.startPageX=p[0];this.startPageY=p[1];},addToGroup:function(sGroup){this.groups[sGroup]=true;this.DDM.regDragDrop(this,sGroup);},removeFromGroup:function(sGroup){if(this.groups[sGroup]){delete this.groups[sGroup];}
|
||||
this.DDM.removeDDFromGroup(this,sGroup);},setDragElId:function(id){this.dragElId=id;},setHandleElId:function(id){if(typeof id!=="string"){id=Dom.generateId(id);}
|
||||
this.handleElId=id;this.DDM.regHandle(this.id,id);},setOuterHandleElId:function(id){if(typeof id!=="string"){id=Dom.generateId(id);}
|
||||
Event.on(id,"mousedown",this.handleMouseDown,this,true);this.setHandleElId(id);this.hasOuterHandles=true;},unreg:function(){Event.removeListener(this.id,"mousedown",this.handleMouseDown);this._domRef=null;this.DDM._remove(this);},isLocked:function(){return(this.DDM.isLocked()||this.locked);},handleMouseDown:function(e,oDD){var button=e.which||e.button;if(this.primaryButtonOnly&&button>1){return;}
|
||||
if(this.isLocked()){return;}
|
||||
this.b4MouseDown(e);this.onMouseDown(e);this.DDM.refreshCache(this.groups);var pt=new YAHOO.util.Point(Event.getPageX(e),Event.getPageY(e));if(!this.hasOuterHandles&&!this.DDM.isOverTarget(pt,this)){}else{if(this.clickValidator(e)){this.setStartPosition();this.DDM.handleMouseDown(e,this);this.DDM.stopEvent(e);}else{}}},clickValidator:function(e){var target=Event.getTarget(e);return(this.isValidHandleChild(target)&&(this.id==this.handleElId||this.DDM.handleWasClicked(target,this.id)));},getTargetCoord:function(iPageX,iPageY){var x=iPageX-this.deltaX;var y=iPageY-this.deltaY;if(this.constrainX){if(x<this.minX){x=this.minX;}
|
||||
if(x>this.maxX){x=this.maxX;}}
|
||||
if(this.constrainY){if(y<this.minY){y=this.minY;}
|
||||
if(y>this.maxY){y=this.maxY;}}
|
||||
x=this.getTick(x,this.xTicks);y=this.getTick(y,this.yTicks);return{x:x,y:y};},addInvalidHandleType:function(tagName){var type=tagName.toUpperCase();this.invalidHandleTypes[type]=type;},addInvalidHandleId:function(id){if(typeof id!=="string"){id=Dom.generateId(id);}
|
||||
this.invalidHandleIds[id]=id;},addInvalidHandleClass:function(cssClass){this.invalidHandleClasses.push(cssClass);},removeInvalidHandleType:function(tagName){var type=tagName.toUpperCase();delete this.invalidHandleTypes[type];},removeInvalidHandleId:function(id){if(typeof id!=="string"){id=Dom.generateId(id);}
|
||||
delete this.invalidHandleIds[id];},removeInvalidHandleClass:function(cssClass){for(var i=0,len=this.invalidHandleClasses.length;i<len;++i){if(this.invalidHandleClasses[i]==cssClass){delete this.invalidHandleClasses[i];}}},isValidHandleChild:function(node){var valid=true;var nodeName;try{nodeName=node.nodeName.toUpperCase();}catch(e){nodeName=node.nodeName;}
|
||||
valid=valid&&!this.invalidHandleTypes[nodeName];valid=valid&&!this.invalidHandleIds[node.id];for(var i=0,len=this.invalidHandleClasses.length;valid&&i<len;++i){valid=!Dom.hasClass(node,this.invalidHandleClasses[i]);}
|
||||
return valid;},setXTicks:function(iStartX,iTickSize){this.xTicks=[];this.xTickSize=iTickSize;var tickMap={};for(var i=this.initPageX;i>=this.minX;i=i-iTickSize){if(!tickMap[i]){this.xTicks[this.xTicks.length]=i;tickMap[i]=true;}}
|
||||
for(i=this.initPageX;i<=this.maxX;i=i+iTickSize){if(!tickMap[i]){this.xTicks[this.xTicks.length]=i;tickMap[i]=true;}}
|
||||
this.xTicks.sort(this.DDM.numericSort);},setYTicks:function(iStartY,iTickSize){this.yTicks=[];this.yTickSize=iTickSize;var tickMap={};for(var i=this.initPageY;i>=this.minY;i=i-iTickSize){if(!tickMap[i]){this.yTicks[this.yTicks.length]=i;tickMap[i]=true;}}
|
||||
for(i=this.initPageY;i<=this.maxY;i=i+iTickSize){if(!tickMap[i]){this.yTicks[this.yTicks.length]=i;tickMap[i]=true;}}
|
||||
this.yTicks.sort(this.DDM.numericSort);},setXConstraint:function(iLeft,iRight,iTickSize){this.leftConstraint=parseInt(iLeft,10);this.rightConstraint=parseInt(iRight,10);this.minX=this.initPageX-this.leftConstraint;this.maxX=this.initPageX+this.rightConstraint;if(iTickSize){this.setXTicks(this.initPageX,iTickSize);}
|
||||
this.constrainX=true;},clearConstraints:function(){this.constrainX=false;this.constrainY=false;this.clearTicks();},clearTicks:function(){this.xTicks=null;this.yTicks=null;this.xTickSize=0;this.yTickSize=0;},setYConstraint:function(iUp,iDown,iTickSize){this.topConstraint=parseInt(iUp,10);this.bottomConstraint=parseInt(iDown,10);this.minY=this.initPageY-this.topConstraint;this.maxY=this.initPageY+this.bottomConstraint;if(iTickSize){this.setYTicks(this.initPageY,iTickSize);}
|
||||
this.constrainY=true;},resetConstraints:function(){if(this.initPageX||this.initPageX===0){var dx=(this.maintainOffset)?this.lastPageX-this.initPageX:0;var dy=(this.maintainOffset)?this.lastPageY-this.initPageY:0;this.setInitPosition(dx,dy);}else{this.setInitPosition();}
|
||||
if(this.constrainX){this.setXConstraint(this.leftConstraint,this.rightConstraint,this.xTickSize);}
|
||||
if(this.constrainY){this.setYConstraint(this.topConstraint,this.bottomConstraint,this.yTickSize);}},getTick:function(val,tickArray){if(!tickArray){return val;}else if(tickArray[0]>=val){return tickArray[0];}else{for(var i=0,len=tickArray.length;i<len;++i){var next=i+1;if(tickArray[next]&&tickArray[next]>=val){var diff1=val-tickArray[i];var diff2=tickArray[next]-val;return(diff2>diff1)?tickArray[i]:tickArray[next];}}
|
||||
return tickArray[tickArray.length-1];}},toString:function(){return("DragDrop "+this.id);}};})();YAHOO.util.DD=function(id,sGroup,config){if(id){this.init(id,sGroup,config);}};YAHOO.extend(YAHOO.util.DD,YAHOO.util.DragDrop,{scroll:true,autoOffset:function(iPageX,iPageY){var x=iPageX-this.startPageX;var y=iPageY-this.startPageY;this.setDelta(x,y);},setDelta:function(iDeltaX,iDeltaY){this.deltaX=iDeltaX;this.deltaY=iDeltaY;},setDragElPos:function(iPageX,iPageY){var el=this.getDragEl();this.alignElWithMouse(el,iPageX,iPageY);},alignElWithMouse:function(el,iPageX,iPageY){var oCoord=this.getTargetCoord(iPageX,iPageY);if(!this.deltaSetXY){var aCoord=[oCoord.x,oCoord.y];YAHOO.util.Dom.setXY(el,aCoord);var newLeft=parseInt(YAHOO.util.Dom.getStyle(el,"left"),10);var newTop=parseInt(YAHOO.util.Dom.getStyle(el,"top"),10);this.deltaSetXY=[newLeft-oCoord.x,newTop-oCoord.y];}else{YAHOO.util.Dom.setStyle(el,"left",(oCoord.x+this.deltaSetXY[0])+"px");YAHOO.util.Dom.setStyle(el,"top",(oCoord.y+this.deltaSetXY[1])+"px");}
|
||||
this.cachePosition(oCoord.x,oCoord.y);this.autoScroll(oCoord.x,oCoord.y,el.offsetHeight,el.offsetWidth);},cachePosition:function(iPageX,iPageY){if(iPageX){this.lastPageX=iPageX;this.lastPageY=iPageY;}else{var aCoord=YAHOO.util.Dom.getXY(this.getEl());this.lastPageX=aCoord[0];this.lastPageY=aCoord[1];}},autoScroll:function(x,y,h,w){if(this.scroll){var clientH=this.DDM.getClientHeight();var clientW=this.DDM.getClientWidth();var st=this.DDM.getScrollTop();var sl=this.DDM.getScrollLeft();var bot=h+y;var right=w+x;var toBot=(clientH+st-y-this.deltaY);var toRight=(clientW+sl-x-this.deltaX);var thresh=40;var scrAmt=(document.all)?80:30;if(bot>clientH&&toBot<thresh){window.scrollTo(sl,st+scrAmt);}
|
||||
if(y<st&&st>0&&y-st<thresh){window.scrollTo(sl,st-scrAmt);}
|
||||
if(right>clientW&&toRight<thresh){window.scrollTo(sl+scrAmt,st);}
|
||||
if(x<sl&&sl>0&&x-sl<thresh){window.scrollTo(sl-scrAmt,st);}}},applyConfig:function(){YAHOO.util.DD.superclass.applyConfig.call(this);this.scroll=(this.config.scroll!==false);},b4MouseDown:function(e){this.setStartPosition();this.autoOffset(YAHOO.util.Event.getPageX(e),YAHOO.util.Event.getPageY(e));},b4Drag:function(e){this.setDragElPos(YAHOO.util.Event.getPageX(e),YAHOO.util.Event.getPageY(e));},toString:function(){return("DD "+this.id);}});YAHOO.util.DDProxy=function(id,sGroup,config){if(id){this.init(id,sGroup,config);this.initFrame();}};YAHOO.util.DDProxy.dragElId="ygddfdiv";YAHOO.extend(YAHOO.util.DDProxy,YAHOO.util.DD,{resizeFrame:true,centerFrame:false,createFrame:function(){var self=this;var body=document.body;if(!body||!body.firstChild){setTimeout(function(){self.createFrame();},50);return;}
|
||||
var div=this.getDragEl();if(!div){div=document.createElement("div");div.id=this.dragElId;var s=div.style;s.position="absolute";s.visibility="hidden";s.cursor="move";s.border="2px solid #aaa";s.zIndex=999;body.insertBefore(div,body.firstChild);}},initFrame:function(){this.createFrame();},applyConfig:function(){YAHOO.util.DDProxy.superclass.applyConfig.call(this);this.resizeFrame=(this.config.resizeFrame!==false);this.centerFrame=(this.config.centerFrame);this.setDragElId(this.config.dragElId||YAHOO.util.DDProxy.dragElId);},showFrame:function(iPageX,iPageY){var el=this.getEl();var dragEl=this.getDragEl();var s=dragEl.style;this._resizeProxy();if(this.centerFrame){this.setDelta(Math.round(parseInt(s.width,10)/2),Math.round(parseInt(s.height,10)/2));}
|
||||
this.setDragElPos(iPageX,iPageY);YAHOO.util.Dom.setStyle(dragEl,"visibility","visible");},_resizeProxy:function(){if(this.resizeFrame){var DOM=YAHOO.util.Dom;var el=this.getEl();var dragEl=this.getDragEl();var bt=parseInt(DOM.getStyle(dragEl,"borderTopWidth"),10);var br=parseInt(DOM.getStyle(dragEl,"borderRightWidth"),10);var bb=parseInt(DOM.getStyle(dragEl,"borderBottomWidth"),10);var bl=parseInt(DOM.getStyle(dragEl,"borderLeftWidth"),10);if(isNaN(bt)){bt=0;}
|
||||
if(isNaN(br)){br=0;}
|
||||
if(isNaN(bb)){bb=0;}
|
||||
if(isNaN(bl)){bl=0;}
|
||||
var newWidth=Math.max(0,el.offsetWidth-br-bl);var newHeight=Math.max(0,el.offsetHeight-bt-bb);DOM.setStyle(dragEl,"width",newWidth+"px");DOM.setStyle(dragEl,"height",newHeight+"px");}},b4MouseDown:function(e){this.setStartPosition();var x=YAHOO.util.Event.getPageX(e);var y=YAHOO.util.Event.getPageY(e);this.autoOffset(x,y);this.setDragElPos(x,y);},b4StartDrag:function(x,y){this.showFrame(x,y);},b4EndDrag:function(e){YAHOO.util.Dom.setStyle(this.getDragEl(),"visibility","hidden");},endDrag:function(e){var DOM=YAHOO.util.Dom;var lel=this.getEl();var del=this.getDragEl();DOM.setStyle(del,"visibility","");DOM.setStyle(lel,"visibility","hidden");YAHOO.util.DDM.moveToEl(lel,del);DOM.setStyle(del,"visibility","hidden");DOM.setStyle(lel,"visibility","");},toString:function(){return("DDProxy "+this.id);}});YAHOO.util.DDTarget=function(id,sGroup,config){if(id){this.initTarget(id,sGroup,config);}};YAHOO.extend(YAHOO.util.DDTarget,YAHOO.util.DragDrop,{toString:function(){return("DDTarget "+this.id);}});YAHOO.register("dragdrop",YAHOO.util.DragDropMgr,{version:"2.2.2",build:"204"});
|
||||
3018
www/extras/yui/build/dragdrop/dragdrop.js
vendored
|
|
@ -1,16 +0,0 @@
|
|||
Element Release Notes
|
||||
|
||||
** version 2.2.2 ***
|
||||
|
||||
* fixed contentReady timing regression
|
||||
|
||||
*** version 2.2.1 ***
|
||||
|
||||
* Added support for "dblclick", "focus", "blur", and "submit" event (for elements that support them)
|
||||
* Fixed scope correction for addListener/on/subscribe
|
||||
|
||||
*** version 2.2.0 ***
|
||||
|
||||
* beta introduction (broken out of TabView for general use)
|
||||
|
||||
* The Element class provides a wrapper for HTMLElements in the DOM and makes simpler common tasks such as adding listeners, manipulating the DOM, and setting and getting attributes.
|
||||
925
www/extras/yui/build/element/element-beta-debug.js
vendored
|
|
@ -1,925 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 2.2.2
|
||||
*/
|
||||
/**
|
||||
* Provides Attribute configurations.
|
||||
* @namespace YAHOO.util
|
||||
* @class Attribute
|
||||
* @constructor
|
||||
* @param hash {Object} The intial Attribute.
|
||||
* @param {YAHOO.util.AttributeProvider} The owner of the Attribute instance.
|
||||
*/
|
||||
|
||||
YAHOO.util.Attribute = function(hash, owner) {
|
||||
if (owner) {
|
||||
this.owner = owner;
|
||||
this.configure(hash, true);
|
||||
}
|
||||
};
|
||||
|
||||
YAHOO.util.Attribute.prototype = {
|
||||
/**
|
||||
* The name of the attribute.
|
||||
* @property name
|
||||
* @type String
|
||||
*/
|
||||
name: undefined,
|
||||
|
||||
/**
|
||||
* The value of the attribute.
|
||||
* @property value
|
||||
* @type String
|
||||
*/
|
||||
value: null,
|
||||
|
||||
/**
|
||||
* The owner of the attribute.
|
||||
* @property owner
|
||||
* @type YAHOO.util.AttributeProvider
|
||||
*/
|
||||
owner: null,
|
||||
|
||||
/**
|
||||
* Whether or not the attribute is read only.
|
||||
* @property readOnly
|
||||
* @type Boolean
|
||||
*/
|
||||
readOnly: false,
|
||||
|
||||
/**
|
||||
* Whether or not the attribute can only be written once.
|
||||
* @property writeOnce
|
||||
* @type Boolean
|
||||
*/
|
||||
writeOnce: false,
|
||||
|
||||
/**
|
||||
* The attribute's initial configuration.
|
||||
* @private
|
||||
* @property _initialConfig
|
||||
* @type Object
|
||||
*/
|
||||
_initialConfig: null,
|
||||
|
||||
/**
|
||||
* Whether or not the attribute's value has been set.
|
||||
* @private
|
||||
* @property _written
|
||||
* @type Boolean
|
||||
*/
|
||||
_written: false,
|
||||
|
||||
/**
|
||||
* The method to use when setting the attribute's value.
|
||||
* The method recieves the new value as the only argument.
|
||||
* @property method
|
||||
* @type Function
|
||||
*/
|
||||
method: null,
|
||||
|
||||
/**
|
||||
* The validator to use when setting the attribute's value.
|
||||
* @property validator
|
||||
* @type Function
|
||||
* @return Boolean
|
||||
*/
|
||||
validator: null,
|
||||
|
||||
/**
|
||||
* Retrieves the current value of the attribute.
|
||||
* @method getValue
|
||||
* @return {any} The current value of the attribute.
|
||||
*/
|
||||
getValue: function() {
|
||||
return this.value;
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the value of the attribute and fires beforeChange and change events.
|
||||
* @method setValue
|
||||
* @param {Any} value The value to apply to the attribute.
|
||||
* @param {Boolean} silent If true the change events will not be fired.
|
||||
* @return {Boolean} Whether or not the value was set.
|
||||
*/
|
||||
setValue: function(value, silent) {
|
||||
var beforeRetVal;
|
||||
var owner = this.owner;
|
||||
var name = this.name;
|
||||
|
||||
var event = {
|
||||
type: name,
|
||||
prevValue: this.getValue(),
|
||||
newValue: value
|
||||
};
|
||||
|
||||
if (this.readOnly || ( this.writeOnce && this._written) ) {
|
||||
return false; // write not allowed
|
||||
}
|
||||
|
||||
if (this.validator && !this.validator.call(owner, value) ) {
|
||||
return false; // invalid value
|
||||
}
|
||||
|
||||
if (!silent) {
|
||||
beforeRetVal = owner.fireBeforeChangeEvent(event);
|
||||
if (beforeRetVal === false) {
|
||||
YAHOO.log('setValue ' + name +
|
||||
'cancelled by beforeChange event', 'info', 'Attribute');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.method) {
|
||||
this.method.call(owner, value);
|
||||
}
|
||||
|
||||
this.value = value;
|
||||
this._written = true;
|
||||
|
||||
event.type = name;
|
||||
|
||||
if (!silent) {
|
||||
this.owner.fireChangeEvent(event);
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Allows for configuring the Attribute's properties.
|
||||
* @method configure
|
||||
* @param {Object} map A key-value map of Attribute properties.
|
||||
* @param {Boolean} init Whether or not this should become the initial config.
|
||||
*/
|
||||
configure: function(map, init) {
|
||||
map = map || {};
|
||||
this._written = false; // reset writeOnce
|
||||
this._initialConfig = this._initialConfig || {};
|
||||
|
||||
for (var key in map) {
|
||||
if ( key && YAHOO.lang.hasOwnProperty(map, key) ) {
|
||||
this[key] = map[key];
|
||||
if (init) {
|
||||
this._initialConfig[key] = map[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Resets the value to the initial config value.
|
||||
* @method resetValue
|
||||
* @return {Boolean} Whether or not the value was set.
|
||||
*/
|
||||
resetValue: function() {
|
||||
return this.setValue(this._initialConfig.value);
|
||||
},
|
||||
|
||||
/**
|
||||
* Resets the attribute config to the initial config state.
|
||||
* @method resetConfig
|
||||
*/
|
||||
resetConfig: function() {
|
||||
this.configure(this._initialConfig);
|
||||
},
|
||||
|
||||
/**
|
||||
* Resets the value to the current value.
|
||||
* Useful when values may have gotten out of sync with actual properties.
|
||||
* @method refresh
|
||||
* @return {Boolean} Whether or not the value was set.
|
||||
*/
|
||||
refresh: function(silent) {
|
||||
this.setValue(this.value, silent);
|
||||
}
|
||||
};
|
||||
|
||||
(function() {
|
||||
var Lang = YAHOO.util.Lang;
|
||||
|
||||
/*
|
||||
Copyright (c) 2006, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
*/
|
||||
|
||||
/**
|
||||
* Provides and manages YAHOO.util.Attribute instances
|
||||
* @namespace YAHOO.util
|
||||
* @class AttributeProvider
|
||||
* @uses YAHOO.util.EventProvider
|
||||
*/
|
||||
YAHOO.util.AttributeProvider = function() {};
|
||||
|
||||
YAHOO.util.AttributeProvider.prototype = {
|
||||
|
||||
/**
|
||||
* A key-value map of Attribute configurations
|
||||
* @property _configs
|
||||
* @protected (may be used by subclasses and augmentors)
|
||||
* @private
|
||||
* @type {Object}
|
||||
*/
|
||||
_configs: null,
|
||||
/**
|
||||
* Returns the current value of the attribute.
|
||||
* @method get
|
||||
* @param {String} key The attribute whose value will be returned.
|
||||
*/
|
||||
get: function(key){
|
||||
var configs = this._configs || {};
|
||||
var config = configs[key];
|
||||
|
||||
if (!config) {
|
||||
YAHOO.log(key + ' not found', 'error', 'AttributeProvider');
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return config.value;
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the value of a config.
|
||||
* @method set
|
||||
* @param {String} key The name of the attribute
|
||||
* @param {Any} value The value to apply to the attribute
|
||||
* @param {Boolean} silent Whether or not to suppress change events
|
||||
* @return {Boolean} Whether or not the value was set.
|
||||
*/
|
||||
set: function(key, value, silent){
|
||||
var configs = this._configs || {};
|
||||
var config = configs[key];
|
||||
|
||||
if (!config) {
|
||||
YAHOO.log('set failed: ' + key + ' not found',
|
||||
'error', 'AttributeProvider');
|
||||
return false;
|
||||
}
|
||||
|
||||
return config.setValue(value, silent);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns an array of attribute names.
|
||||
* @method getAttributeKeys
|
||||
* @return {Array} An array of attribute names.
|
||||
*/
|
||||
getAttributeKeys: function(){
|
||||
var configs = this._configs;
|
||||
var keys = [];
|
||||
var config;
|
||||
for (var key in configs) {
|
||||
config = configs[key];
|
||||
if ( Lang.hasOwnProperty(configs, key) &&
|
||||
!Lang.isUndefined(config) ) {
|
||||
keys[keys.length] = key;
|
||||
}
|
||||
}
|
||||
|
||||
return keys;
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets multiple attribute values.
|
||||
* @method setAttributes
|
||||
* @param {Object} map A key-value map of attributes
|
||||
* @param {Boolean} silent Whether or not to suppress change events
|
||||
*/
|
||||
setAttributes: function(map, silent){
|
||||
for (var key in map) {
|
||||
if ( Lang.hasOwnProperty(map, key) ) {
|
||||
this.set(key, map[key], silent);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Resets the specified attribute's value to its initial value.
|
||||
* @method resetValue
|
||||
* @param {String} key The name of the attribute
|
||||
* @param {Boolean} silent Whether or not to suppress change events
|
||||
* @return {Boolean} Whether or not the value was set
|
||||
*/
|
||||
resetValue: function(key, silent){
|
||||
var configs = this._configs || {};
|
||||
if (configs[key]) {
|
||||
this.set(key, configs[key]._initialConfig.value, silent);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the attribute's value to its current value.
|
||||
* @method refresh
|
||||
* @param {String | Array} key The attribute(s) to refresh
|
||||
* @param {Boolean} silent Whether or not to suppress change events
|
||||
*/
|
||||
refresh: function(key, silent){
|
||||
var configs = this._configs;
|
||||
|
||||
key = ( ( Lang.isString(key) ) ? [key] : key ) ||
|
||||
this.getAttributeKeys();
|
||||
|
||||
for (var i = 0, len = key.length; i < len; ++i) {
|
||||
if ( // only set if there is a value and not null
|
||||
configs[key[i]] &&
|
||||
! Lang.isUndefined(configs[key[i]].value) &&
|
||||
! Lang.isNull(configs[key[i]].value) ) {
|
||||
configs[key[i]].refresh(silent);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Adds an Attribute to the AttributeProvider instance.
|
||||
* @method register
|
||||
* @param {String} key The attribute's name
|
||||
* @param {Object} map A key-value map containing the
|
||||
* attribute's properties.
|
||||
* @deprecated Use setAttributeConfig
|
||||
*/
|
||||
register: function(key, map) {
|
||||
this.setAttributeConfig(key, map);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Returns the attribute's properties.
|
||||
* @method getAttributeConfig
|
||||
* @param {String} key The attribute's name
|
||||
* @private
|
||||
* @return {object} A key-value map containing all of the
|
||||
* attribute's properties.
|
||||
*/
|
||||
getAttributeConfig: function(key) {
|
||||
var configs = this._configs || {};
|
||||
var config = configs[key] || {};
|
||||
var map = {}; // returning a copy to prevent overrides
|
||||
|
||||
for (key in config) {
|
||||
if ( Lang.hasOwnProperty(config, key) ) {
|
||||
map[key] = config[key];
|
||||
}
|
||||
}
|
||||
|
||||
return map;
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets or updates an Attribute instance's properties.
|
||||
* @method setAttributeConfig
|
||||
* @param {String} key The attribute's name.
|
||||
* @param {Object} map A key-value map of attribute properties
|
||||
* @param {Boolean} init Whether or not this should become the intial config.
|
||||
*/
|
||||
setAttributeConfig: function(key, map, init) {
|
||||
var configs = this._configs || {};
|
||||
map = map || {};
|
||||
if (!configs[key]) {
|
||||
map.name = key;
|
||||
configs[key] = new YAHOO.util.Attribute(map, this);
|
||||
} else {
|
||||
configs[key].configure(map, init);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets or updates an Attribute instance's properties.
|
||||
* @method configureAttribute
|
||||
* @param {String} key The attribute's name.
|
||||
* @param {Object} map A key-value map of attribute properties
|
||||
* @param {Boolean} init Whether or not this should become the intial config.
|
||||
* @deprecated Use setAttributeConfig
|
||||
*/
|
||||
configureAttribute: function(key, map, init) {
|
||||
this.setAttributeConfig(key, map, init);
|
||||
},
|
||||
|
||||
/**
|
||||
* Resets an attribute to its intial configuration.
|
||||
* @method resetAttributeConfig
|
||||
* @param {String} key The attribute's name.
|
||||
* @private
|
||||
*/
|
||||
resetAttributeConfig: function(key){
|
||||
var configs = this._configs || {};
|
||||
configs[key].resetConfig();
|
||||
},
|
||||
|
||||
/**
|
||||
* Fires the attribute's beforeChange event.
|
||||
* @method fireBeforeChangeEvent
|
||||
* @param {String} key The attribute's name.
|
||||
* @param {Obj} e The event object to pass to handlers.
|
||||
*/
|
||||
fireBeforeChangeEvent: function(e) {
|
||||
var type = 'before';
|
||||
type += e.type.charAt(0).toUpperCase() + e.type.substr(1) + 'Change';
|
||||
e.type = type;
|
||||
return this.fireEvent(e.type, e);
|
||||
},
|
||||
|
||||
/**
|
||||
* Fires the attribute's change event.
|
||||
* @method fireChangeEvent
|
||||
* @param {String} key The attribute's name.
|
||||
* @param {Obj} e The event object to pass to the handlers.
|
||||
*/
|
||||
fireChangeEvent: function(e) {
|
||||
e.type += 'Change';
|
||||
return this.fireEvent(e.type, e);
|
||||
}
|
||||
};
|
||||
|
||||
YAHOO.augment(YAHOO.util.AttributeProvider, YAHOO.util.EventProvider);
|
||||
})();
|
||||
|
||||
(function() {
|
||||
// internal shorthand
|
||||
var Dom = YAHOO.util.Dom,
|
||||
AttributeProvider = YAHOO.util.AttributeProvider;
|
||||
|
||||
/**
|
||||
* Element provides an wrapper object to simplify adding
|
||||
* event listeners, using dom methods, and managing attributes.
|
||||
* @module element
|
||||
* @namespace YAHOO.util
|
||||
* @requires yahoo, dom, event
|
||||
* @beta
|
||||
*/
|
||||
|
||||
/**
|
||||
* Element provides an wrapper object to simplify adding
|
||||
* event listeners, using dom methods, and managing attributes.
|
||||
* @class Element
|
||||
* @uses YAHOO.util.AttributeProvider
|
||||
* @constructor
|
||||
* @param el {HTMLElement | String} The html element that
|
||||
* represents the Element.
|
||||
* @param {Object} map A key-value map of initial config names and values
|
||||
*/
|
||||
YAHOO.util.Element = function(el, map) {
|
||||
if (arguments.length) {
|
||||
this.init(el, map);
|
||||
}
|
||||
};
|
||||
|
||||
YAHOO.util.Element.prototype = {
|
||||
/**
|
||||
* Dom events supported by the Element instance.
|
||||
* @property DOM_EVENTS
|
||||
* @type Object
|
||||
*/
|
||||
DOM_EVENTS: null,
|
||||
|
||||
/**
|
||||
* Wrapper for HTMLElement method.
|
||||
* @method appendChild
|
||||
* @param {Boolean} deep Whether or not to do a deep clone
|
||||
*/
|
||||
appendChild: function(child) {
|
||||
child = child.get ? child.get('element') : child;
|
||||
this.get('element').appendChild(child);
|
||||
},
|
||||
|
||||
/**
|
||||
* Wrapper for HTMLElement method.
|
||||
* @method getElementsByTagName
|
||||
* @param {String} tag The tagName to collect
|
||||
*/
|
||||
getElementsByTagName: function(tag) {
|
||||
return this.get('element').getElementsByTagName(tag);
|
||||
},
|
||||
|
||||
/**
|
||||
* Wrapper for HTMLElement method.
|
||||
* @method hasChildNodes
|
||||
* @return {Boolean} Whether or not the element has childNodes
|
||||
*/
|
||||
hasChildNodes: function() {
|
||||
return this.get('element').hasChildNodes();
|
||||
},
|
||||
|
||||
/**
|
||||
* Wrapper for HTMLElement method.
|
||||
* @method insertBefore
|
||||
* @param {HTMLElement} element The HTMLElement to insert
|
||||
* @param {HTMLElement} before The HTMLElement to insert
|
||||
* the element before.
|
||||
*/
|
||||
insertBefore: function(element, before) {
|
||||
element = element.get ? element.get('element') : element;
|
||||
before = (before && before.get) ? before.get('element') : before;
|
||||
|
||||
this.get('element').insertBefore(element, before);
|
||||
},
|
||||
|
||||
/**
|
||||
* Wrapper for HTMLElement method.
|
||||
* @method removeChild
|
||||
* @param {HTMLElement} child The HTMLElement to remove
|
||||
*/
|
||||
removeChild: function(child) {
|
||||
child = child.get ? child.get('element') : child;
|
||||
this.get('element').removeChild(child);
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Wrapper for HTMLElement method.
|
||||
* @method replaceChild
|
||||
* @param {HTMLElement} newNode The HTMLElement to insert
|
||||
* @param {HTMLElement} oldNode The HTMLElement to replace
|
||||
*/
|
||||
replaceChild: function(newNode, oldNode) {
|
||||
newNode = newNode.get ? newNode.get('element') : newNode;
|
||||
oldNode = oldNode.get ? oldNode.get('element') : oldNode;
|
||||
return this.get('element').replaceChild(newNode, oldNode);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Registers Element specific attributes.
|
||||
* @method initAttributes
|
||||
* @param {Object} map A key-value map of initial attribute configs
|
||||
*/
|
||||
initAttributes: function(map) {
|
||||
},
|
||||
|
||||
/**
|
||||
* Adds a listener for the given event. These may be DOM or
|
||||
* customEvent listeners. Any event that is fired via fireEvent
|
||||
* can be listened for. All handlers receive an event object.
|
||||
* @method addListener
|
||||
* @param {String} type The name of the event to listen for
|
||||
* @param {Function} fn The handler to call when the event fires
|
||||
* @param {Any} obj A variable to pass to the handler
|
||||
* @param {Object} scope The object to use for the scope of the handler
|
||||
*/
|
||||
addListener: function(type, fn, obj, scope) {
|
||||
var el = this.get('element');
|
||||
scope = scope || this;
|
||||
|
||||
el = this.get('id') || el;
|
||||
var self = this;
|
||||
if (!this._events[type]) { // create on the fly
|
||||
if ( this.DOM_EVENTS[type] ) {
|
||||
YAHOO.util.Event.addListener(el, type, function(e) {
|
||||
if (e.srcElement && !e.target) { // supplement IE with target
|
||||
e.target = e.srcElement;
|
||||
}
|
||||
self.fireEvent(type, e);
|
||||
}, obj, scope);
|
||||
}
|
||||
|
||||
this.createEvent(type, this);
|
||||
}
|
||||
|
||||
this.subscribe.apply(this, arguments); // notify via customEvent
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Alias for addListener
|
||||
* @method on
|
||||
* @param {String} type The name of the event to listen for
|
||||
* @param {Function} fn The function call when the event fires
|
||||
* @param {Any} obj A variable to pass to the handler
|
||||
* @param {Object} scope The object to use for the scope of the handler
|
||||
*/
|
||||
on: function() { this.addListener.apply(this, arguments); },
|
||||
|
||||
|
||||
/**
|
||||
* Remove an event listener
|
||||
* @method removeListener
|
||||
* @param {String} type The name of the event to listen for
|
||||
* @param {Function} fn The function call when the event fires
|
||||
*/
|
||||
removeListener: function(type, fn) {
|
||||
this.unsubscribe.apply(this, arguments);
|
||||
},
|
||||
|
||||
/**
|
||||
* Wrapper for Dom method.
|
||||
* @method addClass
|
||||
* @param {String} className The className to add
|
||||
*/
|
||||
addClass: function(className) {
|
||||
Dom.addClass(this.get('element'), className);
|
||||
},
|
||||
|
||||
/**
|
||||
* Wrapper for Dom method.
|
||||
* @method getElementsByClassName
|
||||
* @param {String} className The className to collect
|
||||
* @param {String} tag (optional) The tag to use in
|
||||
* conjunction with class name
|
||||
* @return {Array} Array of HTMLElements
|
||||
*/
|
||||
getElementsByClassName: function(className, tag) {
|
||||
return Dom.getElementsByClassName(className, tag,
|
||||
this.get('element') );
|
||||
},
|
||||
|
||||
/**
|
||||
* Wrapper for Dom method.
|
||||
* @method hasClass
|
||||
* @param {String} className The className to add
|
||||
* @return {Boolean} Whether or not the element has the class name
|
||||
*/
|
||||
hasClass: function(className) {
|
||||
return Dom.hasClass(this.get('element'), className);
|
||||
},
|
||||
|
||||
/**
|
||||
* Wrapper for Dom method.
|
||||
* @method removeClass
|
||||
* @param {String} className The className to remove
|
||||
*/
|
||||
removeClass: function(className) {
|
||||
return Dom.removeClass(this.get('element'), className);
|
||||
},
|
||||
|
||||
/**
|
||||
* Wrapper for Dom method.
|
||||
* @method replaceClass
|
||||
* @param {String} oldClassName The className to replace
|
||||
* @param {String} newClassName The className to add
|
||||
*/
|
||||
replaceClass: function(oldClassName, newClassName) {
|
||||
return Dom.replaceClass(this.get('element'),
|
||||
oldClassName, newClassName);
|
||||
},
|
||||
|
||||
/**
|
||||
* Wrapper for Dom method.
|
||||
* @method setStyle
|
||||
* @param {String} property The style property to set
|
||||
* @param {String} value The value to apply to the style property
|
||||
*/
|
||||
setStyle: function(property, value) {
|
||||
var el = this.get('element');
|
||||
if (!el) {
|
||||
return this._queue[this._queue.length] = ['setStyle', arguments];
|
||||
}
|
||||
|
||||
return Dom.setStyle(el, property, value); // TODO: always queuing?
|
||||
},
|
||||
|
||||
/**
|
||||
* Wrapper for Dom method.
|
||||
* @method getStyle
|
||||
* @param {String} property The style property to retrieve
|
||||
* @return {String} The current value of the property
|
||||
*/
|
||||
getStyle: function(property) {
|
||||
return Dom.getStyle(this.get('element'), property);
|
||||
},
|
||||
|
||||
/**
|
||||
* Apply any queued set calls.
|
||||
* @method fireQueue
|
||||
*/
|
||||
fireQueue: function() {
|
||||
var queue = this._queue;
|
||||
for (var i = 0, len = queue.length; i < len; ++i) {
|
||||
this[queue[i][0]].apply(this, queue[i][1]);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Appends the HTMLElement into either the supplied parentNode.
|
||||
* @method appendTo
|
||||
* @param {HTMLElement | Element} parentNode The node to append to
|
||||
* @param {HTMLElement | Element} before An optional node to insert before
|
||||
*/
|
||||
appendTo: function(parent, before) {
|
||||
parent = (parent.get) ? parent.get('element') : Dom.get(parent);
|
||||
|
||||
this.fireEvent('beforeAppendTo', {
|
||||
type: 'beforeAppendTo',
|
||||
target: parent
|
||||
});
|
||||
|
||||
|
||||
before = (before && before.get) ?
|
||||
before.get('element') : Dom.get(before);
|
||||
var element = this.get('element');
|
||||
|
||||
if (!element) {
|
||||
YAHOO.log('appendTo failed: element not available',
|
||||
'error', 'Element');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!parent) {
|
||||
YAHOO.log('appendTo failed: parent not available',
|
||||
'error', 'Element');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (element.parent != parent) {
|
||||
if (before) {
|
||||
parent.insertBefore(element, before);
|
||||
} else {
|
||||
parent.appendChild(element);
|
||||
}
|
||||
}
|
||||
|
||||
YAHOO.log(element + 'appended to ' + parent);
|
||||
|
||||
this.fireEvent('appendTo', {
|
||||
type: 'appendTo',
|
||||
target: parent
|
||||
});
|
||||
},
|
||||
|
||||
get: function(key) {
|
||||
var configs = this._configs || {};
|
||||
var el = configs.element; // avoid loop due to 'element'
|
||||
if (el && !configs[key] && !YAHOO.lang.isUndefined(el.value[key]) ) {
|
||||
return el.value[key];
|
||||
}
|
||||
|
||||
return AttributeProvider.prototype.get.call(this, key);
|
||||
},
|
||||
|
||||
set: function(key, value, silent) {
|
||||
var el = this.get('element');
|
||||
if (!el) {
|
||||
this._queue[this._queue.length] = ['set', arguments];
|
||||
if (this._configs[key]) {
|
||||
this._configs[key].value = value; // so "get" works while queueing
|
||||
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// set it on the element if not configured and is an HTML attribute
|
||||
if ( !this._configs[key] && !YAHOO.lang.isUndefined(el[key]) ) {
|
||||
_registerHTMLAttr.call(this, key);
|
||||
}
|
||||
|
||||
return AttributeProvider.prototype.set.apply(this, arguments);
|
||||
},
|
||||
|
||||
setAttributeConfig: function(key, map, init) {
|
||||
var el = this.get('element');
|
||||
|
||||
if (el && !this._configs[key] && !YAHOO.lang.isUndefined(el[key]) ) {
|
||||
_registerHTMLAttr.call(this, key, map);
|
||||
} else {
|
||||
AttributeProvider.prototype.setAttributeConfig.apply(this, arguments);
|
||||
}
|
||||
},
|
||||
|
||||
getAttributeKeys: function() {
|
||||
var el = this.get('element');
|
||||
var keys = AttributeProvider.prototype.getAttributeKeys.call(this);
|
||||
|
||||
//add any unconfigured element keys
|
||||
for (var key in el) {
|
||||
if (!this._configs[key]) {
|
||||
keys[key] = keys[key] || el[key];
|
||||
}
|
||||
}
|
||||
|
||||
return keys;
|
||||
},
|
||||
|
||||
createEvent: function(type, scope) {
|
||||
this._events[type] = true;
|
||||
AttributeProvider.prototype.createEvent.apply(this, arguments);
|
||||
},
|
||||
|
||||
init: function(el, attr) {
|
||||
_initElement.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
|
||||
var _initElement = function(el, attr) {
|
||||
this._queue = this._queue || [];
|
||||
this._events = this._events || {};
|
||||
this._configs = this._configs || {};
|
||||
attr = attr || {};
|
||||
attr.element = attr.element || el || null;
|
||||
|
||||
this.DOM_EVENTS = {
|
||||
'click': true,
|
||||
'dblclick': true,
|
||||
'keydown': true,
|
||||
'keypress': true,
|
||||
'keyup': true,
|
||||
'mousedown': true,
|
||||
'mousemove': true,
|
||||
'mouseout': true,
|
||||
'mouseover': true,
|
||||
'mouseup': true,
|
||||
'focus': true,
|
||||
'blur': true,
|
||||
'submit': true
|
||||
};
|
||||
|
||||
var isReady = false; // to determine when to init HTMLElement and content
|
||||
|
||||
if (YAHOO.lang.isString(el) ) { // defer until available/ready
|
||||
_registerHTMLAttr.call(this, 'id', { value: attr.element });
|
||||
}
|
||||
|
||||
if (Dom.get(el)) {
|
||||
isReady = true;
|
||||
_initHTMLElement.call(this, attr);
|
||||
_initContent.call(this, attr);
|
||||
}
|
||||
|
||||
YAHOO.util.Event.onAvailable(attr.element, function() {
|
||||
if (!isReady) { // otherwise already done
|
||||
_initHTMLElement.call(this, attr);
|
||||
}
|
||||
|
||||
this.fireEvent('available', { type: 'available', target: attr.element });
|
||||
}, this, true);
|
||||
|
||||
YAHOO.util.Event.onContentReady(attr.element, function() {
|
||||
if (!isReady) { // otherwise already done
|
||||
_initContent.call(this, attr);
|
||||
}
|
||||
this.fireEvent('contentReady', { type: 'contentReady', target: attr.element });
|
||||
}, this, true);
|
||||
};
|
||||
|
||||
var _initHTMLElement = function(attr) {
|
||||
/**
|
||||
* The HTMLElement the Element instance refers to.
|
||||
* @config element
|
||||
* @type HTMLElement
|
||||
*/
|
||||
this.setAttributeConfig('element', {
|
||||
value: Dom.get(attr.element),
|
||||
readOnly: true
|
||||
});
|
||||
};
|
||||
|
||||
var _initContent = function(attr) {
|
||||
this.initAttributes(attr);
|
||||
this.setAttributes(attr, true);
|
||||
this.fireQueue();
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the value of the property and fires beforeChange and change events.
|
||||
* @private
|
||||
* @method _registerHTMLAttr
|
||||
* @param {YAHOO.util.Element} element The Element instance to
|
||||
* register the config to.
|
||||
* @param {String} key The name of the config to register
|
||||
* @param {Object} map A key-value map of the config's params
|
||||
*/
|
||||
var _registerHTMLAttr = function(key, map) {
|
||||
var el = this.get('element');
|
||||
map = map || {};
|
||||
map.name = key;
|
||||
map.method = map.method || function(value) {
|
||||
el[key] = value;
|
||||
};
|
||||
map.value = map.value || el[key];
|
||||
this._configs[key] = new YAHOO.util.Attribute(map, this);
|
||||
};
|
||||
|
||||
/**
|
||||
* Fires when the Element's HTMLElement can be retrieved by Id.
|
||||
* <p>See: <a href="#addListener">Element.addListener</a></p>
|
||||
* <p><strong>Event fields:</strong><br>
|
||||
* <code><String> type</code> available<br>
|
||||
* <code><HTMLElement>
|
||||
* target</code> the HTMLElement bound to this Element instance<br>
|
||||
* <p><strong>Usage:</strong><br>
|
||||
* <code>var handler = function(e) {var target = e.target};<br>
|
||||
* myTabs.addListener('available', handler);</code></p>
|
||||
* @event available
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fires when the Element's HTMLElement subtree is rendered.
|
||||
* <p>See: <a href="#addListener">Element.addListener</a></p>
|
||||
* <p><strong>Event fields:</strong><br>
|
||||
* <code><String> type</code> contentReady<br>
|
||||
* <code><HTMLElement>
|
||||
* target</code> the HTMLElement bound to this Element instance<br>
|
||||
* <p><strong>Usage:</strong><br>
|
||||
* <code>var handler = function(e) {var target = e.target};<br>
|
||||
* myTabs.addListener('contentReady', handler);</code></p>
|
||||
* @event contentReady
|
||||
*/
|
||||
|
||||
|
||||
YAHOO.augment(YAHOO.util.Element, AttributeProvider);
|
||||
})();
|
||||
|
||||
YAHOO.register("element", YAHOO.util.Element, {version: "2.2.2", build: "204"});
|
||||
34
www/extras/yui/build/element/element-beta-min.js
vendored
|
|
@ -1,34 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 2.2.2
|
||||
*/
|
||||
|
||||
YAHOO.util.Attribute=function(hash,owner){if(owner){this.owner=owner;this.configure(hash,true);}};YAHOO.util.Attribute.prototype={name:undefined,value:null,owner:null,readOnly:false,writeOnce:false,_initialConfig:null,_written:false,method:null,validator:null,getValue:function(){return this.value;},setValue:function(value,silent){var beforeRetVal;var owner=this.owner;var name=this.name;var event={type:name,prevValue:this.getValue(),newValue:value};if(this.readOnly||(this.writeOnce&&this._written)){return false;}
|
||||
if(this.validator&&!this.validator.call(owner,value)){return false;}
|
||||
if(!silent){beforeRetVal=owner.fireBeforeChangeEvent(event);if(beforeRetVal===false){return false;}}
|
||||
if(this.method){this.method.call(owner,value);}
|
||||
this.value=value;this._written=true;event.type=name;if(!silent){this.owner.fireChangeEvent(event);}
|
||||
return true;},configure:function(map,init){map=map||{};this._written=false;this._initialConfig=this._initialConfig||{};for(var key in map){if(key&&YAHOO.lang.hasOwnProperty(map,key)){this[key]=map[key];if(init){this._initialConfig[key]=map[key];}}}},resetValue:function(){return this.setValue(this._initialConfig.value);},resetConfig:function(){this.configure(this._initialConfig);},refresh:function(silent){this.setValue(this.value,silent);}};(function(){var Lang=YAHOO.util.Lang;YAHOO.util.AttributeProvider=function(){};YAHOO.util.AttributeProvider.prototype={_configs:null,get:function(key){var configs=this._configs||{};var config=configs[key];if(!config){return undefined;}
|
||||
return config.value;},set:function(key,value,silent){var configs=this._configs||{};var config=configs[key];if(!config){return false;}
|
||||
return config.setValue(value,silent);},getAttributeKeys:function(){var configs=this._configs;var keys=[];var config;for(var key in configs){config=configs[key];if(Lang.hasOwnProperty(configs,key)&&!Lang.isUndefined(config)){keys[keys.length]=key;}}
|
||||
return keys;},setAttributes:function(map,silent){for(var key in map){if(Lang.hasOwnProperty(map,key)){this.set(key,map[key],silent);}}},resetValue:function(key,silent){var configs=this._configs||{};if(configs[key]){this.set(key,configs[key]._initialConfig.value,silent);return true;}
|
||||
return false;},refresh:function(key,silent){var configs=this._configs;key=((Lang.isString(key))?[key]:key)||this.getAttributeKeys();for(var i=0,len=key.length;i<len;++i){if(configs[key[i]]&&!Lang.isUndefined(configs[key[i]].value)&&!Lang.isNull(configs[key[i]].value)){configs[key[i]].refresh(silent);}}},register:function(key,map){this.setAttributeConfig(key,map);},getAttributeConfig:function(key){var configs=this._configs||{};var config=configs[key]||{};var map={};for(key in config){if(Lang.hasOwnProperty(config,key)){map[key]=config[key];}}
|
||||
return map;},setAttributeConfig:function(key,map,init){var configs=this._configs||{};map=map||{};if(!configs[key]){map.name=key;configs[key]=new YAHOO.util.Attribute(map,this);}else{configs[key].configure(map,init);}},configureAttribute:function(key,map,init){this.setAttributeConfig(key,map,init);},resetAttributeConfig:function(key){var configs=this._configs||{};configs[key].resetConfig();},fireBeforeChangeEvent:function(e){var type='before';type+=e.type.charAt(0).toUpperCase()+e.type.substr(1)+'Change';e.type=type;return this.fireEvent(e.type,e);},fireChangeEvent:function(e){e.type+='Change';return this.fireEvent(e.type,e);}};YAHOO.augment(YAHOO.util.AttributeProvider,YAHOO.util.EventProvider);})();(function(){var Dom=YAHOO.util.Dom,AttributeProvider=YAHOO.util.AttributeProvider;YAHOO.util.Element=function(el,map){if(arguments.length){this.init(el,map);}};YAHOO.util.Element.prototype={DOM_EVENTS:null,appendChild:function(child){child=child.get?child.get('element'):child;this.get('element').appendChild(child);},getElementsByTagName:function(tag){return this.get('element').getElementsByTagName(tag);},hasChildNodes:function(){return this.get('element').hasChildNodes();},insertBefore:function(element,before){element=element.get?element.get('element'):element;before=(before&&before.get)?before.get('element'):before;this.get('element').insertBefore(element,before);},removeChild:function(child){child=child.get?child.get('element'):child;this.get('element').removeChild(child);return true;},replaceChild:function(newNode,oldNode){newNode=newNode.get?newNode.get('element'):newNode;oldNode=oldNode.get?oldNode.get('element'):oldNode;return this.get('element').replaceChild(newNode,oldNode);},initAttributes:function(map){},addListener:function(type,fn,obj,scope){var el=this.get('element');scope=scope||this;el=this.get('id')||el;var self=this;if(!this._events[type]){if(this.DOM_EVENTS[type]){YAHOO.util.Event.addListener(el,type,function(e){if(e.srcElement&&!e.target){e.target=e.srcElement;}
|
||||
self.fireEvent(type,e);},obj,scope);}
|
||||
this.createEvent(type,this);}
|
||||
this.subscribe.apply(this,arguments);},on:function(){this.addListener.apply(this,arguments);},removeListener:function(type,fn){this.unsubscribe.apply(this,arguments);},addClass:function(className){Dom.addClass(this.get('element'),className);},getElementsByClassName:function(className,tag){return Dom.getElementsByClassName(className,tag,this.get('element'));},hasClass:function(className){return Dom.hasClass(this.get('element'),className);},removeClass:function(className){return Dom.removeClass(this.get('element'),className);},replaceClass:function(oldClassName,newClassName){return Dom.replaceClass(this.get('element'),oldClassName,newClassName);},setStyle:function(property,value){var el=this.get('element');if(!el){return this._queue[this._queue.length]=['setStyle',arguments];}
|
||||
return Dom.setStyle(el,property,value);},getStyle:function(property){return Dom.getStyle(this.get('element'),property);},fireQueue:function(){var queue=this._queue;for(var i=0,len=queue.length;i<len;++i){this[queue[i][0]].apply(this,queue[i][1]);}},appendTo:function(parent,before){parent=(parent.get)?parent.get('element'):Dom.get(parent);this.fireEvent('beforeAppendTo',{type:'beforeAppendTo',target:parent});before=(before&&before.get)?before.get('element'):Dom.get(before);var element=this.get('element');if(!element){return false;}
|
||||
if(!parent){return false;}
|
||||
if(element.parent!=parent){if(before){parent.insertBefore(element,before);}else{parent.appendChild(element);}}
|
||||
this.fireEvent('appendTo',{type:'appendTo',target:parent});},get:function(key){var configs=this._configs||{};var el=configs.element;if(el&&!configs[key]&&!YAHOO.lang.isUndefined(el.value[key])){return el.value[key];}
|
||||
return AttributeProvider.prototype.get.call(this,key);},set:function(key,value,silent){var el=this.get('element');if(!el){this._queue[this._queue.length]=['set',arguments];if(this._configs[key]){this._configs[key].value=value;}
|
||||
return;}
|
||||
if(!this._configs[key]&&!YAHOO.lang.isUndefined(el[key])){_registerHTMLAttr.call(this,key);}
|
||||
return AttributeProvider.prototype.set.apply(this,arguments);},setAttributeConfig:function(key,map,init){var el=this.get('element');if(el&&!this._configs[key]&&!YAHOO.lang.isUndefined(el[key])){_registerHTMLAttr.call(this,key,map);}else{AttributeProvider.prototype.setAttributeConfig.apply(this,arguments);}},getAttributeKeys:function(){var el=this.get('element');var keys=AttributeProvider.prototype.getAttributeKeys.call(this);for(var key in el){if(!this._configs[key]){keys[key]=keys[key]||el[key];}}
|
||||
return keys;},createEvent:function(type,scope){this._events[type]=true;AttributeProvider.prototype.createEvent.apply(this,arguments);},init:function(el,attr){_initElement.apply(this,arguments);}};var _initElement=function(el,attr){this._queue=this._queue||[];this._events=this._events||{};this._configs=this._configs||{};attr=attr||{};attr.element=attr.element||el||null;this.DOM_EVENTS={'click':true,'dblclick':true,'keydown':true,'keypress':true,'keyup':true,'mousedown':true,'mousemove':true,'mouseout':true,'mouseover':true,'mouseup':true,'focus':true,'blur':true,'submit':true};var isReady=false;if(YAHOO.lang.isString(el)){_registerHTMLAttr.call(this,'id',{value:attr.element});}
|
||||
if(Dom.get(el)){isReady=true;_initHTMLElement.call(this,attr);_initContent.call(this,attr);}
|
||||
YAHOO.util.Event.onAvailable(attr.element,function(){if(!isReady){_initHTMLElement.call(this,attr);}
|
||||
this.fireEvent('available',{type:'available',target:attr.element});},this,true);YAHOO.util.Event.onContentReady(attr.element,function(){if(!isReady){_initContent.call(this,attr);}
|
||||
this.fireEvent('contentReady',{type:'contentReady',target:attr.element});},this,true);};var _initHTMLElement=function(attr){this.setAttributeConfig('element',{value:Dom.get(attr.element),readOnly:true});};var _initContent=function(attr){this.initAttributes(attr);this.setAttributes(attr,true);this.fireQueue();};var _registerHTMLAttr=function(key,map){var el=this.get('element');map=map||{};map.name=key;map.method=map.method||function(value){el[key]=value;};map.value=map.value||el[key];this._configs[key]=new YAHOO.util.Attribute(map,this);};YAHOO.augment(YAHOO.util.Element,AttributeProvider);})();YAHOO.register("element",YAHOO.util.Element,{version:"2.2.2",build:"204"});
|
||||
915
www/extras/yui/build/element/element-beta.js
vendored
|
|
@ -1,915 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 2.2.2
|
||||
*/
|
||||
/**
|
||||
* Provides Attribute configurations.
|
||||
* @namespace YAHOO.util
|
||||
* @class Attribute
|
||||
* @constructor
|
||||
* @param hash {Object} The intial Attribute.
|
||||
* @param {YAHOO.util.AttributeProvider} The owner of the Attribute instance.
|
||||
*/
|
||||
|
||||
YAHOO.util.Attribute = function(hash, owner) {
|
||||
if (owner) {
|
||||
this.owner = owner;
|
||||
this.configure(hash, true);
|
||||
}
|
||||
};
|
||||
|
||||
YAHOO.util.Attribute.prototype = {
|
||||
/**
|
||||
* The name of the attribute.
|
||||
* @property name
|
||||
* @type String
|
||||
*/
|
||||
name: undefined,
|
||||
|
||||
/**
|
||||
* The value of the attribute.
|
||||
* @property value
|
||||
* @type String
|
||||
*/
|
||||
value: null,
|
||||
|
||||
/**
|
||||
* The owner of the attribute.
|
||||
* @property owner
|
||||
* @type YAHOO.util.AttributeProvider
|
||||
*/
|
||||
owner: null,
|
||||
|
||||
/**
|
||||
* Whether or not the attribute is read only.
|
||||
* @property readOnly
|
||||
* @type Boolean
|
||||
*/
|
||||
readOnly: false,
|
||||
|
||||
/**
|
||||
* Whether or not the attribute can only be written once.
|
||||
* @property writeOnce
|
||||
* @type Boolean
|
||||
*/
|
||||
writeOnce: false,
|
||||
|
||||
/**
|
||||
* The attribute's initial configuration.
|
||||
* @private
|
||||
* @property _initialConfig
|
||||
* @type Object
|
||||
*/
|
||||
_initialConfig: null,
|
||||
|
||||
/**
|
||||
* Whether or not the attribute's value has been set.
|
||||
* @private
|
||||
* @property _written
|
||||
* @type Boolean
|
||||
*/
|
||||
_written: false,
|
||||
|
||||
/**
|
||||
* The method to use when setting the attribute's value.
|
||||
* The method recieves the new value as the only argument.
|
||||
* @property method
|
||||
* @type Function
|
||||
*/
|
||||
method: null,
|
||||
|
||||
/**
|
||||
* The validator to use when setting the attribute's value.
|
||||
* @property validator
|
||||
* @type Function
|
||||
* @return Boolean
|
||||
*/
|
||||
validator: null,
|
||||
|
||||
/**
|
||||
* Retrieves the current value of the attribute.
|
||||
* @method getValue
|
||||
* @return {any} The current value of the attribute.
|
||||
*/
|
||||
getValue: function() {
|
||||
return this.value;
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the value of the attribute and fires beforeChange and change events.
|
||||
* @method setValue
|
||||
* @param {Any} value The value to apply to the attribute.
|
||||
* @param {Boolean} silent If true the change events will not be fired.
|
||||
* @return {Boolean} Whether or not the value was set.
|
||||
*/
|
||||
setValue: function(value, silent) {
|
||||
var beforeRetVal;
|
||||
var owner = this.owner;
|
||||
var name = this.name;
|
||||
|
||||
var event = {
|
||||
type: name,
|
||||
prevValue: this.getValue(),
|
||||
newValue: value
|
||||
};
|
||||
|
||||
if (this.readOnly || ( this.writeOnce && this._written) ) {
|
||||
return false; // write not allowed
|
||||
}
|
||||
|
||||
if (this.validator && !this.validator.call(owner, value) ) {
|
||||
return false; // invalid value
|
||||
}
|
||||
|
||||
if (!silent) {
|
||||
beforeRetVal = owner.fireBeforeChangeEvent(event);
|
||||
if (beforeRetVal === false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.method) {
|
||||
this.method.call(owner, value);
|
||||
}
|
||||
|
||||
this.value = value;
|
||||
this._written = true;
|
||||
|
||||
event.type = name;
|
||||
|
||||
if (!silent) {
|
||||
this.owner.fireChangeEvent(event);
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Allows for configuring the Attribute's properties.
|
||||
* @method configure
|
||||
* @param {Object} map A key-value map of Attribute properties.
|
||||
* @param {Boolean} init Whether or not this should become the initial config.
|
||||
*/
|
||||
configure: function(map, init) {
|
||||
map = map || {};
|
||||
this._written = false; // reset writeOnce
|
||||
this._initialConfig = this._initialConfig || {};
|
||||
|
||||
for (var key in map) {
|
||||
if ( key && YAHOO.lang.hasOwnProperty(map, key) ) {
|
||||
this[key] = map[key];
|
||||
if (init) {
|
||||
this._initialConfig[key] = map[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Resets the value to the initial config value.
|
||||
* @method resetValue
|
||||
* @return {Boolean} Whether or not the value was set.
|
||||
*/
|
||||
resetValue: function() {
|
||||
return this.setValue(this._initialConfig.value);
|
||||
},
|
||||
|
||||
/**
|
||||
* Resets the attribute config to the initial config state.
|
||||
* @method resetConfig
|
||||
*/
|
||||
resetConfig: function() {
|
||||
this.configure(this._initialConfig);
|
||||
},
|
||||
|
||||
/**
|
||||
* Resets the value to the current value.
|
||||
* Useful when values may have gotten out of sync with actual properties.
|
||||
* @method refresh
|
||||
* @return {Boolean} Whether or not the value was set.
|
||||
*/
|
||||
refresh: function(silent) {
|
||||
this.setValue(this.value, silent);
|
||||
}
|
||||
};
|
||||
|
||||
(function() {
|
||||
var Lang = YAHOO.util.Lang;
|
||||
|
||||
/*
|
||||
Copyright (c) 2006, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
*/
|
||||
|
||||
/**
|
||||
* Provides and manages YAHOO.util.Attribute instances
|
||||
* @namespace YAHOO.util
|
||||
* @class AttributeProvider
|
||||
* @uses YAHOO.util.EventProvider
|
||||
*/
|
||||
YAHOO.util.AttributeProvider = function() {};
|
||||
|
||||
YAHOO.util.AttributeProvider.prototype = {
|
||||
|
||||
/**
|
||||
* A key-value map of Attribute configurations
|
||||
* @property _configs
|
||||
* @protected (may be used by subclasses and augmentors)
|
||||
* @private
|
||||
* @type {Object}
|
||||
*/
|
||||
_configs: null,
|
||||
/**
|
||||
* Returns the current value of the attribute.
|
||||
* @method get
|
||||
* @param {String} key The attribute whose value will be returned.
|
||||
*/
|
||||
get: function(key){
|
||||
var configs = this._configs || {};
|
||||
var config = configs[key];
|
||||
|
||||
if (!config) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return config.value;
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the value of a config.
|
||||
* @method set
|
||||
* @param {String} key The name of the attribute
|
||||
* @param {Any} value The value to apply to the attribute
|
||||
* @param {Boolean} silent Whether or not to suppress change events
|
||||
* @return {Boolean} Whether or not the value was set.
|
||||
*/
|
||||
set: function(key, value, silent){
|
||||
var configs = this._configs || {};
|
||||
var config = configs[key];
|
||||
|
||||
if (!config) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return config.setValue(value, silent);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns an array of attribute names.
|
||||
* @method getAttributeKeys
|
||||
* @return {Array} An array of attribute names.
|
||||
*/
|
||||
getAttributeKeys: function(){
|
||||
var configs = this._configs;
|
||||
var keys = [];
|
||||
var config;
|
||||
for (var key in configs) {
|
||||
config = configs[key];
|
||||
if ( Lang.hasOwnProperty(configs, key) &&
|
||||
!Lang.isUndefined(config) ) {
|
||||
keys[keys.length] = key;
|
||||
}
|
||||
}
|
||||
|
||||
return keys;
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets multiple attribute values.
|
||||
* @method setAttributes
|
||||
* @param {Object} map A key-value map of attributes
|
||||
* @param {Boolean} silent Whether or not to suppress change events
|
||||
*/
|
||||
setAttributes: function(map, silent){
|
||||
for (var key in map) {
|
||||
if ( Lang.hasOwnProperty(map, key) ) {
|
||||
this.set(key, map[key], silent);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Resets the specified attribute's value to its initial value.
|
||||
* @method resetValue
|
||||
* @param {String} key The name of the attribute
|
||||
* @param {Boolean} silent Whether or not to suppress change events
|
||||
* @return {Boolean} Whether or not the value was set
|
||||
*/
|
||||
resetValue: function(key, silent){
|
||||
var configs = this._configs || {};
|
||||
if (configs[key]) {
|
||||
this.set(key, configs[key]._initialConfig.value, silent);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the attribute's value to its current value.
|
||||
* @method refresh
|
||||
* @param {String | Array} key The attribute(s) to refresh
|
||||
* @param {Boolean} silent Whether or not to suppress change events
|
||||
*/
|
||||
refresh: function(key, silent){
|
||||
var configs = this._configs;
|
||||
|
||||
key = ( ( Lang.isString(key) ) ? [key] : key ) ||
|
||||
this.getAttributeKeys();
|
||||
|
||||
for (var i = 0, len = key.length; i < len; ++i) {
|
||||
if ( // only set if there is a value and not null
|
||||
configs[key[i]] &&
|
||||
! Lang.isUndefined(configs[key[i]].value) &&
|
||||
! Lang.isNull(configs[key[i]].value) ) {
|
||||
configs[key[i]].refresh(silent);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Adds an Attribute to the AttributeProvider instance.
|
||||
* @method register
|
||||
* @param {String} key The attribute's name
|
||||
* @param {Object} map A key-value map containing the
|
||||
* attribute's properties.
|
||||
* @deprecated Use setAttributeConfig
|
||||
*/
|
||||
register: function(key, map) {
|
||||
this.setAttributeConfig(key, map);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Returns the attribute's properties.
|
||||
* @method getAttributeConfig
|
||||
* @param {String} key The attribute's name
|
||||
* @private
|
||||
* @return {object} A key-value map containing all of the
|
||||
* attribute's properties.
|
||||
*/
|
||||
getAttributeConfig: function(key) {
|
||||
var configs = this._configs || {};
|
||||
var config = configs[key] || {};
|
||||
var map = {}; // returning a copy to prevent overrides
|
||||
|
||||
for (key in config) {
|
||||
if ( Lang.hasOwnProperty(config, key) ) {
|
||||
map[key] = config[key];
|
||||
}
|
||||
}
|
||||
|
||||
return map;
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets or updates an Attribute instance's properties.
|
||||
* @method setAttributeConfig
|
||||
* @param {String} key The attribute's name.
|
||||
* @param {Object} map A key-value map of attribute properties
|
||||
* @param {Boolean} init Whether or not this should become the intial config.
|
||||
*/
|
||||
setAttributeConfig: function(key, map, init) {
|
||||
var configs = this._configs || {};
|
||||
map = map || {};
|
||||
if (!configs[key]) {
|
||||
map.name = key;
|
||||
configs[key] = new YAHOO.util.Attribute(map, this);
|
||||
} else {
|
||||
configs[key].configure(map, init);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets or updates an Attribute instance's properties.
|
||||
* @method configureAttribute
|
||||
* @param {String} key The attribute's name.
|
||||
* @param {Object} map A key-value map of attribute properties
|
||||
* @param {Boolean} init Whether or not this should become the intial config.
|
||||
* @deprecated Use setAttributeConfig
|
||||
*/
|
||||
configureAttribute: function(key, map, init) {
|
||||
this.setAttributeConfig(key, map, init);
|
||||
},
|
||||
|
||||
/**
|
||||
* Resets an attribute to its intial configuration.
|
||||
* @method resetAttributeConfig
|
||||
* @param {String} key The attribute's name.
|
||||
* @private
|
||||
*/
|
||||
resetAttributeConfig: function(key){
|
||||
var configs = this._configs || {};
|
||||
configs[key].resetConfig();
|
||||
},
|
||||
|
||||
/**
|
||||
* Fires the attribute's beforeChange event.
|
||||
* @method fireBeforeChangeEvent
|
||||
* @param {String} key The attribute's name.
|
||||
* @param {Obj} e The event object to pass to handlers.
|
||||
*/
|
||||
fireBeforeChangeEvent: function(e) {
|
||||
var type = 'before';
|
||||
type += e.type.charAt(0).toUpperCase() + e.type.substr(1) + 'Change';
|
||||
e.type = type;
|
||||
return this.fireEvent(e.type, e);
|
||||
},
|
||||
|
||||
/**
|
||||
* Fires the attribute's change event.
|
||||
* @method fireChangeEvent
|
||||
* @param {String} key The attribute's name.
|
||||
* @param {Obj} e The event object to pass to the handlers.
|
||||
*/
|
||||
fireChangeEvent: function(e) {
|
||||
e.type += 'Change';
|
||||
return this.fireEvent(e.type, e);
|
||||
}
|
||||
};
|
||||
|
||||
YAHOO.augment(YAHOO.util.AttributeProvider, YAHOO.util.EventProvider);
|
||||
})();
|
||||
|
||||
(function() {
|
||||
// internal shorthand
|
||||
var Dom = YAHOO.util.Dom,
|
||||
AttributeProvider = YAHOO.util.AttributeProvider;
|
||||
|
||||
/**
|
||||
* Element provides an wrapper object to simplify adding
|
||||
* event listeners, using dom methods, and managing attributes.
|
||||
* @module element
|
||||
* @namespace YAHOO.util
|
||||
* @requires yahoo, dom, event
|
||||
* @beta
|
||||
*/
|
||||
|
||||
/**
|
||||
* Element provides an wrapper object to simplify adding
|
||||
* event listeners, using dom methods, and managing attributes.
|
||||
* @class Element
|
||||
* @uses YAHOO.util.AttributeProvider
|
||||
* @constructor
|
||||
* @param el {HTMLElement | String} The html element that
|
||||
* represents the Element.
|
||||
* @param {Object} map A key-value map of initial config names and values
|
||||
*/
|
||||
YAHOO.util.Element = function(el, map) {
|
||||
if (arguments.length) {
|
||||
this.init(el, map);
|
||||
}
|
||||
};
|
||||
|
||||
YAHOO.util.Element.prototype = {
|
||||
/**
|
||||
* Dom events supported by the Element instance.
|
||||
* @property DOM_EVENTS
|
||||
* @type Object
|
||||
*/
|
||||
DOM_EVENTS: null,
|
||||
|
||||
/**
|
||||
* Wrapper for HTMLElement method.
|
||||
* @method appendChild
|
||||
* @param {Boolean} deep Whether or not to do a deep clone
|
||||
*/
|
||||
appendChild: function(child) {
|
||||
child = child.get ? child.get('element') : child;
|
||||
this.get('element').appendChild(child);
|
||||
},
|
||||
|
||||
/**
|
||||
* Wrapper for HTMLElement method.
|
||||
* @method getElementsByTagName
|
||||
* @param {String} tag The tagName to collect
|
||||
*/
|
||||
getElementsByTagName: function(tag) {
|
||||
return this.get('element').getElementsByTagName(tag);
|
||||
},
|
||||
|
||||
/**
|
||||
* Wrapper for HTMLElement method.
|
||||
* @method hasChildNodes
|
||||
* @return {Boolean} Whether or not the element has childNodes
|
||||
*/
|
||||
hasChildNodes: function() {
|
||||
return this.get('element').hasChildNodes();
|
||||
},
|
||||
|
||||
/**
|
||||
* Wrapper for HTMLElement method.
|
||||
* @method insertBefore
|
||||
* @param {HTMLElement} element The HTMLElement to insert
|
||||
* @param {HTMLElement} before The HTMLElement to insert
|
||||
* the element before.
|
||||
*/
|
||||
insertBefore: function(element, before) {
|
||||
element = element.get ? element.get('element') : element;
|
||||
before = (before && before.get) ? before.get('element') : before;
|
||||
|
||||
this.get('element').insertBefore(element, before);
|
||||
},
|
||||
|
||||
/**
|
||||
* Wrapper for HTMLElement method.
|
||||
* @method removeChild
|
||||
* @param {HTMLElement} child The HTMLElement to remove
|
||||
*/
|
||||
removeChild: function(child) {
|
||||
child = child.get ? child.get('element') : child;
|
||||
this.get('element').removeChild(child);
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Wrapper for HTMLElement method.
|
||||
* @method replaceChild
|
||||
* @param {HTMLElement} newNode The HTMLElement to insert
|
||||
* @param {HTMLElement} oldNode The HTMLElement to replace
|
||||
*/
|
||||
replaceChild: function(newNode, oldNode) {
|
||||
newNode = newNode.get ? newNode.get('element') : newNode;
|
||||
oldNode = oldNode.get ? oldNode.get('element') : oldNode;
|
||||
return this.get('element').replaceChild(newNode, oldNode);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Registers Element specific attributes.
|
||||
* @method initAttributes
|
||||
* @param {Object} map A key-value map of initial attribute configs
|
||||
*/
|
||||
initAttributes: function(map) {
|
||||
},
|
||||
|
||||
/**
|
||||
* Adds a listener for the given event. These may be DOM or
|
||||
* customEvent listeners. Any event that is fired via fireEvent
|
||||
* can be listened for. All handlers receive an event object.
|
||||
* @method addListener
|
||||
* @param {String} type The name of the event to listen for
|
||||
* @param {Function} fn The handler to call when the event fires
|
||||
* @param {Any} obj A variable to pass to the handler
|
||||
* @param {Object} scope The object to use for the scope of the handler
|
||||
*/
|
||||
addListener: function(type, fn, obj, scope) {
|
||||
var el = this.get('element');
|
||||
scope = scope || this;
|
||||
|
||||
el = this.get('id') || el;
|
||||
var self = this;
|
||||
if (!this._events[type]) { // create on the fly
|
||||
if ( this.DOM_EVENTS[type] ) {
|
||||
YAHOO.util.Event.addListener(el, type, function(e) {
|
||||
if (e.srcElement && !e.target) { // supplement IE with target
|
||||
e.target = e.srcElement;
|
||||
}
|
||||
self.fireEvent(type, e);
|
||||
}, obj, scope);
|
||||
}
|
||||
|
||||
this.createEvent(type, this);
|
||||
}
|
||||
|
||||
this.subscribe.apply(this, arguments); // notify via customEvent
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Alias for addListener
|
||||
* @method on
|
||||
* @param {String} type The name of the event to listen for
|
||||
* @param {Function} fn The function call when the event fires
|
||||
* @param {Any} obj A variable to pass to the handler
|
||||
* @param {Object} scope The object to use for the scope of the handler
|
||||
*/
|
||||
on: function() { this.addListener.apply(this, arguments); },
|
||||
|
||||
|
||||
/**
|
||||
* Remove an event listener
|
||||
* @method removeListener
|
||||
* @param {String} type The name of the event to listen for
|
||||
* @param {Function} fn The function call when the event fires
|
||||
*/
|
||||
removeListener: function(type, fn) {
|
||||
this.unsubscribe.apply(this, arguments);
|
||||
},
|
||||
|
||||
/**
|
||||
* Wrapper for Dom method.
|
||||
* @method addClass
|
||||
* @param {String} className The className to add
|
||||
*/
|
||||
addClass: function(className) {
|
||||
Dom.addClass(this.get('element'), className);
|
||||
},
|
||||
|
||||
/**
|
||||
* Wrapper for Dom method.
|
||||
* @method getElementsByClassName
|
||||
* @param {String} className The className to collect
|
||||
* @param {String} tag (optional) The tag to use in
|
||||
* conjunction with class name
|
||||
* @return {Array} Array of HTMLElements
|
||||
*/
|
||||
getElementsByClassName: function(className, tag) {
|
||||
return Dom.getElementsByClassName(className, tag,
|
||||
this.get('element') );
|
||||
},
|
||||
|
||||
/**
|
||||
* Wrapper for Dom method.
|
||||
* @method hasClass
|
||||
* @param {String} className The className to add
|
||||
* @return {Boolean} Whether or not the element has the class name
|
||||
*/
|
||||
hasClass: function(className) {
|
||||
return Dom.hasClass(this.get('element'), className);
|
||||
},
|
||||
|
||||
/**
|
||||
* Wrapper for Dom method.
|
||||
* @method removeClass
|
||||
* @param {String} className The className to remove
|
||||
*/
|
||||
removeClass: function(className) {
|
||||
return Dom.removeClass(this.get('element'), className);
|
||||
},
|
||||
|
||||
/**
|
||||
* Wrapper for Dom method.
|
||||
* @method replaceClass
|
||||
* @param {String} oldClassName The className to replace
|
||||
* @param {String} newClassName The className to add
|
||||
*/
|
||||
replaceClass: function(oldClassName, newClassName) {
|
||||
return Dom.replaceClass(this.get('element'),
|
||||
oldClassName, newClassName);
|
||||
},
|
||||
|
||||
/**
|
||||
* Wrapper for Dom method.
|
||||
* @method setStyle
|
||||
* @param {String} property The style property to set
|
||||
* @param {String} value The value to apply to the style property
|
||||
*/
|
||||
setStyle: function(property, value) {
|
||||
var el = this.get('element');
|
||||
if (!el) {
|
||||
return this._queue[this._queue.length] = ['setStyle', arguments];
|
||||
}
|
||||
|
||||
return Dom.setStyle(el, property, value); // TODO: always queuing?
|
||||
},
|
||||
|
||||
/**
|
||||
* Wrapper for Dom method.
|
||||
* @method getStyle
|
||||
* @param {String} property The style property to retrieve
|
||||
* @return {String} The current value of the property
|
||||
*/
|
||||
getStyle: function(property) {
|
||||
return Dom.getStyle(this.get('element'), property);
|
||||
},
|
||||
|
||||
/**
|
||||
* Apply any queued set calls.
|
||||
* @method fireQueue
|
||||
*/
|
||||
fireQueue: function() {
|
||||
var queue = this._queue;
|
||||
for (var i = 0, len = queue.length; i < len; ++i) {
|
||||
this[queue[i][0]].apply(this, queue[i][1]);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Appends the HTMLElement into either the supplied parentNode.
|
||||
* @method appendTo
|
||||
* @param {HTMLElement | Element} parentNode The node to append to
|
||||
* @param {HTMLElement | Element} before An optional node to insert before
|
||||
*/
|
||||
appendTo: function(parent, before) {
|
||||
parent = (parent.get) ? parent.get('element') : Dom.get(parent);
|
||||
|
||||
this.fireEvent('beforeAppendTo', {
|
||||
type: 'beforeAppendTo',
|
||||
target: parent
|
||||
});
|
||||
|
||||
|
||||
before = (before && before.get) ?
|
||||
before.get('element') : Dom.get(before);
|
||||
var element = this.get('element');
|
||||
|
||||
if (!element) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!parent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (element.parent != parent) {
|
||||
if (before) {
|
||||
parent.insertBefore(element, before);
|
||||
} else {
|
||||
parent.appendChild(element);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.fireEvent('appendTo', {
|
||||
type: 'appendTo',
|
||||
target: parent
|
||||
});
|
||||
},
|
||||
|
||||
get: function(key) {
|
||||
var configs = this._configs || {};
|
||||
var el = configs.element; // avoid loop due to 'element'
|
||||
if (el && !configs[key] && !YAHOO.lang.isUndefined(el.value[key]) ) {
|
||||
return el.value[key];
|
||||
}
|
||||
|
||||
return AttributeProvider.prototype.get.call(this, key);
|
||||
},
|
||||
|
||||
set: function(key, value, silent) {
|
||||
var el = this.get('element');
|
||||
if (!el) {
|
||||
this._queue[this._queue.length] = ['set', arguments];
|
||||
if (this._configs[key]) {
|
||||
this._configs[key].value = value; // so "get" works while queueing
|
||||
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// set it on the element if not configured and is an HTML attribute
|
||||
if ( !this._configs[key] && !YAHOO.lang.isUndefined(el[key]) ) {
|
||||
_registerHTMLAttr.call(this, key);
|
||||
}
|
||||
|
||||
return AttributeProvider.prototype.set.apply(this, arguments);
|
||||
},
|
||||
|
||||
setAttributeConfig: function(key, map, init) {
|
||||
var el = this.get('element');
|
||||
|
||||
if (el && !this._configs[key] && !YAHOO.lang.isUndefined(el[key]) ) {
|
||||
_registerHTMLAttr.call(this, key, map);
|
||||
} else {
|
||||
AttributeProvider.prototype.setAttributeConfig.apply(this, arguments);
|
||||
}
|
||||
},
|
||||
|
||||
getAttributeKeys: function() {
|
||||
var el = this.get('element');
|
||||
var keys = AttributeProvider.prototype.getAttributeKeys.call(this);
|
||||
|
||||
//add any unconfigured element keys
|
||||
for (var key in el) {
|
||||
if (!this._configs[key]) {
|
||||
keys[key] = keys[key] || el[key];
|
||||
}
|
||||
}
|
||||
|
||||
return keys;
|
||||
},
|
||||
|
||||
createEvent: function(type, scope) {
|
||||
this._events[type] = true;
|
||||
AttributeProvider.prototype.createEvent.apply(this, arguments);
|
||||
},
|
||||
|
||||
init: function(el, attr) {
|
||||
_initElement.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
|
||||
var _initElement = function(el, attr) {
|
||||
this._queue = this._queue || [];
|
||||
this._events = this._events || {};
|
||||
this._configs = this._configs || {};
|
||||
attr = attr || {};
|
||||
attr.element = attr.element || el || null;
|
||||
|
||||
this.DOM_EVENTS = {
|
||||
'click': true,
|
||||
'dblclick': true,
|
||||
'keydown': true,
|
||||
'keypress': true,
|
||||
'keyup': true,
|
||||
'mousedown': true,
|
||||
'mousemove': true,
|
||||
'mouseout': true,
|
||||
'mouseover': true,
|
||||
'mouseup': true,
|
||||
'focus': true,
|
||||
'blur': true,
|
||||
'submit': true
|
||||
};
|
||||
|
||||
var isReady = false; // to determine when to init HTMLElement and content
|
||||
|
||||
if (YAHOO.lang.isString(el) ) { // defer until available/ready
|
||||
_registerHTMLAttr.call(this, 'id', { value: attr.element });
|
||||
}
|
||||
|
||||
if (Dom.get(el)) {
|
||||
isReady = true;
|
||||
_initHTMLElement.call(this, attr);
|
||||
_initContent.call(this, attr);
|
||||
}
|
||||
|
||||
YAHOO.util.Event.onAvailable(attr.element, function() {
|
||||
if (!isReady) { // otherwise already done
|
||||
_initHTMLElement.call(this, attr);
|
||||
}
|
||||
|
||||
this.fireEvent('available', { type: 'available', target: attr.element });
|
||||
}, this, true);
|
||||
|
||||
YAHOO.util.Event.onContentReady(attr.element, function() {
|
||||
if (!isReady) { // otherwise already done
|
||||
_initContent.call(this, attr);
|
||||
}
|
||||
this.fireEvent('contentReady', { type: 'contentReady', target: attr.element });
|
||||
}, this, true);
|
||||
};
|
||||
|
||||
var _initHTMLElement = function(attr) {
|
||||
/**
|
||||
* The HTMLElement the Element instance refers to.
|
||||
* @config element
|
||||
* @type HTMLElement
|
||||
*/
|
||||
this.setAttributeConfig('element', {
|
||||
value: Dom.get(attr.element),
|
||||
readOnly: true
|
||||
});
|
||||
};
|
||||
|
||||
var _initContent = function(attr) {
|
||||
this.initAttributes(attr);
|
||||
this.setAttributes(attr, true);
|
||||
this.fireQueue();
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the value of the property and fires beforeChange and change events.
|
||||
* @private
|
||||
* @method _registerHTMLAttr
|
||||
* @param {YAHOO.util.Element} element The Element instance to
|
||||
* register the config to.
|
||||
* @param {String} key The name of the config to register
|
||||
* @param {Object} map A key-value map of the config's params
|
||||
*/
|
||||
var _registerHTMLAttr = function(key, map) {
|
||||
var el = this.get('element');
|
||||
map = map || {};
|
||||
map.name = key;
|
||||
map.method = map.method || function(value) {
|
||||
el[key] = value;
|
||||
};
|
||||
map.value = map.value || el[key];
|
||||
this._configs[key] = new YAHOO.util.Attribute(map, this);
|
||||
};
|
||||
|
||||
/**
|
||||
* Fires when the Element's HTMLElement can be retrieved by Id.
|
||||
* <p>See: <a href="#addListener">Element.addListener</a></p>
|
||||
* <p><strong>Event fields:</strong><br>
|
||||
* <code><String> type</code> available<br>
|
||||
* <code><HTMLElement>
|
||||
* target</code> the HTMLElement bound to this Element instance<br>
|
||||
* <p><strong>Usage:</strong><br>
|
||||
* <code>var handler = function(e) {var target = e.target};<br>
|
||||
* myTabs.addListener('available', handler);</code></p>
|
||||
* @event available
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fires when the Element's HTMLElement subtree is rendered.
|
||||
* <p>See: <a href="#addListener">Element.addListener</a></p>
|
||||
* <p><strong>Event fields:</strong><br>
|
||||
* <code><String> type</code> contentReady<br>
|
||||
* <code><HTMLElement>
|
||||
* target</code> the HTMLElement bound to this Element instance<br>
|
||||
* <p><strong>Usage:</strong><br>
|
||||
* <code>var handler = function(e) {var target = e.target};<br>
|
||||
* myTabs.addListener('contentReady', handler);</code></p>
|
||||
* @event contentReady
|
||||
*/
|
||||
|
||||
|
||||
YAHOO.augment(YAHOO.util.Element, AttributeProvider);
|
||||
})();
|
||||
|
||||
YAHOO.register("element", YAHOO.util.Element, {version: "2.2.2", build: "204"});
|
||||
|
|
@ -1,180 +0,0 @@
|
|||
|
||||
YUI Library - Event - Release Notes
|
||||
|
||||
2.2.2
|
||||
* No change
|
||||
|
||||
2.2.1
|
||||
* onAvailable listeners are processed before onContentReady listeners so
|
||||
they fire in the logical order when an element is found to be available
|
||||
and ready in the same pass.
|
||||
* Added onDOMReady for receiving notification when the DOM is first usable.
|
||||
* In Internet Explorer, onAvailable/onContentReady checks now start when
|
||||
DOMReady fires to reduce the possibility of receiving an "operation
|
||||
aborted" errors when inserting DOM nodes during in the onAvailable/
|
||||
onContentReady listener execution.
|
||||
* CustomEvent subscribers supplying undefined callbacks will be notified
|
||||
when subscribing rather than having an ambiguous error thrown when the
|
||||
event is fired.
|
||||
* Fixed missing html tags in the examples.
|
||||
* POLL_INTERVAL is 10 ms.
|
||||
* YAHOO.util.CustomEvent is now declared before YAHOO.util.Event.
|
||||
|
||||
2.2.0
|
||||
|
||||
* YAHOO.util.KeyListener was moved from the container package into event.
|
||||
|
||||
* The Safari bug that made it so preventDefault would not work with click
|
||||
and double-click listeners on anchor tags was resolved in version 2.0.4.
|
||||
The workaround (using DOM0 events for these instead of the normal DOM2
|
||||
events) is now only used for releases prior to 2.0.4.
|
||||
|
||||
* getListeners/purgeElement now work correctly with unload listeners
|
||||
|
||||
* When legacyEvents are used (Safari<2.0.4 click events), if there was an
|
||||
existing DOM0 event that the utility replaced, it is executed along with
|
||||
the listeners that were added with the utility.
|
||||
|
||||
* Restored Event.regCE for compatibility with a beta release of the library
|
||||
that in use in an external API.
|
||||
|
||||
* unsubscribe in CustomEvent and EventProvider will remove all listeners
|
||||
if the listener is omitted.
|
||||
|
||||
* Added unsubscribeAll to EventProvider
|
||||
|
||||
* Added Event.lastError which stores the most recent error object if
|
||||
a browser-specific add/remove listener call throws an exception.
|
||||
|
||||
0.12.2
|
||||
|
||||
* Fixed a bug introduced in 0.12.1 release caused nested onAvailable
|
||||
calls to fail.
|
||||
|
||||
0.12.1
|
||||
|
||||
* If an error is thrown during the browser-specific add/remove lister call,
|
||||
addListener/removeListener will catch the error and return false.
|
||||
|
||||
* onAvailable array items are nulled out instead of deleted when completed to
|
||||
get around an Opera issue introduced in a recent version of the browser.
|
||||
|
||||
0.12.0
|
||||
|
||||
* If the function argument is not provided to Event.removeListener, all
|
||||
all listeners for the specified event type on the element will be removed.
|
||||
|
||||
* CustomEvent now has an optional parameter that defines the signature of
|
||||
the listeners for this event. Two signatures are supported:
|
||||
|
||||
YAHOO.util.CustomEvent.LIST:
|
||||
param1: event name
|
||||
param2: array of arguments provided to fire()
|
||||
param3: <optional> the custom object supplied to subscribe()
|
||||
|
||||
YAHOO.util.CustomEvent.FLAT:
|
||||
param1: the first argument provided to fire()
|
||||
param2: <optional> the custom object supplied to subscribe()
|
||||
|
||||
The new flat signature makes it possible to provide a better API
|
||||
when using custom events, and it makes it possible to transparently
|
||||
wrap DOM events.
|
||||
|
||||
* The parameters for overriding scope in both Event.addListener, and
|
||||
CustomEvent.subscribe have been augmented. In addition to the
|
||||
previous behavior where a true value would make the previous parameter
|
||||
the execution scope, an object can be supplied instead. If an object
|
||||
is provided, that object becomes the scope obj. This makes it possible
|
||||
to pass a both a custom object and adjust the scope to a different object.
|
||||
|
||||
* Added EventProvider, which is a wrapper for CustomEvent that makes it
|
||||
possible to subscribe to events by name, whether or not the event has
|
||||
been created. This class was designed to be used with YAHOO.augment.
|
||||
EventProvider custom events are created with the new FLAT listener
|
||||
signature.
|
||||
|
||||
* CustomEvent subscribers can return false to stop the propagation of
|
||||
the event.
|
||||
|
||||
* CustomEvents now have an onSubscribe custom event that can used to the
|
||||
case where a subscriber subscribes to an one-time event that has already
|
||||
happened. Also provides a way for the implementer to defer initialization
|
||||
logic until after the first subscription.
|
||||
|
||||
* Event.getCharCode now always returns keyCode if charCode is not available.
|
||||
|
||||
* Added Event.onContentReady, which is similar to onAvailable, but it also
|
||||
checks simblings to try to determine when the element's children are
|
||||
available.
|
||||
|
||||
0.11.4
|
||||
|
||||
* Fixed a memory leak in IE6 that occurred when the utility was hosted in
|
||||
an iframe.
|
||||
|
||||
* Fixed an issue with Safari click listeners when listeners were removed.
|
||||
|
||||
0.11.3
|
||||
|
||||
* The listener cache is now pruned when events are removed. This fixes
|
||||
a performance issue when adding many listeners, removing them, and
|
||||
adding them again repeatedly.
|
||||
|
||||
* Safari click listeners will work correctly if a bound element is removed
|
||||
from the DOM and a new element with the same ID is added.
|
||||
|
||||
* Removed the code that automatically unsubscribed custom event listeners.
|
||||
|
||||
0.11.0
|
||||
|
||||
* Added Event.purgeElement which will remove all listeners added via
|
||||
addListener from the supplied element. If an optional "type" parameter
|
||||
is supplied, only events of that type will be removed. Optionally, the
|
||||
purge can be performed recursively on the element's children as well.
|
||||
|
||||
* Added Event.getListeners which will return all listeners attached to
|
||||
a given element.. either all listeners or listeners of a specific type.
|
||||
|
||||
* getTarget now automatically resolves text nodes. The optional parameter
|
||||
for this feature is now deprecated.
|
||||
|
||||
* getRelatedTarget now resolves text nodes for the browsers that return the
|
||||
text node rather than its host HTML element.
|
||||
|
||||
* CustomEvent now logs the custom event activity if the logger widget is available
|
||||
|
||||
0.10.0
|
||||
|
||||
* Added Safari dblclick to the list of legacy events.
|
||||
|
||||
* When multiple identical event handlers are defined, multiple calls
|
||||
to removeListener can now remove all of them.
|
||||
|
||||
* removeListener works properly for unload events
|
||||
|
||||
* Legacy event bookkeeping is more efficient, improving the performance for
|
||||
adding Safari click events.
|
||||
|
||||
* _unload() is more efficient, improving the page transition experience in
|
||||
Safari in particular.
|
||||
|
||||
* addListener, removeListener now return false if the function argument is
|
||||
not valid.
|
||||
|
||||
* Fixed an operator precedence issue in getCharCode.
|
||||
|
||||
* Added Event.getXY, which returns [Event.getPageX(e), Event.getPageY(e)]
|
||||
|
||||
* Added Event.onAvailable, which will execute the callback when the element
|
||||
with the supplied id is found. Currently searches periodically until the
|
||||
window load event or for up to 10 seconds after the onAvailable method
|
||||
was executed.
|
||||
|
||||
* The lazy listener attachment process now will poll beyond the window load
|
||||
event in order to better handle the case when a listener is defined
|
||||
late in the page but before the element is in the dom.
|
||||
|
||||
* Fixed browser detection for Opera installations reporting as IE.
|
||||
|
||||
* It is now possible to remove and re-add legacy events (Safari click event).
|
||||
|
||||
2205
www/extras/yui/build/event/event-debug.js
vendored
87
www/extras/yui/build/event/event-min.js
vendored
|
|
@ -1,87 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 2.2.2
|
||||
*/
|
||||
|
||||
YAHOO.util.CustomEvent=function(type,oScope,silent,signature){this.type=type;this.scope=oScope||window;this.silent=silent;this.signature=signature||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){}
|
||||
var onsubscribeType="_YUICEOnSubscribe";if(type!==onsubscribeType){this.subscribeEvent=new YAHOO.util.CustomEvent(onsubscribeType,this,true);}};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(fn,obj,override){if(!fn){throw new Error("Invalid callback for subscriber to '"+this.type+"'");}
|
||||
if(this.subscribeEvent){this.subscribeEvent.fire(fn,obj,override);}
|
||||
this.subscribers.push(new YAHOO.util.Subscriber(fn,obj,override));},unsubscribe:function(fn,obj){if(!fn){return this.unsubscribeAll();}
|
||||
var found=false;for(var i=0,len=this.subscribers.length;i<len;++i){var s=this.subscribers[i];if(s&&s.contains(fn,obj)){this._delete(i);found=true;}}
|
||||
return found;},fire:function(){var len=this.subscribers.length;if(!len&&this.silent){return true;}
|
||||
var args=[],ret=true,i;for(i=0;i<arguments.length;++i){args.push(arguments[i]);}
|
||||
var argslength=args.length;if(!this.silent){}
|
||||
for(i=0;i<len;++i){var s=this.subscribers[i];if(s){if(!this.silent){}
|
||||
var scope=s.getScope(this.scope);if(this.signature==YAHOO.util.CustomEvent.FLAT){var param=null;if(args.length>0){param=args[0];}
|
||||
ret=s.fn.call(scope,param,s.obj);}else{ret=s.fn.call(scope,this.type,args,s.obj);}
|
||||
if(false===ret){if(!this.silent){}
|
||||
return false;}}}
|
||||
return true;},unsubscribeAll:function(){for(var i=0,len=this.subscribers.length;i<len;++i){this._delete(len-1-i);}
|
||||
return i;},_delete:function(index){var s=this.subscribers[index];if(s){delete s.fn;delete s.obj;}
|
||||
this.subscribers.splice(index,1);},toString:function(){return"CustomEvent: "+"'"+this.type+"', "+"scope: "+this.scope;}};YAHOO.util.Subscriber=function(fn,obj,override){this.fn=fn;this.obj=obj||null;this.override=override;};YAHOO.util.Subscriber.prototype.getScope=function(defaultScope){if(this.override){if(this.override===true){return this.obj;}else{return this.override;}}
|
||||
return defaultScope;};YAHOO.util.Subscriber.prototype.contains=function(fn,obj){if(obj){return(this.fn==fn&&this.obj==obj);}else{return(this.fn==fn);}};YAHOO.util.Subscriber.prototype.toString=function(){return"Subscriber { obj: "+(this.obj||"")+", override: "+(this.override||"no")+" }";};if(!YAHOO.util.Event){YAHOO.util.Event=function(){var loadComplete=false;var DOMReady=false;var listeners=[];var unloadListeners=[];var legacyEvents=[];var legacyHandlers=[];var retryCount=0;var onAvailStack=[];var legacyMap=[];var counter=0;var lastError=null;return{POLL_RETRYS:200,POLL_INTERVAL:10,EL:0,TYPE:1,FN:2,WFN:3,OBJ:3,ADJ_SCOPE:4,isSafari:(/KHTML/gi).test(navigator.userAgent),webkit:function(){var v=navigator.userAgent.match(/AppleWebKit\/([^ ]*)/);if(v&&v[1]){return v[1];}
|
||||
return null;}(),isIE:(!this.webkit&&!navigator.userAgent.match(/opera/gi)&&navigator.userAgent.match(/msie/gi)),_interval:null,startInterval:function(){if(!this._interval){var self=this;var callback=function(){self._tryPreloadAttach();};this._interval=setInterval(callback,this.POLL_INTERVAL);}},onAvailable:function(p_id,p_fn,p_obj,p_override){onAvailStack.push({id:p_id,fn:p_fn,obj:p_obj,override:p_override,checkReady:false});retryCount=this.POLL_RETRYS;this.startInterval();},onDOMReady:function(p_fn,p_obj,p_override){this.DOMReadyEvent.subscribe(p_fn,p_obj,p_override);},onContentReady:function(p_id,p_fn,p_obj,p_override){onAvailStack.push({id:p_id,fn:p_fn,obj:p_obj,override:p_override,checkReady:true});retryCount=this.POLL_RETRYS;this.startInterval();},addListener:function(el,sType,fn,obj,override){if(!fn||!fn.call){return false;}
|
||||
if(this._isValidCollection(el)){var ok=true;for(var i=0,len=el.length;i<len;++i){ok=this.on(el[i],sType,fn,obj,override)&&ok;}
|
||||
return ok;}else if(typeof el=="string"){var oEl=this.getEl(el);if(oEl){el=oEl;}else{this.onAvailable(el,function(){YAHOO.util.Event.on(el,sType,fn,obj,override);});return true;}}
|
||||
if(!el){return false;}
|
||||
if("unload"==sType&&obj!==this){unloadListeners[unloadListeners.length]=[el,sType,fn,obj,override];return true;}
|
||||
var scope=el;if(override){if(override===true){scope=obj;}else{scope=override;}}
|
||||
var wrappedFn=function(e){return fn.call(scope,YAHOO.util.Event.getEvent(e),obj);};var li=[el,sType,fn,wrappedFn,scope];var index=listeners.length;listeners[index]=li;if(this.useLegacyEvent(el,sType)){var legacyIndex=this.getLegacyIndex(el,sType);if(legacyIndex==-1||el!=legacyEvents[legacyIndex][0]){legacyIndex=legacyEvents.length;legacyMap[el.id+sType]=legacyIndex;legacyEvents[legacyIndex]=[el,sType,el["on"+sType]];legacyHandlers[legacyIndex]=[];el["on"+sType]=function(e){YAHOO.util.Event.fireLegacyEvent(YAHOO.util.Event.getEvent(e),legacyIndex);};}
|
||||
legacyHandlers[legacyIndex].push(li);}else{try{this._simpleAdd(el,sType,wrappedFn,false);}catch(ex){this.lastError=ex;this.removeListener(el,sType,fn);return false;}}
|
||||
return true;},fireLegacyEvent:function(e,legacyIndex){var ok=true,le,lh,li,scope,ret;lh=legacyHandlers[legacyIndex];for(var i=0,len=lh.length;i<len;++i){li=lh[i];if(li&&li[this.WFN]){scope=li[this.ADJ_SCOPE];ret=li[this.WFN].call(scope,e);ok=(ok&&ret);}}
|
||||
le=legacyEvents[legacyIndex];if(le&&le[2]){le[2](e);}
|
||||
return ok;},getLegacyIndex:function(el,sType){var key=this.generateId(el)+sType;if(typeof legacyMap[key]=="undefined"){return-1;}else{return legacyMap[key];}},useLegacyEvent:function(el,sType){if(this.webkit&&("click"==sType||"dblclick"==sType)){var v=parseInt(this.webkit,10);if(!isNaN(v)&&v<418){return true;}}
|
||||
return false;},removeListener:function(el,sType,fn){var i,len;if(typeof el=="string"){el=this.getEl(el);}else if(this._isValidCollection(el)){var ok=true;for(i=0,len=el.length;i<len;++i){ok=(this.removeListener(el[i],sType,fn)&&ok);}
|
||||
return ok;}
|
||||
if(!fn||!fn.call){return this.purgeElement(el,false,sType);}
|
||||
if("unload"==sType){for(i=0,len=unloadListeners.length;i<len;i++){var li=unloadListeners[i];if(li&&li[0]==el&&li[1]==sType&&li[2]==fn){unloadListeners.splice(i,1);return true;}}
|
||||
return false;}
|
||||
var cacheItem=null;var index=arguments[3];if("undefined"==typeof index){index=this._getCacheIndex(el,sType,fn);}
|
||||
if(index>=0){cacheItem=listeners[index];}
|
||||
if(!el||!cacheItem){return false;}
|
||||
if(this.useLegacyEvent(el,sType)){var legacyIndex=this.getLegacyIndex(el,sType);var llist=legacyHandlers[legacyIndex];if(llist){for(i=0,len=llist.length;i<len;++i){li=llist[i];if(li&&li[this.EL]==el&&li[this.TYPE]==sType&&li[this.FN]==fn){llist.splice(i,1);break;}}}}else{try{this._simpleRemove(el,sType,cacheItem[this.WFN],false);}catch(ex){this.lastError=ex;return false;}}
|
||||
delete listeners[index][this.WFN];delete listeners[index][this.FN];listeners.splice(index,1);return true;},getTarget:function(ev,resolveTextNode){var t=ev.target||ev.srcElement;return this.resolveTextNode(t);},resolveTextNode:function(node){if(node&&3==node.nodeType){return node.parentNode;}else{return node;}},getPageX:function(ev){var x=ev.pageX;if(!x&&0!==x){x=ev.clientX||0;if(this.isIE){x+=this._getScrollLeft();}}
|
||||
return x;},getPageY:function(ev){var y=ev.pageY;if(!y&&0!==y){y=ev.clientY||0;if(this.isIE){y+=this._getScrollTop();}}
|
||||
return y;},getXY:function(ev){return[this.getPageX(ev),this.getPageY(ev)];},getRelatedTarget:function(ev){var t=ev.relatedTarget;if(!t){if(ev.type=="mouseout"){t=ev.toElement;}else if(ev.type=="mouseover"){t=ev.fromElement;}}
|
||||
return this.resolveTextNode(t);},getTime:function(ev){if(!ev.time){var t=new Date().getTime();try{ev.time=t;}catch(ex){this.lastError=ex;return t;}}
|
||||
return ev.time;},stopEvent:function(ev){this.stopPropagation(ev);this.preventDefault(ev);},stopPropagation:function(ev){if(ev.stopPropagation){ev.stopPropagation();}else{ev.cancelBubble=true;}},preventDefault:function(ev){if(ev.preventDefault){ev.preventDefault();}else{ev.returnValue=false;}},getEvent:function(e){var ev=e||window.event;if(!ev){var c=this.getEvent.caller;while(c){ev=c.arguments[0];if(ev&&Event==ev.constructor){break;}
|
||||
c=c.caller;}}
|
||||
return ev;},getCharCode:function(ev){return ev.charCode||ev.keyCode||0;},_getCacheIndex:function(el,sType,fn){for(var i=0,len=listeners.length;i<len;++i){var li=listeners[i];if(li&&li[this.FN]==fn&&li[this.EL]==el&&li[this.TYPE]==sType){return i;}}
|
||||
return-1;},generateId:function(el){var id=el.id;if(!id){id="yuievtautoid-"+counter;++counter;el.id=id;}
|
||||
return id;},_isValidCollection:function(o){return(o&&o.length&&typeof o!="string"&&!o.tagName&&!o.alert&&typeof o[0]!="undefined");},elCache:{},getEl:function(id){return document.getElementById(id);},clearCache:function(){},DOMReadyEvent:new YAHOO.util.CustomEvent("DOMReady",this),_load:function(e){if(!loadComplete){loadComplete=true;var EU=YAHOO.util.Event;EU._ready();if(this.isIE){EU._simpleRemove(window,"load",EU._load);}}},_ready:function(e){if(!DOMReady){DOMReady=true;var EU=YAHOO.util.Event;EU.DOMReadyEvent.fire();EU._simpleRemove(document,"DOMContentLoaded",EU._ready);}},_tryPreloadAttach:function(){if(this.locked){return false;}
|
||||
if(this.isIE&&!DOMReady){return false;}
|
||||
this.locked=true;var tryAgain=!loadComplete;if(!tryAgain){tryAgain=(retryCount>0);}
|
||||
var notAvail=[];var executeItem=function(el,item){var scope=el;if(item.override){if(item.override===true){scope=item.obj;}else{scope=item.override;}}
|
||||
item.fn.call(scope,item.obj);};var i,len,item,el;for(i=0,len=onAvailStack.length;i<len;++i){item=onAvailStack[i];if(item&&!item.checkReady){el=this.getEl(item.id);if(el){executeItem(el,item);onAvailStack[i]=null;}else{notAvail.push(item);}}}
|
||||
for(i=0,len=onAvailStack.length;i<len;++i){item=onAvailStack[i];if(item&&item.checkReady){el=this.getEl(item.id);if(el){if(loadComplete||el.nextSibling){executeItem(el,item);onAvailStack[i]=null;}}else{notAvail.push(item);}}}
|
||||
retryCount=(notAvail.length===0)?0:retryCount-1;if(tryAgain){this.startInterval();}else{clearInterval(this._interval);this._interval=null;}
|
||||
this.locked=false;return true;},purgeElement:function(el,recurse,sType){var elListeners=this.getListeners(el,sType);if(elListeners){for(var i=0,len=elListeners.length;i<len;++i){var l=elListeners[i];this.removeListener(el,l.type,l.fn);}}
|
||||
if(recurse&&el&&el.childNodes){for(i=0,len=el.childNodes.length;i<len;++i){this.purgeElement(el.childNodes[i],recurse,sType);}}},getListeners:function(el,sType){var results=[],searchLists;if(!sType){searchLists=[listeners,unloadListeners];}else if(sType=="unload"){searchLists=[unloadListeners];}else{searchLists=[listeners];}
|
||||
for(var j=0;j<searchLists.length;++j){var searchList=searchLists[j];if(searchList&&searchList.length>0){for(var i=0,len=searchList.length;i<len;++i){var l=searchList[i];if(l&&l[this.EL]===el&&(!sType||sType===l[this.TYPE])){results.push({type:l[this.TYPE],fn:l[this.FN],obj:l[this.OBJ],adjust:l[this.ADJ_SCOPE],index:i});}}}}
|
||||
return(results.length)?results:null;},_unload:function(e){var EU=YAHOO.util.Event,i,j,l,len,index;for(i=0,len=unloadListeners.length;i<len;++i){l=unloadListeners[i];if(l){var scope=window;if(l[EU.ADJ_SCOPE]){if(l[EU.ADJ_SCOPE]===true){scope=l[EU.OBJ];}else{scope=l[EU.ADJ_SCOPE];}}
|
||||
l[EU.FN].call(scope,EU.getEvent(e),l[EU.OBJ]);unloadListeners[i]=null;l=null;scope=null;}}
|
||||
unloadListeners=null;if(listeners&&listeners.length>0){j=listeners.length;while(j){index=j-1;l=listeners[index];if(l){EU.removeListener(l[EU.EL],l[EU.TYPE],l[EU.FN],index);}
|
||||
j=j-1;}
|
||||
l=null;EU.clearCache();}
|
||||
for(i=0,len=legacyEvents.length;i<len;++i){legacyEvents[i][0]=null;legacyEvents[i]=null;}
|
||||
legacyEvents=null;EU._simpleRemove(window,"unload",EU._unload);},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var dd=document.documentElement,db=document.body;if(dd&&(dd.scrollTop||dd.scrollLeft)){return[dd.scrollTop,dd.scrollLeft];}else if(db){return[db.scrollTop,db.scrollLeft];}else{return[0,0];}},regCE:function(){},_simpleAdd:function(){if(window.addEventListener){return function(el,sType,fn,capture){el.addEventListener(sType,fn,(capture));};}else if(window.attachEvent){return function(el,sType,fn,capture){el.attachEvent("on"+sType,fn);};}else{return function(){};}}(),_simpleRemove:function(){if(window.removeEventListener){return function(el,sType,fn,capture){el.removeEventListener(sType,fn,(capture));};}else if(window.detachEvent){return function(el,sType,fn){el.detachEvent("on"+sType,fn);};}else{return function(){};}}()};}();(function(){var EU=YAHOO.util.Event;EU.on=EU.addListener;if(EU.isIE){document.write('<scr'+'ipt id="_yui_eu_dr" defer="true" src="//:"></script>');var el=document.getElementById("_yui_eu_dr");el.onreadystatechange=function(){if("complete"==this.readyState){this.parentNode.removeChild(this);YAHOO.util.Event._ready();}};el=null;YAHOO.util.Event.onDOMReady(YAHOO.util.Event._tryPreloadAttach,YAHOO.util.Event,true);}else if(EU.webkit){EU._drwatch=setInterval(function(){var rs=document.readyState;if("loaded"==rs||"complete"==rs){clearInterval(EU._drwatch);EU._drwatch=null;EU._ready();}},EU.POLL_INTERVAL);}else{EU._simpleAdd(document,"DOMContentLoaded",EU._ready);}
|
||||
EU._simpleAdd(window,"load",EU._load);EU._simpleAdd(window,"unload",EU._unload);EU._tryPreloadAttach();})();}
|
||||
YAHOO.util.EventProvider=function(){};YAHOO.util.EventProvider.prototype={__yui_events:null,__yui_subscribers:null,subscribe:function(p_type,p_fn,p_obj,p_override){this.__yui_events=this.__yui_events||{};var ce=this.__yui_events[p_type];if(ce){ce.subscribe(p_fn,p_obj,p_override);}else{this.__yui_subscribers=this.__yui_subscribers||{};var subs=this.__yui_subscribers;if(!subs[p_type]){subs[p_type]=[];}
|
||||
subs[p_type].push({fn:p_fn,obj:p_obj,override:p_override});}},unsubscribe:function(p_type,p_fn,p_obj){this.__yui_events=this.__yui_events||{};var ce=this.__yui_events[p_type];if(ce){return ce.unsubscribe(p_fn,p_obj);}else{return false;}},unsubscribeAll:function(p_type){return this.unsubscribe(p_type);},createEvent:function(p_type,p_config){this.__yui_events=this.__yui_events||{};var opts=p_config||{};var events=this.__yui_events;if(events[p_type]){}else{var scope=opts.scope||this;var silent=opts.silent||null;var ce=new YAHOO.util.CustomEvent(p_type,scope,silent,YAHOO.util.CustomEvent.FLAT);events[p_type]=ce;if(opts.onSubscribeCallback){ce.subscribeEvent.subscribe(opts.onSubscribeCallback);}
|
||||
this.__yui_subscribers=this.__yui_subscribers||{};var qs=this.__yui_subscribers[p_type];if(qs){for(var i=0;i<qs.length;++i){ce.subscribe(qs[i].fn,qs[i].obj,qs[i].override);}}}
|
||||
return events[p_type];},fireEvent:function(p_type,arg1,arg2,etc){this.__yui_events=this.__yui_events||{};var ce=this.__yui_events[p_type];if(ce){var args=[];for(var i=1;i<arguments.length;++i){args.push(arguments[i]);}
|
||||
return ce.fire.apply(ce,args);}else{return null;}},hasEvent:function(type){if(this.__yui_events){if(this.__yui_events[type]){return true;}}
|
||||
return false;}};YAHOO.util.KeyListener=function(attachTo,keyData,handler,event){if(!attachTo){}else if(!keyData){}else if(!handler){}
|
||||
if(!event){event=YAHOO.util.KeyListener.KEYDOWN;}
|
||||
var keyEvent=new YAHOO.util.CustomEvent("keyPressed");this.enabledEvent=new YAHOO.util.CustomEvent("enabled");this.disabledEvent=new YAHOO.util.CustomEvent("disabled");if(typeof attachTo=='string'){attachTo=document.getElementById(attachTo);}
|
||||
if(typeof handler=='function'){keyEvent.subscribe(handler);}else{keyEvent.subscribe(handler.fn,handler.scope,handler.correctScope);}
|
||||
function handleKeyPress(e,obj){if(!keyData.shift){keyData.shift=false;}
|
||||
if(!keyData.alt){keyData.alt=false;}
|
||||
if(!keyData.ctrl){keyData.ctrl=false;}
|
||||
if(e.shiftKey==keyData.shift&&e.altKey==keyData.alt&&e.ctrlKey==keyData.ctrl){var dataItem;var keyPressed;if(keyData.keys instanceof Array){for(var i=0;i<keyData.keys.length;i++){dataItem=keyData.keys[i];if(dataItem==e.charCode){keyEvent.fire(e.charCode,e);break;}else if(dataItem==e.keyCode){keyEvent.fire(e.keyCode,e);break;}}}else{dataItem=keyData.keys;if(dataItem==e.charCode){keyEvent.fire(e.charCode,e);}else if(dataItem==e.keyCode){keyEvent.fire(e.keyCode,e);}}}}
|
||||
this.enable=function(){if(!this.enabled){YAHOO.util.Event.addListener(attachTo,event,handleKeyPress);this.enabledEvent.fire(keyData);}
|
||||
this.enabled=true;};this.disable=function(){if(this.enabled){YAHOO.util.Event.removeListener(attachTo,event,handleKeyPress);this.disabledEvent.fire(keyData);}
|
||||
this.enabled=false;};this.toString=function(){return"KeyListener ["+keyData.keys+"] "+attachTo.tagName+
|
||||
(attachTo.id?"["+attachTo.id+"]":"");};};YAHOO.util.KeyListener.KEYDOWN="keydown";YAHOO.util.KeyListener.KEYUP="keyup";YAHOO.register("event",YAHOO.util.Event,{version:"2.2.2",build:"204"});
|
||||
2183
www/extras/yui/build/event/event.js
vendored
|
|
@ -1,13 +0,0 @@
|
|||
YUI Library - Fonts - Release Notes
|
||||
|
||||
Version 2.2.0 - 2.2.2
|
||||
|
||||
* No changes.
|
||||
|
||||
Version 0.10.1 - 0.12.2
|
||||
|
||||
* No changes.
|
||||
|
||||
Version 0.10.0
|
||||
|
||||
* Initial release.
|
||||
7
www/extras/yui/build/fonts/fonts-min.css
vendored
|
|
@ -1,7 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 2.2.2
|
||||
*/
|
||||
body {font:13px arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}table {font-size:inherit;font:100%;}select, input, textarea {font:99% arial,helvetica,clean,sans-serif;}pre, code {font:115% monospace;*font-size:100%;}body * {line-height:1.22em;}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 2.2.2
|
||||
*/
|
||||
/**
|
||||
* Percents could work for IE, but for backCompat purposes, we are using keywords.
|
||||
* x-small is for IE6/7 quirks mode.
|
||||
*
|
||||
*/
|
||||
body {font:13px arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}
|
||||
table {font-size:inherit;font:100%;}
|
||||
|
||||
/**
|
||||
* 99% for safari; 100% is too large
|
||||
*/
|
||||
select, input, textarea {font:99% arial,helvetica,clean,sans-serif;}
|
||||
|
||||
/**
|
||||
* Bump up !IE to get to 13px equivalent
|
||||
*/
|
||||
pre, code {font:115% monospace;*font-size:100%;}
|
||||
|
||||
/**
|
||||
* Default line-height based on font-size rather than "computed-value"
|
||||
* see: http://www.w3.org/TR/CSS21/visudet.html#line-height
|
||||
*/
|
||||
body * {line-height:1.22em;}
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
YUI Library - Grids - Release Notes
|
||||
|
||||
Version 2.2.0 - 2.2.2
|
||||
|
||||
* No changes.
|
||||
|
||||
Version 0.12.1 - 0.12.2
|
||||
|
||||
* No changes.
|
||||
|
||||
Version 0.12.0
|
||||
|
||||
* Removed redundant "text-align:left" from nodes below #doc.
|
||||
|
||||
* Removed small-font treatment on #ft.
|
||||
|
||||
* Removed margin-bottom from #hd,#bd.
|
||||
|
||||
* Added two new #doc definitions (#doc2 and #doc3) that provide
|
||||
950px centered and 100% page width presets to supplement the
|
||||
original 750px centered page width.
|
||||
|
||||
* Made ".first" selectors more precise by binding to divs, to
|
||||
make it less likely that our .first definitions will impact
|
||||
nested content elements wishing to use this nomenclature.
|
||||
|
||||
* Fixed "nested yui-gc" bug.
|
||||
|
||||
* Fixed build-process whitespace bug with .yui-t2 and .yui-t5.
|
||||
|
||||
* Migrated .yui-t's technique to "negative margins" technique
|
||||
from "floated ems".
|
||||
|
||||
* The "negative margins" technique caused z-index issues, so
|
||||
position:relative was added to the secondary yui-b to enable
|
||||
correct z-index.
|
||||
|
||||
* Make optimization benefits from inheritence wins via code
|
||||
reorganizations.
|
||||
|
||||
Version 0.11.0
|
||||
|
||||
* Removed line #43 because it set an already-set value.
|
||||
Was: ".yui-t7 #main .yui-b{min-width:750px;}"
|
||||
|
||||
Version 0.10.0
|
||||
|
||||
* Initial release.
|
||||
7
www/extras/yui/build/grids/grids-min.css
vendored
|
|
@ -1,7 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 2.2.2
|
||||
*/
|
||||
body{text-align:center;}#ft{clear:both;}#doc,#doc2,#doc3,.yui-t1,.yui-t2,.yui-t3,.yui-t4,.yui-t5,.yui-t6,.yui-t7{margin:auto;text-align:left;width:57.69em;*width:56.3em;min-width:750px;}#doc2{width:73.074em;*width:71.313em;min-width:950px;}#doc3{margin:auto 10px;width:auto;}.yui-b{position:relative;}.yui-b{_position:static;}#yui-main .yui-b{position:static;}#yui-main{width:100%;}.yui-t1 #yui-main,.yui-t2 #yui-main,.yui-t3 #yui-main{float:right;margin-left:-25em;}.yui-t4 #yui-main,.yui-t5 #yui-main,.yui-t6 #yui-main{float:left;margin-right:-25em;}.yui-t1 .yui-b{float:left;width:12.3207em;*width:12.0106em;}.yui-t1 #yui-main .yui-b{margin-left:13.3207em;*margin-left:13.0106em;}.yui-t2 .yui-b{float:left;width:13.8456em;*width:13.512em;}.yui-t2 #yui-main .yui-b{margin-left:14.8456em;*margin-left:14.512em;}.yui-t3 .yui-b{float:left;width:23.0759em;*width:22.52em;}.yui-t3 #yui-main .yui-b{margin-left:24.0759em;*margin-left:23.52em;}.yui-t4 .yui-b{float:right;width:13.8456em;*width:13.512em;}.yui-t4 #yui-main .yui-b{margin-right:14.8456em;*margin-right:14.512em;}.yui-t5 .yui-b{float:right;width:18.4608em;*width:18.016em;}.yui-t5 #yui-main .yui-b{margin-right:19.4608em;*margin-right:19.016em;}.yui-t6 .yui-b{float:right;width:23.0759em;*width:22.52em;}.yui-t6 #yui-main .yui-b{margin-right:24.0759em;*margin-right:23.52em;}.yui-t7 #yui-main .yui-b{display:block;margin:0 0 1em 0;}#yui-main .yui-b{float:none;width:auto;}.yui-g .yui-u,.yui-g .yui-g,.yui-gc .yui-u,.yui-gc .yui-g .yui-u,.yui-ge .yui-u,.yui-gf .yui-u{float:right;display:inline;}.yui-g div.first,.yui-gc div.first,.yui-gc div.first div.first,.yui-gd div.first,.yui-ge div.first,.yui-gf div.first{float:left;}.yui-g .yui-u,.yui-g .yui-g{width:49.1%;}.yui-g .yui-g .yui-u,.yui-gc .yui-g .yui-u{width:48.1%;}.yui-gb .yui-u,.yui-gc .yui-u,.yui-gd .yui-u{float:left;margin-left:2%;*margin-left:1.895%;width:32%;}.yui-gb div.first,.yui-gc div.first,.yui-gd div.first{margin-left:0;}.yui-gc div.first,.yui-gd .yui-u{width:66%;}.yui-gd div.first{width:32%;}.yui-ge .yui-u{width:24%;}.yui-ge div.first,.yui-gf .yui-u{width:74.2%;}.yui-gf div.first{width:24%;}.yui-ge div.first{width:74.2%;}#bd:after,.yui-g:after,.yui-gb:after,.yui-gc:after,.yui-gd:after,.yui-ge:after,.yui-gf:after{content:".";display:block;height:0;clear:both;visibility:hidden;}#bd,.yui-g,.yui-gb,.yui-gc,.yui-gd,.yui-ge,.yui-gf{zoom:1;}
|
||||
|
|
@ -1,129 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 2.2.2
|
||||
*/
|
||||
/* for all templates and grids */
|
||||
body{text-align:center;}
|
||||
#ft{clear:both;}
|
||||
/**/
|
||||
/* 750 centered, and backward compatibility */
|
||||
#doc,#doc2,#doc3,.yui-t1,.yui-t2,.yui-t3,.yui-t4,.yui-t5,.yui-t6,.yui-t7 {
|
||||
margin:auto;text-align:left;
|
||||
width:57.69em;*width:56.3em;min-width:750px;}
|
||||
/* 950 centered */
|
||||
#doc2 {
|
||||
width:73.074em;*width:71.313em;min-width:950px;}
|
||||
/* 100% with 10px viewport side matting */
|
||||
#doc3 {
|
||||
margin:auto 10px; /* not for structure, but so content doesn't bleed to edge */
|
||||
width:auto;}
|
||||
|
||||
/* below required for all fluid grids; adjust widths and margins above accordingly */
|
||||
|
||||
/* to preserve source-order independence for Gecko */
|
||||
.yui-b{position:relative;}
|
||||
.yui-b{_position:static;} /* for IE < 7 */
|
||||
#yui-main .yui-b{position:static;}
|
||||
|
||||
#yui-main {width:100%;}
|
||||
.yui-t1 #yui-main,
|
||||
.yui-t2 #yui-main,
|
||||
.yui-t3 #yui-main{float:right;margin-left:-25em;/* IE: preserve layout at narrow widths */}
|
||||
|
||||
.yui-t4 #yui-main,
|
||||
.yui-t5 #yui-main,
|
||||
.yui-t6 #yui-main{float:left;margin-right:-25em;/* IE: preserve layout at narrow widths */}
|
||||
|
||||
.yui-t1 .yui-b {
|
||||
float:left;
|
||||
width:12.3207em;*width:12.0106em;}
|
||||
.yui-t1 #yui-main .yui-b{
|
||||
margin-left:13.3207em;*margin-left:13.0106em;
|
||||
}
|
||||
|
||||
.yui-t2 .yui-b {
|
||||
float:left;
|
||||
width:13.8456em;*width:13.512em;}
|
||||
.yui-t2 #yui-main .yui-b {
|
||||
margin-left:14.8456em;*margin-left:14.512em;
|
||||
}
|
||||
|
||||
.yui-t3 .yui-b {
|
||||
float:left;
|
||||
width:23.0759em;*width:22.52em;}
|
||||
.yui-t3 #yui-main .yui-b {
|
||||
margin-left:24.0759em;*margin-left:23.52em;
|
||||
}
|
||||
|
||||
.yui-t4 .yui-b {
|
||||
float:right;
|
||||
width:13.8456em;*width:13.512em;}
|
||||
.yui-t4 #yui-main .yui-b {
|
||||
margin-right:14.8456em;*margin-right:14.512em;
|
||||
}
|
||||
|
||||
.yui-t5 .yui-b {
|
||||
float:right;
|
||||
width:18.4608em;*width:18.016em;}
|
||||
.yui-t5 #yui-main .yui-b {
|
||||
margin-right:19.4608em;*margin-right:19.016em;
|
||||
}
|
||||
|
||||
.yui-t6 .yui-b {
|
||||
float:right;
|
||||
width:23.0759em;*width:22.52em;}
|
||||
.yui-t6 #yui-main .yui-b {
|
||||
margin-right:24.0759em;*margin-right:23.52em;
|
||||
}
|
||||
|
||||
.yui-t7 #yui-main .yui-b {
|
||||
display:block;margin:0 0 1em 0;
|
||||
}
|
||||
#yui-main .yui-b {float:none;width:auto;}
|
||||
/* GRIDS (not TEMPLATES) */
|
||||
.yui-g .yui-u,
|
||||
.yui-g .yui-g,
|
||||
.yui-gc .yui-u,
|
||||
.yui-gc .yui-g .yui-u,
|
||||
.yui-ge .yui-u,
|
||||
.yui-gf .yui-u{float:right;display:inline;}
|
||||
.yui-g div.first,
|
||||
.yui-gc div.first,
|
||||
.yui-gc div.first div.first,
|
||||
.yui-gd div.first,
|
||||
.yui-ge div.first,
|
||||
.yui-gf div.first{float:left;}
|
||||
.yui-g .yui-u,
|
||||
.yui-g .yui-g{width:49.1%;}
|
||||
.yui-g .yui-g .yui-u,
|
||||
.yui-gc .yui-g .yui-u {width:48.1%;}
|
||||
.yui-gb .yui-u,
|
||||
.yui-gc .yui-u,
|
||||
.yui-gd .yui-u{float:left;margin-left:2%;*margin-left:1.895%;width:32%;}
|
||||
.yui-gb div.first,
|
||||
.yui-gc div.first,
|
||||
.yui-gd div.first{margin-left:0;}
|
||||
.yui-gc div.first,
|
||||
.yui-gd .yui-u{width:66%;}
|
||||
.yui-gd div.first{width:32%;}
|
||||
.yui-ge .yui-u{width:24%;}
|
||||
.yui-ge div.first,
|
||||
.yui-gf .yui-u{width:74.2%;}
|
||||
.yui-gf div.first{width:24%;}
|
||||
.yui-ge div.first{width:74.2%;}
|
||||
#bd:after,
|
||||
.yui-g:after,
|
||||
.yui-gb:after,
|
||||
.yui-gc:after,
|
||||
.yui-gd:after,
|
||||
.yui-ge:after,
|
||||
.yui-gf:after{content:".";display:block;height:0;clear:both;visibility:hidden;}
|
||||
#bd,
|
||||
.yui-g,
|
||||
.yui-gb,
|
||||
.yui-gc,
|
||||
.yui-gd,
|
||||
.yui-ge,
|
||||
.yui-gf{zoom:1;}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
YUI Library - History - Release Notes
|
||||
|
||||
2.2.2
|
||||
* No change
|
||||
|
||||
2.2.1
|
||||
|
||||
* Use YAHOO.lang.hasOwnProperty when iterating over the _modules associative
|
||||
array. This way, the browser history manager will play nice with the
|
||||
libraries that add methods to the prototype of the Array object.
|
||||
* Fixed bug related to escaping / unescaping some values.
|
||||
* Added parameters to the register method to look like the addListener method
|
||||
of the Event utility (you can now pass an object that becomes the scope of
|
||||
the onStateChange handler, or is simply passed in to that handler)
|
||||
* Upgraded code presentation to work with Crockford's latest recommendations
|
||||
(which the latest version of JSLint online implements)
|
||||
* Integrated David Bloom's findings to not have to use an external asset
|
||||
(blank.html) on IE (when not going through HTTPS)
|
||||
|
||||
2.2.0
|
||||
|
||||
* This is the initial release of the browser history manager.
|
||||
This component is considered experimental. Experimental components
|
||||
are released for community experimentation and feedback; they
|
||||
are not considered appropriate for implementation in mission-
|
||||
critical applications. Please see the YUI FAQ at
|
||||
http://developer.yahoo.com/yui/articles/faq/#experimental
|
||||
for more information about the "experimental" designation.
|
||||
|
|
@ -1 +0,0 @@
|
|||
<html><body></body></html>
|
||||
|
|
@ -1,770 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 2.2.2
|
||||
*/
|
||||
/**
|
||||
* The Browser History Manager provides the ability to use the
|
||||
* back/forward navigation buttons in a DHTML application. It also allows
|
||||
* a DHTML application to be bookmarked in a specific state.
|
||||
*
|
||||
* @module history
|
||||
* @requires yahoo,event
|
||||
* @namespace YAHOO.util
|
||||
* @title Browser History Manager
|
||||
* @experimental
|
||||
*/
|
||||
|
||||
/**
|
||||
* The History class provides the ability to use the back/forward navigation
|
||||
* buttons in a DHTML application. It also allows a DHTML application to
|
||||
* be bookmarked in a specific state.
|
||||
*
|
||||
* @class History
|
||||
* @constructor
|
||||
*/
|
||||
YAHOO.util.History = ( function () {
|
||||
|
||||
/**
|
||||
* User agent string used for browser detection.
|
||||
*
|
||||
* @property _ua
|
||||
* @type string
|
||||
* @default null
|
||||
* @private
|
||||
*/
|
||||
var _ua = null;
|
||||
|
||||
/**
|
||||
* String identifying which browser we are in.
|
||||
* Different code is run depending on which browser you are using.
|
||||
*
|
||||
* @property _browser
|
||||
* @type string
|
||||
* @default "unknown"
|
||||
* @private
|
||||
*/
|
||||
var _browser = "unknown";
|
||||
|
||||
/**
|
||||
* Our hidden IFrame used to store the browsing history.
|
||||
*
|
||||
* @property _iframe
|
||||
* @type HTMLIFrameElement
|
||||
* @default null
|
||||
* @private
|
||||
*/
|
||||
var _iframe = null;
|
||||
|
||||
/**
|
||||
* INPUT field (with type="hidden" or type="text") or TEXTAREA.
|
||||
* This field keeps the value of the initial state, current state
|
||||
* the list of all states across pages within a single browser session.
|
||||
*
|
||||
* @property _storageField
|
||||
* @type HTMLInputElement|HTMLTextAreaElement
|
||||
* @default null
|
||||
* @private
|
||||
*/
|
||||
var _storageField = null;
|
||||
|
||||
/**
|
||||
* Flag used to tell whether YAHOO.util.History.initialize has been called.
|
||||
*
|
||||
* @property _initialized
|
||||
* @type boolean
|
||||
* @default false
|
||||
* @private
|
||||
*/
|
||||
var _initialized = false;
|
||||
|
||||
/**
|
||||
* Flag used to tell whether the storage field is ready to be used.
|
||||
*
|
||||
* @property _storageFieldReady
|
||||
* @type boolean
|
||||
* @default false
|
||||
* @private
|
||||
*/
|
||||
var _storageFieldReady = false;
|
||||
|
||||
/**
|
||||
* Flag used to tell whether the Browser History Manager is ready.
|
||||
*
|
||||
* @property _bhmReady
|
||||
* @type boolean
|
||||
* @default false
|
||||
* @private
|
||||
*/
|
||||
var _bhmReady = false;
|
||||
|
||||
/**
|
||||
* List of registered modules.
|
||||
*
|
||||
* @property _modules
|
||||
* @type array
|
||||
* @default []
|
||||
* @private
|
||||
*/
|
||||
var _modules = [];
|
||||
|
||||
/**
|
||||
* List of fully qualified states. This is used only by Safari.
|
||||
*
|
||||
* @property _fqstates
|
||||
* @type array
|
||||
* @default []
|
||||
* @private
|
||||
*/
|
||||
var _fqstates = [];
|
||||
|
||||
/**
|
||||
* Trims a string.
|
||||
*
|
||||
* @method _trim
|
||||
* @param {string} str The string to be trimmed.
|
||||
* @return {string} The trimmed string
|
||||
* @private
|
||||
*/
|
||||
function _trim( str ) {
|
||||
return str.replace( /^\s*(\S*(\s+\S+)*)\s*$/, "$1" );
|
||||
}
|
||||
|
||||
/**
|
||||
* location.hash is a bit buggy on Opera. I have seen instances where
|
||||
* navigating the history using the back/forward buttons, and hence
|
||||
* changing the URL, would not change location.hash. That's ok, the
|
||||
* implementation of an equivalent is trivial.
|
||||
*
|
||||
* @method _getHash
|
||||
* @return {string} The hash portion of the document's location
|
||||
* @private
|
||||
*/
|
||||
function _getHash() {
|
||||
|
||||
var href;
|
||||
var i;
|
||||
|
||||
href = top.location.href;
|
||||
i = href.indexOf( "#" );
|
||||
return i >= 0 ? href.substr( i + 1 ) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores all the registered modules' initial state and current state.
|
||||
* On Safari, we also store all the fully qualified states visited by
|
||||
* the application within a single browser session. The storage takes
|
||||
* place in the form field specified during initialization.
|
||||
*
|
||||
* @method _storeStates
|
||||
* @private
|
||||
*/
|
||||
function _storeStates() {
|
||||
|
||||
var moduleName;
|
||||
var moduleObj;
|
||||
var initialStates = [];
|
||||
var currentStates = [];
|
||||
|
||||
for ( moduleName in _modules ) {
|
||||
if ( YAHOO.lang.hasOwnProperty( _modules, moduleName ) ) {
|
||||
moduleObj = _modules[moduleName];
|
||||
initialStates.push( moduleName + "=" + moduleObj.initialState );
|
||||
currentStates.push( moduleName + "=" + moduleObj.currentState );
|
||||
}
|
||||
}
|
||||
|
||||
_storageField.value = initialStates.join( "&" ) + "|" + currentStates.join( "&" );
|
||||
|
||||
if ( _browser == "safari" ) {
|
||||
_storageField.value += "|" + _fqstates.join( "," );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Periodically checks whether our internal IFrame is ready to be used.
|
||||
*
|
||||
* @method _checkIframeLoaded
|
||||
* @private
|
||||
*/
|
||||
function _checkIframeLoaded() {
|
||||
|
||||
var doc;
|
||||
var elem;
|
||||
var fqstate;
|
||||
|
||||
if ( !_iframe.contentWindow || !_iframe.contentWindow.document ) {
|
||||
// Check again in 10 msec...
|
||||
setTimeout( _checkIframeLoaded, 10 );
|
||||
return;
|
||||
}
|
||||
|
||||
// Start the thread that will have the responsibility to
|
||||
// periodically check whether a navigate operation has been
|
||||
// requested on the main window. This will happen when
|
||||
// YAHOO.util.History.navigate has been called or after
|
||||
// the user has hit the back/forward button.
|
||||
|
||||
doc = _iframe.contentWindow.document;
|
||||
elem = doc.getElementById( "state" );
|
||||
// We must use innerText, and not innerHTML because our string contains
|
||||
// the "&" character (which would end up being escaped as "&") and
|
||||
// the string comparison would fail...
|
||||
fqstate = elem ? elem.innerText : null;
|
||||
|
||||
setInterval( function () {
|
||||
|
||||
var newfqstate;
|
||||
var hash;
|
||||
var states;
|
||||
var moduleName;
|
||||
var moduleObj;
|
||||
|
||||
doc = _iframe.contentWindow.document;
|
||||
elem = doc.getElementById( "state" );
|
||||
// See my comment above about using innerText instead of innerHTML...
|
||||
newfqstate = elem ? elem.innerText : null;
|
||||
|
||||
if ( newfqstate != fqstate ) {
|
||||
fqstate = newfqstate;
|
||||
_handleFQStateChange( fqstate );
|
||||
|
||||
if ( !fqstate ) {
|
||||
states = [];
|
||||
for ( moduleName in _modules ) {
|
||||
if ( YAHOO.lang.hasOwnProperty( _modules, moduleName ) ) {
|
||||
moduleObj = _modules[moduleName];
|
||||
states.push( moduleName + "=" + moduleObj.initialState );
|
||||
}
|
||||
}
|
||||
hash = states.join( "&" );
|
||||
} else {
|
||||
hash = fqstate;
|
||||
}
|
||||
|
||||
// Allow the state to be bookmarked without messing up the browser history...
|
||||
top.location.replace( "#" + hash );
|
||||
|
||||
_storeStates();
|
||||
}
|
||||
}, 50 );
|
||||
|
||||
_bhmReady = true;
|
||||
|
||||
YAHOO.util.History.onLoadEvent.fire();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the new currentState attribute of all modules depending on the new
|
||||
* fully qualified state. Also notifies the modules which current state has
|
||||
* changed.
|
||||
*
|
||||
* @method _handleFQStateChange
|
||||
* @param {string} fqstate Fully qualified state
|
||||
* @private
|
||||
*/
|
||||
function _handleFQStateChange( fqstate ) {
|
||||
|
||||
var i;
|
||||
var len;
|
||||
var moduleName;
|
||||
var moduleObj;
|
||||
var modules;
|
||||
var states;
|
||||
var tokens;
|
||||
var currentState;
|
||||
|
||||
if ( !fqstate ) {
|
||||
// Notifies all modules
|
||||
for ( moduleName in _modules ) {
|
||||
if ( YAHOO.lang.hasOwnProperty( _modules, moduleName ) ) {
|
||||
moduleObj = _modules[moduleName];
|
||||
moduleObj.currentState = moduleObj.initialState;
|
||||
moduleObj.onStateChange( unescape( moduleObj.currentState ) );
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
modules = [];
|
||||
states = fqstate.split( "&" );
|
||||
for ( i = 0, len = states.length ; i < len ; i++ ) {
|
||||
tokens = states[i].split( "=" );
|
||||
if ( tokens.length == 2 ) {
|
||||
moduleName = tokens[0];
|
||||
currentState = tokens[1];
|
||||
modules[moduleName] = currentState;
|
||||
}
|
||||
}
|
||||
|
||||
for ( moduleName in _modules ) {
|
||||
if ( YAHOO.lang.hasOwnProperty( _modules, moduleName ) ) {
|
||||
moduleObj = _modules[moduleName];
|
||||
currentState = modules[moduleName];
|
||||
if ( !currentState || moduleObj.currentState != currentState ) {
|
||||
moduleObj.currentState = currentState || moduleObj.initialState;
|
||||
moduleObj.onStateChange( unescape( moduleObj.currentState ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finish up the initialization of the Browser History Manager.
|
||||
*
|
||||
* @method _initialize
|
||||
* @private
|
||||
*/
|
||||
function _initialize() {
|
||||
|
||||
var i;
|
||||
var len;
|
||||
var parts;
|
||||
var tokens;
|
||||
var moduleName;
|
||||
var moduleObj;
|
||||
var initialStates;
|
||||
var initialState;
|
||||
var currentStates;
|
||||
var currentState;
|
||||
var counter;
|
||||
var hash;
|
||||
|
||||
_storageField = document.getElementById( "yui_hist_field" );
|
||||
|
||||
// Decode the content of our storage field...
|
||||
parts = _storageField.value.split( "|" );
|
||||
|
||||
if ( parts.length > 1 ) {
|
||||
|
||||
initialStates = parts[0].split( "&" );
|
||||
for ( i = 0, len = initialStates.length ; i < len ; i++ ) {
|
||||
tokens = initialStates[i].split( "=" );
|
||||
if ( tokens.length == 2 ) {
|
||||
moduleName = tokens[0];
|
||||
initialState = tokens[1];
|
||||
moduleObj = _modules[moduleName];
|
||||
if ( moduleObj ) {
|
||||
moduleObj.initialState = initialState;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
currentStates = parts[1].split( "&" );
|
||||
for ( i = 0, len = currentStates.length ; i < len ; i++ ) {
|
||||
tokens = currentStates[i].split( "=" );
|
||||
if ( tokens.length >= 2 ) {
|
||||
moduleName = tokens[0];
|
||||
currentState = tokens[1];
|
||||
moduleObj = _modules[moduleName];
|
||||
if ( moduleObj ) {
|
||||
moduleObj.currentState = currentState;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( parts.length > 2 ) {
|
||||
_fqstates = parts[2].split( "," );
|
||||
}
|
||||
|
||||
_storageFieldReady = true;
|
||||
|
||||
if ( _browser == "msie" ) {
|
||||
|
||||
_iframe = document.getElementById( "yui_hist_iframe" );
|
||||
_checkIframeLoaded();
|
||||
|
||||
} else {
|
||||
|
||||
// Start the thread that will have the responsibility to
|
||||
// periodically check whether a navigate operation has been
|
||||
// requested on the main window. This will happen when
|
||||
// YAHOO.util.History.navigate has been called or after
|
||||
// the user has hit the back/forward button.
|
||||
|
||||
// On Safari 1.x and 2.0, the only way to catch a back/forward
|
||||
// operation is to watch history.length... We basically exploit
|
||||
// what I consider to be a bug (history.length is not supposed
|
||||
// to change when going back/forward in the history...) This is
|
||||
// why, in the following thread, we first compare the hash,
|
||||
// because the hash thing will be fixed in the next major
|
||||
// version of Safari. So even if they fix the history.length
|
||||
// bug, all this will still work!
|
||||
counter = history.length;
|
||||
|
||||
// On Gecko and Opera, we just need to watch the hash...
|
||||
hash = _getHash();
|
||||
|
||||
setInterval( function () {
|
||||
|
||||
var state;
|
||||
var newHash;
|
||||
var newCounter;
|
||||
|
||||
newHash = _getHash();
|
||||
newCounter = history.length;
|
||||
if ( newHash != hash ) {
|
||||
hash = newHash;
|
||||
counter = newCounter;
|
||||
_handleFQStateChange( hash );
|
||||
_storeStates();
|
||||
} else if ( newCounter != counter ) {
|
||||
// If we ever get here, we should be on Safari...
|
||||
hash = newHash;
|
||||
counter = newCounter;
|
||||
state = _fqstates[counter - 1];
|
||||
_handleFQStateChange( state );
|
||||
_storeStates();
|
||||
}
|
||||
}, 50 );
|
||||
|
||||
_bhmReady = true;
|
||||
|
||||
YAHOO.util.History.onLoadEvent.fire();
|
||||
}
|
||||
}
|
||||
|
||||
// Simple browser detection code
|
||||
// After talking with Matt Sweeney, I moved back to using the
|
||||
// user agent string instead of doing browser detection.
|
||||
_ua = navigator.userAgent.toLowerCase();
|
||||
if ( _ua.indexOf( "opera" ) != -1 ) {
|
||||
// Opera (check first in case of spoof)
|
||||
_browser = "opera";
|
||||
} else if ( _ua.indexOf( "msie" ) != -1 ) {
|
||||
// Microsoft Internet Explorer and derivatives...
|
||||
_browser = "msie";
|
||||
} else if ( _ua.indexOf( "safari" ) != -1 ) {
|
||||
// Safari (check before Gecko because it includes "like Gecko")
|
||||
_browser = "safari";
|
||||
} else if ( _ua.indexOf( "gecko" ) != -1 ) {
|
||||
// Gecko
|
||||
_browser = "gecko";
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
/**
|
||||
* Fired when the Browser History Manager is ready.
|
||||
*
|
||||
* @event onLoadEvent
|
||||
*/
|
||||
onLoadEvent: new YAHOO.util.CustomEvent( "onLoad" ),
|
||||
|
||||
/**
|
||||
* Registers a new module.
|
||||
*
|
||||
* @method register
|
||||
* @param {string} module Non-empty string uniquely identifying the
|
||||
* module you wish to register.
|
||||
* @param {string} initialState The initial state of the specified
|
||||
* module corresponding to its earliest history entry.
|
||||
* @param {function} onStateChange Callback called when the
|
||||
* state of the specified module has changed.
|
||||
* @param {object} obj An arbitrary object that will be passed as a
|
||||
* parameter to the handler.
|
||||
* @param {boolean} override If true, the obj passed in becomes the
|
||||
* execution scope of the listener.
|
||||
*/
|
||||
register: function ( module, initialState, onStateChange, obj, override ) {
|
||||
|
||||
var scope;
|
||||
var wrappedFn;
|
||||
|
||||
if ( typeof module != "string" || _trim( module ) === "" ||
|
||||
typeof initialState != "string" ||
|
||||
typeof onStateChange != "function" ) {
|
||||
throw new Error( "Missing or invalid argument passed to YAHOO.util.History.register" );
|
||||
}
|
||||
|
||||
if ( _modules[module] ) {
|
||||
throw new Error( "A module cannot be registered twice" );
|
||||
}
|
||||
|
||||
// Note: A module CANNOT be registered after calling
|
||||
// YAHOO.util.History.initialize. Indeed, we set the initial state
|
||||
// of each registered module in YAHOO.util.History.initialize.
|
||||
// If you could register a module after initializing the Browser
|
||||
// History Manager, you would not read the correct state using
|
||||
// YAHOO.util.History.getCurrentState when coming back to the
|
||||
// page using the back button.
|
||||
if ( _initialized ) {
|
||||
throw new Error( "All modules must be registered before calling YAHOO.util.History.initialize" );
|
||||
}
|
||||
|
||||
// Make sure the strings passed in do not contain our separators "," and "|"
|
||||
module = escape( module );
|
||||
initialState = escape( initialState );
|
||||
|
||||
// If the user chooses to override the scope, we use the
|
||||
// custom object passed in as the execution scope.
|
||||
scope = null;
|
||||
if ( override === true ) {
|
||||
scope = obj;
|
||||
} else {
|
||||
scope = override;
|
||||
}
|
||||
|
||||
wrappedFn = function ( state ) {
|
||||
return onStateChange.call( scope, state, obj );
|
||||
};
|
||||
|
||||
_modules[module] = {
|
||||
name: module,
|
||||
initialState: initialState,
|
||||
currentState: initialState,
|
||||
onStateChange: wrappedFn
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Initializes the Browser History Manager. Call this method
|
||||
* from a script block located right after the opening body tag.
|
||||
*
|
||||
* @method initialize
|
||||
* @param {string} iframeTarget Optional - Path to an existing
|
||||
* HTML document accessible from the same domain. If not
|
||||
* specified, defaults to "blank.html". This is only useful
|
||||
* if you use https.
|
||||
* @public
|
||||
*/
|
||||
initialize: function ( iframeTarget ) {
|
||||
|
||||
// Return if the browser history manager has already been initialized
|
||||
if ( _initialized ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( _browser == "unknown" ) {
|
||||
throw new Error( "Your web browser is not supported by the Browser History Manager" );
|
||||
}
|
||||
|
||||
if ( !iframeTarget ) {
|
||||
iframeTarget = "blank.html";
|
||||
}
|
||||
|
||||
if ( typeof iframeTarget != "string" || _trim( iframeTarget ) === "" ) {
|
||||
throw new Error( "Invalid argument passed to YAHOO.util.History.initialize" );
|
||||
}
|
||||
|
||||
document.write( '<input type="hidden" id="yui_hist_field">' );
|
||||
|
||||
if ( _browser == "msie" ) {
|
||||
if ( location.protocol == "https:" ) {
|
||||
// If we use https, we MUST point the IFrame to a valid
|
||||
// document on the same server. If we don't, we will get
|
||||
// a warning (do you want to display non secure items?)
|
||||
document.write( '<iframe id="yui_hist_iframe" src="' + iframeTarget + '" style="position:absolute;visibility:hidden;"></iframe>' );
|
||||
} else {
|
||||
// This trick allows us to do without having to download
|
||||
// the asset, saving one HTTP request...
|
||||
document.write( '<iframe id="yui_hist_iframe" src="javascript:document.open();document.write("' + new Date().getTime() + '");document.close();" style="position:absolute;visibility:hidden;"></iframe>' );
|
||||
}
|
||||
}
|
||||
|
||||
// We have to wait for the window's onload handler. Otherwise, our
|
||||
// hidden form field will always be empty (i.e. the browser won't
|
||||
// have had enough time to restore the session)
|
||||
YAHOO.util.Event.addListener( window, "load", _initialize );
|
||||
|
||||
_initialized = true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Call this method when you want to store a new entry in the browser's history.
|
||||
*
|
||||
* @method navigate
|
||||
* @param {string} module Non-empty string representing your module.
|
||||
* @param {string} state String representing the new state of the specified module.
|
||||
* @return {boolean} Indicates whether the new state was successfully added to the history.
|
||||
* @public
|
||||
*/
|
||||
navigate: function ( module, state ) {
|
||||
|
||||
var currentStates;
|
||||
var moduleName;
|
||||
var moduleObj;
|
||||
var currentState;
|
||||
var fqstate;
|
||||
var html;
|
||||
var doc;
|
||||
|
||||
if ( typeof module != "string" || typeof state != "string" ) {
|
||||
throw new Error( "Missing or invalid argument passed to YAHOO.util.History.navigate" );
|
||||
}
|
||||
|
||||
if ( !_bhmReady ) {
|
||||
throw new Error( "The Browser History Manager is not initialized" );
|
||||
}
|
||||
|
||||
if ( !_modules[module] ) {
|
||||
throw new Error( "The following module has not been registered: " + module );
|
||||
}
|
||||
|
||||
// Make sure the strings passed in do not contain our separators "," and "|"
|
||||
module = escape( module );
|
||||
state = escape( state );
|
||||
|
||||
// Generate our new full state string mod1=xxx&mod2=yyy
|
||||
currentStates = [];
|
||||
for ( moduleName in _modules ) {
|
||||
if ( YAHOO.lang.hasOwnProperty( _modules, moduleName ) ) {
|
||||
moduleObj = _modules[moduleName];
|
||||
currentState = ( moduleName == module ) ? state : moduleObj.currentState;
|
||||
currentStates.push( moduleName + "=" + currentState );
|
||||
}
|
||||
}
|
||||
|
||||
fqstate = currentStates.join( "&" );
|
||||
|
||||
if ( _browser == "msie" ) {
|
||||
|
||||
html = '<html><body><div id="state">' + fqstate + '</div></body></html>';
|
||||
try {
|
||||
doc = _iframe.contentWindow.document;
|
||||
doc.open();
|
||||
doc.write( html );
|
||||
doc.close();
|
||||
} catch ( e ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// Known bug: On Safari 1.x and 2.0, if you have tab browsing
|
||||
// enabled, Safari will show an endless loading icon in the
|
||||
// tab. This has apparently been fixed in recent WebKit builds.
|
||||
// One work around found by Dav Glass is to submit a form that
|
||||
// points to the same document. This indeed works on Safari 1.x
|
||||
// and 2.0 but creates bigger problems on WebKit. So for now,
|
||||
// we'll consider this an acceptable bug, and hope that Apple
|
||||
// comes out with their next version of Safari very soon.
|
||||
top.location.hash = fqstate;
|
||||
if ( _browser == "safari" ) {
|
||||
// The following two lines are only useful for Safari 1.x
|
||||
// and 2.0. Recent nightly builds of WebKit do not require
|
||||
// that, but unfortunately, it is not easy to differentiate
|
||||
// between the two. Once Safari 2.0 departs the A-grade
|
||||
// list, we can remove the following two lines...
|
||||
_fqstates[history.length] = fqstate;
|
||||
_storeStates();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the current state of the specified module.
|
||||
*
|
||||
* @method getCurrentState
|
||||
* @param {string} module Non-empty string representing your module.
|
||||
* @return {string} The current state of the specified module.
|
||||
* @public
|
||||
*/
|
||||
getCurrentState: function ( module ) {
|
||||
|
||||
var moduleObj;
|
||||
|
||||
if ( typeof module != "string" ) {
|
||||
throw new Error( "Missing or invalid argument passed to YAHOO.util.History.getCurrentState" );
|
||||
}
|
||||
|
||||
if ( !_storageFieldReady ) {
|
||||
throw new Error( "The Browser History Manager is not initialized" );
|
||||
}
|
||||
|
||||
moduleObj = _modules[module];
|
||||
if ( !moduleObj ) {
|
||||
throw new Error( "No such registered module: " + module );
|
||||
}
|
||||
|
||||
return unescape( moduleObj.currentState );
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the state of a module according to the URL fragment
|
||||
* identifier. This method is useful to initialize your modules
|
||||
* if your application was bookmarked from a particular state.
|
||||
*
|
||||
* @method getBookmarkedState
|
||||
* @param {string} module Non-empty string representing your module.
|
||||
* @return {string} The bookmarked state of the specified module.
|
||||
* @public
|
||||
*/
|
||||
getBookmarkedState: function ( module ) {
|
||||
|
||||
var i;
|
||||
var len;
|
||||
var hash;
|
||||
var states;
|
||||
var tokens;
|
||||
var moduleName;
|
||||
|
||||
if ( typeof module != "string" ) {
|
||||
throw new Error( "Missing or invalid argument passed to YAHOO.util.History.getBookmarkedState" );
|
||||
}
|
||||
|
||||
hash = top.location.hash.substr(1);
|
||||
states = hash.split( "&" );
|
||||
for ( i = 0, len = states.length ; i < len ; i++ ) {
|
||||
tokens = states[i].split( "=" );
|
||||
if ( tokens.length == 2 ) {
|
||||
moduleName = tokens[0];
|
||||
if ( moduleName == module ) {
|
||||
return unescape( tokens[1] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the value of the specified query string parameter.
|
||||
* This method is not used internally by the Browser History Manager.
|
||||
* However, it is provided here as a helper since many applications
|
||||
* using the Browser History Manager will want to read the value of
|
||||
* url parameters to initialize themselves.
|
||||
*
|
||||
* @method getQueryStringParameter
|
||||
* @param {string} paramName Name of the parameter we want to look up.
|
||||
* @param {string} queryString Optional URL to look at. If not specified,
|
||||
* this method uses the URL in the address bar.
|
||||
* @return {string} The value of the specified parameter, or null.
|
||||
* @public
|
||||
*/
|
||||
getQueryStringParameter: function ( paramName, url ) {
|
||||
|
||||
var i;
|
||||
var len;
|
||||
var idx;
|
||||
var queryString;
|
||||
var params;
|
||||
var tokens;
|
||||
|
||||
url = url || top.location.href;
|
||||
|
||||
idx = url.indexOf( "?" );
|
||||
queryString = idx >= 0 ? url.substr( idx + 1 ) : url;
|
||||
params = queryString.split( "&" );
|
||||
|
||||
for ( i = 0, len = params.length ; i < len ; i++ ) {
|
||||
tokens = params[i].split( "=" );
|
||||
if ( tokens.length >= 2 ) {
|
||||
if ( tokens[0] == paramName ) {
|
||||
return unescape( tokens[1] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} )();
|
||||
YAHOO.register("history", YAHOO.util.History, {version: "2.2.2", build: "204"});
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 2.2.2
|
||||
*/
|
||||
|
||||
YAHOO.util.History=(function(){var _ua=null;var _browser="unknown";var _iframe=null;var _storageField=null;var _initialized=false;var _storageFieldReady=false;var _bhmReady=false;var _modules=[];var _fqstates=[];function _trim(str){return str.replace(/^\s*(\S*(\s+\S+)*)\s*$/,"$1");}
|
||||
function _getHash(){var href;var i;href=top.location.href;i=href.indexOf("#");return i>=0?href.substr(i+1):null;}
|
||||
function _storeStates(){var moduleName;var moduleObj;var initialStates=[];var currentStates=[];for(moduleName in _modules){if(YAHOO.lang.hasOwnProperty(_modules,moduleName)){moduleObj=_modules[moduleName];initialStates.push(moduleName+"="+moduleObj.initialState);currentStates.push(moduleName+"="+moduleObj.currentState);}}
|
||||
_storageField.value=initialStates.join("&")+"|"+currentStates.join("&");if(_browser=="safari"){_storageField.value+="|"+_fqstates.join(",");}}
|
||||
function _checkIframeLoaded(){var doc;var elem;var fqstate;if(!_iframe.contentWindow||!_iframe.contentWindow.document){setTimeout(_checkIframeLoaded,10);return;}
|
||||
doc=_iframe.contentWindow.document;elem=doc.getElementById("state");fqstate=elem?elem.innerText:null;setInterval(function(){var newfqstate;var hash;var states;var moduleName;var moduleObj;doc=_iframe.contentWindow.document;elem=doc.getElementById("state");newfqstate=elem?elem.innerText:null;if(newfqstate!=fqstate){fqstate=newfqstate;_handleFQStateChange(fqstate);if(!fqstate){states=[];for(moduleName in _modules){if(YAHOO.lang.hasOwnProperty(_modules,moduleName)){moduleObj=_modules[moduleName];states.push(moduleName+"="+moduleObj.initialState);}}
|
||||
hash=states.join("&");}else{hash=fqstate;}
|
||||
top.location.replace("#"+hash);_storeStates();}},50);_bhmReady=true;YAHOO.util.History.onLoadEvent.fire();}
|
||||
function _handleFQStateChange(fqstate){var i;var len;var moduleName;var moduleObj;var modules;var states;var tokens;var currentState;if(!fqstate){for(moduleName in _modules){if(YAHOO.lang.hasOwnProperty(_modules,moduleName)){moduleObj=_modules[moduleName];moduleObj.currentState=moduleObj.initialState;moduleObj.onStateChange(unescape(moduleObj.currentState));}}
|
||||
return;}
|
||||
modules=[];states=fqstate.split("&");for(i=0,len=states.length;i<len;i++){tokens=states[i].split("=");if(tokens.length==2){moduleName=tokens[0];currentState=tokens[1];modules[moduleName]=currentState;}}
|
||||
for(moduleName in _modules){if(YAHOO.lang.hasOwnProperty(_modules,moduleName)){moduleObj=_modules[moduleName];currentState=modules[moduleName];if(!currentState||moduleObj.currentState!=currentState){moduleObj.currentState=currentState||moduleObj.initialState;moduleObj.onStateChange(unescape(moduleObj.currentState));}}}}
|
||||
function _initialize(){var i;var len;var parts;var tokens;var moduleName;var moduleObj;var initialStates;var initialState;var currentStates;var currentState;var counter;var hash;_storageField=document.getElementById("yui_hist_field");parts=_storageField.value.split("|");if(parts.length>1){initialStates=parts[0].split("&");for(i=0,len=initialStates.length;i<len;i++){tokens=initialStates[i].split("=");if(tokens.length==2){moduleName=tokens[0];initialState=tokens[1];moduleObj=_modules[moduleName];if(moduleObj){moduleObj.initialState=initialState;}}}
|
||||
currentStates=parts[1].split("&");for(i=0,len=currentStates.length;i<len;i++){tokens=currentStates[i].split("=");if(tokens.length>=2){moduleName=tokens[0];currentState=tokens[1];moduleObj=_modules[moduleName];if(moduleObj){moduleObj.currentState=currentState;}}}}
|
||||
if(parts.length>2){_fqstates=parts[2].split(",");}
|
||||
_storageFieldReady=true;if(_browser=="msie"){_iframe=document.getElementById("yui_hist_iframe");_checkIframeLoaded();}else{counter=history.length;hash=_getHash();setInterval(function(){var state;var newHash;var newCounter;newHash=_getHash();newCounter=history.length;if(newHash!=hash){hash=newHash;counter=newCounter;_handleFQStateChange(hash);_storeStates();}else if(newCounter!=counter){hash=newHash;counter=newCounter;state=_fqstates[counter-1];_handleFQStateChange(state);_storeStates();}},50);_bhmReady=true;YAHOO.util.History.onLoadEvent.fire();}}
|
||||
_ua=navigator.userAgent.toLowerCase();if(_ua.indexOf("opera")!=-1){_browser="opera";}else if(_ua.indexOf("msie")!=-1){_browser="msie";}else if(_ua.indexOf("safari")!=-1){_browser="safari";}else if(_ua.indexOf("gecko")!=-1){_browser="gecko";}
|
||||
return{onLoadEvent:new YAHOO.util.CustomEvent("onLoad"),register:function(module,initialState,onStateChange,obj,override){var scope;var wrappedFn;if(typeof module!="string"||_trim(module)===""||typeof initialState!="string"||typeof onStateChange!="function"){throw new Error("Missing or invalid argument passed to YAHOO.util.History.register");}
|
||||
if(_modules[module]){throw new Error("A module cannot be registered twice");}
|
||||
if(_initialized){throw new Error("All modules must be registered before calling YAHOO.util.History.initialize");}
|
||||
module=escape(module);initialState=escape(initialState);scope=null;if(override===true){scope=obj;}else{scope=override;}
|
||||
wrappedFn=function(state){return onStateChange.call(scope,state,obj);};_modules[module]={name:module,initialState:initialState,currentState:initialState,onStateChange:wrappedFn};},initialize:function(iframeTarget){if(_initialized){return;}
|
||||
if(_browser=="unknown"){throw new Error("Your web browser is not supported by the Browser History Manager");}
|
||||
if(!iframeTarget){iframeTarget="blank.html";}
|
||||
if(typeof iframeTarget!="string"||_trim(iframeTarget)===""){throw new Error("Invalid argument passed to YAHOO.util.History.initialize");}
|
||||
document.write('<input type="hidden" id="yui_hist_field">');if(_browser=="msie"){if(location.protocol=="https:"){document.write('<iframe id="yui_hist_iframe" src="'+iframeTarget+'" style="position:absolute;visibility:hidden;"></iframe>');}else{document.write('<iframe id="yui_hist_iframe" src="javascript:document.open();document.write("'+new Date().getTime()+'");document.close();" style="position:absolute;visibility:hidden;"></iframe>');}}
|
||||
YAHOO.util.Event.addListener(window,"load",_initialize);_initialized=true;},navigate:function(module,state){var currentStates;var moduleName;var moduleObj;var currentState;var fqstate;var html;var doc;if(typeof module!="string"||typeof state!="string"){throw new Error("Missing or invalid argument passed to YAHOO.util.History.navigate");}
|
||||
if(!_bhmReady){throw new Error("The Browser History Manager is not initialized");}
|
||||
if(!_modules[module]){throw new Error("The following module has not been registered: "+module);}
|
||||
module=escape(module);state=escape(state);currentStates=[];for(moduleName in _modules){if(YAHOO.lang.hasOwnProperty(_modules,moduleName)){moduleObj=_modules[moduleName];currentState=(moduleName==module)?state:moduleObj.currentState;currentStates.push(moduleName+"="+currentState);}}
|
||||
fqstate=currentStates.join("&");if(_browser=="msie"){html='<html><body><div id="state">'+fqstate+'</div></body></html>';try{doc=_iframe.contentWindow.document;doc.open();doc.write(html);doc.close();}catch(e){return false;}}else{top.location.hash=fqstate;if(_browser=="safari"){_fqstates[history.length]=fqstate;_storeStates();}}
|
||||
return true;},getCurrentState:function(module){var moduleObj;if(typeof module!="string"){throw new Error("Missing or invalid argument passed to YAHOO.util.History.getCurrentState");}
|
||||
if(!_storageFieldReady){throw new Error("The Browser History Manager is not initialized");}
|
||||
moduleObj=_modules[module];if(!moduleObj){throw new Error("No such registered module: "+module);}
|
||||
return unescape(moduleObj.currentState);},getBookmarkedState:function(module){var i;var len;var hash;var states;var tokens;var moduleName;if(typeof module!="string"){throw new Error("Missing or invalid argument passed to YAHOO.util.History.getBookmarkedState");}
|
||||
hash=top.location.hash.substr(1);states=hash.split("&");for(i=0,len=states.length;i<len;i++){tokens=states[i].split("=");if(tokens.length==2){moduleName=tokens[0];if(moduleName==module){return unescape(tokens[1]);}}}
|
||||
return null;},getQueryStringParameter:function(paramName,url){var i;var len;var idx;var queryString;var params;var tokens;url=url||top.location.href;idx=url.indexOf("?");queryString=idx>=0?url.substr(idx+1):url;params=queryString.split("&");for(i=0,len=params.length;i<len;i++){tokens=params[i].split("=");if(tokens.length>=2){if(tokens[0]==paramName){return unescape(tokens[1]);}}}
|
||||
return null;}};})();YAHOO.register("history",YAHOO.util.History,{version:"2.2.2",build:"204"});
|
||||
770
www/extras/yui/build/history/history-experimental.js
vendored
|
|
@ -1,770 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 2.2.2
|
||||
*/
|
||||
/**
|
||||
* The Browser History Manager provides the ability to use the
|
||||
* back/forward navigation buttons in a DHTML application. It also allows
|
||||
* a DHTML application to be bookmarked in a specific state.
|
||||
*
|
||||
* @module history
|
||||
* @requires yahoo,event
|
||||
* @namespace YAHOO.util
|
||||
* @title Browser History Manager
|
||||
* @experimental
|
||||
*/
|
||||
|
||||
/**
|
||||
* The History class provides the ability to use the back/forward navigation
|
||||
* buttons in a DHTML application. It also allows a DHTML application to
|
||||
* be bookmarked in a specific state.
|
||||
*
|
||||
* @class History
|
||||
* @constructor
|
||||
*/
|
||||
YAHOO.util.History = ( function () {
|
||||
|
||||
/**
|
||||
* User agent string used for browser detection.
|
||||
*
|
||||
* @property _ua
|
||||
* @type string
|
||||
* @default null
|
||||
* @private
|
||||
*/
|
||||
var _ua = null;
|
||||
|
||||
/**
|
||||
* String identifying which browser we are in.
|
||||
* Different code is run depending on which browser you are using.
|
||||
*
|
||||
* @property _browser
|
||||
* @type string
|
||||
* @default "unknown"
|
||||
* @private
|
||||
*/
|
||||
var _browser = "unknown";
|
||||
|
||||
/**
|
||||
* Our hidden IFrame used to store the browsing history.
|
||||
*
|
||||
* @property _iframe
|
||||
* @type HTMLIFrameElement
|
||||
* @default null
|
||||
* @private
|
||||
*/
|
||||
var _iframe = null;
|
||||
|
||||
/**
|
||||
* INPUT field (with type="hidden" or type="text") or TEXTAREA.
|
||||
* This field keeps the value of the initial state, current state
|
||||
* the list of all states across pages within a single browser session.
|
||||
*
|
||||
* @property _storageField
|
||||
* @type HTMLInputElement|HTMLTextAreaElement
|
||||
* @default null
|
||||
* @private
|
||||
*/
|
||||
var _storageField = null;
|
||||
|
||||
/**
|
||||
* Flag used to tell whether YAHOO.util.History.initialize has been called.
|
||||
*
|
||||
* @property _initialized
|
||||
* @type boolean
|
||||
* @default false
|
||||
* @private
|
||||
*/
|
||||
var _initialized = false;
|
||||
|
||||
/**
|
||||
* Flag used to tell whether the storage field is ready to be used.
|
||||
*
|
||||
* @property _storageFieldReady
|
||||
* @type boolean
|
||||
* @default false
|
||||
* @private
|
||||
*/
|
||||
var _storageFieldReady = false;
|
||||
|
||||
/**
|
||||
* Flag used to tell whether the Browser History Manager is ready.
|
||||
*
|
||||
* @property _bhmReady
|
||||
* @type boolean
|
||||
* @default false
|
||||
* @private
|
||||
*/
|
||||
var _bhmReady = false;
|
||||
|
||||
/**
|
||||
* List of registered modules.
|
||||
*
|
||||
* @property _modules
|
||||
* @type array
|
||||
* @default []
|
||||
* @private
|
||||
*/
|
||||
var _modules = [];
|
||||
|
||||
/**
|
||||
* List of fully qualified states. This is used only by Safari.
|
||||
*
|
||||
* @property _fqstates
|
||||
* @type array
|
||||
* @default []
|
||||
* @private
|
||||
*/
|
||||
var _fqstates = [];
|
||||
|
||||
/**
|
||||
* Trims a string.
|
||||
*
|
||||
* @method _trim
|
||||
* @param {string} str The string to be trimmed.
|
||||
* @return {string} The trimmed string
|
||||
* @private
|
||||
*/
|
||||
function _trim( str ) {
|
||||
return str.replace( /^\s*(\S*(\s+\S+)*)\s*$/, "$1" );
|
||||
}
|
||||
|
||||
/**
|
||||
* location.hash is a bit buggy on Opera. I have seen instances where
|
||||
* navigating the history using the back/forward buttons, and hence
|
||||
* changing the URL, would not change location.hash. That's ok, the
|
||||
* implementation of an equivalent is trivial.
|
||||
*
|
||||
* @method _getHash
|
||||
* @return {string} The hash portion of the document's location
|
||||
* @private
|
||||
*/
|
||||
function _getHash() {
|
||||
|
||||
var href;
|
||||
var i;
|
||||
|
||||
href = top.location.href;
|
||||
i = href.indexOf( "#" );
|
||||
return i >= 0 ? href.substr( i + 1 ) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores all the registered modules' initial state and current state.
|
||||
* On Safari, we also store all the fully qualified states visited by
|
||||
* the application within a single browser session. The storage takes
|
||||
* place in the form field specified during initialization.
|
||||
*
|
||||
* @method _storeStates
|
||||
* @private
|
||||
*/
|
||||
function _storeStates() {
|
||||
|
||||
var moduleName;
|
||||
var moduleObj;
|
||||
var initialStates = [];
|
||||
var currentStates = [];
|
||||
|
||||
for ( moduleName in _modules ) {
|
||||
if ( YAHOO.lang.hasOwnProperty( _modules, moduleName ) ) {
|
||||
moduleObj = _modules[moduleName];
|
||||
initialStates.push( moduleName + "=" + moduleObj.initialState );
|
||||
currentStates.push( moduleName + "=" + moduleObj.currentState );
|
||||
}
|
||||
}
|
||||
|
||||
_storageField.value = initialStates.join( "&" ) + "|" + currentStates.join( "&" );
|
||||
|
||||
if ( _browser == "safari" ) {
|
||||
_storageField.value += "|" + _fqstates.join( "," );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Periodically checks whether our internal IFrame is ready to be used.
|
||||
*
|
||||
* @method _checkIframeLoaded
|
||||
* @private
|
||||
*/
|
||||
function _checkIframeLoaded() {
|
||||
|
||||
var doc;
|
||||
var elem;
|
||||
var fqstate;
|
||||
|
||||
if ( !_iframe.contentWindow || !_iframe.contentWindow.document ) {
|
||||
// Check again in 10 msec...
|
||||
setTimeout( _checkIframeLoaded, 10 );
|
||||
return;
|
||||
}
|
||||
|
||||
// Start the thread that will have the responsibility to
|
||||
// periodically check whether a navigate operation has been
|
||||
// requested on the main window. This will happen when
|
||||
// YAHOO.util.History.navigate has been called or after
|
||||
// the user has hit the back/forward button.
|
||||
|
||||
doc = _iframe.contentWindow.document;
|
||||
elem = doc.getElementById( "state" );
|
||||
// We must use innerText, and not innerHTML because our string contains
|
||||
// the "&" character (which would end up being escaped as "&") and
|
||||
// the string comparison would fail...
|
||||
fqstate = elem ? elem.innerText : null;
|
||||
|
||||
setInterval( function () {
|
||||
|
||||
var newfqstate;
|
||||
var hash;
|
||||
var states;
|
||||
var moduleName;
|
||||
var moduleObj;
|
||||
|
||||
doc = _iframe.contentWindow.document;
|
||||
elem = doc.getElementById( "state" );
|
||||
// See my comment above about using innerText instead of innerHTML...
|
||||
newfqstate = elem ? elem.innerText : null;
|
||||
|
||||
if ( newfqstate != fqstate ) {
|
||||
fqstate = newfqstate;
|
||||
_handleFQStateChange( fqstate );
|
||||
|
||||
if ( !fqstate ) {
|
||||
states = [];
|
||||
for ( moduleName in _modules ) {
|
||||
if ( YAHOO.lang.hasOwnProperty( _modules, moduleName ) ) {
|
||||
moduleObj = _modules[moduleName];
|
||||
states.push( moduleName + "=" + moduleObj.initialState );
|
||||
}
|
||||
}
|
||||
hash = states.join( "&" );
|
||||
} else {
|
||||
hash = fqstate;
|
||||
}
|
||||
|
||||
// Allow the state to be bookmarked without messing up the browser history...
|
||||
top.location.replace( "#" + hash );
|
||||
|
||||
_storeStates();
|
||||
}
|
||||
}, 50 );
|
||||
|
||||
_bhmReady = true;
|
||||
|
||||
YAHOO.util.History.onLoadEvent.fire();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the new currentState attribute of all modules depending on the new
|
||||
* fully qualified state. Also notifies the modules which current state has
|
||||
* changed.
|
||||
*
|
||||
* @method _handleFQStateChange
|
||||
* @param {string} fqstate Fully qualified state
|
||||
* @private
|
||||
*/
|
||||
function _handleFQStateChange( fqstate ) {
|
||||
|
||||
var i;
|
||||
var len;
|
||||
var moduleName;
|
||||
var moduleObj;
|
||||
var modules;
|
||||
var states;
|
||||
var tokens;
|
||||
var currentState;
|
||||
|
||||
if ( !fqstate ) {
|
||||
// Notifies all modules
|
||||
for ( moduleName in _modules ) {
|
||||
if ( YAHOO.lang.hasOwnProperty( _modules, moduleName ) ) {
|
||||
moduleObj = _modules[moduleName];
|
||||
moduleObj.currentState = moduleObj.initialState;
|
||||
moduleObj.onStateChange( unescape( moduleObj.currentState ) );
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
modules = [];
|
||||
states = fqstate.split( "&" );
|
||||
for ( i = 0, len = states.length ; i < len ; i++ ) {
|
||||
tokens = states[i].split( "=" );
|
||||
if ( tokens.length == 2 ) {
|
||||
moduleName = tokens[0];
|
||||
currentState = tokens[1];
|
||||
modules[moduleName] = currentState;
|
||||
}
|
||||
}
|
||||
|
||||
for ( moduleName in _modules ) {
|
||||
if ( YAHOO.lang.hasOwnProperty( _modules, moduleName ) ) {
|
||||
moduleObj = _modules[moduleName];
|
||||
currentState = modules[moduleName];
|
||||
if ( !currentState || moduleObj.currentState != currentState ) {
|
||||
moduleObj.currentState = currentState || moduleObj.initialState;
|
||||
moduleObj.onStateChange( unescape( moduleObj.currentState ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finish up the initialization of the Browser History Manager.
|
||||
*
|
||||
* @method _initialize
|
||||
* @private
|
||||
*/
|
||||
function _initialize() {
|
||||
|
||||
var i;
|
||||
var len;
|
||||
var parts;
|
||||
var tokens;
|
||||
var moduleName;
|
||||
var moduleObj;
|
||||
var initialStates;
|
||||
var initialState;
|
||||
var currentStates;
|
||||
var currentState;
|
||||
var counter;
|
||||
var hash;
|
||||
|
||||
_storageField = document.getElementById( "yui_hist_field" );
|
||||
|
||||
// Decode the content of our storage field...
|
||||
parts = _storageField.value.split( "|" );
|
||||
|
||||
if ( parts.length > 1 ) {
|
||||
|
||||
initialStates = parts[0].split( "&" );
|
||||
for ( i = 0, len = initialStates.length ; i < len ; i++ ) {
|
||||
tokens = initialStates[i].split( "=" );
|
||||
if ( tokens.length == 2 ) {
|
||||
moduleName = tokens[0];
|
||||
initialState = tokens[1];
|
||||
moduleObj = _modules[moduleName];
|
||||
if ( moduleObj ) {
|
||||
moduleObj.initialState = initialState;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
currentStates = parts[1].split( "&" );
|
||||
for ( i = 0, len = currentStates.length ; i < len ; i++ ) {
|
||||
tokens = currentStates[i].split( "=" );
|
||||
if ( tokens.length >= 2 ) {
|
||||
moduleName = tokens[0];
|
||||
currentState = tokens[1];
|
||||
moduleObj = _modules[moduleName];
|
||||
if ( moduleObj ) {
|
||||
moduleObj.currentState = currentState;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( parts.length > 2 ) {
|
||||
_fqstates = parts[2].split( "," );
|
||||
}
|
||||
|
||||
_storageFieldReady = true;
|
||||
|
||||
if ( _browser == "msie" ) {
|
||||
|
||||
_iframe = document.getElementById( "yui_hist_iframe" );
|
||||
_checkIframeLoaded();
|
||||
|
||||
} else {
|
||||
|
||||
// Start the thread that will have the responsibility to
|
||||
// periodically check whether a navigate operation has been
|
||||
// requested on the main window. This will happen when
|
||||
// YAHOO.util.History.navigate has been called or after
|
||||
// the user has hit the back/forward button.
|
||||
|
||||
// On Safari 1.x and 2.0, the only way to catch a back/forward
|
||||
// operation is to watch history.length... We basically exploit
|
||||
// what I consider to be a bug (history.length is not supposed
|
||||
// to change when going back/forward in the history...) This is
|
||||
// why, in the following thread, we first compare the hash,
|
||||
// because the hash thing will be fixed in the next major
|
||||
// version of Safari. So even if they fix the history.length
|
||||
// bug, all this will still work!
|
||||
counter = history.length;
|
||||
|
||||
// On Gecko and Opera, we just need to watch the hash...
|
||||
hash = _getHash();
|
||||
|
||||
setInterval( function () {
|
||||
|
||||
var state;
|
||||
var newHash;
|
||||
var newCounter;
|
||||
|
||||
newHash = _getHash();
|
||||
newCounter = history.length;
|
||||
if ( newHash != hash ) {
|
||||
hash = newHash;
|
||||
counter = newCounter;
|
||||
_handleFQStateChange( hash );
|
||||
_storeStates();
|
||||
} else if ( newCounter != counter ) {
|
||||
// If we ever get here, we should be on Safari...
|
||||
hash = newHash;
|
||||
counter = newCounter;
|
||||
state = _fqstates[counter - 1];
|
||||
_handleFQStateChange( state );
|
||||
_storeStates();
|
||||
}
|
||||
}, 50 );
|
||||
|
||||
_bhmReady = true;
|
||||
|
||||
YAHOO.util.History.onLoadEvent.fire();
|
||||
}
|
||||
}
|
||||
|
||||
// Simple browser detection code
|
||||
// After talking with Matt Sweeney, I moved back to using the
|
||||
// user agent string instead of doing browser detection.
|
||||
_ua = navigator.userAgent.toLowerCase();
|
||||
if ( _ua.indexOf( "opera" ) != -1 ) {
|
||||
// Opera (check first in case of spoof)
|
||||
_browser = "opera";
|
||||
} else if ( _ua.indexOf( "msie" ) != -1 ) {
|
||||
// Microsoft Internet Explorer and derivatives...
|
||||
_browser = "msie";
|
||||
} else if ( _ua.indexOf( "safari" ) != -1 ) {
|
||||
// Safari (check before Gecko because it includes "like Gecko")
|
||||
_browser = "safari";
|
||||
} else if ( _ua.indexOf( "gecko" ) != -1 ) {
|
||||
// Gecko
|
||||
_browser = "gecko";
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
/**
|
||||
* Fired when the Browser History Manager is ready.
|
||||
*
|
||||
* @event onLoadEvent
|
||||
*/
|
||||
onLoadEvent: new YAHOO.util.CustomEvent( "onLoad" ),
|
||||
|
||||
/**
|
||||
* Registers a new module.
|
||||
*
|
||||
* @method register
|
||||
* @param {string} module Non-empty string uniquely identifying the
|
||||
* module you wish to register.
|
||||
* @param {string} initialState The initial state of the specified
|
||||
* module corresponding to its earliest history entry.
|
||||
* @param {function} onStateChange Callback called when the
|
||||
* state of the specified module has changed.
|
||||
* @param {object} obj An arbitrary object that will be passed as a
|
||||
* parameter to the handler.
|
||||
* @param {boolean} override If true, the obj passed in becomes the
|
||||
* execution scope of the listener.
|
||||
*/
|
||||
register: function ( module, initialState, onStateChange, obj, override ) {
|
||||
|
||||
var scope;
|
||||
var wrappedFn;
|
||||
|
||||
if ( typeof module != "string" || _trim( module ) === "" ||
|
||||
typeof initialState != "string" ||
|
||||
typeof onStateChange != "function" ) {
|
||||
throw new Error( "Missing or invalid argument passed to YAHOO.util.History.register" );
|
||||
}
|
||||
|
||||
if ( _modules[module] ) {
|
||||
throw new Error( "A module cannot be registered twice" );
|
||||
}
|
||||
|
||||
// Note: A module CANNOT be registered after calling
|
||||
// YAHOO.util.History.initialize. Indeed, we set the initial state
|
||||
// of each registered module in YAHOO.util.History.initialize.
|
||||
// If you could register a module after initializing the Browser
|
||||
// History Manager, you would not read the correct state using
|
||||
// YAHOO.util.History.getCurrentState when coming back to the
|
||||
// page using the back button.
|
||||
if ( _initialized ) {
|
||||
throw new Error( "All modules must be registered before calling YAHOO.util.History.initialize" );
|
||||
}
|
||||
|
||||
// Make sure the strings passed in do not contain our separators "," and "|"
|
||||
module = escape( module );
|
||||
initialState = escape( initialState );
|
||||
|
||||
// If the user chooses to override the scope, we use the
|
||||
// custom object passed in as the execution scope.
|
||||
scope = null;
|
||||
if ( override === true ) {
|
||||
scope = obj;
|
||||
} else {
|
||||
scope = override;
|
||||
}
|
||||
|
||||
wrappedFn = function ( state ) {
|
||||
return onStateChange.call( scope, state, obj );
|
||||
};
|
||||
|
||||
_modules[module] = {
|
||||
name: module,
|
||||
initialState: initialState,
|
||||
currentState: initialState,
|
||||
onStateChange: wrappedFn
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Initializes the Browser History Manager. Call this method
|
||||
* from a script block located right after the opening body tag.
|
||||
*
|
||||
* @method initialize
|
||||
* @param {string} iframeTarget Optional - Path to an existing
|
||||
* HTML document accessible from the same domain. If not
|
||||
* specified, defaults to "blank.html". This is only useful
|
||||
* if you use https.
|
||||
* @public
|
||||
*/
|
||||
initialize: function ( iframeTarget ) {
|
||||
|
||||
// Return if the browser history manager has already been initialized
|
||||
if ( _initialized ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( _browser == "unknown" ) {
|
||||
throw new Error( "Your web browser is not supported by the Browser History Manager" );
|
||||
}
|
||||
|
||||
if ( !iframeTarget ) {
|
||||
iframeTarget = "blank.html";
|
||||
}
|
||||
|
||||
if ( typeof iframeTarget != "string" || _trim( iframeTarget ) === "" ) {
|
||||
throw new Error( "Invalid argument passed to YAHOO.util.History.initialize" );
|
||||
}
|
||||
|
||||
document.write( '<input type="hidden" id="yui_hist_field">' );
|
||||
|
||||
if ( _browser == "msie" ) {
|
||||
if ( location.protocol == "https:" ) {
|
||||
// If we use https, we MUST point the IFrame to a valid
|
||||
// document on the same server. If we don't, we will get
|
||||
// a warning (do you want to display non secure items?)
|
||||
document.write( '<iframe id="yui_hist_iframe" src="' + iframeTarget + '" style="position:absolute;visibility:hidden;"></iframe>' );
|
||||
} else {
|
||||
// This trick allows us to do without having to download
|
||||
// the asset, saving one HTTP request...
|
||||
document.write( '<iframe id="yui_hist_iframe" src="javascript:document.open();document.write("' + new Date().getTime() + '");document.close();" style="position:absolute;visibility:hidden;"></iframe>' );
|
||||
}
|
||||
}
|
||||
|
||||
// We have to wait for the window's onload handler. Otherwise, our
|
||||
// hidden form field will always be empty (i.e. the browser won't
|
||||
// have had enough time to restore the session)
|
||||
YAHOO.util.Event.addListener( window, "load", _initialize );
|
||||
|
||||
_initialized = true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Call this method when you want to store a new entry in the browser's history.
|
||||
*
|
||||
* @method navigate
|
||||
* @param {string} module Non-empty string representing your module.
|
||||
* @param {string} state String representing the new state of the specified module.
|
||||
* @return {boolean} Indicates whether the new state was successfully added to the history.
|
||||
* @public
|
||||
*/
|
||||
navigate: function ( module, state ) {
|
||||
|
||||
var currentStates;
|
||||
var moduleName;
|
||||
var moduleObj;
|
||||
var currentState;
|
||||
var fqstate;
|
||||
var html;
|
||||
var doc;
|
||||
|
||||
if ( typeof module != "string" || typeof state != "string" ) {
|
||||
throw new Error( "Missing or invalid argument passed to YAHOO.util.History.navigate" );
|
||||
}
|
||||
|
||||
if ( !_bhmReady ) {
|
||||
throw new Error( "The Browser History Manager is not initialized" );
|
||||
}
|
||||
|
||||
if ( !_modules[module] ) {
|
||||
throw new Error( "The following module has not been registered: " + module );
|
||||
}
|
||||
|
||||
// Make sure the strings passed in do not contain our separators "," and "|"
|
||||
module = escape( module );
|
||||
state = escape( state );
|
||||
|
||||
// Generate our new full state string mod1=xxx&mod2=yyy
|
||||
currentStates = [];
|
||||
for ( moduleName in _modules ) {
|
||||
if ( YAHOO.lang.hasOwnProperty( _modules, moduleName ) ) {
|
||||
moduleObj = _modules[moduleName];
|
||||
currentState = ( moduleName == module ) ? state : moduleObj.currentState;
|
||||
currentStates.push( moduleName + "=" + currentState );
|
||||
}
|
||||
}
|
||||
|
||||
fqstate = currentStates.join( "&" );
|
||||
|
||||
if ( _browser == "msie" ) {
|
||||
|
||||
html = '<html><body><div id="state">' + fqstate + '</div></body></html>';
|
||||
try {
|
||||
doc = _iframe.contentWindow.document;
|
||||
doc.open();
|
||||
doc.write( html );
|
||||
doc.close();
|
||||
} catch ( e ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// Known bug: On Safari 1.x and 2.0, if you have tab browsing
|
||||
// enabled, Safari will show an endless loading icon in the
|
||||
// tab. This has apparently been fixed in recent WebKit builds.
|
||||
// One work around found by Dav Glass is to submit a form that
|
||||
// points to the same document. This indeed works on Safari 1.x
|
||||
// and 2.0 but creates bigger problems on WebKit. So for now,
|
||||
// we'll consider this an acceptable bug, and hope that Apple
|
||||
// comes out with their next version of Safari very soon.
|
||||
top.location.hash = fqstate;
|
||||
if ( _browser == "safari" ) {
|
||||
// The following two lines are only useful for Safari 1.x
|
||||
// and 2.0. Recent nightly builds of WebKit do not require
|
||||
// that, but unfortunately, it is not easy to differentiate
|
||||
// between the two. Once Safari 2.0 departs the A-grade
|
||||
// list, we can remove the following two lines...
|
||||
_fqstates[history.length] = fqstate;
|
||||
_storeStates();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the current state of the specified module.
|
||||
*
|
||||
* @method getCurrentState
|
||||
* @param {string} module Non-empty string representing your module.
|
||||
* @return {string} The current state of the specified module.
|
||||
* @public
|
||||
*/
|
||||
getCurrentState: function ( module ) {
|
||||
|
||||
var moduleObj;
|
||||
|
||||
if ( typeof module != "string" ) {
|
||||
throw new Error( "Missing or invalid argument passed to YAHOO.util.History.getCurrentState" );
|
||||
}
|
||||
|
||||
if ( !_storageFieldReady ) {
|
||||
throw new Error( "The Browser History Manager is not initialized" );
|
||||
}
|
||||
|
||||
moduleObj = _modules[module];
|
||||
if ( !moduleObj ) {
|
||||
throw new Error( "No such registered module: " + module );
|
||||
}
|
||||
|
||||
return unescape( moduleObj.currentState );
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the state of a module according to the URL fragment
|
||||
* identifier. This method is useful to initialize your modules
|
||||
* if your application was bookmarked from a particular state.
|
||||
*
|
||||
* @method getBookmarkedState
|
||||
* @param {string} module Non-empty string representing your module.
|
||||
* @return {string} The bookmarked state of the specified module.
|
||||
* @public
|
||||
*/
|
||||
getBookmarkedState: function ( module ) {
|
||||
|
||||
var i;
|
||||
var len;
|
||||
var hash;
|
||||
var states;
|
||||
var tokens;
|
||||
var moduleName;
|
||||
|
||||
if ( typeof module != "string" ) {
|
||||
throw new Error( "Missing or invalid argument passed to YAHOO.util.History.getBookmarkedState" );
|
||||
}
|
||||
|
||||
hash = top.location.hash.substr(1);
|
||||
states = hash.split( "&" );
|
||||
for ( i = 0, len = states.length ; i < len ; i++ ) {
|
||||
tokens = states[i].split( "=" );
|
||||
if ( tokens.length == 2 ) {
|
||||
moduleName = tokens[0];
|
||||
if ( moduleName == module ) {
|
||||
return unescape( tokens[1] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the value of the specified query string parameter.
|
||||
* This method is not used internally by the Browser History Manager.
|
||||
* However, it is provided here as a helper since many applications
|
||||
* using the Browser History Manager will want to read the value of
|
||||
* url parameters to initialize themselves.
|
||||
*
|
||||
* @method getQueryStringParameter
|
||||
* @param {string} paramName Name of the parameter we want to look up.
|
||||
* @param {string} queryString Optional URL to look at. If not specified,
|
||||
* this method uses the URL in the address bar.
|
||||
* @return {string} The value of the specified parameter, or null.
|
||||
* @public
|
||||
*/
|
||||
getQueryStringParameter: function ( paramName, url ) {
|
||||
|
||||
var i;
|
||||
var len;
|
||||
var idx;
|
||||
var queryString;
|
||||
var params;
|
||||
var tokens;
|
||||
|
||||
url = url || top.location.href;
|
||||
|
||||
idx = url.indexOf( "?" );
|
||||
queryString = idx >= 0 ? url.substr( idx + 1 ) : url;
|
||||
params = queryString.split( "&" );
|
||||
|
||||
for ( i = 0, len = params.length ; i < len ; i++ ) {
|
||||
tokens = params[i].split( "=" );
|
||||
if ( tokens.length >= 2 ) {
|
||||
if ( tokens[0] == paramName ) {
|
||||
return unescape( tokens[1] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} )();
|
||||
YAHOO.register("history", YAHOO.util.History, {version: "2.2.2", build: "204"});
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
Logger Release Notes
|
||||
|
||||
**** version 2.2.2 ***
|
||||
|
||||
* No changes.
|
||||
|
||||
|
||||
|
||||
*** version 2.2.1 ***
|
||||
|
||||
* Updated default ".yui-log-hd h4" font-size to "107%".
|
||||
* Fixed synchronicity issue with pause()/resume() calls and the corresponding
|
||||
LogReader button state.
|
||||
* Better support for "\n" newlines in log messages, while wrapping long lines in
|
||||
verboseOutput mode.
|
||||
* Added draggable and outputBuffer properties to LogReader.
|
||||
* Added showCategory(), hideCategory(), showSource(), hideSource(), and
|
||||
clearConsole() methods to LogReader.
|
||||
* Support for multiple freestanding LogReader instances.
|
||||
* Improved type checking with YAHOO.lang.
|
||||
|
||||
|
||||
|
||||
**** version 2.2.0 ***
|
||||
|
||||
* Implemented expand() and collapse() in LogReader class.
|
||||
* Better internal browser detection.
|
||||
|
||||
|
||||
|
||||
*** version 0.12.2 ***
|
||||
|
||||
* No changes.
|
||||
|
||||
|
||||
|
||||
**** version 0.12.1 ***
|
||||
|
||||
* Fixed issues with setting LogReader's "bottom" property.
|
||||
|
||||
|
||||
|
||||
*** version 0.12.0 ***
|
||||
|
||||
* Added method formatMsg(oLogMsg) to support custom formatting of log messages
|
||||
for output to a LogReader.
|
||||
|
||||
|
||||
|
||||
*** version 0.11.3 ***
|
||||
|
||||
* The Logger static method enableFirebug() has been RENAMED to
|
||||
enableBrowserConsole().
|
||||
* The Logger static method disableFirebug() has been RENAMED to
|
||||
disableBrowserConsole().
|
||||
* By default, the Logger will not automatically output to Firebug or Safari's
|
||||
JavaScript console. To enable this feature, implementers should now explicitly
|
||||
call YAHOO.widget.Logger.enableBrowserConsole().
|
||||
* Implementers may now cap the size of the YAHOO.widget.Logger stack by setting
|
||||
the property YAHOO.widget.Logger.maxStackEntries.
|
||||
* Implementers may now control the number of items displayed in each console by
|
||||
setting the LogReader properties thresholdMax and thresholdMin.
|
||||
|
||||
|
||||
|
||||
*** version 0.11.0 ***
|
||||
|
||||
* Initial release
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 2.2.2
|
||||
*/
|
||||
/* logger default styles */
|
||||
/* default width: 31em */
|
||||
/* default font-size 77% */
|
||||
.yui-log {padding:1em;width:31em;background-color:#AAA;border:1px solid black;font-family:monospace;font-size:77%;text-align:left;z-index:9000;}
|
||||
/* for containers built from scratch */
|
||||
.yui-log-container {position:absolute;top:1em;right:1em;}
|
||||
.yui-log p {margin:1px;padding:.1em;}
|
||||
.yui-log button {font-family:monospace;}
|
||||
.yui-log .yui-log-hd {margin-top:1em;padding:.5em;background-color:#575757;color:#FFF;}
|
||||
.yui-log .yui-log-hd h4 {font-size:107%;}
|
||||
/* height is controlled here: default 20em*/
|
||||
.yui-log .yui-log-bd {width:100%;height:20em;background-color:#FFF;border:1px solid gray;overflow:auto;}
|
||||
/* for pre to respect newlines yet wrap long lines */
|
||||
/* http://www.longren.org/2006/09/27/wrapping-text-inside-pre-tags/ */
|
||||
.yui-log pre.yui-log-verbose {
|
||||
white-space: pre-wrap; /* css-3 */
|
||||
white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
|
||||
white-space: -pre-wrap; /* Opera 4-6 */
|
||||
white-space: -o-pre-wrap; /* Opera 7 */
|
||||
word-wrap: break-word; /* Internet Explorer 5.5+ */
|
||||
}
|
||||
.yui-log .yui-log-ft {margin-top:.5em;margin-bottom:1em;}
|
||||
.yui-log .yui-log-ft .yui-log-categoryfilters {}
|
||||
.yui-log .yui-log-ft .yui-log-sourcefilters {width:100%;border-top:1px solid #575757;margin-top:.75em;padding-top:.75em;}
|
||||
.yui-log .yui-log-btns {position:relative;float:right;bottom:.25em;}
|
||||
.yui-log .yui-log-filtergrp {margin-right:.5em;}
|
||||
.yui-log .info {background-color:#A7CC25;} /* A7CC25 green */
|
||||
.yui-log .warn {background-color:#F58516;} /* F58516 orange */
|
||||
.yui-log .error {background-color:#E32F0B;} /* E32F0B red */
|
||||
.yui-log .time {background-color:#A6C9D7;} /* A6C9D7 blue */
|
||||
.yui-log .window {background-color:#F2E886;} /* F2E886 tan */
|
||||
1818
www/extras/yui/build/logger/logger-debug.js
vendored
66
www/extras/yui/build/logger/logger-min.js
vendored
|
|
@ -1,66 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 2.2.2
|
||||
*/
|
||||
|
||||
YAHOO.widget.LogMsg=function(oConfigs){if(oConfigs&&(oConfigs.constructor==Object)){for(var param in oConfigs){this[param]=oConfigs[param];}}};YAHOO.widget.LogMsg.prototype.msg=null;YAHOO.widget.LogMsg.prototype.time=null;YAHOO.widget.LogMsg.prototype.category=null;YAHOO.widget.LogMsg.prototype.source=null;YAHOO.widget.LogMsg.prototype.sourceDetail=null;YAHOO.widget.LogWriter=function(sSource){if(!sSource){YAHOO.log("Could not instantiate LogWriter due to invalid source.","error","LogWriter");return;}
|
||||
this._source=sSource;};YAHOO.widget.LogWriter.prototype.toString=function(){return"LogWriter "+this._sSource;};YAHOO.widget.LogWriter.prototype.log=function(sMsg,sCategory){YAHOO.widget.Logger.log(sMsg,sCategory,this._source);};YAHOO.widget.LogWriter.prototype.getSource=function(){return this._sSource;};YAHOO.widget.LogWriter.prototype.setSource=function(sSource){if(!sSource){YAHOO.log("Could not set source due to invalid source.","error",this.toString());return;}
|
||||
else{this._sSource=sSource;}};YAHOO.widget.LogWriter.prototype._source=null;YAHOO.widget.LogReader=function(elContainer,oConfigs){var oSelf=this;this._sName=YAHOO.widget.LogReader._index;YAHOO.widget.LogReader._index++;if(oConfigs&&(oConfigs.constructor==Object)){for(var param in oConfigs){this[param]=oConfigs[param];}}
|
||||
elContainer=YAHOO.util.Dom.get(elContainer);if(elContainer&&elContainer.tagName&&(elContainer.tagName.toLowerCase()=="div")){this._elContainer=elContainer;YAHOO.util.Dom.addClass(this._elContainer,"yui-log");}
|
||||
else{this._elContainer=document.body.appendChild(document.createElement("div"));YAHOO.util.Dom.addClass(this._elContainer,"yui-log");YAHOO.util.Dom.addClass(this._elContainer,"yui-log-container");var containerStyle=this._elContainer.style;if(this.width){containerStyle.width=this.width;}
|
||||
if(this.right){containerStyle.right=this.right;}
|
||||
if(this.top){containerStyle.top=this.top;}
|
||||
if(this.left){containerStyle.left=this.left;containerStyle.right="auto";}
|
||||
if(this.bottom){containerStyle.bottom=this.bottom;containerStyle.top="auto";}
|
||||
if(this.fontSize){containerStyle.fontSize=this.fontSize;}
|
||||
if(navigator.userAgent.toLowerCase().indexOf("opera")!=-1){document.body.style+='';}}
|
||||
if(this._elContainer){if(!this._elHd){this._elHd=this._elContainer.appendChild(document.createElement("div"));this._elHd.id="yui-log-hd"+this._sName;this._elHd.className="yui-log-hd";this._elCollapse=this._elHd.appendChild(document.createElement("div"));this._elCollapse.className="yui-log-btns";this._btnCollapse=document.createElement("input");this._btnCollapse.type="button";this._btnCollapse.style.fontSize=YAHOO.util.Dom.getStyle(this._elContainer,"fontSize");this._btnCollapse.className="yui-log-button";this._btnCollapse.value="Collapse";this._btnCollapse=this._elCollapse.appendChild(this._btnCollapse);YAHOO.util.Event.addListener(oSelf._btnCollapse,'click',oSelf._onClickCollapseBtn,oSelf);this._title=this._elHd.appendChild(document.createElement("h4"));this._title.innerHTML="Logger Console";}
|
||||
if(!this._elConsole){this._elConsole=this._elContainer.appendChild(document.createElement("div"));this._elConsole.className="yui-log-bd";if(this.height){this._elConsole.style.height=this.height;}}
|
||||
if(!this._elFt&&this.footerEnabled){this._elFt=this._elContainer.appendChild(document.createElement("div"));this._elFt.className="yui-log-ft";this._elBtns=this._elFt.appendChild(document.createElement("div"));this._elBtns.className="yui-log-btns";this._btnPause=document.createElement("input");this._btnPause.type="button";this._btnPause.style.fontSize=YAHOO.util.Dom.getStyle(this._elContainer,"fontSize");this._btnPause.className="yui-log-button";this._btnPause.value="Pause";this._btnPause=this._elBtns.appendChild(this._btnPause);YAHOO.util.Event.addListener(oSelf._btnPause,'click',oSelf._onClickPauseBtn,oSelf);this._btnClear=document.createElement("input");this._btnClear.type="button";this._btnClear.style.fontSize=YAHOO.util.Dom.getStyle(this._elContainer,"fontSize");this._btnClear.className="yui-log-button";this._btnClear.value="Clear";this._btnClear=this._elBtns.appendChild(this._btnClear);YAHOO.util.Event.addListener(oSelf._btnClear,'click',oSelf._onClickClearBtn,oSelf);this._elCategoryFilters=this._elFt.appendChild(document.createElement("div"));this._elCategoryFilters.className="yui-log-categoryfilters";this._elSourceFilters=this._elFt.appendChild(document.createElement("div"));this._elSourceFilters.className="yui-log-sourcefilters";}}
|
||||
if(YAHOO.util.DD&&this.draggable){var ylog_dd=new YAHOO.util.DD(this._elContainer);ylog_dd.setHandleElId(this._elHd.id);this._elHd.style.cursor="move";}
|
||||
if(!this._buffer){this._buffer=[];}
|
||||
this._lastTime=YAHOO.widget.Logger.getStartTime();YAHOO.widget.Logger.newLogEvent.subscribe(this._onNewLog,this);YAHOO.widget.Logger.logResetEvent.subscribe(this._onReset,this);this._filterCheckboxes={};this._categoryFilters=[];var catsLen=YAHOO.widget.Logger.categories.length;if(this._elCategoryFilters){for(var i=0;i<catsLen;i++){this._createCategoryCheckbox(YAHOO.widget.Logger.categories[i]);}}
|
||||
this._sourceFilters=[];var sourcesLen=YAHOO.widget.Logger.sources.length;if(this._elSourceFilters){for(var j=0;j<sourcesLen;j++){this._createSourceCheckbox(YAHOO.widget.Logger.sources[j]);}}
|
||||
YAHOO.widget.Logger.categoryCreateEvent.subscribe(this._onCategoryCreate,this);YAHOO.widget.Logger.sourceCreateEvent.subscribe(this._onSourceCreate,this);this._filterLogs();YAHOO.log("LogReader initialized",null,this.toString());};YAHOO.widget.LogReader.prototype.logReaderEnabled=true;YAHOO.widget.LogReader.prototype.width=null;YAHOO.widget.LogReader.prototype.height=null;YAHOO.widget.LogReader.prototype.top=null;YAHOO.widget.LogReader.prototype.left=null;YAHOO.widget.LogReader.prototype.right=null;YAHOO.widget.LogReader.prototype.bottom=null;YAHOO.widget.LogReader.prototype.fontSize=null;YAHOO.widget.LogReader.prototype.footerEnabled=true;YAHOO.widget.LogReader.prototype.verboseOutput=true;YAHOO.widget.LogReader.prototype.newestOnTop=true;YAHOO.widget.LogReader.prototype.outputBuffer=100;YAHOO.widget.LogReader.prototype.thresholdMax=500;YAHOO.widget.LogReader.prototype.thresholdMin=100;YAHOO.widget.LogReader.prototype.isCollapsed=false;YAHOO.widget.LogReader.prototype.isPaused=false;YAHOO.widget.LogReader.prototype.draggable=true;YAHOO.widget.LogReader.prototype.toString=function(){return"LogReader instance"+this._sName;};YAHOO.widget.LogReader.prototype.pause=function(){this.isPaused=true;this._btnPause.value="Resume";this._timeout=null;this.logReaderEnabled=false;};YAHOO.widget.LogReader.prototype.resume=function(){this.isPaused=false;this._btnPause.value="Pause";this.logReaderEnabled=true;this._printBuffer();};YAHOO.widget.LogReader.prototype.hide=function(){this._elContainer.style.display="none";};YAHOO.widget.LogReader.prototype.show=function(){this._elContainer.style.display="block";};YAHOO.widget.LogReader.prototype.collapse=function(){this._elConsole.style.display="none";if(this._elFt){this._elFt.style.display="none";}
|
||||
this._btnCollapse.value="Expand";this.isCollapsed=true;};YAHOO.widget.LogReader.prototype.expand=function(){this._elConsole.style.display="block";if(this._elFt){this._elFt.style.display="block";}
|
||||
this._btnCollapse.value="Collapse";this.isCollapsed=false;};YAHOO.widget.LogReader.prototype.getCheckbox=function(filter){return this._filterCheckboxes[filter];};YAHOO.widget.LogReader.prototype.getCategories=function(){return this._categoryFilters;};YAHOO.widget.LogReader.prototype.showCategory=function(sCategory){var filtersArray=this._categoryFilters;if(filtersArray.indexOf){if(filtersArray.indexOf(sCategory)>-1){return;}}
|
||||
else{for(var i=0;i<filtersArray.length;i++){if(filtersArray[i]===sCategory){return;}}}
|
||||
this._categoryFilters.push(sCategory);this._filterLogs();this.getCheckbox(sCategory).checked=true;};YAHOO.widget.LogReader.prototype.hideCategory=function(sCategory){var filtersArray=this._categoryFilters;for(var i=0;i<filtersArray.length;i++){if(sCategory==filtersArray[i]){filtersArray.splice(i,1);break;}}
|
||||
this._filterLogs();this.getCheckbox(sCategory).checked=false;};YAHOO.widget.LogReader.prototype.getSources=function(){return this._sourceFilters;};YAHOO.widget.LogReader.prototype.showSource=function(sSource){var filtersArray=this._sourceFilters;if(filtersArray.indexOf){if(filtersArray.indexOf(sSource)>-1){return;}}
|
||||
else{for(var i=0;i<filtersArray.length;i++){if(sSource==filtersArray[i]){return;}}}
|
||||
filtersArray.push(sSource);this._filterLogs();this.getCheckbox(sSource).checked=true;};YAHOO.widget.LogReader.prototype.hideSource=function(sSource){var filtersArray=this._sourceFilters;for(var i=0;i<filtersArray.length;i++){if(sSource==filtersArray[i]){filtersArray.splice(i,1);break;}}
|
||||
this._filterLogs();this.getCheckbox(sSource).checked=false;};YAHOO.widget.LogReader.prototype.clearConsole=function(){this._timeout=null;this._buffer=[];this._consoleMsgCount=0;var elConsole=this._elConsole;while(elConsole.hasChildNodes()){elConsole.removeChild(elConsole.firstChild);}};YAHOO.widget.LogReader.prototype.setTitle=function(sTitle){this._title.innerHTML=this.html2Text(sTitle);};YAHOO.widget.LogReader.prototype.getLastTime=function(){return this._lastTime;};YAHOO.widget.LogReader.prototype.formatMsg=function(oLogMsg){var category=oLogMsg.category;var label=category.substring(0,4).toUpperCase();var time=oLogMsg.time;if(time.toLocaleTimeString){var localTime=time.toLocaleTimeString();}
|
||||
else{localTime=time.toString();}
|
||||
var msecs=time.getTime();var startTime=YAHOO.widget.Logger.getStartTime();var totalTime=msecs-startTime;var elapsedTime=msecs-this.getLastTime();var source=oLogMsg.source;var sourceDetail=oLogMsg.sourceDetail;var sourceAndDetail=(sourceDetail)?source+" "+sourceDetail:source;var msg=this.html2Text(oLogMsg.msg);var output=(this.verboseOutput)?["<pre class=\"yui-log-verbose\"><p><span class='",category,"'>",label,"</span> ",totalTime,"ms (+",elapsedTime,") ",localTime,": ","</p><p>",sourceAndDetail,": </p><p>",msg,"</p></pre>"]:["<pre><p><span class='",category,"'>",label,"</span> ",totalTime,"ms (+",elapsedTime,") ",localTime,": ",sourceAndDetail,": ",msg,"</p></pre>"];return output.join("");};YAHOO.widget.LogReader.prototype.html2Text=function(sHtml){if(sHtml){sHtml+="";return sHtml.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");}
|
||||
return"";};YAHOO.widget.LogReader._index=0;YAHOO.widget.LogReader.prototype._sName=null;YAHOO.widget.LogReader.prototype._buffer=null;YAHOO.widget.LogReader.prototype._consoleMsgCount=0;YAHOO.widget.LogReader.prototype._lastTime=null;YAHOO.widget.LogReader.prototype._timeout=null;YAHOO.widget.LogReader.prototype._filterCheckboxes=null;YAHOO.widget.LogReader.prototype._categoryFilters=null;YAHOO.widget.LogReader.prototype._sourceFilters=null;YAHOO.widget.LogReader.prototype._elContainer=null;YAHOO.widget.LogReader.prototype._elHd=null;YAHOO.widget.LogReader.prototype._elCollapse=null;YAHOO.widget.LogReader.prototype._btnCollapse=null;YAHOO.widget.LogReader.prototype._title=null;YAHOO.widget.LogReader.prototype._elConsole=null;YAHOO.widget.LogReader.prototype._elFt=null;YAHOO.widget.LogReader.prototype._elBtns=null;YAHOO.widget.LogReader.prototype._elCategoryFilters=null;YAHOO.widget.LogReader.prototype._elSourceFilters=null;YAHOO.widget.LogReader.prototype._btnPause=null;YAHOO.widget.LogReader.prototype._btnClear=null;YAHOO.widget.LogReader.prototype._createCategoryCheckbox=function(sCategory){var oSelf=this;if(this._elFt){var elParent=this._elCategoryFilters;var filters=this._categoryFilters;var elFilter=elParent.appendChild(document.createElement("span"));elFilter.className="yui-log-filtergrp";var chkCategory=document.createElement("input");chkCategory.id="yui-log-filter-"+sCategory+this._sName;chkCategory.className="yui-log-filter-"+sCategory;chkCategory.type="checkbox";chkCategory.category=sCategory;chkCategory=elFilter.appendChild(chkCategory);chkCategory.checked=true;filters.push(sCategory);YAHOO.util.Event.addListener(chkCategory,'click',oSelf._onCheckCategory,oSelf);var lblCategory=elFilter.appendChild(document.createElement("label"));lblCategory.htmlFor=chkCategory.id;lblCategory.className=sCategory;lblCategory.innerHTML=sCategory;this._filterCheckboxes[sCategory]=chkCategory;}};YAHOO.widget.LogReader.prototype._createSourceCheckbox=function(sSource){var oSelf=this;if(this._elFt){var elParent=this._elSourceFilters;var filters=this._sourceFilters;var elFilter=elParent.appendChild(document.createElement("span"));elFilter.className="yui-log-filtergrp";var chkSource=document.createElement("input");chkSource.id="yui-log-filter"+sSource+this._sName;chkSource.className="yui-log-filter"+sSource;chkSource.type="checkbox";chkSource.source=sSource;chkSource=elFilter.appendChild(chkSource);chkSource.checked=true;filters.push(sSource);YAHOO.util.Event.addListener(chkSource,'click',oSelf._onCheckSource,oSelf);var lblSource=elFilter.appendChild(document.createElement("label"));lblSource.htmlFor=chkSource.id;lblSource.className=sSource;lblSource.innerHTML=sSource;this._filterCheckboxes[sSource]=chkSource;}};YAHOO.widget.LogReader.prototype._filterLogs=function(){if(this._elConsole!==null){this.clearConsole();this._printToConsole(YAHOO.widget.Logger.getStack());}};YAHOO.widget.LogReader.prototype._printBuffer=function(){this._timeout=null;if(this._elConsole!==null){var thresholdMax=this.thresholdMax;thresholdMax=(thresholdMax&&!isNaN(thresholdMax))?thresholdMax:500;if(this._consoleMsgCount<thresholdMax){var entries=[];for(var i=0;i<this._buffer.length;i++){entries[i]=this._buffer[i];}
|
||||
this._buffer=[];this._printToConsole(entries);}
|
||||
else{this._filterLogs();}
|
||||
if(!this.newestOnTop){this._elConsole.scrollTop=this._elConsole.scrollHeight;}}};YAHOO.widget.LogReader.prototype._printToConsole=function(aEntries){var entriesLen=aEntries.length;var thresholdMin=this.thresholdMin;if(isNaN(thresholdMin)||(thresholdMin>this.thresholdMax)){thresholdMin=0;}
|
||||
var entriesStartIndex=(entriesLen>thresholdMin)?(entriesLen-thresholdMin):0;var sourceFiltersLen=this._sourceFilters.length;var categoryFiltersLen=this._categoryFilters.length;for(var i=entriesStartIndex;i<entriesLen;i++){var okToPrint=false;var okToFilterCats=false;var entry=aEntries[i];var source=entry.source;var category=entry.category;for(var j=0;j<sourceFiltersLen;j++){if(source==this._sourceFilters[j]){okToFilterCats=true;break;}}
|
||||
if(okToFilterCats){for(var k=0;k<categoryFiltersLen;k++){if(category==this._categoryFilters[k]){okToPrint=true;break;}}}
|
||||
if(okToPrint){var output=this.formatMsg(entry);if(this.newestOnTop){this._elConsole.innerHTML=output+this._elConsole.innerHTML;}
|
||||
else{this._elConsole.innerHTML+=output;}
|
||||
this._consoleMsgCount++;this._lastTime=entry.time.getTime();}}};YAHOO.widget.LogReader.prototype._onCategoryCreate=function(sType,aArgs,oSelf){var category=aArgs[0];if(oSelf._elFt){oSelf._createCategoryCheckbox(category);}};YAHOO.widget.LogReader.prototype._onSourceCreate=function(sType,aArgs,oSelf){var source=aArgs[0];if(oSelf._elFt){oSelf._createSourceCheckbox(source);}};YAHOO.widget.LogReader.prototype._onCheckCategory=function(v,oSelf){var category=this.category;if(!this.checked){oSelf.hideCategory(category);}
|
||||
else{oSelf.showCategory(category);}};YAHOO.widget.LogReader.prototype._onCheckSource=function(v,oSelf){var source=this.source;if(!this.checked){oSelf.hideSource(source);}
|
||||
else{oSelf.showSource(source);}};YAHOO.widget.LogReader.prototype._onClickCollapseBtn=function(v,oSelf){if(!oSelf.isCollapsed){oSelf.collapse();}
|
||||
else{oSelf.expand();}};YAHOO.widget.LogReader.prototype._onClickPauseBtn=function(v,oSelf){if(!oSelf.isPaused){oSelf.pause();}
|
||||
else{oSelf.resume();}};YAHOO.widget.LogReader.prototype._onClickClearBtn=function(v,oSelf){oSelf.clearConsole();};YAHOO.widget.LogReader.prototype._onNewLog=function(sType,aArgs,oSelf){var logEntry=aArgs[0];oSelf._buffer.push(logEntry);if(oSelf.logReaderEnabled===true&&oSelf._timeout===null){oSelf._timeout=setTimeout(function(){oSelf._printBuffer();},oSelf.outputBuffer);}};YAHOO.widget.LogReader.prototype._onReset=function(sType,aArgs,oSelf){oSelf._filterLogs();};YAHOO.widget.Logger={loggerEnabled:true,_browserConsoleEnabled:false,categories:["info","warn","error","time","window"],sources:["global"],_stack:[],maxStackEntries:2500,_startTime:new Date().getTime(),_lastTime:null};YAHOO.widget.Logger.log=function(sMsg,sCategory,sSource){if(this.loggerEnabled){if(!sCategory){sCategory="info";}
|
||||
else{sCategory=sCategory.toLocaleLowerCase();if(this._isNewCategory(sCategory)){this._createNewCategory(sCategory);}}
|
||||
var sClass="global";var sDetail=null;if(sSource){var spaceIndex=sSource.indexOf(" ");if(spaceIndex>0){sClass=sSource.substring(0,spaceIndex);sDetail=sSource.substring(spaceIndex,sSource.length);}
|
||||
else{sClass=sSource;}
|
||||
if(this._isNewSource(sClass)){this._createNewSource(sClass);}}
|
||||
var timestamp=new Date();var logEntry=new YAHOO.widget.LogMsg({msg:sMsg,time:timestamp,category:sCategory,source:sClass,sourceDetail:sDetail});var stack=this._stack;var maxStackEntries=this.maxStackEntries;if(maxStackEntries&&!isNaN(maxStackEntries)&&(stack.length>=maxStackEntries)){stack.shift();}
|
||||
stack.push(logEntry);this.newLogEvent.fire(logEntry);if(this._browserConsoleEnabled){this._printToBrowserConsole(logEntry);}
|
||||
return true;}
|
||||
else{return false;}};YAHOO.widget.Logger.reset=function(){this._stack=[];this._startTime=new Date().getTime();this.loggerEnabled=true;this.log("Logger reset");this.logResetEvent.fire();};YAHOO.widget.Logger.getStack=function(){return this._stack;};YAHOO.widget.Logger.getStartTime=function(){return this._startTime;};YAHOO.widget.Logger.disableBrowserConsole=function(){YAHOO.log("Logger output to the function console.log() has been disabled.");this._browserConsoleEnabled=false;};YAHOO.widget.Logger.enableBrowserConsole=function(){this._browserConsoleEnabled=true;YAHOO.log("Logger output to the function console.log() has been enabled.");};YAHOO.widget.Logger.categoryCreateEvent=new YAHOO.util.CustomEvent("categoryCreate",this,true);YAHOO.widget.Logger.sourceCreateEvent=new YAHOO.util.CustomEvent("sourceCreate",this,true);YAHOO.widget.Logger.newLogEvent=new YAHOO.util.CustomEvent("newLog",this,true);YAHOO.widget.Logger.logResetEvent=new YAHOO.util.CustomEvent("logReset",this,true);YAHOO.widget.Logger._createNewCategory=function(sCategory){this.categories.push(sCategory);this.categoryCreateEvent.fire(sCategory);};YAHOO.widget.Logger._isNewCategory=function(sCategory){for(var i=0;i<this.categories.length;i++){if(sCategory==this.categories[i]){return false;}}
|
||||
return true;};YAHOO.widget.Logger._createNewSource=function(sSource){this.sources.push(sSource);this.sourceCreateEvent.fire(sSource);};YAHOO.widget.Logger._isNewSource=function(sSource){if(sSource){for(var i=0;i<this.sources.length;i++){if(sSource==this.sources[i]){return false;}}
|
||||
return true;}};YAHOO.widget.Logger._printToBrowserConsole=function(oEntry){if(window.console&&console.log){var category=oEntry.category;var label=oEntry.category.substring(0,4).toUpperCase();var time=oEntry.time;if(time.toLocaleTimeString){var localTime=time.toLocaleTimeString();}
|
||||
else{localTime=time.toString();}
|
||||
var msecs=time.getTime();var elapsedTime=(YAHOO.widget.Logger._lastTime)?(msecs-YAHOO.widget.Logger._lastTime):0;YAHOO.widget.Logger._lastTime=msecs;var output=localTime+" ("+
|
||||
elapsedTime+"ms): "+
|
||||
oEntry.source+": "+
|
||||
oEntry.msg;console.log(output);}};YAHOO.widget.Logger._onWindowError=function(sMsg,sUrl,sLine){try{YAHOO.widget.Logger.log(sMsg+' ('+sUrl+', line '+sLine+')',"window");if(YAHOO.widget.Logger._origOnWindowError){YAHOO.widget.Logger._origOnWindowError();}}
|
||||
catch(e){return false;}};if(window.onerror){YAHOO.widget.Logger._origOnWindowError=window.onerror;}
|
||||
window.onerror=YAHOO.widget.Logger._onWindowError;YAHOO.widget.Logger.log("Logger initialized");YAHOO.register("logger",YAHOO.widget.Logger,{version:"2.2.2",build:"204"});
|
||||
1818
www/extras/yui/build/logger/logger.js
vendored
|
|
@ -1,478 +0,0 @@
|
|||
*** version 2.2.2 ***
|
||||
|
||||
Fixed the following bugs:
|
||||
-------------------------
|
||||
|
||||
+ "toString" method of MenuItem, MenuBarItem and ContextMenuItem classes will
|
||||
no longer throw a JavaScript error when using the debug version
|
||||
of the Event utility.
|
||||
|
||||
+ "toString" method of Menu, MenuBar and ContextMenu classes will
|
||||
no longer attempt to output the instance's id if it is not available.
|
||||
|
||||
+ Logger statements output by debug version of MenuManager are now properly
|
||||
categorized as "MenuManager"
|
||||
|
||||
|
||||
|
||||
*** version 2.2.1 ***
|
||||
|
||||
Added the following features:
|
||||
-----------------------------
|
||||
|
||||
+ Added the following methods to YAHOO.widget.Menu:
|
||||
- "focus"
|
||||
- "blur"
|
||||
- "hasFocus"
|
||||
|
||||
+ Added the following Custom Events to YAHOO.widget.Menu:
|
||||
+ "focusEvent"
|
||||
+ "blurEvent"
|
||||
|
||||
+ Added the following methods to YAHOO.widget.MenuManager:
|
||||
- "getFocusedMenuItem"
|
||||
- "getFocusedMenu"
|
||||
|
||||
+ Added "hasFocus" method to YAHOO.widget.MenuItem
|
||||
|
||||
|
||||
Fixed the following bugs:
|
||||
-------------------------
|
||||
|
||||
+ Menu instances no longer set focus to themselves by default when made
|
||||
visible. Menus only receive focus in response to the following events:
|
||||
- The user mouses down on a MenuItem instance
|
||||
- The user tabs into a MenuItem instance
|
||||
|
||||
+ Application of the "maxheight" configuration property is now correctly
|
||||
deferred until the "render" event fires when Menu instance is being
|
||||
lazy loaded.
|
||||
|
||||
+ The "maxheight" configuration property can now be set multiple times without
|
||||
a Menu instance restoring itself to its original default height.
|
||||
|
||||
+ The "maxheight" configuration property can now be set on hidden Menu
|
||||
instances that use lazy loading.
|
||||
|
||||
+ Menu instances with a "width" configuration property set will now render
|
||||
at the specified width rather than shrink wrapping to their contents.
|
||||
|
||||
+ Menu item help text no longer wraps to the next line in Opera 9.
|
||||
|
||||
+ Immediate submenus of a Menubar instance will no longer shift their position
|
||||
to try and remain inside the confines of the browser's viewport.
|
||||
|
||||
+ Lazy loaded ContextMenu instances now appear in the correct position when
|
||||
they are made visible for the first time.
|
||||
|
||||
+ MenuBar instances no longer throw JavaScript errors when navigating items with
|
||||
submenus containing no active items using the keyboard.
|
||||
|
||||
+ Replaced use of native "hasOwnProperty" method
|
||||
with YAHOO.lang.hasOwnProperty.
|
||||
|
||||
+ Rendered Menu instances will now update their width when items are added
|
||||
or removed.
|
||||
|
||||
+ Mousing over a Menu instance in an IE window that does not have focus will
|
||||
no longer cause the window to receive focus.
|
||||
|
||||
|
||||
Changes:
|
||||
--------
|
||||
|
||||
+ "activeItem" property of YAHOO.widget.Menu now returns a reference to the
|
||||
Menu's currently selected item.
|
||||
|
||||
+ Added a "visible" CSS class that is applied to visible Menu instances.
|
||||
|
||||
+ Refactored the Menu family to improve performance, especially when working
|
||||
with a large number of instances in IE6.
|
||||
|
||||
|
||||
|
||||
*** version 2.2.0 ***
|
||||
|
||||
Added the following features:
|
||||
-----------------------------
|
||||
|
||||
* Added two new methods to YAHOO.widget.Menu:
|
||||
|
||||
* "getItems" - Returns a flat array of the items in a menu.
|
||||
|
||||
* "clearContent" - Removes all of the content from the menu, including the
|
||||
menu items, group titles, header and footer.
|
||||
|
||||
|
||||
* Added three new configuration attributes to YAHOO.widget.Menu:
|
||||
|
||||
* "submenuhidedelay" - Number indicating the time (in milliseconds) that
|
||||
should expire before a submenu is hidden when the user mouses out of a
|
||||
menu item heading in the direction of a submenu. The value must be
|
||||
greater than or equal to the value specified for the "showdelay"
|
||||
configuration property.
|
||||
|
||||
* "maxheight" - Defines the maximum height (in pixels) for a menu before
|
||||
the contents of the body are scrolled.
|
||||
|
||||
* "classname" - CSS class to be applied to the menu's root <div> element.
|
||||
The specified class(es) are appended in addition to the default class as
|
||||
specified by the menu's CSS_CLASS_NAME constant.
|
||||
|
||||
|
||||
* Added new constants to YAHOO.widget.MenuItem:
|
||||
|
||||
* COLLAPSED_SUBMENU_INDICATOR_TEXT - String representing the text for the
|
||||
<em> element used for the submenu arrow indicator.
|
||||
|
||||
* EXPANDED_SUBMENU_INDICATOR_TEXT - String representing the text for the
|
||||
submenu arrow indicator element (<em>) when the submenu is visible.
|
||||
|
||||
* DISABLED_SUBMENU_INDICATOR_ALT_TEXT - String representing the text for
|
||||
the submenu arrow indicator element (<em>) when the menu item is disabled.
|
||||
|
||||
* CHECKED_TEXT - String representing the text to be used for the checked
|
||||
indicator element (<em>).
|
||||
|
||||
* DISABLED_CHECKED_TEXT - String representing the text to be used for the
|
||||
checked indicator element (<em>) when the menu item is disabled.
|
||||
|
||||
|
||||
* Added two new configuration attributes to YAHOO.widget.MenuItem:
|
||||
|
||||
* "onclick" - Object literal representing the code to be executed when the
|
||||
button is clicked. Format:
|
||||
|
||||
{
|
||||
fn: Function, // The handler to call when the event fires.
|
||||
obj: Object, // An object to pass back to the handler.
|
||||
scope: Object // The object to use for the scope of the handler.
|
||||
}
|
||||
|
||||
* "classname" - CSS class to be applied to the menu item's root <li>
|
||||
element. The specified class(es) are appended in addition to the default
|
||||
class as specified by the menu item's CSS_CLASS_NAME constant.
|
||||
|
||||
|
||||
* Added an "id" property to YAHOO.widget.MenuItem that represents the id of
|
||||
the menu item's root <li> node. Although not a configuration attribute, this
|
||||
property should be set via the object literal of configuration attributes
|
||||
passed as the second argument to the constructor. If no value is
|
||||
specified, then one will be generated using the "generateId" method of the
|
||||
Dom utility (YAHOO.widget.Dom).
|
||||
|
||||
* Added a "trigger context menu event"
|
||||
(YAHOO.widget.ContextMenu.triggerContextMenuEvent) that fires when the DOM
|
||||
"contextmenu" event ("mousedown" for Opera) is fired by one of the elemeents
|
||||
defined as a YAHOO.widget.ContextMenu instance's trigger.
|
||||
|
||||
* Added a "cancel" method to YAHOO.widget.ContextMenu that can be used to
|
||||
cancel the display of a YAHOO.widget.ContextMen instance. This method
|
||||
should be called within the scope of a "context menu" event handler for
|
||||
one of the context menu's triggers
|
||||
(YAHOO.widget.ContextMenu.triggerContextMenuEvent).
|
||||
|
||||
|
||||
Fixed the following bugs:
|
||||
-------------------------
|
||||
|
||||
* Users can now move diagonally from a menu item to its corresponding submenu
|
||||
without the submenu hiding immediately.
|
||||
|
||||
* "destroy" method of YAHOO.widget.Menu now unsubscribes from the "text resize"
|
||||
event (YAHOO.widget.Module.textResizeEvent).
|
||||
|
||||
* Browser progress bar no longer flashes when hovering over checked menu items
|
||||
or menu items with submenus.
|
||||
|
||||
* Menu item submenu indicator image no longer jumps to the next line in
|
||||
quirks mode.
|
||||
|
||||
* Mouse events no longer fire in Firefox if a YAHOO.widget.Menu instance is
|
||||
moved by script into a stationary mouse pointer.
|
||||
|
||||
* Modified "toString" method of YAHOO.widget.ContextMenuItem to return the
|
||||
correct class name, as it was reporting as YAHOO.widget.MenuBarItem.
|
||||
|
||||
|
||||
Changes:
|
||||
--------
|
||||
|
||||
* Default value for the "showdelay" configuration attribute is now 250
|
||||
|
||||
* Modified code so that all Menu images are added via CSS background images.
|
||||
As a result, the following constants and properties have been deprecated:
|
||||
|
||||
* YAHOO.widget.MenuItem.SUBMENU_INDICATOR_IMAGE_PATH
|
||||
* YAHOO.widget.MenuItem.SELECTED_SUBMENU_INDICATOR_IMAGE_PATH
|
||||
* YAHOO.widget.MenuItem.DISABLED_SUBMENU_INDICATOR_IMAGE_PATH
|
||||
* YAHOO.widget.MenuItem.COLLAPSED_SUBMENU_INDICATOR_ALT_TEXT
|
||||
* YAHOO.widget.MenuItem.EXPANDED_SUBMENU_INDICATOR_ALT_TEXT
|
||||
* YAHOO.widget.MenuItem.DISABLED_SUBMENU_INDICATOR_ALT_TEXT
|
||||
* YAHOO.widget.MenuItem.CHECKED_IMAGE_PATH
|
||||
* YAHOO.widget.MenuItem.SELECTED_CHECKED_IMAGE_PATH
|
||||
* YAHOO.widget.MenuItem.DISABLED_CHECKED_IMAGE_PATH
|
||||
* YAHOO.widget.MenuItem.CHECKED_IMAGE_ALT_TEXT
|
||||
* YAHOO.widget.MenuItem.DISABLED_CHECKED_IMAGE_ALT_TEXT
|
||||
* YAHOO.widget.MenuItem.IMG_ROOT
|
||||
* YAHOO.widget.MenuItem.IMG_ROOT_SSL
|
||||
* YAHOO.widget.MenuItem.imageRoot
|
||||
* YAHOO.widget.MenuItem.isSecure
|
||||
|
||||
|
||||
|
||||
*** version 0.12.2 ***
|
||||
|
||||
* No changes
|
||||
|
||||
|
||||
|
||||
*** version 0.12.1 ***
|
||||
|
||||
Fixed the following bugs:
|
||||
-------------------------
|
||||
|
||||
* Placed the call to the DOM "focus" method used by the MenuItem class inside
|
||||
a zero-second timeout to resolve a race condition between menu positioning
|
||||
and focusing of a menu item that resulted in the browser viewport
|
||||
scrolling unnecessarily.
|
||||
|
||||
* Switched to JSMin for JavaScript compression to resolve issues with the
|
||||
minified version.
|
||||
|
||||
* Disabled menu item instances will no longer display a submenu if the item is
|
||||
clicked or moused over.
|
||||
|
||||
* Can no longer select more than one item in a menu if using the keyboard and
|
||||
mouse simultaneously.
|
||||
|
||||
* Calling the "destory" method on a menu will now unregister all of the menu's
|
||||
submenus from the MenuManager.
|
||||
|
||||
|
||||
|
||||
*** version 0.12 ***
|
||||
|
||||
Added the following features:
|
||||
-----------------------------
|
||||
|
||||
* Added the YAHOO.widget.MenuManager singleton class.
|
||||
|
||||
* Added two new methods to YAHOO.widget.Menu:
|
||||
|
||||
* "addItems" - Adds an array of items to a menu.
|
||||
|
||||
* "getRoot" - Returns the root menu in a menu hierarchy.
|
||||
|
||||
* Added two new events to YAHOO.widget.Menu:
|
||||
|
||||
* "itemAddedEvent" - Fires when an item is added to a menu.
|
||||
|
||||
* "itemRemovedEvent" - Fires when an item is removed from a menu.
|
||||
|
||||
* Added two new properties to YAHOO.widget.Menu:
|
||||
|
||||
* "itemData" - Array of items to be added to the menu.
|
||||
|
||||
* "lazyLoad" - Boolean indicating if the menu's "lazy load" feature
|
||||
is enabled.
|
||||
|
||||
* Added new configuration properties to YAHOO.widget.Menu:
|
||||
|
||||
* "hidedelay" - Hides the menu after the specified number of milliseconds.
|
||||
|
||||
* "showdelay" - Shows the menu after the specified number of milliseconds.
|
||||
|
||||
* "container" - The containing element the menu should be rendered into.
|
||||
|
||||
* "clicktohide" - Boolean indicating if the menu will automatically be
|
||||
hidden if the user clicks outside of it.
|
||||
|
||||
* "autosubmenudisplay" - Boolean indicating if submenus are automatically
|
||||
made visible when the user mouses over the menu's items.
|
||||
|
||||
* Added a "toString" method to YAHOO.widget.MenuItem, YAHOO.widget.MenuBarItem
|
||||
and YAHOO.widget.ContextMenuItem that returns the class name followed by the
|
||||
value of the item's "text" configuration property.
|
||||
|
||||
|
||||
Fixed the following bugs:
|
||||
-------------------------
|
||||
|
||||
* Setting a YAHOO.widget.ContextMenu instance's "trigger" configuration
|
||||
property will remove all previous triggers before setting up the new ones.
|
||||
|
||||
* "destroy" method of YAHOO.widget.ContextMenu cleans up all DOM event handlers.
|
||||
|
||||
* Clicking on a menu item with a submenu no longer hides/collapses the
|
||||
entire menu.
|
||||
|
||||
* Clicking an item's submenu indicator image no longer collapses the
|
||||
entire menu.
|
||||
|
||||
|
||||
Changes:
|
||||
--------
|
||||
|
||||
* Deprecated the YAHOO.widget.MenuModule and YAHOO.widget.MenuModuleItem
|
||||
classes. The Base classes are now YAHOO.widget.Menu and
|
||||
YAHOO.widget.MenuItem.
|
||||
|
||||
* "addItem" and "insertItem" methods of YAHOO.widget.Menu now accept an
|
||||
object literal representing YAHOO.widget.MenuItem configuration properties.
|
||||
|
||||
* "clearActiveItem" now takes an argument: flag indicating if the Menu
|
||||
instance's active item should be blurred.
|
||||
|
||||
* Switched the default value of the "visible" configuration property for
|
||||
YAHOO.widget.Menu to "false."
|
||||
|
||||
* Switched the default value of the "constraintoviewport" configuration
|
||||
property for YAHOO.widget.Menu to "true."
|
||||
|
||||
* Overloaded the "submenu" configuration property for YAHOO.widget.MenuItem
|
||||
so that it now can accept any of the following:
|
||||
|
||||
* YAHOO.widget.Menu instance
|
||||
* Object literal representation of a menu
|
||||
* Element id
|
||||
* Element reference
|
||||
|
||||
* "hide" and "show" methods of statically positioned menus now toggle the their
|
||||
element's "display" style property between "block" and "none."
|
||||
|
||||
|
||||
|
||||
*** version 0.10.0 ***
|
||||
|
||||
* Initial release
|
||||
|
||||
* Known issues:
|
||||
|
||||
* Some Firefox extensions disable the ability for JavaScript to prevent
|
||||
the display of the browser's default context menu. These extensions
|
||||
can cause the YUI ContextMenu to stop working. If you encounter this
|
||||
problem, you can reset the context menu preference in Firefox back to
|
||||
the default by making sure the "Disable or replace context menus"
|
||||
preference is checked:
|
||||
|
||||
Mac Firefox 1.0:
|
||||
-------------------
|
||||
Preferences > Web Features >
|
||||
Advanced... > Disable or replace context menus
|
||||
|
||||
Mac Firefox 1.5
|
||||
-------------------
|
||||
Preferences > Context >
|
||||
Advanced... > Disable or replace context menus
|
||||
|
||||
Windows Firefox 1.0
|
||||
-------------------
|
||||
Tools > Options > Web Features >
|
||||
Advanced... > Disable or replace context menus
|
||||
|
||||
Windows Firefox 1.5
|
||||
-------------------
|
||||
Tools > Options > Context >
|
||||
Advanced... > Disable or replace context menus
|
||||
|
||||
|
||||
|
||||
*** version 0.11.3 ***
|
||||
|
||||
Added the following features:
|
||||
-----------------------------
|
||||
|
||||
* Added a "target" configuration property to the MenuModuleItem object that
|
||||
allows the user to specify the target of an item's anchor element. Items
|
||||
that make use of the "target" configuration property will require the user
|
||||
to click exactly on the item's anchor element to navigate to the specified
|
||||
URL.
|
||||
|
||||
* Items without a "url" property set will automatically hide their parent
|
||||
menu instance(s) when clicked.
|
||||
|
||||
|
||||
Fixed the following bugs:
|
||||
-------------------------
|
||||
|
||||
* Items in a submenu should now navigate to their specified URL when clicked.
|
||||
|
||||
* Removed MenuBar's use of "overflow:hidden." This fixes an issue in Firefox
|
||||
1.5 in which submenus of a Menubar instance cannot overlay other absolutely
|
||||
positioned elements on the page.
|
||||
|
||||
* Submenus of a Menubar instance will now automatically have their iframe shim
|
||||
enabled in IE<7.
|
||||
|
||||
* Statically positioned Menubar and Menu instances will now render with the
|
||||
correct position and dimensions in Safari.
|
||||
|
||||
* MenuModuleItem's "focus" method now checks to make sure that an item's
|
||||
"display" style property is not "none" before trying to set focus to its
|
||||
anchor element.
|
||||
|
||||
* A ContextMenu instance will now hide all other ContextMenu instances before
|
||||
displaying itself.
|
||||
|
||||
* Removed the dead space in front of an item's submenu indicator image in IE.
|
||||
This space was causing an item's submenu to flicker when the user hovered
|
||||
over it.
|
||||
|
||||
|
||||
Changes:
|
||||
--------
|
||||
|
||||
* Moved the DOM event handlers for every menu from the root DIV node of each
|
||||
instance to the document object. This change reduces the number of DOM event
|
||||
handlers used by Menu to eight, improving the cleanup time required by the
|
||||
Event utility.
|
||||
|
||||
|
||||
|
||||
*** version 0.11.0 ***
|
||||
|
||||
Added the following features:
|
||||
-----------------------------
|
||||
* Overloaded the "addItem" and "insertItem" methods of MenuModule to accept a
|
||||
string or a MenuModuleItem instance
|
||||
|
||||
* Added the ability to define a MenuItem instance as being "checked"
|
||||
|
||||
|
||||
Fixed the following bugs:
|
||||
-------------------------
|
||||
* Changing the path for the submenu indicator image of one MenuModuleItem
|
||||
subclass will no longer affect other subclasses
|
||||
|
||||
* MenuItem instances built from existing markup without anchor tags will no
|
||||
longer trigger a JavaScript error when clicked
|
||||
|
||||
* Modified the implementation of the "imageRoot" property for the
|
||||
MenuModuleItem class so that it is set to a secure/non-secure path when the
|
||||
object is instantiated
|
||||
|
||||
* Menu instances now resize in response to changes to the browser's font size
|
||||
|
||||
* Modified the propagation of the MenuModule class's "submenualignment"
|
||||
configuration property so that it only applies to instances of the same type
|
||||
|
||||
* Adjusted the specificity of the style rule that controls the position of a
|
||||
MenuItem instance's submenu indicator image to prevent it from wrapping in IE
|
||||
|
||||
* Specified a width and height for submenu indicator images in the Menu
|
||||
stylesheet to ensure that Menu instances are always rendered at the correct
|
||||
width
|
||||
|
||||
* Clicking a MenuItem instance will no longer trigger two HTTP GET requests
|
||||
|
||||
* Users can now control or shift-click on MenuItem links
|
||||
|
||||
|
||||
Changes:
|
||||
--------
|
||||
* In the Menu stylesheet (menu.css), switched from using "first" class to
|
||||
"first-of-type" class
|
||||
|
||||
* Changed case of MenuModuleItem class's "subMenuIndicator" property
|
||||
to "submenuIndicator"
|
||||
|
Before Width: | Height: | Size: 264 B |
|
|
@ -1,401 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2007, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 2.2.2
|
||||
*/
|
||||
/* Menu styles */
|
||||
|
||||
div.yuimenu {
|
||||
|
||||
background-color:#f6f7ee;
|
||||
border:solid 1px #c4c4be;
|
||||
padding:1px;
|
||||
|
||||
}
|
||||
|
||||
/* Submenus are positioned absolute and hidden by default */
|
||||
|
||||
div.yuimenu div.yuimenu,
|
||||
div.yuimenubar div.yuimenu {
|
||||
|
||||
position:absolute;
|
||||
visibility:hidden;
|
||||
|
||||
}
|
||||
|
||||
/* MenuBar Styles */
|
||||
|
||||
div.yuimenubar {
|
||||
|
||||
background-color:#f6f7ee;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
Applying a width triggers "haslayout" in IE so that the module's
|
||||
body clears its floated elements
|
||||
*/
|
||||
div.yuimenubar div.bd {
|
||||
|
||||
width:100%;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
Clear the module body for other browsers
|
||||
*/
|
||||
div.yuimenubar div.bd:after {
|
||||
|
||||
content:'.';
|
||||
display:block;
|
||||
clear:both;
|
||||
visibility:hidden;
|
||||
height:0;
|
||||
|
||||
}
|
||||
|
||||
/* Matches the group title (H6) inside a Menu or MenuBar instance */
|
||||
|
||||
div.yuimenu h6,
|
||||
div.yuimenubar h6 {
|
||||
|
||||
font-size:100%;
|
||||
font-weight:normal;
|
||||
margin:0;
|
||||
border:solid 1px #c4c4be;
|
||||
color:#b9b9b9;
|
||||
|
||||
}
|
||||
|
||||
div.yuimenubar h6 {
|
||||
|
||||
float:left;
|
||||
display:inline; /* Prevent margin doubling in IE */
|
||||
padding:4px 12px;
|
||||
border-width:0 1px 0 0;
|
||||
|
||||
}
|
||||
|
||||
div.yuimenu h6 {
|
||||
|
||||
float:none;
|
||||
display:block;
|
||||
border-width:1px 0 0 0;
|
||||
padding:5px 10px 0 10px;
|
||||
|
||||
}
|
||||
|
||||
/* Matches the UL inside a Menu or MenuBar instance */
|
||||
|
||||
div.yuimenubar ul {
|
||||
|
||||
list-style-type:none;
|
||||
margin:0;
|
||||
padding:0;
|
||||
|
||||
}
|
||||
|
||||
div.yuimenu ul {
|
||||
|
||||
list-style-type:none;
|
||||
border:solid 1px #c4c4be;
|
||||
border-width:1px 0 0 0;
|
||||
margin:0;
|
||||
padding:10px 0;
|
||||
|
||||
}
|
||||
|
||||
div.yuimenu ul.first-of-type,
|
||||
div.yuimenu ul.hastitle,
|
||||
div.yuimenu h6.first-of-type {
|
||||
|
||||
border-width:0;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
Styles for the menu's header and footer elements that are used as controls
|
||||
to scroll the menu's body element when the menu's height exceeds the
|
||||
value of the "maxheight" configuration property.
|
||||
*/
|
||||
|
||||
div.yuimenu div.topscrollbar,
|
||||
div.yuimenu div.bottomscrollbar {
|
||||
|
||||
height:16px;
|
||||
background-image:url(map.gif);
|
||||
background-repeat:no-repeat;
|
||||
|
||||
}
|
||||
|
||||
|
||||
div.yuimenu div.topscrollbar {
|
||||
|
||||
background-image:url(map.gif);
|
||||
background-position:center -72px;
|
||||
|
||||
}
|
||||
|
||||
|
||||
div.yuimenu div.topscrollbar_disabled {
|
||||
|
||||
background-image:url(map.gif);
|
||||
background-position:center -88px;
|
||||
|
||||
}
|
||||
|
||||
|
||||
div.yuimenu div.bottomscrollbar {
|
||||
|
||||
background-image:url(map.gif);
|
||||
background-position:center -104px;
|
||||
|
||||
}
|
||||
|
||||
|
||||
div.yuimenu div.bottomscrollbar_disabled {
|
||||
|
||||
background-image:url(map.gif);
|
||||
background-position:center -120px;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* MenuItem and MenuBarItem styles */
|
||||
|
||||
div.yuimenu li,
|
||||
div.yuimenubar li {
|
||||
|
||||
font-size:85%;
|
||||
cursor:pointer;
|
||||
cursor:hand;
|
||||
white-space:nowrap;
|
||||
text-align:left;
|
||||
|
||||
}
|
||||
|
||||
div.yuimenu li.yuimenuitem {
|
||||
|
||||
padding:2px 24px;
|
||||
|
||||
}
|
||||
|
||||
div.yuimenu li li,
|
||||
div.yuimenubar li li {
|
||||
|
||||
font-size:100%;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Matches the help text for a menu item */
|
||||
|
||||
div.yuimenu li.hashelptext em.helptext {
|
||||
|
||||
font-style:normal;
|
||||
margin:0 0 0 40px;
|
||||
|
||||
}
|
||||
|
||||
div.yuimenu li a,
|
||||
div.yuimenubar li a {
|
||||
|
||||
/*
|
||||
"zoom:1" triggers "haslayout" in IE to ensure that the mouseover and
|
||||
mouseout events bubble to the parent LI in IE.
|
||||
*/
|
||||
zoom:1;
|
||||
color:#000;
|
||||
text-decoration:none;
|
||||
|
||||
}
|
||||
|
||||
div.yuimenu li.hassubmenu,
|
||||
div.yuimenu li.hashelptext {
|
||||
|
||||
text-align:right;
|
||||
|
||||
}
|
||||
|
||||
div.yuimenu li.hassubmenu a.hassubmenu,
|
||||
div.yuimenu li.hashelptext a.hashelptext {
|
||||
|
||||
/*
|
||||
Need to apply float immediately for IE or help text will jump to the
|
||||
next line
|
||||
*/
|
||||
|
||||
*float:left;
|
||||
*display:inline; /* Prevent margin doubling in IE */
|
||||
text-align:left;
|
||||
|
||||
}
|
||||
|
||||
div.yuimenu.visible li.hassubmenu a.hassubmenu,
|
||||
div.yuimenu.visible li.hashelptext a.hashelptext {
|
||||
|
||||
/*
|
||||
Apply the float only when the menu is visible to prevent the help
|
||||
text from wrapping to the next line in Opera.
|
||||
*/
|
||||
|
||||
float:left;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Matches selected menu items */
|
||||
|
||||
div.yuimenu li.selected,
|
||||
div.yuimenubar li.selected {
|
||||
|
||||
background-color:#8c8ad0;
|
||||
|
||||
}
|
||||
|
||||
div.yuimenu li.selected a.selected,
|
||||
div.yuimenubar li.selected a.selected {
|
||||
|
||||
text-decoration:underline;
|
||||
|
||||
}
|
||||
|
||||
div.yuimenu li.selected a.selected,
|
||||
div.yuimenu li.selected em.selected,
|
||||
div.yuimenubar li.selected a.selected {
|
||||
|
||||
color:#fff;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Matches disabled menu items */
|
||||
|
||||
div.yuimenu li.disabled,
|
||||
div.yuimenubar li.disabled {
|
||||
|
||||
cursor:default;
|
||||
|
||||
}
|
||||
|
||||
div.yuimenu li.disabled a.disabled,
|
||||
div.yuimenu li.disabled em.disabled,
|
||||
div.yuimenubar li.disabled a.disabled {
|
||||
|
||||
color:#b9b9b9;
|
||||
cursor:default;
|
||||
|
||||
}
|
||||
|
||||
div.yuimenubar li.yuimenubaritem {
|
||||
|
||||
float:left;
|
||||
display:inline; /* Prevent margin doubling in IE */
|
||||
border-width:0 0 0 1px;
|
||||
border-style:solid;
|
||||
border-color:#c4c4be;
|
||||
padding:4px 24px;
|
||||
margin:0;
|
||||
|
||||
}
|
||||
|
||||
div.yuimenubar li.yuimenubaritem.first-of-type {
|
||||
|
||||
border-width:0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Styles for the the submenu indicator for menu items */
|
||||
|
||||
div.yuimenu li.hassubmenu em.submenuindicator,
|
||||
div.yuimenubar li.hassubmenu em.submenuindicator {
|
||||
|
||||
display:-moz-inline-box; /* Mozilla */
|
||||
display:inline-block; /* IE, Opera and Safari */
|
||||
vertical-align:middle;
|
||||
height:8px;
|
||||
width:8px;
|
||||
text-indent:9px;
|
||||
font:0/0 arial;
|
||||
overflow:hidden;
|
||||
background-image:url(map.gif);
|
||||
background-repeat:no-repeat;
|
||||
|
||||
}
|
||||
|
||||
div.yuimenubar li.hassubmenu em.submenuindicator {
|
||||
|
||||
background-position:0 -24px;
|
||||
margin:0 0 0 10px;
|
||||
|
||||
}
|
||||
|
||||
div.yuimenubar li.hassubmenu em.submenuindicator.selected {
|
||||
|
||||
background-position:0 -32px;
|
||||
|
||||
}
|
||||
|
||||
div.yuimenubar li.hassubmenu em.submenuindicator.disabled {
|
||||
|
||||
background-position:0 -40px;
|
||||
|
||||
}
|
||||
|
||||
div.yuimenu li.hassubmenu em.submenuindicator {
|
||||
|
||||
background-position:0 0;
|
||||
margin:0 -16px 0 10px;
|
||||
|
||||
}
|
||||
|
||||
div.yuimenu li.hassubmenu em.submenuindicator.selected {
|
||||
|
||||
background-position:0 -8px;
|
||||
|
||||
}
|
||||
|
||||
div.yuimenu li.hassubmenu em.submenuindicator.disabled {
|
||||
|
||||
background-position:0 -16px;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Styles for a menu item's "checked" state */
|
||||
|
||||
div.yuimenu li.checked {
|
||||
|
||||
position:relative;
|
||||
|
||||
}
|
||||
|
||||
div.yuimenu li.checked em.checkedindicator {
|
||||
|
||||
height:8px;
|
||||
width:8px;
|
||||
text-indent:9px;
|
||||
overflow:hidden;
|
||||
background-image:url(map.gif);
|
||||
background-position:0 -48px;
|
||||
background-repeat:no-repeat;
|
||||
position:absolute;
|
||||
left:6px;
|
||||
_left:-16px; /* Underscore hack b/c this is for IE 6 only */
|
||||
top:.5em;
|
||||
|
||||
}
|
||||
|
||||
div.yuimenu li.checked em.checkedindicator.selected {
|
||||
|
||||
background-position:0 -56px;
|
||||
|
||||
}
|
||||
|
||||
div.yuimenu li.checked em.checkedindicator.disabled {
|
||||
|
||||
background-position:0 -64px;
|
||||
|
||||
}
|
||||
|
Before Width: | Height: | Size: 53 B |
|
Before Width: | Height: | Size: 53 B |
|
Before Width: | Height: | Size: 53 B |
|
Before Width: | Height: | Size: 54 B |
|
Before Width: | Height: | Size: 54 B |
|
Before Width: | Height: | Size: 54 B |
|
Before Width: | Height: | Size: 53 B |
|
Before Width: | Height: | Size: 53 B |