@ -1,276 +0,0 @@
@@ -1,276 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
DynDocument Class |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
requires: dynapi.api.DynElement |
||||
*/ |
||||
|
||||
function DynDocument(frame) { |
||||
this.DynElement = DynElement; |
||||
this.DynElement(); |
||||
this.frame = frame; |
||||
this.doc = this.frame.document; |
||||
this._dyndoc = this; |
||||
this.x = 0; |
||||
this.y = 0; |
||||
this.w = 0; |
||||
this.h = 0; |
||||
this._topZIndex = 10000; |
||||
var o = this; |
||||
this.frame.onresize = function() {o._handleResize()}; |
||||
this.onResizeNS4 = "reload"; // or "redraw"
|
||||
this._created = false; |
||||
}; |
||||
var p = dynapi.setPrototype('DynDocument','DynElement'); |
||||
p._remove = function() { |
||||
this.elm=null; |
||||
this.doc=null; |
||||
this.frame=null; |
||||
}; |
||||
p.getBgColor = function() { |
||||
return this.bgColor; |
||||
}; |
||||
p.getX = p.getY = p.getPageX = p.getPageY = dynapi.functions.Zero; |
||||
p.getWidth = function() { |
||||
if (!this.w) this.findDimensions(); |
||||
return this.w; |
||||
}; |
||||
p.getHeight = function() { |
||||
if (!this.h) this.findDimensions(); |
||||
return this.h; |
||||
}; |
||||
p.findDimensions = function() { |
||||
this.w=(dynapi.ua.ns||dynapi.ua.opera)? this.frame.innerWidth : this.elm.clientWidth; |
||||
this.h=(dynapi.ua.ns||dynapi.ua.opera)? this.frame.innerHeight : this.elm.clientHeight; |
||||
}; |
||||
p.setBgColor = function(color) { |
||||
if (color == null) color=''; |
||||
if (dynapi.ua.ns4 && color == '') color = '#ffffff'; |
||||
this.bgColor = color; |
||||
this.doc.bgColor = color; |
||||
}; |
||||
p.setFgColor = function(color) { |
||||
if (color == null) color=''; |
||||
if (dynapi.ua.ns4 && color == '') color='#ffffff'; |
||||
this.fgColor = color; |
||||
this.doc.fgColor = color; |
||||
}; |
||||
p.insertChild = function(c,pos,usebp) { // Blueprint Enabled
|
||||
if (c && !c.isInline && c.parent == this) { |
||||
if(pos) c.setPosition(pos); |
||||
DynElement._flagPreCreate(c); |
||||
if(usebp) c.isInline=c._noInlineValues=true; |
||||
else { |
||||
this.doc.write(c.getOuterHTML()); |
||||
c._inserted = true; |
||||
} |
||||
} |
||||
}; |
||||
p.insertAllChildren = function(usebp,bpSrc) { // Blueprint Enabled
|
||||
var i,c,str =['']; |
||||
var ch=this.children; |
||||
for(i=0;i<ch.length;i++) { |
||||
c = ch[i]; |
||||
if(!c.isInline && !c._inserted){ |
||||
DynElement._flagPreCreate(c); |
||||
if(usebp) c.isInline=c._noInlineValues=true; |
||||
else { |
||||
str[i]=c.getOuterHTML(); |
||||
c._inserted = true; |
||||
} |
||||
} |
||||
} |
||||
if(this._hBuffer.length) this.doc.write(this._hBuffer.join('')); // used by addHTML()
|
||||
if(usebp){ |
||||
if(bpSrc) dynapi.frame.document.write('<script type="text/javascript" language="JavaScript" src="'+bpSrc+'"><\/script>');
|
||||
} |
||||
else { |
||||
this.doc.write(str.join('\n')); |
||||
this.doc.close(); |
||||
} |
||||
}; |
||||
|
||||
p._create = function() { |
||||
var ua=dynapi.ua; |
||||
this._created = true; |
||||
if (ua.ns4) { |
||||
this.css = this.doc; |
||||
this.elm = this.doc; |
||||
} |
||||
else { |
||||
this.elm = this.frame.document.body; |
||||
this.css = this.frame.document.body.style; |
||||
if (ua.ie) { |
||||
this._overflow = this.css.overflow || ''; |
||||
} |
||||
if (this._cursor) this.css.cursor = this._cursor; |
||||
} |
||||
this.elm._dynobj = this; |
||||
this.doc._dynobj = this; // DynKeyEvent needs this!
|
||||
this.findDimensions(); |
||||
|
||||
this.fgColor = this.doc.fgColor||''; |
||||
this.bgColor = this.doc.bgColor||''; |
||||
|
||||
var divs; |
||||
// create divs object - speeds up DOM browsers on Win32. Linux & Mac?
|
||||
if (ua.ie||ua.dom) { |
||||
divs={}; |
||||
var dv,all=(ua.ie||ua.opera)? document.all.tags('div') : document.getElementsByTagName('div'); |
||||
var i=0,l=all.length; // very important!
|
||||
while (i<l){ |
||||
dv=all[i]; |
||||
divs[dv.id]=dv; |
||||
i++; |
||||
} |
||||
} |
||||
|
||||
var c,ch=this.children; |
||||
for(i=0;i<ch.length;i++){ |
||||
c=ch[i]; |
||||
if (c._inserted) c._createInserted(divs); |
||||
else if(c.isInline) c._createInline(divs); |
||||
else c._create(); |
||||
}; |
||||
this._updateAnchors();
|
||||
|
||||
if(ua.ie && this._textSelectable==false) this.doc.onselectstart = dynapi.functions.Deny; |
||||
|
||||
if (this.captureMouseEvents) this.captureMouseEvents(); |
||||
if (this.captureKeyEvents) this.captureKeyEvents(); |
||||
this.invokeEvent('load'); |
||||
}; |
||||
p.destroyAllChildren = function() { |
||||
for (var i=0;i<this.children.length;i++) { |
||||
this.children[i]._destroy(); |
||||
delete this.children[i]; |
||||
} |
||||
this.children = []; |
||||
}; |
||||
p._destroy = function() { |
||||
this.destroyAllChildren(); |
||||
delete DynObject.all; |
||||
this.elm = null; |
||||
this.css = null; |
||||
this.frame = null; |
||||
}; |
||||
|
||||
p._handleResize = function() { |
||||
var w = this.w; |
||||
var h = this.h; |
||||
this.findDimensions(); |
||||
if (this.w!=w || this.h!=h) { |
||||
if (dynapi.ua.ns4) { |
||||
if (this.onResizeNS4=="redraw") { |
||||
for (var i=0;i<this.children.length;i++) { |
||||
this.children[i].elm = null; |
||||
if (this.children[i]._created) { |
||||
this.children[i]._created = false; |
||||
this.children[i]._create(); |
||||
} |
||||
} |
||||
this.invokeEvent('resize'); |
||||
} |
||||
else if (this.onResizeNS4=="reload") { |
||||
this.doc.location.href = this.doc.location.href; |
||||
} |
||||
} |
||||
else { |
||||
this.invokeEvent('resize'); |
||||
this._updateAnchors(); |
||||
} |
||||
} |
||||
}; |
||||
p.getCursor = function() {return (this._cursor=='pointer')? 'hand':this._cursor}; |
||||
p.setCursor = function(c) { |
||||
if (!c) c = 'default'; |
||||
else c=(c+'').toLowerCase(); |
||||
if (!dynapi.ua.ie && c=='hand') c='pointer'; |
||||
if (this._cursor!=c) { |
||||
this._cursor = c; |
||||
if (this.css) this.css.cursor = c; |
||||
} |
||||
}; |
||||
p.setTextSelectable = function(b){ |
||||
this._textSelectable = b;
|
||||
if(!dynapi.ua.ie) this.captureMouseEvents(); |
||||
else{ |
||||
if (this.doc) this.doc.onselectstart = b? dynapi.functions.Allow : dynapi.functions.Deny; |
||||
} |
||||
if (!b) this.setCursor('default'); |
||||
}; |
||||
p.showScrollBars = function(b){ |
||||
if(b==this._showScroll) return; |
||||
else this._showScroll=b; |
||||
if(dynapi.ua.ie){ |
||||
window.setTimeout('document.body.scroll="'+((b)? 'yes':'no')+'"',100); |
||||
}else if(dynapi.ua.ns||dynapi.ua.opera){ |
||||
if(b){ |
||||
this._docSize=[document.width,document.height]; |
||||
document.width = this.frame.innerWidth; |
||||
document.height = this.frame.innerHeight; |
||||
}else if(this._docSize){ |
||||
document.width = this._docSize[0]; |
||||
document.height = this._docSize[1]; |
||||
} |
||||
} |
||||
}; |
||||
p.writeStyle = function(s){ |
||||
// note: don't ever add \n to the end of the following strings or ns4 will choke!
|
||||
if(!s) return; |
||||
var css ='<style><!-- '; |
||||
for(var i in s) css +='.'+i+' {'+s[i]+';} '; |
||||
css += ' --></style>'; |
||||
document.write(css); |
||||
}; |
||||
|
||||
p._hBuffer = []; |
||||
p.addHTML = function(html){ |
||||
var elm,ua = dynapi.ua; |
||||
var hbuf=this._hBuffer; |
||||
var cnt=(this._hblc)? this._hblc++:(this._hblc=1); |
||||
if (ua.ns4) { |
||||
html='<nobr>'+html+'<nobr>'; |
||||
if(!this._created) hbuf[cnt]=html; |
||||
else { |
||||
elm=new Layer(0,this.frame); |
||||
elm.left=elm.top=0; |
||||
var doc=elm.document; |
||||
elm.clip.width=dynapi.document.w; |
||||
elm.clip.height=dynapi.document.h; |
||||
doc.open();doc.write(html);doc.close(); |
||||
elm.visibility = 'inherit'; |
||||
} |
||||
} |
||||
else { |
||||
var pelm=this.elm; |
||||
if(!this._created) hbuf[cnt]=html; |
||||
else { |
||||
if(ua.ie){ |
||||
pelm.insertAdjacentHTML("beforeEnd",html); |
||||
elm = pelm.children[pelm.children.length-1];
|
||||
} |
||||
else{ |
||||
var r = pelm.ownerDocument.createRange(); |
||||
r.setStartBefore(pelm); |
||||
var ptxt = r.createContextualFragment(html); |
||||
pelm.appendChild(ptxt); |
||||
elm = pelm.lastChild;
|
||||
} |
||||
} |
||||
} |
||||
}; |
||||
|
||||
function main() { |
||||
if (dynapi.document==null) { |
||||
dynapi.document = new DynDocument(dynapi.frame); |
||||
if (dynapi.loaded) dynapi.document._create(); |
||||
else dynapi.onLoad(function() { |
||||
dynapi.document._create(); |
||||
}); |
||||
} |
||||
}; |
||||
if (!dynapi.loaded) main(); |
||||
|
||||
@ -1,396 +0,0 @@
@@ -1,396 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
DynLayer Base/Common Class |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
requires: dynapi.api.DynDocument |
||||
*/ |
||||
|
||||
var DynLayerBase = {}; // used by library
|
||||
function DynLayer(html,x,y,w,h,color,image) { |
||||
this.DynElement = DynElement; |
||||
this.DynElement(); |
||||
|
||||
if (html && typeof(html)=='object'){ // typeof more stable than constructor when creating layers from another frame
|
||||
var args=html; // dictionary input
|
||||
html=args.html; |
||||
x = args.x; |
||||
y = args.y; |
||||
w = args.w; |
||||
h = args.h; |
||||
color = args.color; |
||||
image = args.image; |
||||
this.z = (args.zIndex||1); |
||||
this._saveAnchor = args.anchor; |
||||
this.visible = (args.visible==false)? false:true; |
||||
this._textSelectable = (args.textSelectable==false)?false:true; |
||||
if (args.id) this.setID(args.id,true); |
||||
} |
||||
else { |
||||
this.visible = true; |
||||
this.z = 1; |
||||
this._saveAnchor = false; |
||||
this._textSelectable = true; |
||||
} |
||||
|
||||
this.x = x||0; |
||||
this.y = y||0; |
||||
this.w = w; |
||||
this.h = h; |
||||
this.bgColor = color; |
||||
this.bgImage = image; |
||||
this.html = (html!=null)? html+'':null; // convert html to string
|
||||
this.elm = null; |
||||
this.doc = null; |
||||
this.css = null;
|
||||
}; |
||||
var p = dynapi.setPrototype('DynLayer','DynElement'); |
||||
p._cssBorder = ''; |
||||
p._fixBw = 0; |
||||
p._fixBh = 0; |
||||
p._adjustSize=function(){ |
||||
var aw=this._aSzW; |
||||
var ah=this._aSzH; |
||||
if(this._created && (aw||ah)) { |
||||
var i,c,w=0,h=0; |
||||
// get furthest child
|
||||
for (i=0;i<this.children.length;i++){ |
||||
c=this.children[i]; |
||||
if(c && w<(c.x+c.w)) w=c.x+c.w; |
||||
if(c && h<(c.y+c.h)) h=c.y+c.h; |
||||
} |
||||
|
||||
if(aw) { |
||||
i = this.getContentWidth(); |
||||
if(w<i) w=i; |
||||
if(w!=this.w) this.setWidth(w); // set width first
|
||||
} |
||||
if(ah) { |
||||
i = this.getContentHeight(); |
||||
if(h<i) h=i; |
||||
if(h!=this.h) this.setHeight(h); // set height after width
|
||||
} |
||||
} |
||||
}; |
||||
p._destroy = function() { |
||||
this._destroyAllChildren(); |
||||
this.removeAllEventListeners(); |
||||
if (this.elm) this._remove(); |
||||
this.setAnchor(null); // remove anchor
|
||||
this.frame = null; |
||||
this.bgImage = null; |
||||
this.bgColor = null; |
||||
this.html = null; |
||||
this.x = null; |
||||
this.y = null; |
||||
this.w = null; |
||||
this.h = null; |
||||
this.z = null; |
||||
this.doc = null; |
||||
this.css = null; |
||||
this._dyndoc = null; |
||||
this.parent = null; |
||||
this._blkBoardElm = null; |
||||
DynObject.all[this.id] = null; |
||||
}; |
||||
p._destroyAllChildren = function() { |
||||
var aSz = this._aSz; |
||||
this._aSz = false; // prevent children from adjusting parent's size when removed
|
||||
for (var i=0;i<this.children.length;i++) { |
||||
this.children[i]._destroy(); |
||||
delete this.children[i]; |
||||
} |
||||
this.children.length=0; |
||||
this._aSz = aSz; |
||||
}; |
||||
p._remove = function() { //! Overwritten by NS4
|
||||
var p = this.parent; |
||||
if (p && this._alias) p[this._alias]=null; |
||||
if (p && this.elm) { |
||||
//this.elm.style.visibility = "hidden";
|
||||
//this.elm.innerHTML = "";
|
||||
//this.elm.outerHTML = "";
|
||||
var pref=p.elm; |
||||
if(document.getElementById && document.childNodes){ |
||||
if(this.elm.parentNode) pref = this.elm.parentNode; // used with relative layers
|
||||
pref.removeChild(this.elm); |
||||
} |
||||
else if (pref && pref.children){ |
||||
this.elm.outerHTML=''; |
||||
} |
||||
this.elm = null; |
||||
if (this.releaseMouseEvents) this.releaseMouseEvents(); |
||||
if (this.releaseKeyEvents) this.releaseKeyEvents(); |
||||
} |
||||
/* |
||||
this.frame = null; |
||||
this.bgImage = null; |
||||
this.bgColor = null; |
||||
this.html = null; |
||||
this.z = null; |
||||
this.w = null; |
||||
this.h = null; |
||||
this.elm = this.css = this.doc = null; |
||||
*/ |
||||
}; |
||||
p._createInserted = function(divs){ |
||||
DynLayer._assignElement(this,null,divs); //! NS4 will ignore divs
|
||||
DynElement._flagCreate(this); |
||||
}; |
||||
p.getOuterHTML=function() { //! Overwritten by NS4
|
||||
// get box fix values
|
||||
var fixBw = (this._fixBw)? this._fixBw:0; |
||||
var fixBh = (this._fixBh)? this._fixBh:0; |
||||
if (fixBw||fixBh) this._fixBoxModel = true; |
||||
if (this._noStyle) return '<div '+this._cssClass+' id="'+this.id+'">'+this.getInnerHTML()+'</div>'; |
||||
else { |
||||
var s,clip='',bgimage=' background-image:none;'; |
||||
if(this.bgImage!=null) bgimage=' background-image:url('+this.bgImage+');'; |
||||
if (this.clip) clip=' clip:rect('+this.clip[0]+'px '+this.clip[1]+'px '+this.clip[2]+'px '+this.clip[3]+'px);'; |
||||
else if (this.w!=null && this.h!=null) clip=' clip:rect(0px '+(this.w+fixBw)+'px '+(this.h+fixBh)+'px 0px);'; |
||||
// modify box fix values
|
||||
if (!dynapi.ua.ie && !dynapi.ua.opera) fixBw = 0; |
||||
if (!dynapi.ua.ie) fixBh = 0; |
||||
return [ |
||||
'\n<div '+this._cssClass+' id="'+this.id+'" style="', |
||||
' left:',(this.x!=null? this.x : 0),'px;', |
||||
' top:',(this.y!=null? this.y : 0),'px;',
|
||||
((this.w!=null)? ' width:'+(this.w+fixBw)+'px;':''), |
||||
((this.h!=null)? ' height:'+(this.h+fixBh)+'px;':''), |
||||
((this.z)? ' z-index:'+this.z+';':''), |
||||
((this._cursor!=null)? ' cursor:'+this._cursor+';':'cursor:auto;'), |
||||
((this.bgColor!=null)? ' background-color:'+this.bgColor+';':''), |
||||
((this.visible==false)? ' visibility:hidden;':' visibility:inherit;'), |
||||
bgimage, |
||||
clip, |
||||
this._cssBorder, |
||||
this._cssOverflow, |
||||
this._cssPosition, |
||||
';">', |
||||
this.getInnerHTML(), |
||||
'</div>' |
||||
].join('');
|
||||
} |
||||
}; |
||||
p.getInnerHTML=function() { //! Overwritten by NS4
|
||||
var s = ''; |
||||
var i,ch=this.children; |
||||
if (this.html!=null) s+=this.html; |
||||
if (this._blkBoardElm) s=('<div id="'+this.id+'_blkboard">'+s+'</div>');
|
||||
if(ch.length<50) for (i=0;i<ch.length;i++) s+=ch[i].getOuterHTML();
|
||||
else if(ch.length){ |
||||
var ar=['']; // speed improvement for layers with nested children
|
||||
for (i=0;i<ch.length;i++) ar[i]=ch[i].getOuterHTML(); |
||||
s=s+ar.join(''); |
||||
} |
||||
return s; |
||||
}; |
||||
|
||||
p.getPageX = function() {return (this.isChild)? this.parent.getPageX()+(this.x||0) : this.x||0}; //! Overwritten by NS4
|
||||
p.getPageY = function() {return (this.isChild)? this.parent.getPageY()+(this.y||0) : this.y||0}; //! Overwritten by NS4
|
||||
|
||||
p.setAutoSize = function(w,h){
|
||||
this._aSzW = w; // automatically adjust the size of layer to the size of its content
|
||||
this._aSzH = h; |
||||
this._aSz = w||h; |
||||
if(this._aSz) this._adjustSize(); |
||||
};
|
||||
|
||||
p._cssClass = ''; |
||||
p.setClass = function(c,noInlineStyle){ |
||||
this._className=c; |
||||
if(this.elm) this.elm.className=c; |
||||
else { |
||||
this._cssClass=(c)? 'class="'+c+'"':''; |
||||
this._noStyle=noInlineStyle; |
||||
} |
||||
}; |
||||
|
||||
p.setVisible = function(b) { //! Overwritten by NS4
|
||||
//if (b!=this.visible) {
|
||||
this.visible = b; |
||||
if (this.css) this.css.visibility = b? "inherit" : "hidden"; |
||||
//}
|
||||
}; |
||||
p.setSize = function(w,h) { //! Overwritten by NS4
|
||||
if (this._useMinSize||this._useMaxSize){ |
||||
if (this._minW && w<this._minW) w=this._minW; |
||||
if (this._minH && h<this._minH) h=this._minH; |
||||
if (this._maxW && w>this._maxW) w=this._maxW; |
||||
if (this._maxH && h>this._maxH) h=this._maxH; |
||||
} |
||||
var cw = (w!=null && w!=this.w); |
||||
var ch = (h!=null && h!=this.h); |
||||
if (cw) this.w = w<0? 0 : w; |
||||
if (ch) this.h = h<0? 0 : h; |
||||
if (cw||ch) { |
||||
if (this._hasAnchor) this.updateAnchor(); // update this anchor
|
||||
if (this._hasChildAnchors) this._updateAnchors(); // update child anchors
|
||||
if (this.css) { |
||||
if (cw) this.css.width = this.w||0; |
||||
if (ch) this.css.height = this.h||0; |
||||
if (cw || ch) {
|
||||
if(this._needBoxFix) BorderManager.FixBoxModel(this,true); |
||||
else this.css.clip = 'rect(0px '+(this.w||0)+'px '+(this.h||0)+'px 0px)'; |
||||
// adjust parent size after being sized
|
||||
if(this.parent._aSz) this.parent._adjustSize(); |
||||
} |
||||
if (this.updateLayout) this.updateLayout(); // what's this?
|
||||
} |
||||
} |
||||
if(this._hasResizeEvents) this.invokeEvent('resize'); |
||||
return (cw||ch); |
||||
}; |
||||
p.setMaximumSize = function(w,h){ |
||||
this._maxW=w; this._maxH=h; |
||||
this._useMaxSize=(w!=h!=null); |
||||
w=(this.w>w)?w:this.w; |
||||
h=(this.h>h)? h:this.h; |
||||
this.setSize(this.w,this.h); |
||||
}; |
||||
p.setMinimumSize = function(w,h){ |
||||
this._minW=w; this._minH=h; |
||||
this._useMinSize=(w!=h!=null); |
||||
this.setSize(this.w,this.h); |
||||
}; |
||||
|
||||
p._position = 'absolute'; |
||||
p._cssPosition = ' position:absolute'; |
||||
p.setPosition = function(p){ |
||||
if(p!='relative' && p!='fixed' && p!='absolute') p='absolute'; |
||||
this._position=p; |
||||
if (this.css) this.css.position=p; |
||||
else this._cssPosition = ' position:'+p; |
||||
}; |
||||
|
||||
p._overflow='hidden'; |
||||
p._cssOverflow =' overflow:hidden;'; |
||||
p.getOverflow = function(){return this._overflow}; |
||||
p.setOverflow = function(s){ |
||||
if(!s) s='default'; |
||||
this._overflow=s; |
||||
if(this.css) this.css.overflow=s; |
||||
else this._cssOverflow=' overflow:'+s+';'; |
||||
}; |
||||
|
||||
p.getAnchor = function(){ |
||||
if(!this.parent) return this._saveAnchors; |
||||
else if (this.parent._childAnchors) { |
||||
return this.parent._childAnchors[this.id]; |
||||
} |
||||
}; |
||||
p.setAnchor = function(anchor) { |
||||
if (anchor == null) { |
||||
delete this._saveAnchor; |
||||
if (this.parent && this.parent._childAnchors && this.parent._childAnchors[this.id]) delete this.parent._childAnchors[this.id]; |
||||
this._hasAnchor = false; |
||||
} |
||||
else if (this.parent) { |
||||
if (!this.parent._childAnchors) this.parent._childAnchors = {}; |
||||
var a = this.parent._childAnchors; |
||||
a[this.id] = anchor; |
||||
this.parent._updateAnchor(this.id); |
||||
this._hasAnchor = this.parent._hasChildAnchors = true; |
||||
} |
||||
else this._saveAnchor = anchor; |
||||
}; |
||||
p.setX=function(x) {this.setLocation(x,null)}; |
||||
p.setY=function(y) {this.setLocation(null,y)}; |
||||
p.getX=function() {return this.x||0}; |
||||
p.getY=function() {return this.y||0}; |
||||
p.setPageX = function(x) {this.setPageLocation(x,null)}; |
||||
p.setPageY = function(y) {this.setPageLocation(null,y)}; |
||||
p.getVisible=function() {return this.visible}; |
||||
p.getZIndex=function() {return this.z}; |
||||
p.setZIndex=function(z) { |
||||
if (typeof(z)=="object") { |
||||
if (z.above) this.z = z.above.z + 1; |
||||
else if (z.below) this.z = z.below.z - 1; |
||||
else if (z.topmost && !this.parent) this.z = (DynLayer._z)? (DynLayer._z++):(DynLayer._z=1000); |
||||
else if (z.topmost) { |
||||
var topZ=10000,ch=this.parent.children; |
||||
for(var i=0;i<ch.length;i++) if (ch[i].z>topZ) topZ=ch[i].z; |
||||
this.parent._topZ = topZ+2; |
||||
this.z = this.parent._topZ; |
||||
} |
||||
} |
||||
else this.z = z; |
||||
if (this.css) this.css.zIndex = this.z; |
||||
}; |
||||
p.getHTML = function() {return this.html}; |
||||
p.setWidth=function(w) {this.setSize(w,null)}; |
||||
p.setHeight=function(h) {this.setSize(null,h)}; |
||||
p.getWidth=function() {return this.w||0}; |
||||
p.getHeight=function() {return this.h||0}; |
||||
p.getBgImage=function() {return this.bgImage}; |
||||
p.getBgColor=function() {return this.bgColor}; |
||||
p.setBgColor=function(c) { //! Overwritten by NS4
|
||||
if (c==null) c = 'transparent'; |
||||
this.bgColor = c; |
||||
if (this.css) this.css.backgroundColor = c; |
||||
}; |
||||
p.setBgImage=function(path) { //! Overwritten by NS4
|
||||
this.bgImage=path; |
||||
if (this.css) this.css.backgroundImage='url('+path+')'; |
||||
}; |
||||
p.setClip=function(clip) { //! Overwritten by NS4
|
||||
var cc=this.getClip(); |
||||
for (var i=0;i<clip.length;i++) if (clip[i]==null) clip[i]=cc[i]; |
||||
this.clip=clip; |
||||
if (this.css==null) return; |
||||
var c=this.css.clip; |
||||
this.css.clip="rect("+clip[0]+"px "+clip[1]+"px "+clip[2]+"px "+clip[3]+"px)"; |
||||
}; |
||||
p.getClip=function() { //! Overwritten by NS4
|
||||
if (this.css==null || !this.css.clip) return [0,0,0,0]; |
||||
var c = this.css.clip; |
||||
if (c) { |
||||
if (c.indexOf("rect(")>-1) { |
||||
c=c.split("rect(")[1].split(")")[0]; |
||||
c=c.replace(/(\D+)/g,',').split(","); |
||||
for (var i=0;i<c.length;i++) c[i]=parseInt(c[i]); |
||||
return [c[0],c[1],c[2],c[3]]; |
||||
} |
||||
else return [0,this.w,this.h,0]; |
||||
} |
||||
}; |
||||
p.slideTo = function(endx,endy,inc,speed) { |
||||
if (!this._slideActive) { |
||||
var x = this.x||0; |
||||
var y = this.y||0; |
||||
if (endx==null) endx = x; |
||||
if (endy==null) endy = y; |
||||
var distx = endx-x; |
||||
var disty = endy-y; |
||||
if (x==endx && y==endy) return; |
||||
var num = Math.sqrt(Math.pow(distx,2) + Math.pow(disty,2))/(inc||10)-1; |
||||
var dx = distx/num; |
||||
var dy = disty/num; |
||||
this._slideActive = true; |
||||
this._slide(dx,dy,endx,endy,num,this.x,this.y,1,(speed||20)); |
||||
} |
||||
}; |
||||
p.slideStop = function() { |
||||
this._slideActive = false; |
||||
//this.invokeEvent('pathcancel');
|
||||
}; |
||||
p._slide = function(dx,dy,endx,endy,num,x,y,i,speed) { |
||||
if (!this._slideActive) this.slideStop(); |
||||
else if (i++ < num) { |
||||
this.invokeEvent('pathrun'); |
||||
if (this._slideActive) { |
||||
x += dx; |
||||
y += dy; |
||||
this.setLocation(Math.round(x),Math.round(y)); |
||||
setTimeout(this+'._slide('+dx+','+dy+','+endx+','+endy+','+num+','+x+','+y+','+i+','+speed+')',speed); |
||||
} |
||||
//else this.slideStop();
|
||||
} |
||||
else { |
||||
this._slideActive = false; |
||||
this.invokeEvent('pathrun'); |
||||
this.setLocation(endx,endy); |
||||
this.invokeEvent('pathfinish'); |
||||
} |
||||
}; |
||||
@ -1,149 +0,0 @@
@@ -1,149 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
DynLayer DOM Specific Functions |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
requires: dynapi.api.DynLayerBase |
||||
*/ |
||||
|
||||
p = DynLayer.prototype; |
||||
p._create = function() { |
||||
if (this.parent && !this.elm) { |
||||
DynElement._flagPreCreate(this); |
||||
var elm, parentElement; |
||||
parentElement = this.parent.elm; |
||||
|
||||
// this method seems faster for most dom browsers
|
||||
var r = parentElement.ownerDocument.createRange(); |
||||
r.setStartBefore(parentElement); |
||||
var ptxt = r.createContextualFragment(this.getOuterHTML()); |
||||
parentElement.appendChild(ptxt); |
||||
elm = parentElement.lastChild; |
||||
|
||||
DynLayer._assignElement(this,elm); |
||||
DynElement._flagCreate(this); |
||||
} |
||||
}; |
||||
DynLayer._assignElement = function(dlyr,elm,divs) { |
||||
if (!elm ) { |
||||
elm = (divs)? divs[dlyr.id] : dlyr.parent.doc.getElementById(dlyr.id); |
||||
if (!elm){ |
||||
if(dlyr.isInline) dlyr._create(); // force create() for missing inline layer
|
||||
return; |
||||
} |
||||
} |
||||
dlyr.elm = elm; |
||||
dlyr.css = elm.style; |
||||
dlyr.doc = dlyr.parent.doc; |
||||
dlyr.elm._dynobj = dlyr; |
||||
dlyr._dyndoc = dlyr.parent._dyndoc; |
||||
if(dlyr._blkBoardElm) dlyr._blkBoardElm = (divs)? divs[dlyr.id+'_blkboard'] : dlyr.parent.doc.getElementById(dlyr.id+'_blkboard'); |
||||
|
||||
if (dlyr.z) dlyr.css.zIndex = dlyr.z; |
||||
|
||||
if (dlyr.html!=null && dlyr.html!='' && (dlyr.w==null || dlyr.h==null)) { |
||||
var cw = (dlyr.w==null)? dlyr.getContentWidth() : null; |
||||
var ch = (dlyr.h==null)? dlyr.getContentHeight() : null; |
||||
//var cw = (dlyr.w==null)? dlyr.getElmWidth() : null;
|
||||
//var ch = (dlyr.h==null)? dlyr.getElmHeight() : null;
|
||||
dlyr.setSize(cw,ch); |
||||
} |
||||
|
||||
var i,ch=dlyr.children;
|
||||
for (i=0;i<ch.length;i++) DynLayer._assignElement(ch[i],null,divs); |
||||
|
||||
// Box Fix - for Border Manager
|
||||
if (dlyr._needBoxFix) BorderManager.FixBoxModel(dlyr); |
||||
|
||||
if (dlyr._hasKeyEvents) dlyr.captureKeyEvents(); |
||||
if (dlyr._hasMouseEvents) dlyr.captureMouseEvents(); |
||||
}; |
||||
p.enableBlackboard = function(){ |
||||
if (!this._created) this._blkBoardElm=true; |
||||
else if(!this._blkBoardElm){ |
||||
var r,ptxt; |
||||
var h='',elm = this.elm; |
||||
if(this.html!=null) h=this.html; |
||||
r = elm.ownerDocument.createRange(); |
||||
r.setStartBefore(elm); |
||||
ptxt = r.createContextualFragment('<div id="'+this.id+'_blkboard">'+h+'</div>'); |
||||
elm.appendChild(ptxt); |
||||
this._blkBoardElm = elm.lastChild;
|
||||
} |
||||
}; |
||||
p.setLocation=function(x,y) { |
||||
var cx = (x!=null && x!=this.x); |
||||
var cy = (y!=null && y!=this.y); |
||||
if (cx) this.x = x||0; |
||||
if (cy) this.y = y||0; |
||||
if (this.css!=null) { |
||||
if (cx) this.css.left = this.x+"px"; |
||||
if (cy) this.css.top = this.y+"px"; |
||||
// adjust parent size after being moved
|
||||
if((cx||cy) && this.parent._aSz) this.parent._adjustSize(); |
||||
} |
||||
if(this._hasLocationEvents) this.invokeEvent('locationchange'); |
||||
return (cx||cy); |
||||
}; |
||||
p.setPageLocation = function(x,y) { |
||||
if (this.isChild) { |
||||
if (x!=null) x = x - this.parent.getPageX(); |
||||
if (y!=null) y = y - this.parent.getPageY(); |
||||
} |
||||
return this.setLocation(x,y); |
||||
}; |
||||
p.setHTML = function(html) { |
||||
if (html!=this.html) { |
||||
this.html = html; |
||||
if (this.css) { |
||||
var elm = (this._blkBoardElm)? this._blkBoardElm:this.elm; |
||||
elm.innerHTML = html;
|
||||
var sTmp=(this.w==null)?'<NOBR>'+this.html+'</NOBR>':this.html; |
||||
while (elm.hasChildNodes()) elm.removeChild(elm.firstChild); |
||||
var r=elm.ownerDocument.createRange(); |
||||
r.selectNodeContents(elm); |
||||
r.collapse(true); |
||||
var df=r.createContextualFragment(sTmp); |
||||
elm.appendChild(df); |
||||
this._adjustSize(); |
||||
} |
||||
} |
||||
if(this._hasContentEvents) this.invokeEvent('contentchange');
|
||||
}; |
||||
p.setTextSelectable=function(b) { |
||||
this._textSelectable = b; |
||||
if(!this._hasMouseEvents) this.captureMouseEvents(); |
||||
if (!b) this.setCursor('default'); |
||||
}; |
||||
p.getCursor = function() {return (this._cursor=='pointer')? 'hand':this._cursor}; |
||||
p.setCursor = function(c) { |
||||
if (!c) c = 'default'; |
||||
else c=(c+'').toLowerCase(); |
||||
if (c=='hand') c='pointer'; |
||||
if (this._cursor!=c) { |
||||
this._cursor = c; |
||||
if (this.css) this.css.cursor = c; |
||||
}
|
||||
}; |
||||
p.getContentWidth=function() { |
||||
if (this.elm==null) return 0; |
||||
else { |
||||
var p = this.parent;
|
||||
var tw = this.elm.style.width; |
||||
this.css.width = "auto";
|
||||
var w = this.elm.offsetWidth; |
||||
this.css.width = tw; |
||||
return w; |
||||
}; |
||||
}; |
||||
p.getContentHeight=function() { |
||||
if (this.elm==null) return 0; |
||||
else { |
||||
var th = this.css.height; |
||||
this.elm.style.height = "auto"; |
||||
var h = this.elm.offsetHeight; |
||||
this.css.height = th; |
||||
return h; |
||||
} |
||||
}; |
||||
@ -1,180 +0,0 @@
@@ -1,180 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
DynLayer IE Specific Functions |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
requires: dynapi.api.DynLayerBase |
||||
*/ |
||||
|
||||
p = DynLayer.prototype; |
||||
p._create = function() { |
||||
if (this.parent && !this.elm) {
|
||||
DynElement._flagPreCreate(this);
|
||||
var elm, parentElement; |
||||
parentElement = this.parent.elm; |
||||
if(dynapi.ua.v<5){ |
||||
parentElement.insertAdjacentHTML("beforeEnd",this.getOuterHTML()); |
||||
elm = parentElement.children[parentElement.children.length-1]; |
||||
} |
||||
else { |
||||
// this method is more efficient for ie5+. any comment?
|
||||
elm=document.createElement('DIV'); |
||||
elm.id=this.id; |
||||
if(this._className) elm.className=this._className; |
||||
if(!this._noStyle) { |
||||
var css = elm.style; |
||||
css.position=(this._position||'absolute'); |
||||
css.pixelLeft=(this.x||0); |
||||
css.pixelTop=(this.y||0); |
||||
if(this.w!=null) css.width = this.w; |
||||
if(this.h!=null) css.height = this.h; |
||||
css.backgroundColor=(this.bgColor||'transparent'); |
||||
css.zIndex=(this.z||1); |
||||
css.cursor=(this._cursor||'auto'); |
||||
css.overflow=(this._overflow||'');
|
||||
if(this.bgImage!=null) css.backgroundImage='url('+this.bgImage+')'; |
||||
if (this.bgImage==null && this.html==null) css.backgroundImage='none'; |
||||
if (this.clip) css.clip='rect('+this.clip[0]+'px '+this.clip[1]+'px '+this.clip[2]+'px '+this.clip[3]+'px)'; |
||||
else if (this.w!=null && this.h!=null) css.clip='rect(0px '+this.w+'px '+this.h+'px 0px)';
|
||||
css.visibility=(this.visible==false)? 'hidden':'inherit'; |
||||
// border - set by BorderManager
|
||||
if(this._cssBorTop){ |
||||
css.borderTop = this._cssBorTop||''; |
||||
css.borderRight = this._cssBorRight||'';
|
||||
css.borderBottom = this._cssBorBottom||''; |
||||
css.borderLeft = this._cssBorLeft||''; |
||||
} |
||||
} |
||||
elm.innerHTML = this.getInnerHTML(); |
||||
parentElement.appendChild(elm); |
||||
} |
||||
DynLayer._assignElement(this,elm); |
||||
DynElement._flagCreate(this); |
||||
} |
||||
}; |
||||
DynLayer._assignElement = function(dlyr,elm,divs) { |
||||
if (!elm ) { |
||||
elm = (divs)? divs[dlyr.id] : dlyr.parent.elm.all[dlyr.id]; |
||||
if (!elm){ |
||||
if(dlyr.isInline) dlyr._create(); // force create() for missing inline layer
|
||||
return; |
||||
} |
||||
} |
||||
dlyr.elm = elm; |
||||
dlyr.css = elm.style; |
||||
dlyr.doc = dlyr.parent.doc; |
||||
dlyr.elm._dynobj = dlyr; |
||||
dlyr._dyndoc = dlyr.parent._dyndoc; |
||||
if(dlyr._blkBoardElm) dlyr._blkBoardElm = (divs)? divs[dlyr.id+'_blkboard'] : dlyr.parent.elm.all[dlyr.id+'_blkboard']; |
||||
|
||||
if (dlyr.html!=null && dlyr.html!='' && (dlyr.w==null || dlyr.h==null)) { |
||||
var cw = (dlyr.w==null)? dlyr.getContentWidth() : null; |
||||
var ch = (dlyr.h==null)? dlyr.getContentHeight() : null; |
||||
dlyr.setSize(cw,ch); |
||||
} |
||||
|
||||
var i,ch=dlyr.children;
|
||||
for (i=0;i<ch.length;i++) DynLayer._assignElement(ch[i],null,divs); |
||||
|
||||
if (dlyr._textSelectable==false) elm.onselectstart = dynapi.functions.Deny; |
||||
|
||||
// prevent dragging of images
|
||||
//if (elm.all.tags("img").length) elm.ondragstart = dynapi.functions.False;
|
||||
|
||||
// Box Fix - for Border Manager
|
||||
if (dlyr._needBoxFix) BorderManager.FixBoxModel(dlyr); |
||||
|
||||
if (dlyr._hasKeyEvents) dlyr.captureKeyEvents(); |
||||
if (dlyr._hasMouseEvents) dlyr.captureMouseEvents(); |
||||
|
||||
}; |
||||
p.enableBlackboard = function(){ |
||||
if (!this._created) this._blkBoardElm=true; |
||||
else if(!this._blkBoardElm){ |
||||
var h='',elm = this.elm; |
||||
if(this.html!=null) h=this.html; |
||||
elm.insertAdjacentHTML("beforeEnd",'<div id="'+this.id+'_blkboard">'+h+'</div>'); |
||||
this._blkBoardElm = elm.children[elm.children.length-1]; |
||||
} |
||||
}; |
||||
p.setLocation=function(x,y) { |
||||
var cx = (x!=null && x!=this.x); |
||||
var cy = (y!=null && y!=this.y); |
||||
if (cx) this.x = x||0; |
||||
if (cy) this.y = y||0; |
||||
if (this.css!=null) { |
||||
if (cx) this.css.pixelLeft = this.x; |
||||
if (cy) this.css.pixelTop = this.y; |
||||
// adjust parent size after being moved
|
||||
if((cx||cy) && this.parent._aSz) this.parent._adjustSize();
|
||||
} |
||||
if(this._hasLocationEvents) this.invokeEvent('locationchange'); |
||||
return (cx||cy); |
||||
}; |
||||
// this method was breaking in IE saying cx was not defined.
|
||||
// fixed by davesag 21.jan.2004
|
||||
p.setPageLocation = function(x,y) { |
||||
var cx = (x!=null && x!=this.x); |
||||
var cy = (y!=null && y!=this.y); |
||||
if (cx) this.x = x||0; |
||||
if (cy) this.y = y||0; |
||||
if (this.css!=null) { |
||||
if (this.isChild) { |
||||
if (dynapi.ua.v>=5) { |
||||
if (cx) this.css.pixelLeft = this.x; |
||||
if (cy) this.css.pixelTop = this.y; |
||||
} |
||||
else { |
||||
if (cx) this.css.left = this.x+"px"; |
||||
if (cy) this.css.top = this.y+"px"; |
||||
} |
||||
} |
||||
} |
||||
return this.setLocation(x,y); |
||||
}; |
||||
p.setHTML = function(html) { |
||||
if (html!=this.html) { |
||||
this.html = html; |
||||
if (this.css) { |
||||
var elm = (this._blkBoardElm)? this._blkBoardElm:this.elm; |
||||
elm.innerHTML = html; |
||||
this._adjustSize(); |
||||
} |
||||
} |
||||
if(this._hasContentEvents) this.invokeEvent('contentchange');
|
||||
}; |
||||
p.setTextSelectable=function(b) { |
||||
this._textSelectable = b; |
||||
if (this.elm) this.elm.onselectstart = b? dynapi.functions.Allow : dynapi.functions.Deny; |
||||
if (!b) this.setCursor('default'); |
||||
// && this.captureMouseEvents && !this._hasMouseEvents) this.captureMouseEvents();
|
||||
}; |
||||
p.getCursor = function() {return this._cursor}; |
||||
p.setCursor = function(c) { |
||||
if (!c) c = 'default'; |
||||
else c=(c+'').toLowerCase(); |
||||
if (this._cursor!=c) { |
||||
this._cursor = c; |
||||
if (this.css) this.css.cursor = c; |
||||
} |
||||
}; |
||||
p.getContentWidth=function() { |
||||
if (this.elm==null) return 0; |
||||
else { |
||||
var w,tw = this.css.width; |
||||
this.css.width='auto'; // force ie to get width
|
||||
if (dynapi.ua.platform=="mac") w = this.elm.offsetWidth; |
||||
else w = parseInt(this.elm.scrollWidth); |
||||
this.css.width=tw; |
||||
return w; |
||||
}; |
||||
}; |
||||
p.getContentHeight=function() { |
||||
if (this.elm==null) return 0; |
||||
else { |
||||
if (dynapi.ua.platform=="mac") return this.elm.offsetHeight; |
||||
return parseInt(this.elm.scrollHeight); |
||||
|
||||
} |
||||
}; |
||||
@ -1,308 +0,0 @@
@@ -1,308 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
DynLayer NS4 Specific Functions |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
requires: dynapi.api.DynLayerBase |
||||
*/ |
||||
|
||||
p = DynLayer.prototype; |
||||
p._ns4IPad = '<img src="'+dynapi.library.path+'gui/images/pixel.gif" width="0" height="0">'; // used with blackboard
|
||||
p._remove = function() { |
||||
if (this.elm) { |
||||
var p = this.parent; |
||||
if (p && this._alias) p[this._alias]=null; |
||||
if (!p.doc.recycled) p.doc.recycled=[]; |
||||
p.doc.recycled[p.doc.recycled.length]=this.elm; |
||||
this.elm.visibility="hide"; |
||||
this.elm = null; |
||||
if (this.releaseMouseEvents) this.releaseMouseEvents(); |
||||
if (this.releaseKeyEvents) this.releaseKeyEvents(); |
||||
} |
||||
/*this.frame = null; |
||||
this.bgImage = null; |
||||
this.bgColor = null; |
||||
this.html = null; |
||||
this.z = null; |
||||
this.w = null; |
||||
this.h = null; |
||||
this.elm = null; |
||||
this.doc = null; |
||||
this.css = null;*/ |
||||
}; |
||||
p._create = function() { |
||||
if (this.parent && !this.elm) { |
||||
DynElement._flagPreCreate(this); |
||||
var parentElement = this.parent.isClass('DynLayer')? this.parent.elm : this.parent.frame; |
||||
var elm = new Layer(this.w||0, parentElement); |
||||
if(this._className) elm.className=this._className; // does this work in ns4?
|
||||
if(!this._noStyle) { |
||||
if (this.w) elm.clip.width = this.w+this._fixBw; |
||||
if (this.h) elm.clip.height = this.h+this._fixBh; |
||||
if (this.x && this.y) elm.moveTo(this.x,this.y); |
||||
else if (this.x) elm.left = this.x; |
||||
else if (this.y) elm.top = this.y; |
||||
if (this.bgColor!=null) elm.document.bgColor = this.bgColor; |
||||
if (this.clip) { |
||||
var c = elm.clip, cl = this.clip; |
||||
c.top=cl[0], c.right=cl[1], c.bottom=cl[2], c.left=cl[3]; |
||||
} |
||||
if (this.z) elm.zIndex = this.z; |
||||
if (this.visible) elm.visibility = 'inherit'; |
||||
} |
||||
if (this.children.length || (this.html!=null && this.html!='')) { |
||||
elm.document.write(this.getInnerHTML()); |
||||
elm.document.close(); |
||||
} |
||||
DynLayer._assignElement(this,elm); |
||||
DynElement._flagCreate(this); |
||||
} |
||||
}; |
||||
DynLayer._getLayerById = function(id,pElm){ |
||||
var i,lyrs,elm; |
||||
pElm = (pElm)? pElm:document; |
||||
lyrs = pElm.layers; |
||||
for (i=0;i<lyrs.length;i++){ |
||||
elm=lyrs[i]; |
||||
if (elm.id==id) return elm; |
||||
else if (elm.layers.length){ |
||||
elm = this._getLayerById(id,elm); |
||||
if (elm) return elm; |
||||
}
|
||||
} |
||||
}; |
||||
DynLayer._assignElement = function(dlyr,elm) { |
||||
if (!elm) { |
||||
elm = dlyr.parent.doc.layers[dlyr.id]; |
||||
if (!elm) elm=DynLayer._getLayerById(dlyr.id,dlyr.parent.elm); |
||||
if (!elm){ |
||||
if(dlyr.isInline) dlyr._create(); // force create() for missing inline layer
|
||||
return; |
||||
} |
||||
} |
||||
dlyr.elm = elm; |
||||
dlyr.css = elm; |
||||
dlyr.doc = elm.document; |
||||
if(dlyr._blkBoardElm) { |
||||
dlyr._blkBoardElm = elm.document.layers[dlyr.id+'blkboard']; |
||||
dlyr.doc = dlyr._blkBoardElm.document; // useful for <forms>, images, links, etc
|
||||
} |
||||
dlyr.elm._dynobj = dlyr.doc._dynobj = dlyr; |
||||
dlyr._dyndoc = dlyr.parent._dyndoc; |
||||
|
||||
if (dlyr.html!=null && dlyr.html!='' && (dlyr.w==null || dlyr.h==null)) { |
||||
var cw = (dlyr.w==null)? dlyr.getContentWidth() : null; |
||||
var ch = (dlyr.h==null)? dlyr.getContentHeight() : null; |
||||
//var cw = (dlyr.w==null)? dlyr.getElmWidth() : null;
|
||||
//var ch = (dlyr.h==null)? dlyr.getElmHeight() : null;
|
||||
dlyr.setSize(cw,ch); |
||||
} |
||||
if (dlyr.bgImage!=null) dlyr.setBgImage(dlyr.bgImage); |
||||
|
||||
var i,ch=dlyr.children;
|
||||
for (i=0;i<ch.length;i++) DynLayer._assignElement(ch[i],null); |
||||
|
||||
|
||||
if (dlyr._hasKeyEvents) dlyr.captureKeyEvents(); |
||||
if (dlyr._hasMouseEvents) dlyr.captureMouseEvents(); |
||||
else { |
||||
// assign ._dynobj to images and links
|
||||
for (var i=0;i<dlyr.doc.images.length;i++) dlyr.doc.images[i]._dynobj=dlyr; // was _dynobji
|
||||
for (var i=0;i<dlyr.doc.links.length;i++) dlyr.doc.links[i]._dynobj=dlyr; |
||||
} |
||||
}; |
||||
|
||||
p.getOuterHTML = function() { |
||||
// get box fix values
|
||||
var fixBw = (this._fixBw)? this._fixBw:0; |
||||
var fixBh = (this._fixBh)? this._fixBh:0; |
||||
var tag='layer',clip=''; |
||||
if (fixBw||fixBh) this._fixBoxModel = true; |
||||
if(this._position=='relative') tag='ilayer'; |
||||
if(this._noStyle) return '\n<'+tag+' '+this._cssClass+' id="'+this.id+'">'+this.getInnerHTML()+'</'+tag+'>'; |
||||
else { |
||||
if (this.clip) clip=' clip="'+this.clip[3]+','+this.clip[0]+','+this.clip[1]+','+this.clip[2]+'"'; |
||||
else clip=' clip="0,0,'+((this.w>=0)? this.w+fixBw:0)+','+((this.h>=0)? this.h+fixBh:0)+'"'; |
||||
return [ |
||||
'\n<'+tag+' ',this._cssClass,' id="'+this.id+'"', |
||||
' left=',(this.x!=null? this.x : 0), |
||||
' top=',(this.y!=null? this.y : 0), |
||||
((this.visible)? ' visibility="inherit"':' visibility="hide"'), |
||||
((this.w!=null)? ' width='+(this.w+fixBw):''), |
||||
((this.h!=null)? ' height='+(this.h+fixBw):''), |
||||
((this.z)? ' zindex='+this.z:''),
|
||||
((this.bgColor!=null)? ' bgcolor="'+this.bgColor+'"':''), |
||||
((this.bgImage!=null)? ' background="'+this.bgImage+'"':''),
|
||||
clip,'>',this.getInnerHTML(),'</'+tag+'>' |
||||
].join(''); |
||||
} |
||||
}; |
||||
p.getInnerHTML = function() { |
||||
var i,s = '',ch=this.children; |
||||
if (this.html!=null) { |
||||
if (this.w==null) s += '<nobr>'+this.html+'</nobr>'; |
||||
else s+=this.html; |
||||
} |
||||
if (this._blkBoardElm) s='<layer id="'+this.id+'blkboard">'+this._ns4IPad+s+'</layer>';
|
||||
if(ch.length<50) for (i=0;i<ch.length;i++) s+=ch[i].getOuterHTML();
|
||||
else if(ch.length){ |
||||
var ar=['']; // speed improvement for layers with nested children
|
||||
for (i=0;i<ch.length;i++) ar[i]=ch[i].getOuterHTML(); |
||||
s=s+ar.join('');
|
||||
} |
||||
return s; |
||||
}; |
||||
p.enableBlackboard = function(){ |
||||
if (!this._created) this._blkBoardElm=true; |
||||
else if(!this._blkBoardElm){ |
||||
var c,i,h='',elm = this.elm; |
||||
if(this.html!=null) h=this.html;
|
||||
var parentElement = this.parent.isClass('DynLayer')? this.parent.elm : this.parent.frame; |
||||
var belm = this._blkBoardElm = new Layer(0, elm); |
||||
this.doc = belm.document; |
||||
this.doc.write(h); this.doc.close(); |
||||
belm.visibility = 'inherit'; |
||||
for (i=0;i<this.children.length;i++){ |
||||
c=this.children[i]; |
||||
c.css.zIndex=c.css.zIndex; // reset zindex
|
||||
}
|
||||
} |
||||
}; |
||||
p.setLocation = function(x,y) { |
||||
var cx = (x!=null && x!=this.x); |
||||
var cy = (y!=null && y!=this.y); |
||||
if (cx) this.x = x||0; |
||||
if (cy) this.y = y||0; |
||||
if (this.css!=null) { |
||||
if (cx && cy) this.elm.moveTo(this.x, this.y); |
||||
else if (cx) this.css.left = this.x; |
||||
else if (cy) this.css.top = this.y; |
||||
// adjust parent size after being moved
|
||||
if((cx||cy) && this.parent._aSz) this.parent._adjustSize();
|
||||
} |
||||
if(this._hasLocationEvents) this.invokeEvent('locationchange');
|
||||
return (cx||cy); |
||||
}; |
||||
p.setPageLocation = function(x,y) { |
||||
if (this.css) { |
||||
if (x!=null) { |
||||
this.css.pageX = x; |
||||
this.x = this.css.left; |
||||
} |
||||
if (y!=null) { |
||||
this.css.pageY = y; |
||||
this.y = this.css.top; |
||||
} |
||||
return true; |
||||
} |
||||
else { |
||||
if (this.isChild) { |
||||
if (x!=null) x = x - this.parent.getPageX(); |
||||
if (y!=null) y = y - this.parent.getPageY(); |
||||
} |
||||
return this.setLocation(x,y); |
||||
} |
||||
}; |
||||
p.getPageX = function() {return this.css? this.css.pageX : null}; |
||||
p.getPageY = function() {return this.css? this.css.pageY : null}; |
||||
p.setVisible = function(b) { |
||||
if (b!=this.visible) { |
||||
this.visible = b; |
||||
if (this.css) this.css.visibility = b? "inherit" : "hide"; |
||||
} |
||||
}; |
||||
p.setSize = function(w,h) { |
||||
if (this._useMinSize||this._useMaxSize){ |
||||
if (this._minW && w<this._minW) w=this._minW; |
||||
if (this._minH && h<this._minH) h=this._minH; |
||||
if (this._maxW && w>this._maxW) w=this._maxW; |
||||
if (this._maxH && h>this._maxH) h=this._maxH; |
||||
} |
||||
var cw = (w!=null && w!=this.w); |
||||
var ch = (h!=null && h!=this.h); |
||||
if (cw) this.w = w<0? 0 : w; |
||||
if (ch) this.h = h<0? 0 : h; |
||||
if (cw||ch) { |
||||
if (this._hasAnchor) this.updateAnchor(); // update this anchor
|
||||
if (this._hasChildAnchors) this._updateAnchors(); // update child anchors
|
||||
if (this.css) { |
||||
if (cw) this.css.clip.width = (this.w || 0)+this._fixBw; |
||||
if (ch) this.css.clip.height = (this.h || 0)+this._fixBh; |
||||
// adjust parent size after being sized
|
||||
if((cw||ch) && this.parent._aSz) this.parent._adjustSize(); |
||||
if (this.updateLayout) this.updateLayout();
|
||||
} |
||||
} |
||||
if(this._hasResizeEvents) this.invokeEvent('resize'); |
||||
return (cw||ch); |
||||
}; |
||||
p.setHTML=function(html) { |
||||
var ch = (html!=null && html!=this.html); |
||||
if (ch) { |
||||
this.html = html; |
||||
if (this.css) { |
||||
var i, doc = this.doc; |
||||
var html=(!this._blkBoardElm)? this.html:this._ns4IPad+this.html; // don't ask why! See HTMLContainer
|
||||
doc.open(); doc.write(html); doc.close(); |
||||
for (i=0;i<doc.images.length;i++) doc.images[i]._dynobj = this; |
||||
for (i=0;i<doc.links.length;i++) doc.links[i]._dynobj = this; |
||||
this._adjustSize(); |
||||
} |
||||
} |
||||
if(this._hasContentEvents) this.invokeEvent('contentchange'); |
||||
}; |
||||
p.setTextSelectable=function(b) { |
||||
this._textSelectable = b; |
||||
this.addEventListener({ |
||||
onmousemove : function(e) { |
||||
e.preventDefault(); |
||||
} |
||||
}); |
||||
// && this.captureMouseEvents && !this._hasMouseEvents) this.captureMouseEvents();
|
||||
}; |
||||
p.getCursor = function() {return this._cursor}; |
||||
p.setCursor = function(c) { |
||||
if (!c) c = 'default'; |
||||
if (this._cursor!=c) this._cursor = c;
|
||||
// Note: not supported in ns4
|
||||
}; |
||||
p.setBgColor=function(c) { |
||||
this.bgColor = c; |
||||
if (this.css) this.elm.document.bgColor = c; |
||||
}; |
||||
p.setBgImage=function(path) { |
||||
this.bgImage=path||'none'; |
||||
if (this.css) { |
||||
//if (!path) this.setBgColor(this.getBgColor());
|
||||
setTimeout(this+'.elm.background.src="'+this.bgImage+'"',1); |
||||
} |
||||
}; |
||||
p.getContentWidth=function() { |
||||
if (this.elm==null) return 0; |
||||
else { |
||||
return this.doc.width; |
||||
}; |
||||
}; |
||||
p.getContentHeight=function() { |
||||
if (this.elm==null) return 0; |
||||
else { |
||||
return this.doc.height; |
||||
} |
||||
}; |
||||
p.setClip=function(clip) { |
||||
var cc=this.getClip(); |
||||
for (var i=0;i<clip.length;i++) if (clip[i]==null) clip[i]=cc[i]; |
||||
this.clip=clip; |
||||
if (this.css==null) return; |
||||
var c=this.css.clip; |
||||
c.top=clip[0], c.right=clip[1], c.bottom=clip[2], c.left=clip[3]; |
||||
}; |
||||
p.getClip=function() { |
||||
if (this.css==null || !this.css.clip) return [0,0,0,0]; |
||||
var c = this.css.clip; |
||||
if (c) { |
||||
return [c.top,c.right,c.bottom,c.left]; |
||||
} |
||||
}; |
||||
|
||||
@ -1,145 +0,0 @@
@@ -1,145 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
DynLayer Opera Specific Functions |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
requires: dynapi.api.DynLayerBase |
||||
*/ |
||||
|
||||
// Warning: Avoid using document.all collection as it has been reported
|
||||
// that on some platforms when opera is set to an identity other than IE
|
||||
// the all[] collection is not available
|
||||
|
||||
p = DynLayer.prototype; |
||||
p._create = function() { |
||||
if (this.parent && !this.elm) { |
||||
DynElement._flagPreCreate(this); |
||||
var elm, parentElement; |
||||
parentElement = this.parent.elm; |
||||
|
||||
// this method is more efficient for opera7+
|
||||
parentElement.insertAdjacentHTML("beforeEnd",this.getOuterHTML()); |
||||
elm = parentElement.children[parentElement.children.length-1]; |
||||
|
||||
DynLayer._assignElement(this,elm); |
||||
DynElement._flagCreate(this); |
||||
} |
||||
}; |
||||
DynLayer._assignElement = function(dlyr,elm,divs) { |
||||
if (!elm ) { |
||||
elm = (divs)? divs[dlyr.id] : dlyr.parent.doc.getElementById(dlyr.id); |
||||
if (!elm){ |
||||
if(dlyr.isInline) dlyr._create(); // force create() for missing inline layer
|
||||
return; |
||||
} |
||||
} |
||||
dlyr.elm = elm; |
||||
dlyr.css = elm.style; |
||||
dlyr.doc = dlyr.parent.doc; |
||||
dlyr.elm._dynobj = dlyr; |
||||
dlyr._dyndoc = dlyr.parent._dyndoc; |
||||
if(dlyr._blkBoardElm) dlyr._blkBoardElm = (divs)? divs[dlyr.id+'_blkboard'] : dlyr.parent.doc.getElementById(dlyr.id+'_blkboard'); |
||||
|
||||
if (dlyr.html!=null && dlyr.html!='' && (dlyr.w==null || dlyr.h==null)) { |
||||
var cw = (dlyr.w==null)? dlyr.getContentWidth() : null; |
||||
var ch = (dlyr.h==null)? dlyr.getContentHeight() : null; |
||||
//var cw = (dlyr.w==null)? dlyr.getElmWidth() : null;
|
||||
//var ch = (dlyr.h==null)? dlyr.getElmHeight() : null;
|
||||
dlyr.setSize(cw,ch); |
||||
} |
||||
|
||||
var i,ch=dlyr.children;
|
||||
for (i=0;i<ch.length;i++) DynLayer._assignElement(ch[i],null,divs); |
||||
|
||||
if (this._textSelectable==false) elm.onselectstart = dynapi.functions.Disallow; |
||||
|
||||
// Box Fix - for Border Manager
|
||||
if (dlyr._needBoxFix) BorderManager.FixBoxModel(dlyr); |
||||
|
||||
if (dlyr._hasKeyEvents) dlyr.captureKeyEvents(); |
||||
if (dlyr._hasMouseEvents) dlyr.captureMouseEvents();
|
||||
}; |
||||
p.enableBlackboard = function(){ |
||||
if (!this._created) this._blkBoardElm=true; |
||||
else if(!this._blkBoardElm){ |
||||
var h='',elm = this.elm; |
||||
if(this.html!=null) h=this.html; |
||||
elm.insertAdjacentHTML("beforeEnd",'<div id="'+this.id+'_blkboard">'+h+'</div>'); |
||||
this._blkBoardElm = elm.children[elm.children.length-1]; |
||||
} |
||||
}; |
||||
p.setLocation=function(x,y) { |
||||
var cx = (x!=null && x!=this.x); |
||||
var cy = (y!=null && y!=this.y); |
||||
if (cx) this.x = x||0; |
||||
if (cy) this.y = y||0; |
||||
if (this.css!=null) { |
||||
if (cx) this.css.pixelLeft = this.x; |
||||
if (cy) this.css.pixelTop = this.y; |
||||
// adjust parent size after being sized
|
||||
if((cx||cy) && this.parent._aSz) this.parent._adjustSize();
|
||||
} |
||||
if(this._hasLocationEvents) this.invokeEvent('locationchange');
|
||||
return (cx||cy); |
||||
}; |
||||
p.setPageLocation = function(x,y) { |
||||
if (this.isChild) { |
||||
if (dynapi.ua.v>=5) { |
||||
if (cx) this.css.pixelLeft = this.x; |
||||
if (cy) this.css.pixelTop = this.y; |
||||
} |
||||
else { |
||||
if (cx) this.css.left = this.x+"px"; |
||||
if (cy) this.css.top = this.y+"px"; |
||||
} |
||||
} |
||||
return this.setLocation(x,y); |
||||
}; |
||||
p.setHTML = function(html) { |
||||
if (html!=this.html) { |
||||
this.html = html; |
||||
if (this.css) { |
||||
var elm = (this._blkBoardElm)? this._blkBoardElm:this.elm; |
||||
elm.innerHTML = html; |
||||
this._adjustSize(); |
||||
} |
||||
} |
||||
if(this._hasContentEvents) this.invokeEvent('contentchange'); |
||||
}; |
||||
p.setTextSelectable=function(b) { |
||||
this._textSelectable = b; |
||||
if (this.elm) this.elm.onselectstart = b? dynapi.functions.Allow : dynapi.functions.Deny; |
||||
if (!b) this.setCursor('default'); |
||||
// && this.captureMouseEvents && !this._hasMouseEvents) this.captureMouseEvents();
|
||||
}; |
||||
p.getCursor = function() {return this._cursor}; |
||||
p.setCursor = function(c) { |
||||
if (!c) c = 'default'; |
||||
else c=(c+'').toLowerCase(); |
||||
if (this._cursor!=c) { |
||||
this._cursor = c; |
||||
if (this.css) this.css.cursor = c; |
||||
}
|
||||
}; |
||||
p.getContentWidth=function() { |
||||
if (this.elm==null) return 0; |
||||
else { |
||||
var tw=this.css.width; |
||||
var w,to = this.css.overflow; |
||||
this.css.width='auto'; |
||||
this.css.overflow='auto'; |
||||
w = parseInt(this.elm.scrollWidth); |
||||
this.css.width=tw; |
||||
this.css.overflow=to; |
||||
return w; |
||||
|
||||
}; |
||||
}; |
||||
p.getContentHeight=function() { |
||||
if (this.elm==null) return 0; |
||||
else { |
||||
if (dynapi.ua.platform=="mac") return this.elm.offsetHeight; |
||||
return parseInt(this.elm.scrollHeight); |
||||
} |
||||
}; |
||||
@ -1,348 +0,0 @@
@@ -1,348 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
DynEvent, EventObject, DynElement Classes |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
*/ |
||||
|
||||
function DynEvent(type,src) { |
||||
this.type = type; |
||||
this.src = src; |
||||
this.origin = src; |
||||
this.propagate = true; |
||||
this.bubble = false; |
||||
this.bubbleChild = null; |
||||
this.defaultValue = true; |
||||
}; |
||||
var p = DynEvent.prototype;
|
||||
p.getType = function() {return this.type}; |
||||
p.getSource = function() {return this.src}; |
||||
p.getOrigin=function() {return this.origin}; |
||||
p.stopPropagation = function() {this.propagate = false}; |
||||
p.preventBubble = function() {this.bubble = false}; |
||||
p.preventDefault = function() {this.defaultValue = false}; |
||||
p.getBubbleChild = function() {return this.bubbleChild}; |
||||
|
||||
function EventObject() { |
||||
this.DynObject = DynObject; |
||||
this.DynObject(); |
||||
this._listeners = []; |
||||
}; |
||||
EventObject._SubClass={}; |
||||
|
||||
p = dynapi.setPrototype('EventObject','DynObject'); |
||||
p.addEventListener = function(el) { |
||||
if (el) { |
||||
for (var i=0;i<this._listeners.length;i++) if (this._listeners[i]==el) return; |
||||
this._listeners[this._listeners.length] = el;
|
||||
// Use onCreate() and onPrecreate() function for create events
|
||||
this._hasContentEvents=(el['oncontentchange'])? true:this._hasContentEvents; |
||||
this._hasLocationEvents=(el['onlocationchange'])? true:this._hasLocationEvents; |
||||
this._hasResizeEvents=(el['onresize'])? true:this._hasResizeEvents; |
||||
this._hasDragEvents=(el['ondragstart']||el['ondragmove']|| |
||||
el['ondragend']||el['ondragdrop']||el['ondrop']|| |
||||
el['ondragover']||el['ondragout'])? true:this._hasDragEvents; |
||||
|
||||
if (this.captureMouseEvents) { |
||||
this._hasMouseEvents = this._hasMouseEvents||(el.onmousedown || el.onmouseup || el.onmouseover || el.onmouseout || el.onclick || el.ondblclick); |
||||
if (this._created && !this._hasMouseEvents) this.captureMouseEvents(); |
||||
} |
||||
if (this.captureKeyEvents)
|
||||
if (this._created && !this._hasKeyEvents && (el.onkeydown || el.onkeyup || el.onkeypress)) this.captureKeyEvents(); |
||||
} |
||||
}; |
||||
p.removeEventListener = function(el) { |
||||
if (el) { |
||||
DynAPI.functions.removeFromArray(this._listeners, el, false); |
||||
if (!this._listeners.length && this.releaseMouseEvents && this.getClassName()!='DynDocument') this.releaseMouseEvents(); |
||||
if (!this._listeners.length && this.releaseKeyEvents && this.getClassName()!='DynDocument') this.releaseKeyEvents(); |
||||
} |
||||
}; |
||||
p.removeAllEventListeners = function() { |
||||
delete this._listeners; |
||||
this._listeners = []; |
||||
}; |
||||
p.invokeEvent = function(type,e,args) { |
||||
if (!e) e = new DynEvent(type,this); |
||||
e.src = this; |
||||
e.type = type; |
||||
|
||||
// Check for subclassing
|
||||
var clsFn=EventObject._SubClass[this+'_'+type]; |
||||
if(clsFn) { |
||||
if (clsFn(e,args)==false) return; |
||||
}; |
||||
|
||||
if (this._listeners.length) for (var i=0;i<this._listeners.length;i++) { |
||||
if (this._listeners[i]["on"+type]) this._listeners[i]["on"+type](e,args); |
||||
if (!e.propagate) break; |
||||
} |
||||
if (this["on"+type]) this["on"+type](e,args); |
||||
if (e.bubble && this.parent) { |
||||
//if ((type=="mouseover" || type=="mouseout") && e._relative==this.parent) return;
|
||||
e.x += this.x; |
||||
e.y += this.y; |
||||
e.bubbleChild = this; |
||||
this.parent.invokeEvent(type,e,args); |
||||
} |
||||
}; |
||||
|
||||
// Add subClassEvent() function to dynapi.functions
|
||||
dynapi.functions.subClassEvent = function(type,eobj,fn){ |
||||
var ek=eobj+'_'+type; |
||||
var cls=EventObject._SubClass; |
||||
if(typeof(fn)=='function') cls[ek]=fn; |
||||
else if(!fn && cls[ek]) delete cls[ek]; |
||||
}; |
||||
|
||||
function DynElement() { |
||||
this.EventObject = EventObject; |
||||
this.EventObject(); |
||||
this.isChild = false; |
||||
this._created = false; |
||||
this.parent = null; |
||||
this._dyndoc = null; |
||||
this.children = []; |
||||
this._childAnchors = []; |
||||
}; |
||||
DynElement._flagCreate = function(c){ // much faster than using DynElemnt._flagEvent
|
||||
var ch=c.children; |
||||
c._created = true; |
||||
if (c._hasCreateFn) c._flagCreateEvent('create');
|
||||
for (var i=0; i<ch.length; i++) this._flagCreate(ch[i]); |
||||
}; |
||||
DynElement._flagPreCreate = function(c){ |
||||
var ch=c.children; |
||||
if (c._hasPCreateFn) c._flagCreateEvent('precreate');
|
||||
for (var i=0; i<ch.length; i++) this._flagPreCreate(ch[i]); |
||||
}; |
||||
DynElement._flagEvent = function(c,type) { |
||||
var ch=c.children; |
||||
c.invokeEvent(type); |
||||
for (var i=0; i<ch.length; i++) this._flagEvent(ch[i],type); |
||||
}; |
||||
p = dynapi.setPrototype('DynElement','EventObject'); |
||||
p._adjustSize = dynapi.functions.Null; |
||||
p.addChild = function(c,alias,inlineID) { |
||||
if (!c) return dynapi.debug.print("Error: no object sent to [DynLayer].addChild()"); |
||||
if (c.isChild) c.removeFromParent(); |
||||
c.isChild = true; |
||||
c.parent = this; |
||||
if (c._saveAnchor) { |
||||
c.setAnchor(c._saveAnchor); |
||||
c._saveAnchor = null; |
||||
delete c._saveAnchor; |
||||
} |
||||
c._alias = alias; |
||||
if(alias) this[alias]=c; |
||||
if(inlineID) c.setID(inlineID,true); |
||||
if (this._created) { |
||||
if (c.isInline) c._createInline(); |
||||
else c._create(); |
||||
} |
||||
this.children[this.children.length] = c; |
||||
if(this._aSz) this._adjustSize(); // adjust size if necessary
|
||||
return c; |
||||
}; |
||||
p.deleteAllChildren = function() { // removes & destroy all children
|
||||
var i=0; |
||||
var ch =this.children; |
||||
var aSz = this._aSz; |
||||
this._aSz = false; // prevent children from adjusting parent's size when removed
|
||||
while(ch.length) { |
||||
c=ch[0]; |
||||
if(c) c.deleteFromParent(); |
||||
else { |
||||
i++; // fail safe method
|
||||
if(i>=ch.length) break; |
||||
} |
||||
};
|
||||
ch.length = 0; |
||||
this._aSz = aSz; |
||||
if(this._aSz) this._adjustSize(); // adjust size if necessary
|
||||
}; |
||||
p.deleteChild = function(c) { // removes & destroy child
|
||||
var l = this.children.length; |
||||
for (var i=0;i<l && this.children[i]!=c;i++); |
||||
if (i!=l) { |
||||
c._destroy(); |
||||
this.dropChildIndex(i); |
||||
} |
||||
}; |
||||
p.deleteFromParent = function () { // removes & destroy child
|
||||
if (this.parent) this.parent.deleteChild(this); |
||||
}; |
||||
p.dropChildIndex = function(i){ |
||||
var ch = this.children; |
||||
var l = ch.length; |
||||
delete ch[i]; |
||||
ch[i] = ch[l-1]; |
||||
ch[l-1] = null; |
||||
ch.length--; |
||||
// adjust parent size if necessary
|
||||
if(this._aSz) this._adjustSize(); |
||||
}; |
||||
p.removeChild = function(c) { |
||||
var l = this.children.length; |
||||
for (var i=0;i<l && this.children[i]!=c;i++); |
||||
if (i!=l) { |
||||
c._remove(); |
||||
c._created = c.isChild = false; |
||||
c.parent = c.dyndoc = null; |
||||
c.elm = c._blkBoardElm = c.css = c.doc = null; |
||||
this.dropChildIndex(i); |
||||
} |
||||
}; |
||||
p.removeFromParent = function () { |
||||
if (this.parent) this.parent.removeChild(this); |
||||
}; |
||||
p._create = p._createInLine = p._createInserted = p._remove = p._delete = p._destroy = dynapi.functions.Null; |
||||
|
||||
p.getChildren = function() {return this.children}; |
||||
p.getAllChildren = function() { |
||||
var temp; |
||||
var ret = []; |
||||
var ch = this.children; |
||||
var l = ch.length; |
||||
for(var i=0;i<l;i++) { |
||||
ret[ch[i].id] = ch[i]; |
||||
temp = ch[i].getAll(); |
||||
for(var j in temp) ret[j] = temp[j]; |
||||
} |
||||
return ret; |
||||
}; |
||||
p.getParents = function(l) { |
||||
if (l==null) l = []; |
||||
if (this.parent) { |
||||
l[l.length] = this.parent; |
||||
l = this.parent.getParents(l); |
||||
} |
||||
return l; |
||||
}; |
||||
p.isParentOf = function(c) { |
||||
if (c) { |
||||
var p = c.getParents(); |
||||
for (var i=0;i<p.length;i++) { |
||||
if (p[i]==this) return true; |
||||
} |
||||
} |
||||
return false; |
||||
}; |
||||
p.isChildOf = function(p) { |
||||
if (!p) return false; |
||||
return p.isParentOf(this); |
||||
}; |
||||
// New onPreCreate() and onCreate() callback functions
|
||||
p.onCreate = function(fn){ |
||||
if(!fn) return; |
||||
if(!this._cfn){this._fn=0;this._cfn=[];} |
||||
var s='create'+this._fn++; |
||||
this._cfn[s]='create'; |
||||
this._hasCreateFn=true; |
||||
this[s]=fn; |
||||
}; |
||||
p.onPreCreate = function(fn){ |
||||
if(!fn) return; |
||||
if(!this._cfn){this._fn=0;this._cfn=[];} |
||||
var s='precreate'+this._fn++; |
||||
this._cfn[s]='precreate'; |
||||
this._hasPCreateFn=true; |
||||
this[s]=fn; |
||||
}; |
||||
p._flagCreateEvent = function(t){ |
||||
for(var i in this._cfn){
|
||||
if(this._cfn[i]==t) this[i](); |
||||
}; |
||||
}; |
||||
|
||||
p.updateAnchor = function() { |
||||
this.parent._updateAnchor(this.id); |
||||
}; |
||||
p._updateAnchor = function(id) { |
||||
if (!id) return; |
||||
var dlyr = DynObject.all[id]; |
||||
var a = this._childAnchors[id]; |
||||
var tw = this.w; |
||||
var th = this.h; |
||||
if (a==null || (tw==null && th==null)) return; |
||||
|
||||
// anchoring/docking
|
||||
var fn=dynapi.functions; |
||||
var padX=0,padY=0; |
||||
if(a.topA) { |
||||
anc=fn.getAnchorLocation(a.topA,this); |
||||
if(anc){padY=anc.y; th=th-padY;} |
||||
} |
||||
if(a.leftA) { |
||||
anc=(a.leftA==a.topA && anc)? anc:fn.getAnchorLocation(a.leftA,this); |
||||
if(anc) {padX=anc.x; tw=tw-padX;} |
||||
} |
||||
if(a.bottomA) { |
||||
anc=fn.getAnchorLocation(a.bottomA,this); |
||||
th=th-(this.h-anc.y); |
||||
} |
||||
if(a.rightA) { |
||||
anc=(a.bottomA==a.rightA && anc)? anc:fn.getAnchorLocation(a.rightA,this); |
||||
if(anc) tw=tw-(this.w-anc.x);
|
||||
} |
||||
|
||||
var aleft=(tw>0 && a.left && typeof(a.left)=='string')? tw*(parseInt(a.left)/100):a.left; |
||||
var aright=(tw>0 && a.right && typeof(a.right)=='string')? tw*(parseInt(a.right)/100):a.right; |
||||
var atop=(th>0 && a.top && typeof(a.top)=='string')? th*(parseInt(a.top)/100):a.top; |
||||
var abottom=(th>0 && a.bottom && typeof(a.bottom)=='string')? th*(parseInt(a.bottom)/100):a.bottom; |
||||
var x = aleft; |
||||
var y = atop; |
||||
var w = null; |
||||
var h = null; |
||||
var dlyrWidth=dlyr.getWidth(); |
||||
var dlyrHeight=dlyr.getHeight(); |
||||
if (a.stretchH!=null) { |
||||
if(typeof(a.stretchH)!='string') w=a.stretchH; |
||||
else { |
||||
if(a.stretchH=='*') w = tw - ((aleft!=null)? aleft:0); |
||||
else w = tw*(parseInt(a.stretchH)/100); |
||||
} |
||||
dlyrWidth=w; |
||||
} |
||||
if (a.centerH!=null) { |
||||
x = Math.ceil(tw/2 - dlyrWidth/2 + a.centerH); |
||||
}else if (aright!=null) { |
||||
if (aleft!=null) w = (tw - aright) - aleft; |
||||
else x = (tw - dlyrWidth) - aright; |
||||
if(tw<=0 && x<0) x=null; // ns4 needs x>=0
|
||||
}
|
||||
if (a.stretchV!=null) { |
||||
if(typeof(a.stretchV)!='string') h=a.stretchV; |
||||
else { |
||||
if(a.stretchV=='*') h = th - ((atop!=null)? atop:0); |
||||
else h = th*(parseInt(a.stretchV)/100); |
||||
} |
||||
dlyrHeight=h; |
||||
}
|
||||
if (a.centerV!=null) { |
||||
y = Math.ceil(th/2 - dlyrHeight/2 + a.centerV); |
||||
}else if (abottom!=null) { |
||||
if (atop!=null) h = (th - abottom) - atop; |
||||
else y = (th - dlyrHeight) - abottom; |
||||
if(th<=0 && y<0) y=null; // ns4 needs y>=0
|
||||
} |
||||
if(padX) {x=(x)? x:0;x+=padX} |
||||
if(padY) {y=(y)? y:0;y+=padY} |
||||
|
||||
var tmp=dlyr._hasAnchor;
|
||||
dlyr._hasAnchor=false; // ignore anchor updates of this layer
|
||||
if(x!=null||y!=null) dlyr.setLocation(x,y); |
||||
if(w!=null||h!=null) dlyr.setSize(w,h); |
||||
dlyr._hasAnchor = tmp; // useful for preventing stack overflow
|
||||
}; |
||||
p._updateAnchors = function() { |
||||
var tw = this.w; |
||||
var th = this.h; |
||||
if (tw==null && th==null) return; |
||||
for (id in this._childAnchors) this._updateAnchor(id); |
||||
}; |
||||
|
||||
|
||||
// Bandwidth timer stop
|
||||
var ua=dynapi.ua; ua._bwe=new Date; |
||||
ua.broadband=((ua._bwe-ua._bws)<=1500)? true:false; |
||||
@ -1,306 +0,0 @@
@@ -1,306 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
DragEvent Class |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
*/ |
||||
|
||||
// DragEvent object
|
||||
function DragEvent(type,src) { |
||||
this.MouseEvent = MouseEvent; |
||||
this.MouseEvent(); |
||||
this.DynEvent(); |
||||
this.isDragging = false; |
||||
}; |
||||
var p = dynapi.setPrototype('DragEvent','MouseEvent'); |
||||
p.getX=function() {return this.x}; |
||||
p.getY=function() {return this.y}; |
||||
p.getPageX=function() {return this.pageX}; |
||||
p.getPageY=function() {return this.pageY}; |
||||
p.cancelDrag=function() {this.isDragging=false}; |
||||
|
||||
//DragEvent.dragPlay=0;
|
||||
|
||||
DragEvent.dragevent = new DragEvent(); |
||||
|
||||
DragEvent.lyrListener = { |
||||
onmousedown : function(e) { |
||||
var ic,o = e.getSource(); |
||||
//setup drag icon
|
||||
if(o._useDragIcon && o._dragIcon) { |
||||
ic=o._dragIcon; |
||||
ic._dragOrg = o; |
||||
ic.setLocation(o.getPageX(),o.getPageY()); |
||||
ic.setSize(o.w,o.h); |
||||
// if icon is fixed width then center at pointer
|
||||
if(ic.w!=o.w||ic.h!=o.h) ic.setLocation(e.getPageX()-(ic.w/2),e.getPageY()-(ic.h/2)); |
||||
} |
||||
DragEvent.startDrag(e,ic); |
||||
//e.preventDefault();
|
||||
} |
||||
}; |
||||
|
||||
DragEvent.startDrag = function(e,dlyr) { |
||||
var origdlyr = dlyr; |
||||
if (!dlyr) dlyr = e.getSource(); |
||||
|
||||
if (dynapi.ua.dom) { |
||||
dlyr.elm.ondragstart = function() { return false; }; |
||||
dlyr.elm.onselectstart = function() { return false; }; |
||||
} |
||||
|
||||
// Initialize dragEvent object
|
||||
var de=DragEvent.dragevent; |
||||
//de.bubble = true;
|
||||
de.src = dlyr; |
||||
de.origin = (origdlyr)? e.origin : dlyr; |
||||
de.x = e.getPageX()-dlyr.getPageX(); |
||||
de.y = e.getPageY()-dlyr.getPageY(); |
||||
de.pageX = e.getPageX(); |
||||
de.pageY = e.getPageY(); |
||||
de.parentPageX = dlyr.parent.getPageX(); |
||||
de.parentPageY = dlyr.parent.getPageY(); |
||||
de._mouseEvent = e._mouseEvent; |
||||
de._browserEvent = e._browserEvent; // ns4 only
|
||||
|
||||
de.isDragging = true; |
||||
|
||||
e.preventDefault(); |
||||
e.preventBubble(); |
||||
|
||||
//dlyr._dyndoc.addEventListener(DragEvent.docListener);
|
||||
|
||||
dlyr.invokeEvent("dragstart",de); |
||||
if(dlyr._dragOrg) { |
||||
dlyr.setVisible(true); |
||||
dlyr._dragOrg.invokeEvent("dragstart",e); |
||||
} |
||||
}; |
||||
|
||||
DragEvent.docListener = { |
||||
onmousemove : function(e) { |
||||
//var x = e.getPageX();
|
||||
//var y = e.getPageY();
|
||||
//dynapi.debug.status('drag move '+e.x+' '+e.y);
|
||||
|
||||
var de = DragEvent.dragevent; |
||||
if (de && de.isDragging) { |
||||
|
||||
|
||||
var lyr = de.src; |
||||
if (!lyr) return; |
||||
|
||||
// DS: what is this?
|
||||
// Detect if we should start the drag
|
||||
/*if(DragEvent.dragPlay==0 || (Math.abs(de.pageX-e.getPageX())-DragEvent.dragPlay>0) || (Math.abs(de.pageY-e.getPageY())-DragEvent.dragPlay>0)) { |
||||
de.isDragging=true; |
||||
de.src.invokeEvent("dragstart",de); |
||||
e.setBubble(de.bubble); |
||||
} |
||||
*/ |
||||
/*else if (!de.dragEnabled) { |
||||
// This allows 'cancelDrag' method to fire the mouseUp as if had been released by the user
|
||||
lyr.invokeEvent("mouseup"); |
||||
return; |
||||
}*/ |
||||
|
||||
// Properties
|
||||
de.type="dragmove"; |
||||
de.pageX=e.getPageX(); |
||||
de.pageY=e.getPageY(); |
||||
de._mouseEvent = e._mouseEvent; |
||||
de._browserEvent = e._browserEvent; // ns4 only
|
||||
|
||||
/*if (DragEvent.stopAtDocumentEdge) { |
||||
if (de.pageX<0) de.pageX = 0; |
||||
if (de.pageY<0) de.pageY = 0; |
||||
if (de.pageX>DynAPI.document.w) de.pageX = DynAPI.document.w; |
||||
if (de.pageY>DynAPI.document.h) de.pageY = DynAPI.document.h; |
||||
}*/ |
||||
|
||||
var x=de.pageX-de.parentPageX-de.x; |
||||
var y=de.pageY-de.parentPageY-de.y; |
||||
|
||||
// Respect boundary, if any
|
||||
if (lyr._dragBoundary) { |
||||
var dB = lyr._dragBoundary; |
||||
var t = dB.top; |
||||
var r = dB.right; |
||||
var b = dB.bottom; |
||||
var l = dB.left; |
||||
// prevent choppy dragging if child is greater than parent
|
||||
var pw = (lyr.parent.w>lyr.w)? lyr.parent.w-lyr.w:lyr.x; |
||||
var ph = (lyr.parent.h>lyr.h)? lyr.parent.h-lyr.h:lyr.y; |
||||
if (x<l) x = l; |
||||
else if (x>pw-r) x = pw-r; |
||||
if (y<t) y = t; |
||||
else if (y>ph-b) y = ph-b; |
||||
} |
||||
else if (lyr._dragBoundaryA) { |
||||
var dB = lyr._dragBoundaryA; |
||||
var b=dB[2]; |
||||
var r=dB[1]; |
||||
var l=dB[3]; |
||||
var t=dB[0]; |
||||
var w=lyr.w; |
||||
var h=lyr.h; |
||||
if (x<l) x=l; |
||||
else if (x+w>r) x=r-w; |
||||
if (y<t) y=t; |
||||
else if (y+h>b) y=b-h; |
||||
} |
||||
// Move dragged layer
|
||||
lyr.setLocation(x,y); |
||||
lyr.invokeEvent("dragmove",de); |
||||
// drag icon
|
||||
if(lyr._dragOrg) { |
||||
lyr._dragOrg.invokeEvent("dragmove",e); |
||||
} |
||||
|
||||
|
||||
if (lyr._dragStealth==false && lyr.parent.DragOver) { |
||||
lyr.parent.DragOver(lyr,e.getPageX(),e.getPageY()); |
||||
} |
||||
|
||||
e.preventDefault(); |
||||
e.preventBubble(); |
||||
} |
||||
}, |
||||
onmouseup : function(e) { |
||||
// Get, if any, the currently drag in process and the layer. If none, return
|
||||
var de=DragEvent.dragevent; |
||||
//de.bubble = true;
|
||||
if (!de) return; |
||||
var lyr=de.src; |
||||
if (!lyr) return; |
||||
|
||||
if (!de.isDragging) { |
||||
de.type="dragend"; |
||||
de.src=null; |
||||
//e.setBubble(true);
|
||||
return; |
||||
} |
||||
if (dynapi.ua.ie) lyr.doc.body.onselectstart = null; |
||||
|
||||
// Avoid click for the dragged layer ( with MouseEvent addition )
|
||||
if (dynapi.ua.def) dynapi.wasDragging=true; |
||||
if (lyr.parent.DragDrop) lyr.parent.DragDrop(lyr,e.getPageX(),e.getPageY());
|
||||
|
||||
// Properties for the event
|
||||
de.type="dragend"; |
||||
de.isDragging=false; |
||||
lyr.invokeEvent("dragend",de); |
||||
// drag icon
|
||||
if(lyr._dragOrg) { |
||||
lyr.setVisible(false); |
||||
lyr._dragOrg.invokeEvent("dragend",de); |
||||
} |
||||
|
||||
|
||||
// Clean drag stuff
|
||||
de.src=null; |
||||
//e.preventDefault();
|
||||
e.preventBubble(); |
||||
|
||||
//lyr._dyndoc.removeEventListener(DragEvent.docListener);
|
||||
} |
||||
}; |
||||
DragEvent.stopAtDocumentEdge = true; |
||||
DragEvent.setDragBoundary=function(lyr,t,r,b,l) { |
||||
if (!lyr) {dynapi.debug.print("Error: no object passed to DragEvent.setDragBoundary()"); return;} |
||||
var a=arguments; |
||||
if (a.length==0) return; |
||||
if (a.length==1) { |
||||
lyr._dragBoundary = {left:0,right:0,top:0,bottom:0}; |
||||
} |
||||
if (a.length==2) { |
||||
lyr._dragBoundary = arguments[1]; |
||||
} |
||||
else if (a.length==5) lyr._dragBoundaryA = [t,r,b,l]; |
||||
}; |
||||
DragEvent.enableDragEvents=function() { |
||||
for (var i=0;i<arguments.length;i++) { |
||||
var lyr=arguments[i]; |
||||
if (!lyr) {dynapi.debug.print("Error: no object passed to DragEvent.enableDragEvents()"); return;} |
||||
if (lyr.isClass('DynLayer')) lyr.addEventListener(DragEvent.lyrListener); |
||||
} |
||||
dynapi.document.addEventListener(DragEvent.docListener); |
||||
dynapi.document.captureMouseEvents(); |
||||
}; |
||||
DragEvent.disableDragEvents=function() { |
||||
for (var i=0;i<arguments.length;i++) { |
||||
var lyr=arguments[i]; |
||||
lyr.removeEventListener(DragEvent.lyrListener); |
||||
} |
||||
}; |
||||
|
||||
// used mainly inside ondrop and ondragover
|
||||
DynLayer.prototype.getDragSource = function(){ |
||||
return this._dragOrg||this; |
||||
}; |
||||
DynLayer.prototype.setDragEnabled = function(b,boundry,useIcon){ |
||||
if(!self.DragEvent) return false; |
||||
if(boundry)DragEvent.setDragBoundary(this,boundry); |
||||
if (b) DragEvent.enableDragEvents(this); |
||||
else DragEvent.disableDragEvents(this); |
||||
this._useDragIcon = useIcon; |
||||
return true;
|
||||
}; |
||||
DynLayer.prototype.setDragIcon = function(icon){ |
||||
if(!icon) return; |
||||
this._dragIcon = icon; |
||||
icon.setZIndex({topmost:true}); |
||||
icon.setVisible(false); |
||||
dynapi.document.addChild(icon); |
||||
}; |
||||
DynLayer.prototype.setDragOverStealthMode = function(b){ |
||||
this._dragStealth=(b)? true:false; |
||||
}; |
||||
|
||||
// Enable ondrop event
|
||||
DynElement.prototype.DragDrop=function(s,mX,mY){
|
||||
if (!this.children.length) return false; |
||||
var ch,chX,sX,sY; |
||||
for (var i in this.children) {
|
||||
ch=this.children[i];
|
||||
if(!ch._hasDragEvents) ch.DragDrop(s,mX,mY); |
||||
else { |
||||
chX=ch.getPageX(); |
||||
chY=ch.getPageY();
|
||||
//sX=s.getPageX();
|
||||
//sY=s.getPageY();
|
||||
//if (chX<sX && chX+ch.w>sX+s.w && chY<sY && chY+ch.h>sY+s.h) {
|
||||
if ((mX>=chX && mX<=chX+ch.w) && (mY>=chY && mY<=chY+ch.h)) {
|
||||
if (ch.DragDrop(s,mX,mY)) return true;
|
||||
ch.invokeEvent("drop",null,s);
|
||||
return true;
|
||||
} |
||||
} |
||||
} |
||||
return false;
|
||||
}; |
||||
|
||||
// Enable ondragover event
|
||||
DynElement.prototype.DragOver=function(s,mX,mY){
|
||||
if (!this.children.length) return false; |
||||
var ch,chX,sX,sY; |
||||
for (var i in this.children) {
|
||||
ch=this.children[i];
|
||||
if (!ch._hasDragEvents) ch.DragOver(s,mX,mY); |
||||
else { |
||||
chX=ch.getPageX(); |
||||
chY=ch.getPageY();
|
||||
if ((mX>=chX && mX<=chX+ch.w) && (mY>=chY && mY<=chY+ch.h)) {
|
||||
if (ch.DragOver(s,mX,mY)) return true; |
||||
ch._isDragOver=true; |
||||
ch.invokeEvent("dragover",null,s);
|
||||
return true;
|
||||
}else if (ch._isDragOver) { |
||||
ch._isDragOver=false; |
||||
ch.invokeEvent("dragout",null,s);
|
||||
} |
||||
} |
||||
} |
||||
return false;
|
||||
}; |
||||
|
||||
@ -1,238 +0,0 @@
@@ -1,238 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
DynKeyEvent Extensions |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
Requirements: |
||||
dynapi.api |
||||
*/ |
||||
function DynKeyEvent(type,src) { |
||||
this.DynEvent = DynEvent; |
||||
this.DynEvent(type,src); |
||||
this.charKey=null; |
||||
}; |
||||
var p=dynapi.setPrototype('DynKeyEvent','DynEvent'); |
||||
p.getKey=function() { |
||||
return this.charKey; |
||||
}; |
||||
DynKeyEvent._keyEventListener=function(e) { |
||||
var dynobj=this._dynobj; |
||||
if(!dynobj) return true; |
||||
var dyndoc=dynobj.doc._dynobj; |
||||
if(!dyndoc) return true; |
||||
if(!e) var e=dyndoc.frame.event; |
||||
|
||||
var evt=new DynKeyEvent(e.type,dynobj); |
||||
evt.which=(e.keyCode)?e.keyCode:e.which; |
||||
var key=String.fromCharCode(evt.which).toLowerCase(); |
||||
if((key>='a'&&key<='z')||(key>='0'&&key<='9')) evt.charKey=key; |
||||
evt.spaceKey=(evt.which==32); |
||||
evt.enterKey=(evt.which==13); |
||||
evt.tabKey=(evt.which==9||evt.which==65289); |
||||
evt.leftKey=(evt.which==37||evt.which==52||evt.which==100||evt.which==65460); |
||||
evt.rightKey=(evt.which==39||evt.which==54||evt.which==102||evt.which==65462); |
||||
evt.upKey=(evt.which==38||evt.which==56||evt.which==104||evt.which==65464); |
||||
evt.downKey=(evt.which==40||evt.which==50||evt.which==98||evt.which==65458); |
||||
evt.altKey=(e.modifiers)?false:(e.altKey||e.altLeft||evt.which==18||evt.which==57388); |
||||
evt.ctrlKey=(e.modifiers)?(e.modifiers&Event.CONTROL_MASK):(e.ctrlKey||e.ctrlLeft||evt.which==17||evt.which==57391); |
||||
evt.shiftKey=(e.modifiers)?(e.modifiers&Event.SHIFT_MASK):(e.shiftKey||e.shiftLeft||evt.which==16||evt.which==57390); |
||||
|
||||
dynobj.invokeEvent(evt.type,evt); |
||||
if(evt.defaultValue==false) { |
||||
if(e.cancelBubble) e.cancelBubble=true; |
||||
if(e.stopPropagation) e.stopPropagation(); |
||||
} |
||||
return evt.defaultValue; |
||||
}; |
||||
|
||||
TabManager={}; |
||||
TabManager._c=0; // Current tab manager index.
|
||||
TabManager._all=[]; |
||||
TabManager._active=false; |
||||
TabManager._activeTimeout=function() { // Prevent duplcate keydown events in NS4.
|
||||
TabManager._active=true; |
||||
setTimeout('TabManager._active=false;',25); |
||||
}; |
||||
TabManager._getForm=null; |
||||
TabManager.getForm=function(p) { // Prevent default tab focus in Mozilla.
|
||||
if(TabManager._getForm) return; |
||||
TabManager._getForm=p; |
||||
var html='<form name="__frm" onsubmit="return false;"><input name="__tab" size=1></form>'; |
||||
return p.addChild(new DynLayer(html),'__lyr'); |
||||
}; |
||||
TabManager._grabFocus=function() { |
||||
var form=TabManager._getForm.__lyr; |
||||
setTimeout(form+'.doc.forms.__frm.__tab.focus();',0); |
||||
}; |
||||
TabManager._el={}; |
||||
TabManager._el.onkeydown=function(e) { |
||||
if(TabManager._getForm) { // User must have inserted TabManager form.
|
||||
if(TabManager._active) return; |
||||
TabManager._activeTimeout(); |
||||
} |
||||
var i1,o1,l1,i2,o2,l2; |
||||
var nextKey=(e.tabKey||e.rightKey); |
||||
var prevKey=((e.shiftKey&&e.tabKey)||e.leftKey); |
||||
var submitKey=(e.enterKey||e.spaceKey); |
||||
i1=TabManager._c; o1=TabManager._all[i1]; l1=TabManager._all.length; |
||||
i2=o1._tabGroup._c; o2=o1._tabGroup._all[i2]; l2=o1._tabGroup._all.length; |
||||
if(nextKey||prevKey) { // Cycle group.
|
||||
if(o2._hasFocusEvents) o2.setFocus(false,o2._focusBubble); |
||||
else o2.invokeEvent('blur'); |
||||
if(prevKey) i2=(i2==0)?l2-1:i2-1; |
||||
else i2=(i2==l2-1)?0:i2+1; |
||||
o2=o1._tabGroup._all[i2]; o1._tabGroup._c=i2; |
||||
if(o2._hasFocusEvents) o2.setFocus(true,o2._focusBubble); |
||||
else o2.invokeEvent('focus'); |
||||
}
|
||||
else if(e.upKey||e.downKey) { // Cycle manager.
|
||||
if(o2._hasFocusEvents) o2.setFocus(false,o2._focusBubble); |
||||
else o2.invokeEvent('blur'); |
||||
if(e.upKey) i1=(i1==0)?l1-1:i1-1; |
||||
else i1=(i1==l1-1)?0:i1+1; |
||||
o1=TabManager._all[i1]; TabManager._c=i1; |
||||
i2=o1._tabGroup._c; |
||||
o2=o1._tabGroup._all[i2]; |
||||
if(o2._hasFocusEvents) o2.setFocus(true,o2._focusBubble); |
||||
else o2.invokeEvent('focus'); |
||||
} else if(submitKey) { |
||||
o2.invokeEvent('submit'); |
||||
} |
||||
e.preventDefault(); |
||||
if(TabManager._getForm) TabManager._grabFocus(); |
||||
}; |
||||
DynElement.prototype.createTabManager=function() { |
||||
var p=this, c=p.children; if(!c) return; |
||||
var args=(arguments.length)?arguments:c; |
||||
var l=args.length, s; if(!l) return; |
||||
if(p._tabGroup) delete p._tabGroup; |
||||
p._tabGroup={ _c:0, _all:[] }; |
||||
for(var i=0;i<l;i++) { |
||||
c=args[i]; |
||||
p._tabGroup._all[i]=c; |
||||
c._hasTabManager=true; |
||||
if(!c._submitFn) { |
||||
s=c.id.replace(/-/g,'.')+'()'; // Element id callback.
|
||||
c._submitFn=s; |
||||
} |
||||
} |
||||
l=TabManager._all.length; TabManager._all[l]=p; |
||||
if(l==0) dynapi.onLoad(function() { |
||||
dynapi.document.addEventListener(TabManager._el); |
||||
}); |
||||
}; |
||||
DynElement.prototype.updateTabManager=function() { |
||||
var tm=TabManager, all=tm._all[TabManager._c]; if(!all) return; |
||||
var old=all._tabGroup; if(!old||old._all[old._c]==this) return; |
||||
var p=this.parent, l; |
||||
var tg=(p&&p._tabGroup)?p._tabGroup:null; if(!tg) return; |
||||
l=tg._all.length; |
||||
for(var i=0;i<l;i++) if(tg._all[i]==this) { tg._c=i; break; } |
||||
l=tm._all.length; |
||||
for(var i=0;i<l;i++) if(tm._all[i]==p) { tm._c=i; break; } |
||||
}; |
||||
DynElement.prototype.addTabListeners=function(el) { |
||||
if(el&&this._tabGroup) { |
||||
var a=this._tabGroup._all; |
||||
for(var i in a) a[i].addEventListener(el); |
||||
} |
||||
}; |
||||
DynElement.prototype.addSubmitFn=function(fn) { |
||||
if(fn) this._submitFn=fn; |
||||
}; |
||||
DynElement.prototype.callSubmitFn=function() { |
||||
var f=this._submitFn; |
||||
if(typeof(f)=='function') f(); |
||||
else if(typeof(f)=='string') eval(f); |
||||
}; |
||||
|
||||
DynElement.prototype.captureKeyEvents=function() { |
||||
var elm=(this.getClassName()=='DynLayer')?this.elm:this.doc; |
||||
if(!elm||this._hasKeyEvents) return true; |
||||
if(elm.addEventListener) { |
||||
elm.addEventListener("keydown",DynKeyEvent._keyEventListener,false); |
||||
elm.addEventListener("keypress",DynKeyEvent._keyEventListener,false); |
||||
elm.addEventListener("keyup",DynKeyEvent._keyEventListener,false); |
||||
} |
||||
else { |
||||
if(elm.captureEvents) |
||||
elm.captureEvents(Event.KEYPRESS|Event.KEYDOWN|Event.KEYUP); |
||||
elm.onkeydown=elm.onkeypress=elm.onkeyup=DynKeyEvent._keyEventListener; |
||||
} |
||||
this._hasKeyEvents=true; |
||||
return false; |
||||
}; |
||||
DynElement.prototype.releaseKeyEvents=function() { |
||||
var elm=(this.getClassName()=='DynLayer')?this.elm:this.doc; |
||||
if(!elm||!this._hasKeyEvents) return true; |
||||
if(elm.removeEventListener) { |
||||
elm.removeEventListener("keydown",DynKeyEvent._keyEventListener,false); |
||||
elm.removeEventListener("keypress",DynKeyEvent._keyEventListener,false); |
||||
elm.removeEventListener("keyup",DynKeyEvent._keyEventListener,false); |
||||
} |
||||
else { |
||||
if(elm.releaseEvents) |
||||
elm.releaseEvents(Event.KEYPRESS|Event.KEYDOWN|Event.KEYUP); |
||||
elm.onkeydown=elm.onkeypress=elm.onkeyup=null; |
||||
} |
||||
this._hasKeyEvents=false; |
||||
return false; |
||||
}; |
||||
|
||||
DynDocument.prototype.captureHotKey = function(key,fn){ |
||||
var klst=((key+'').toLowerCase()).split('+'); |
||||
klst.sort(); |
||||
key=klst.join('+'); |
||||
if(!this._hotKeys){ |
||||
this._hotKeys={}; |
||||
this._keyDn={}; |
||||
this._keyLst=''; |
||||
this.captureKeyEvents(); |
||||
this.addEventListener({ |
||||
onkeydown:function(e){ |
||||
var k = e.which; |
||||
var o = e.getSource();
|
||||
// to-do: add opera v7 key code (57xxx), e.g 57388
|
||||
if (k==13) k="enter"; |
||||
else if(k==27) k="esc"; |
||||
else if(k==45) k="insert"; |
||||
else if(k==46) k="delete"; |
||||
else if(k==36) k="home"; |
||||
else if(k==35) k="end"; |
||||
else if(k==33) k="pgup"; |
||||
else if(k==34) k="pgdn"; |
||||
else if(k==38) k="up"; |
||||
else if(k==40) k="down"; |
||||
else if(k==37) k="left"; |
||||
else if(k==39) k="right";
|
||||
else if(e.altKey && !o._keyDn['alt']) k="alt"; |
||||
else if(e.ctrlKey && !o._keyDn['ctrl']) k="ctrl"; |
||||
else if(e.shiftKey && !o._keyDn['shift']) k="shift"; |
||||
else k=(String.fromCharCode(k)).toLowerCase(); |
||||
if(!o._keyDn[k]) { |
||||
// store new key in keyDn array
|
||||
o._keyLst+=(((o._keyLst)? '+':'')+k); // build key list
|
||||
var ar=o._keyLst.split('+'); |
||||
ar.sort(); |
||||
o._keyLst=ar.join('+'); |
||||
o._keyDn[k]=true; |
||||
} |
||||
k=o._hotKeys[o._keyLst]; |
||||
if(k){ |
||||
o._keyLst='';o._keyDn={}; |
||||
if(typeof(k)=='string') return eval(k); else return k(); |
||||
} |
||||
}, |
||||
onkeyup:function(e){ |
||||
var o=e.getSource();
|
||||
o._keyLst='';o._keyDn={}; |
||||
} |
||||
}); |
||||
} |
||||
this._hotKeys[key]=fn; |
||||
}; |
||||
DynDocument.prototype.releaseHotKey = function(key){ |
||||
if(this._hotKeys) delete this._hotKeys[key]; |
||||
}; |
||||
|
||||
@ -1,124 +0,0 @@
@@ -1,124 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
DynLayer Inline Extension |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
requires: dynapi.api.DynLayer |
||||
*/ |
||||
|
||||
var DynLayerInline = {}; |
||||
|
||||
DynLayer.getInline = function (id, p) { |
||||
var elm; |
||||
var pobj; |
||||
if (!p) pobj = dynapi.document; |
||||
else if (p.isClass && p.isClass('DynElement')) pobj = p; |
||||
|
||||
if (pobj) { |
||||
if (dynapi.ua.ns4) elm = pobj.doc.layers[id]; |
||||
else if (dynapi.ua.ie) elm = pobj.doc.all[id]; |
||||
else if (dynapi.ua.dom) elm = pobj.doc.getElementById(id); |
||||
} |
||||
if (!elm) return alert("DynLayerInline Error: did not find element "+id); |
||||
|
||||
var dlyr = new DynLayer(); |
||||
dlyr.setID(id); |
||||
dlyr.parent = pobj; |
||||
dlyr.elm = elm; |
||||
if (dynapi.ua.ns4) dlyr.doc = elm.document; |
||||
DynLayer._importInlineValues(dlyr); |
||||
DynLayer._assignElement(dlyr,elm); |
||||
DynElement._flagCreate(dlyr); |
||||
return dlyr; |
||||
}; |
||||
|
||||
DynLayer.prototype._createInline = function (divs) { |
||||
if (this.parent && !this.elm) { |
||||
var ch=this.children; |
||||
DynLayer._assignElement(this,null,divs); |
||||
DynLayer._importInlineValues(this); |
||||
for (var i=0;i<ch.length;i++) DynLayer._importInlineValues(ch[i]);
|
||||
DynElement._flagCreate(this); |
||||
} |
||||
}; |
||||
|
||||
DynLayer._importInlineValues = function(dlyr) { |
||||
if(dlyr && dlyr._noInlineValues) return; |
||||
if (dynapi.ua.def) { |
||||
if (dynapi.ua.ie) { |
||||
var css = dlyr.elm.currentStyle; |
||||
dlyr.x = parseInt(css.left); |
||||
dlyr.y = parseInt(css.top); |
||||
dlyr.w = dynapi.ua.ie4? css.pixelWidth : dlyr.elm.offsetWidth; |
||||
dlyr.h = dynapi.ua.ie4? css.pixelHeight : dlyr.elm.offsetHeight; |
||||
dlyr.bgImage = css.backgroundImage; |
||||
dlyr.bgColor = css.backgroundColor; |
||||
dlyr.html = dlyr.elm.innerHTML; |
||||
}
|
||||
else if (dynapi.ua.dom) { |
||||
var css = dlyr.elm.style; |
||||
dlyr.x = parseInt(dlyr.elm.offsetLeft); |
||||
dlyr.y = parseInt(dlyr.elm.offsetTop); |
||||
dlyr.w= dlyr.elm.offsetWidth; |
||||
dlyr.h= dlyr.elm.offsetHeight; |
||||
dlyr.bgImage = css.backgroundImage; |
||||
dlyr.bgColor = css.backgroundColor; |
||||
dlyr.html = dlyr.elm.innerHTML; |
||||
} |
||||
|
||||
} |
||||
else if (dynapi.ua.ns4) { |
||||
var css = dlyr.elm; |
||||
dlyr.x = parseInt(css.left); |
||||
dlyr.y = parseInt(css.top); |
||||
dlyr.w = css.clip.width; |
||||
dlyr.h = css.clip.height; |
||||
dlyr.clip = [css.clip.top,css.clip.right,css.clip.bottom,css.clip.left]; |
||||
dlyr.bgColor = dlyr.doc.bgColor!=''? dlyr.doc.bgColor : null; |
||||
dlyr.bgImage = css.background.src!=''? css.background.src : null; |
||||
dlyr.html = ''; |
||||
} |
||||
dlyr.z = css.zIndex; |
||||
var b = css.visibility; |
||||
dlyr.visible = (b=="inherit" || b=="show" || b=="visible" || b==""); |
||||
}; |
||||
|
||||
// Generate Blueprint
|
||||
DynElement.prototype.getBlueprint = function(type) { |
||||
var i,c,ht,str =[]; |
||||
var f,ch=this.children; |
||||
for(i=0;i<ch.length;i++) { |
||||
c = ch[i]; |
||||
DynElement._flagPreCreate(c); |
||||
ht=c.getOuterHTML(); |
||||
if(!type || type=='css') str[i]=ht; |
||||
else { |
||||
ht=ht.replace(/\'/g,'\\\''); |
||||
ht=ht.replace(/\r/g,'\\r'); |
||||
ht=ht.replace(/\n/g,'\\n'); |
||||
str[str.length]='_bw(\''+ht+'\');'; |
||||
} |
||||
} |
||||
if(!type || type=='css') str=str.join(''); |
||||
else str=str.join('\n'); |
||||
if(type=='css') { // generate style sheet from blueprints
|
||||
var ar=str.split('<div'); |
||||
for(i=0;i<ar.length;i++){ |
||||
ar[i]=ar[i].replace(/(.+)id="(.+)" style="(.+)"(.+)/g,'#$2 {$3}'); |
||||
} |
||||
str=ar.join(''); |
||||
} |
||||
return str; |
||||
}; |
||||
DynElement.prototype.generateBlueprint = function(type) { |
||||
var url=dynapi.library.path+'ext/blueprint.html'; |
||||
var win=window.open(url,'blueprint','width=500,height=350,scrollbars=no,status=no,toolbar=no'); |
||||
var f=win.document.forms['frm']; |
||||
f.txtout.value=this.getBlueprint(type); |
||||
}; |
||||
|
||||
// Blueprint Document write
|
||||
_bw = function(str){ |
||||
document.write(str); |
||||
}; |
||||
@ -1,135 +0,0 @@
@@ -1,135 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
MouseEvent Class |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
requires: dynapi.api.DynDocument |
||||
*/ |
||||
|
||||
function MouseEvent(dyndoc) { |
||||
this.DynEvent = DynEvent; |
||||
this.DynEvent(); |
||||
this.bubble = true; |
||||
this._mouseEvent = null; |
||||
this._relative = null; |
||||
this._dyndoc = dyndoc; |
||||
}; |
||||
var p = dynapi.setPrototype('MouseEvent','DynEvent'); |
||||
p.getX = function() {return this.x}; |
||||
p.getY = function() {return this.y}; |
||||
p.getPageX = function() {return this.pageX}; |
||||
p.getPageY = function() {return this.pageY}; |
||||
//p.trapMouseUp = dynapi.functions.Null;
|
||||
p.getRelative = function() {return this._relative}; |
||||
p.preventBubble = function() { |
||||
this.bubble = false; |
||||
}; |
||||
p.getButton = function() { |
||||
if (!this._mouseEvent) return "left"; |
||||
var b = this._mouseEvent.which; |
||||
if (b==2) return "middle"; |
||||
if (b==3) return "right"; |
||||
else return "left"; |
||||
}; |
||||
p._init = function(type,e,src) { |
||||
this.type = type; |
||||
this._mouseEvent = e; |
||||
this.origin = src; |
||||
this.bubbleChild = null; |
||||
this.defaultValue = true; |
||||
this.bubble = true; |
||||
}; |
||||
p._invoke = function() { |
||||
var o = this.origin; |
||||
o.invokeEvent(this.type,this); |
||||
}; |
||||
MouseEvent._getContainerLayerOf = function(element) { |
||||
if (!element) return null; |
||||
while (!element._dynobj && element.parentNode && element.parentNode!=element) { |
||||
element = element.parentNode; |
||||
} |
||||
return element._dynobj; |
||||
}; |
||||
MouseEvent._eventHandler = function(e) { |
||||
var dynobj = this._dynobj; |
||||
if (!dynobj) return true; |
||||
var dyndoc = dynobj._dyndoc; |
||||
var target = e.target; |
||||
|
||||
var me = dyndoc._mouseEvent; |
||||
var src = MouseEvent._getContainerLayerOf(target); |
||||
me._init(e.type,e,src); |
||||
var rel = e.relatedTarget; |
||||
var r = me._relative = MouseEvent._getContainerLayerOf(rel); |
||||
if (e.type=="mouseout" || e.type=="mouseover") { |
||||
if(!r && dynapi.ua.opera) return; //fix for #15
|
||||
if (r && (r==src||src.isParentOf(r))) return; // fix for #15
|
||||
if (r && (r==src.parent||r.isChildOf(src.parent))) me.bubble=false; |
||||
} |
||||
me.pageX = e.clientX; |
||||
me.pageY = e.clientY; |
||||
if(!src) return; |
||||
me.x = (me.pageX+(window.pageXOffset||0)) - src.getPageX(); //offsetX;
|
||||
me.y = (me.pageY+(window.pageYOffset||0)) - src.getPageY(); //offsetY;
|
||||
e.cancelBubble = true; |
||||
me._invoke(); |
||||
|
||||
var tn=(target.tagName+'').toLowerCase(); |
||||
|
||||
// fix for form elements inside drag-enabled layer #08
|
||||
if(e.type=='mousedown' && tn=='input'||tn=='textarea'||tn=='button') { |
||||
var de=dynapi.frame.DragEvent; |
||||
de=(de && de.dragevent)? de.dragevent:null; |
||||
if(de && de.isDragging) de.cancelDrag(); |
||||
} |
||||
|
||||
// prevent image dragging
|
||||
if(tn=='img' && typeof(target.onmousedown)!="function") { |
||||
target.onmousedown=dynapi.functions.False; |
||||
} |
||||
|
||||
// disable text select
|
||||
if (e.type=='mousedown' && src._textSelectable==false) { |
||||
e.preventDefault(); |
||||
return false; |
||||
} |
||||
|
||||
}; |
||||
|
||||
DynElement.prototype.disableContextMenu = function(){ |
||||
this._noContextMenu = true; |
||||
if(this.elm) this.elm.addEventListener("contextmenu",MouseEvent._eventHandler,false); |
||||
}; |
||||
DynElement.prototype.captureMouseEvents = function() { |
||||
this._hasMouseEvents = true; |
||||
var elm = (this.getClassName()=='DynDocument')? this.doc : this.elm; |
||||
if(elm) { |
||||
elm.addEventListener("mousemove",MouseEvent._eventHandler,false); |
||||
elm.addEventListener("mousedown",MouseEvent._eventHandler,false); |
||||
elm.addEventListener("mouseup",MouseEvent._eventHandler,false); |
||||
elm.addEventListener("mouseover",MouseEvent._eventHandler,false); |
||||
elm.addEventListener("mouseout",MouseEvent._eventHandler,false); |
||||
elm.addEventListener("click",MouseEvent._eventHandler,false); |
||||
elm.addEventListener("dblclick",MouseEvent._eventHandler,false); |
||||
if(this._noContextMenu) elm.addEventListener("contextmenu",MouseEvent._eventHandler,false); |
||||
} |
||||
}; |
||||
DynElement.prototype.releaseMouseEvents=function() { |
||||
this._hasMouseEvents = false; |
||||
var elm = (this.getClassName()=='DynDocument')? this.doc : this.elm; |
||||
if (typeof(elm)=='object') { |
||||
/* elm.removeEventListener("mousemove",MouseEvent._eventHandler,false); |
||||
elm.removeEventListener("mousedown",MouseEvent._eventHandler,false); |
||||
elm.removeEventListener("mouseup",MouseEvent._eventHandler,false); |
||||
elm.removeEventListener("mouseover",MouseEvent._eventHandler,false); |
||||
elm.removeEventListener("mouseout",MouseEvent._eventHandler,false); |
||||
elm.removeEventListener("click",MouseEvent._eventHandler,false); |
||||
elm.removeEventListener("dblclick",MouseEvent._eventHandler,false);*/ |
||||
} |
||||
}; |
||||
|
||||
function main_mouse_dom() {
|
||||
dynapi.document._mouseEvent = new MouseEvent(dynapi.document); |
||||
}; |
||||
if (!dynapi.loaded) main_mouse_dom(); |
||||
@ -1,124 +0,0 @@
@@ -1,124 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
MouseEvent Class |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
requires: dynapi.api.DynDocument |
||||
*/ |
||||
|
||||
function MouseEvent(dyndoc) { |
||||
this.DynEvent = DynEvent; |
||||
this.DynEvent(); |
||||
this.bubble = true; |
||||
this._mouseEvent = null; |
||||
this._relative = null; |
||||
this._dyndoc = dyndoc; |
||||
}; |
||||
var p = dynapi.setPrototype('MouseEvent','DynEvent'); |
||||
p.getX = function() {return this.x}; |
||||
p.getY = function() {return this.y}; |
||||
p.getPageX = function() {return this.pageX}; |
||||
p.getPageY = function() {return this.pageY}; |
||||
p.getRelative = function() {return this._relative}; |
||||
p.preventBubble = function() {this.bubble = false;}; |
||||
p.getButton = function() { |
||||
if (!this._mouseEvent) return "left"; |
||||
var b = this._mouseEvent.button; |
||||
if (b==4) return "middle"; |
||||
if (b==2) return "right"; |
||||
else return "left"; |
||||
}; |
||||
p._init = function(type,e,src) { |
||||
this.type = type; |
||||
this._mouseEvent = e; |
||||
this.origin = src; |
||||
this.bubbleChild = null; |
||||
this.defaultValue = true; |
||||
this.bubble = true; |
||||
}; |
||||
p._invoke = function() { |
||||
var o = this.origin; |
||||
o.invokeEvent(this.type,this); |
||||
}; |
||||
|
||||
MouseEvent._getContainerLayerOf = function(element) { |
||||
if (!element) return null; |
||||
while (!element._dynobj && element.parentElement && element.parentElement!=element) { |
||||
element = element.parentElement; |
||||
} |
||||
return element._dynobj; |
||||
}; |
||||
//MouseEvent.trapMouseUp = dynapi.functions.False; // or MouseEvent.trapMouseUp=null
|
||||
|
||||
MouseEvent._eventHandler = function() { |
||||
var e = dynapi.frame.event; |
||||
var dynobj; |
||||
if (this._dynobj) dynobj = this._dynobj; |
||||
else if (e.srcElement._dynobj) dynobj = e.srcElement._dynobj; |
||||
else dynobj = dynapi.document; |
||||
|
||||
var dyndoc = dynobj._dyndoc; |
||||
var target = e.srcElement; |
||||
|
||||
var me = dyndoc._mouseEvent; |
||||
var src = MouseEvent._getContainerLayerOf(target); |
||||
me._init(e.type,e,src); |
||||
|
||||
var rel = e.type=="mouseout"? e.toElement : e.fromElement; |
||||
var r = me._relative = MouseEvent._getContainerLayerOf(rel); |
||||
if (e.type=="mouseout" || e.type=="mouseover") { |
||||
if (r && src && (r==src||src.isParentOf(r))) return; //fix for #15 (ie only)
|
||||
if (r && src && (r==src.parent||r.isChildOf(src.parent))) me.bubble=false; |
||||
} |
||||
me.pageX = e.clientX; |
||||
me.pageY = e.clientY; |
||||
if(!src) return; |
||||
me.x = (me.pageX + (document.body.scrollLeft||0)) - src.getPageX(); //offsetX;
|
||||
me.y = (me.pageY + (document.body.scrollTop||0)) - src.getPageY(); //offsetY;
|
||||
e.cancelBubble = true; |
||||
me._invoke(); |
||||
|
||||
var tt=target.type; |
||||
var tn=(target.tagName+'').toLowerCase(); |
||||
|
||||
// fix for form elements inside drag-enabled layer #08
|
||||
if(tt=='textarea'||tt=='text' && target.onselectstart==null) target.onselectstart = dynapi.functions.Allow; |
||||
if(e.type=='mousedown' && tn=='input'||tn=='textarea'||tn=='button') { |
||||
var de=dynapi.frame.DragEvent; |
||||
de=(de && de.dragevent)? de.dragevent:null; |
||||
if(de && de.isDragging) de.cancelDrag(); |
||||
} |
||||
|
||||
// prevent image dragging
|
||||
if(target.tagName=='IMG' && typeof(target.ondragstart)!="function") { |
||||
target.ondragstart=dynapi.functions.False; |
||||
} |
||||
|
||||
}; |
||||
|
||||
DynElement.prototype.disableContextMenu = function(){ |
||||
this._noContextMenu = true; |
||||
if(this.elm) this.elm.oncontextmenu = dynapi.functions.False; |
||||
}; |
||||
DynElement.prototype.captureMouseEvents = function() { |
||||
this._hasMouseEvents = true; |
||||
if (this.elm) { |
||||
var elm = (this.getClassName()=='DynDocument')? this.doc : this.elm; |
||||
elm.onmouseover = elm.onmouseout = elm.onmousedown = elm.onmouseup = elm.onclick = elm.ondblclick = elm.onmousemove = MouseEvent._eventHandler; |
||||
if(this._noContextMenu) elm.oncontextmenu = dynapi.functions.False; |
||||
} |
||||
}; |
||||
DynElement.prototype.releaseMouseEvents = function() { |
||||
this._hasMouseEvents = false; |
||||
if (this.elm) { |
||||
var elm = (this.getClassName()=='DynDocument')? this.doc : this.elm; |
||||
elm.onmousedown = elm.onmouseup = elm.onclick = elm.ondblclick = null; |
||||
elm.oncontextmenu = null; |
||||
} |
||||
}; |
||||
|
||||
function main_mouse_ie() {
|
||||
dynapi.document._mouseEvent = new MouseEvent(dynapi.document);
|
||||
}; |
||||
if (!dynapi.loaded) main_mouse_ie(); |
||||
@ -1,434 +0,0 @@
@@ -1,434 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
DynObject, DynAPI Object, UserAgent, Library, Functions |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
*/ |
||||
|
||||
function DynObject() { |
||||
this.id = "DynObject"+DynObject._c++; |
||||
DynObject.all[this.id] = this; |
||||
}; |
||||
var p = DynObject.prototype; |
||||
p.getClassName = function() {return this._className}; |
||||
p.getClass = function() {return dynapi.frame[this._className]}; |
||||
p.isClass = function(n) {return DynObject.isClass(this._className,n)}; |
||||
p.addMethod = function(n,fn) {this[n] = fn}; |
||||
p.removeMethod = function(n) {this[n] = null}; |
||||
p.setID = function(id,isInline,noImports) { |
||||
if (this.id) delete DynObject.all[this.id]; |
||||
this.id = id; |
||||
this.isInline=isInline; |
||||
this._noInlineValues=noImports; |
||||
DynObject.all[this.id] = this; |
||||
}; |
||||
p.toString = function() {return "DynObject.all."+this.id}; |
||||
DynObject.all = []; |
||||
DynObject._c = 0; |
||||
DynObject.isClass = function(cn,n) { |
||||
if (cn == n) return true; |
||||
else { |
||||
var c = dynapi.frame[cn]; |
||||
var p = c.prototype._pClassName; |
||||
if (p) return DynObject.isClass(p,n); |
||||
else return false; |
||||
} |
||||
}; |
||||
|
||||
function _UserAgent() { |
||||
var b = navigator.appName; |
||||
var v = this.version = navigator.appVersion; |
||||
var ua = navigator.userAgent.toLowerCase(); |
||||
this.v = parseInt(v); |
||||
this.safari = ua.indexOf("safari")>-1; // always check for safari & opera
|
||||
this.opera = ua.indexOf("opera")>-1; // before ns or ie
|
||||
this.ns = !this.opera && !this.safari && (b=="Netscape"); |
||||
this.ie = !this.opera && (b=="Microsoft Internet Explorer"); |
||||
this.gecko = ua.indexOf('gecko')>-1; // check for gecko engine
|
||||
if (this.ns) { |
||||
this.ns4 = (this.v==4); |
||||
this.ns6 = (this.v>=5); |
||||
this.b = "Netscape"; |
||||
}else if (this.ie) { |
||||
this.ie4 = this.ie5 = this.ie55 = this.ie6 = false; |
||||
if (v.indexOf('MSIE 4')>0) {this.ie4 = true; this.v = 4;} |
||||
else if (v.indexOf('MSIE 5')>0) {this.ie5 = true; this.v = 5;} |
||||
else if (v.indexOf('MSIE 5.5')>0) {this.ie55 = true; this.v = 5.5;} |
||||
else if (v.indexOf('MSIE 6')>0) {this.ie6 = true; this.v = 6;} |
||||
this.b = "MSIE"; |
||||
}else if (this.opera) { |
||||
this.v=parseInt(ua.substr(ua.indexOf("opera")+6,1)); // set opera version
|
||||
this.opera6=(this.v>=6); |
||||
this.opera7=(this.v>=7); |
||||
this.b = "Opera"; |
||||
}else if (this.safari) { |
||||
this.ns6 = (this.v>=5); // ns6 compatible correct?
|
||||
this.b = "Safari"; |
||||
} |
||||
this.dom = (document.createElement && document.appendChild && document.getElementsByTagName)? true : false; |
||||
this.def = (this.ie||this.dom); |
||||
this.win32 = ua.indexOf("win")>-1; |
||||
this.mac = ua.indexOf("mac")>-1; |
||||
this.other = (!this.win32 && !this.mac); |
||||
this.supported = (this.def||this.ns4||this.ns6||this.opera)? true:false; |
||||
this.broadband=false; |
||||
this._bws=new Date; // bandwidth timer start
|
||||
}; |
||||
|
||||
function DynAPIObject() { |
||||
this.DynObject = DynObject; |
||||
this.DynObject(); |
||||
|
||||
this.version = '3.0.0-beta2'; |
||||
this.loaded = false; |
||||
|
||||
this.ua = new _UserAgent(); |
||||
|
||||
this._loadfn = []; |
||||
this._unloadfn = []; |
||||
var f = this.frame = window; |
||||
|
||||
var url = f.document.location.href; |
||||
url = url.substring(0,url.lastIndexOf('/')+1); |
||||
this.documentPath = url; |
||||
|
||||
var o = this; |
||||
|
||||
this.library = {}; |
||||
this.library.setPath = function(p) {o.library.path = p}; |
||||
|
||||
f.onload = function() { |
||||
o.loaded = true; |
||||
if (!o.ua.supported) return alert('Unsupported Browser. Exiting.'); |
||||
if (o.library._create) o.library._create(); // calls dynapi._onLoad() after loading necessary files
|
||||
else setTimeout(o+'._onLoad()',1); |
||||
}; |
||||
f.onunload = function() { |
||||
for (var i=0;i<o._unloadfn.length;i++) o._unloadfn[i](); |
||||
if (o.document) { |
||||
o.document._destroy(); |
||||
o.document = null; |
||||
} |
||||
}; |
||||
}; |
||||
p = DynAPIObject.prototype = new DynObject; |
||||
|
||||
p.onLoad = function(f) { |
||||
if (typeof(f)=="function") { |
||||
if (!this.loaded) this._loadfn[this._loadfn.length] = f; |
||||
else f(); |
||||
} |
||||
}; |
||||
p._onLoad = function(f) { |
||||
for (var i=0;i<this._loadfn.length;i++) this._loadfn[i](); |
||||
}; |
||||
p.onUnload = function(f) { |
||||
if (typeof(f)=="function") this._unloadfn[this._unloadfn.length] = f; |
||||
}; |
||||
p.setPrototype = function(sC,sP) { |
||||
var c = this.frame[sC]; |
||||
var p = this.frame[sP]; |
||||
if ((!c || !p) && this.ua.ns4 && this.library && this.library.elm) { |
||||
if (!c) c = this.library.elm[sC]; |
||||
if (!p) p = this.library.elm[sP]; |
||||
} |
||||
if (!c || !p) return alert('Prototype Error'); |
||||
c.prototype = new p(); |
||||
c.prototype._className = sC; |
||||
c.prototype._pClassName = sP; |
||||
c.toString = function() {return '['+sC+']'}; |
||||
return c.prototype; |
||||
}; |
||||
|
||||
var dynapi = new DynAPIObject(); |
||||
|
||||
dynapi.ximages={'__xCnTer__':0}; // eXtensible Images
|
||||
p._imageGetHTML=function(){ |
||||
t= '<img src="'+this.src+'"' |
||||
+((this.width)? ' width="'+this.width+'"':'') |
||||
+((this.height)? ' height="'+this.height+'"':'') |
||||
+' border="0">'; |
||||
return t; |
||||
}; |
||||
|
||||
dynapi.functions = { |
||||
removeFromArray : function(array, index, id) { |
||||
var which=(typeof(index)=="object")?index:array[index]; |
||||
if (id) delete array[which.id]; |
||||
else for (var i=0; i<array.length; i++) { |
||||
if (array[i]==which) { |
||||
if(array.splice) array.splice(i,1); |
||||
else { |
||||
for(var x=i; x<array.length-1; x++) array[x]=array[x+1]; |
||||
array.length -= 1; |
||||
} |
||||
break; |
||||
} |
||||
} |
||||
return array; |
||||
}, |
||||
removeFromObject : function(object, id) { |
||||
if(!dynapi.ua.opera) delete object[id]; |
||||
else { |
||||
var o={}; |
||||
for (var i in object) if(id!=i) o[i]=object[i]; |
||||
object=o; |
||||
} |
||||
return object; |
||||
}, |
||||
True : function() {return true}, |
||||
False : function() {return false}, |
||||
Null : function() {}, |
||||
Zero : function() {return 0;}, |
||||
Allow : function() { |
||||
event.cancelBubble = true; |
||||
return true; |
||||
}, |
||||
Deny : function() { |
||||
event.cancelBubble = false; |
||||
return false; |
||||
}, |
||||
getImage : function(src,w,h) { |
||||
img=(w!=null&&h!=null)? new Image(w,h) : new Image(); |
||||
img.src=src; |
||||
img.getHTML=dynapi._imageGetHTML; |
||||
return img; |
||||
}, |
||||
getURLArguments : function(o) { // pass a string or frame/layer object
|
||||
var url,l={}; |
||||
if (typeof(o)=="string") url = o; |
||||
else if (dynapi.ua.ns4 && o.src) url = o.src; |
||||
else if (o.document) url = o.document.location.href; |
||||
else return l; |
||||
var s = url.substring(url.indexOf('?')+1); |
||||
var a = s.split('&'); |
||||
for (var i=0;i<a.length;i++) { |
||||
var b = a[i].split('='); |
||||
l[b[0]] = unescape(b[1]); |
||||
} |
||||
return l; |
||||
}, |
||||
getAnchorLocation : function(a,lyr){ |
||||
var o,x=0,y=0; |
||||
if(lyr && !lyr.doc) lyr=null; |
||||
lyr=(lyr)? lyr:{doc:document,elm:document}; |
||||
if(typeof(a)=='string') { |
||||
if(lyr.doc.all) a=lyr.doc.all[a]; |
||||
else if(lyr.doc.getElementById) a=lyr.doc.getElementById(a); |
||||
else if(lyr.doc.layers) a=lyr.doc.anchors[a]; |
||||
} |
||||
if(a) o=a; |
||||
else return; |
||||
if(lyr.doc.layers) { y+=o.y; x+=o.x;} |
||||
else if(lyr.doc.getElementById || lyr.doc.all){ |
||||
while (o.offsetParent && lyr.elm!=o){ |
||||
x+= o.offsetLeft;y+= o.offsetTop; |
||||
o = o.offsetParent; |
||||
} |
||||
} |
||||
return {x:x,y:y,anchor:a}; |
||||
} |
||||
}; |
||||
|
||||
dynapi.documentArgs = dynapi.functions.getURLArguments(dynapi.frame); |
||||
|
||||
dynapi.debug = {}; |
||||
dynapi._debugBuffer = ''; |
||||
dPrint=function(s){var d=dynapi.debug; d.print(s)}; |
||||
dynapi.debug.print = function(s) { |
||||
//@IF:DEBUG[
|
||||
if(s==null) s=''; |
||||
dynapi._debugBuffer += s + '\n'; |
||||
//]:DEBUG
|
||||
}; |
||||
|
||||
// The DynAPI library system is optional, this can be removed if you want to include other scripts manually
|
||||
function DynAPILibrary() { |
||||
this.DynObject = DynObject; |
||||
this.DynObject(); |
||||
|
||||
// list of js files: this.scripts['../src/api/dynlayer_ie.js'] = {dep, objects, pkg, fn};
|
||||
this.scripts = {}; |
||||
|
||||
// list of package names: this.packages['dynapi.api'] = dynapi.api = {_objects,_path}
|
||||
this.packages = {}; |
||||
|
||||
// list of object names: this.objects['DynLayer'] = this.scripts['../src/api/dynlayer_ie.js']
|
||||
this.objects = {}; |
||||
|
||||
this._c = 0; |
||||
this.loadList = []; |
||||
this.loadIndex = -1; |
||||
this.path = null; |
||||
this.busy = true; |
||||
}; |
||||
p = dynapi.setPrototype('DynAPILibrary','DynObject'); |
||||
|
||||
// can return a path specific to a package, eg. dynapi.library.getPath('dynapi.api') returns '/src/dynapi/api/'
|
||||
p.getPath = function(pkg) { |
||||
if (!pkg) pkg = 'dynapi'; |
||||
if (this.packages[pkg]) return this.packages[pkg]._path; |
||||
return null; |
||||
}; |
||||
|
||||
// set dynapi path
|
||||
p.setPath = function(p,pkgFile) { |
||||
this.path = p; |
||||
|
||||
// to-do: rearrange so add()'s can be done before setPath
|
||||
// full paths will then be determined when queued
|
||||
// need an extra argument on addPackage to specify whether the path is relative to this.path or not
|
||||
// OR: add functionality so that these package definitions can be loaded/included on the fly
|
||||
|
||||
// load pkgFile or 'ext/packages.js' file
|
||||
var s='<script type="text/javascript" language="JavaScript" src="' |
||||
+((pkgFile)? pkgFile:p+'ext/packages.js')+'"><\/script>'; |
||||
document.write(s); |
||||
}; |
||||
|
||||
// adds package(s) to the library
|
||||
p.addPackage = function(pkg, path) { |
||||
var ps; |
||||
if (pkg.indexOf('.')) ps = pkg.split('.'); |
||||
else ps = [pkg]; |
||||
|
||||
var p = dynapi.frame; |
||||
for (var i=0;i<ps.length;i++) { // returns the package object (eg. dynapi.api), or creates it if non-existant
|
||||
if (!p[ps[i]]) p[ps[i]] = {}; |
||||
p = p[ps[i]]; |
||||
} |
||||
this.packages[pkg] = p; |
||||
p._objects = []; |
||||
p._path = path; |
||||
return p; |
||||
}; |
||||
|
||||
// add object(s) to the library
|
||||
p.add = function(name, src, dep, relSource) { |
||||
var objects = typeof(name)=="string"? [name] : name; |
||||
dep = (!dep)? [] : typeof(dep)=="string"? [dep] : dep; |
||||
|
||||
var s,p,pkg; |
||||
if (objects[0].indexOf('.')) { |
||||
pkg = objects[0].substring(0,objects[0].lastIndexOf('.')); |
||||
if (pkg && this.packages[pkg]) { |
||||
p = this.packages[pkg]; |
||||
if (relSource!=false) src = p._path + src; |
||||
} |
||||
} |
||||
if (!this.scripts[src]) s = this.scripts[src] = {}; |
||||
else s = this.scripts[src]; |
||||
s.objects = []; |
||||
s.dep = dep; |
||||
s.rdep = []; |
||||
s.src = src; |
||||
s.pkg = pkg; |
||||
s.loaded = false; |
||||
s.fn = null; |
||||
|
||||
var n; |
||||
for (var i=0;i<objects.length;i++) { |
||||
n = objects[i]; |
||||
if (pkg) n = n.substring(n.lastIndexOf('.')+1); |
||||
this.objects[n] = s; |
||||
s.objects[s.objects.length] = n; |
||||
if (p) p._objects[p._objects.length] = n; |
||||
} |
||||
|
||||
return s; |
||||
}; |
||||
// adds a dependency, whenever object "n" is loaded it will load object "d" beforehand
|
||||
p.addBefore = function(n, d) { |
||||
var s = this.objects[n]; |
||||
if (s && this.objects[d]) s.dep[s.dep.length] = d; |
||||
}; |
||||
// adds a reverse dependency, whenever object "n" is loaded it will load object "r" afterword
|
||||
p.addAfter = function(n, r) { |
||||
var s = this.objects[n]; |
||||
if (s && this.objects[r]) s.rdep[s.rdep.length] = r; |
||||
}; |
||||
|
||||
// returns a list of js source filenames to load
|
||||
p._queue = function(n, list, force) { |
||||
var na=[], names=[],o; |
||||
if (list==null) list = []; |
||||
if (typeof(n)=="string") na = [n]; |
||||
else na = n; |
||||
|
||||
for (var i=0;i<na.length;i++) { |
||||
o = na[i]; |
||||
if (typeof(o)=="string") { |
||||
if (this.packages[o]) |
||||
for (var j in this.packages[o]._objects) |
||||
names[names.length] = this.packages[o]._objects[j]; |
||||
else names[names.length] = o; |
||||
} |
||||
else if (typeof(o)=="object" && o.length) { |
||||
list = this._queue(o, list, force); |
||||
} |
||||
} |
||||
|
||||
var s; |
||||
for (var j=0;j<names.length;j++) { |
||||
s = this._queueObject(names[j], force); |
||||
if (s) { |
||||
if (s.dep) |
||||
for (var i=0;i<s.dep.length;i++) |
||||
list = this._queue(s.dep[i], list, force); |
||||
list[list.length] = s.src; |
||||
// also include reverse deps
|
||||
if (s.rdep.length) list = this._queue(s.rdep, list, force); |
||||
} |
||||
} |
||||
return list; |
||||
}; |
||||
|
||||
// determines whether to queue the script this object is in
|
||||
p._queueObject = function(n, f) { |
||||
if (n.indexOf('.')) { |
||||
var pkg = n.substring(0,n.lastIndexOf('.')); |
||||
if (this.packages[pkg]) n = n.substring(n.lastIndexOf('.')+1); |
||||
} |
||||
var s = this.objects[n]; |
||||
if (s) { |
||||
if (!s.queued) { |
||||
if (f!=true && s.loaded) dynapi.debug.print('Library Warning: '+n+' is already loaded'); |
||||
else { |
||||
s.queued = true; |
||||
s.loaded = false; |
||||
return s; |
||||
} |
||||
} |
||||
} |
||||
else dynapi.debug.print('Library Error: no library map for '+n); |
||||
return false; |
||||
}; |
||||
|
||||
// writes the <script> tag for the object
|
||||
p.include = function() { |
||||
var a = arguments; |
||||
if (a[0]==true) a=a[1]; // arguments used ONLY by packages.js
|
||||
// buffer includes until packages(.js) are loaded
|
||||
if (!this._pakLoaded) { |
||||
if(!this._buffer) this._buffer=[]; |
||||
this._buffer[this._buffer.length]=a; |
||||
return; |
||||
} |
||||
if (dynapi.loaded) this.load(a); |
||||
else { |
||||
var list = this._queue(a); |
||||
var src; |
||||
for (var i=0;i<list.length;i++) { |
||||
src = list[i]; |
||||
this.scripts[src].loaded = true; |
||||
dynapi.frame.document.write('<script type="text/javascript" language="JavaScript" src="'+src+'"><\/script>'); |
||||
} |
||||
} |
||||
}; |
||||
p.load = p.reload = p.loadScript = p.reloadScript = function(n) { |
||||
dynapi.debug.print('Warning: dynapi.library load extensions not included'); |
||||
}; |
||||
dynapi.library = new DynAPILibrary(); |
||||
|
||||
// deprecated
|
||||
var DynAPI = dynapi; |
||||
@ -1,27 +0,0 @@
@@ -1,27 +0,0 @@
|
||||
<html> |
||||
<head> |
||||
<title>Blueprint Output</title> |
||||
</head> |
||||
<body> |
||||
<!-- Used by the generateBluePrint() function --> |
||||
<form method="POST" action="--WEBBOT-SELF--" name="frm"> |
||||
<div align="center"> |
||||
<center> |
||||
<table border="0"> |
||||
<tr> |
||||
<td align="center"><font color="#000080" size="5"><b>DynAPI |
||||
Blueprint</b></font></td> |
||||
</tr> |
||||
<tr> |
||||
<td align="center"><textarea rows="14" name="txtout" cols="54" wrap="off">Loading... Pleas wait</textarea></td> |
||||
</tr> |
||||
<tr> |
||||
<td align="center"><input type="button" value="Close window" name="cmdclose" onclick="window.close()"></td> |
||||
</tr> |
||||
</table> |
||||
</center> |
||||
</div> |
||||
</form> |
||||
</body> |
||||
|
||||
</html> |
||||
@ -1,94 +0,0 @@
@@ -1,94 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
dynapi.functions.Color extension
|
||||
*/ |
||||
|
||||
var f = dynapi.functions; |
||||
f.Color = Color = {}; // used by dynapi.library
|
||||
|
||||
// Color Functions ---------------------------
|
||||
|
||||
f.DecToHex = function(val){ |
||||
lo=val%16; |
||||
val-=lo; |
||||
lo+=48; |
||||
if (lo>57) lo+=7; |
||||
hi=val/16; |
||||
hi+=48; |
||||
if (hi>57) hi+=7; |
||||
return String.fromCharCode(hi,lo); |
||||
}; |
||||
f.getColor = function(r,g,b) {
|
||||
return '#'+dynapi.functions.DecToHex(r)+dynapi.functions.DecToHex(g)+dynapi.functions.DecToHex(b); |
||||
}; |
||||
f.getRandomColor = function() { |
||||
var s = ''; |
||||
for (var i=0;i<3;i++) s += dynapi.functions.DecToHex(Math.floor(255*Math.random())); |
||||
return s; |
||||
}; |
||||
f.createRedPal = function(pal) { |
||||
var r=g=b=0; |
||||
for (var i=0; i<256; i++){ |
||||
pal[i]=dynapi.functions.getColor(r,g,b); |
||||
r+=8; |
||||
if (r>255) { r=255; g+=6; b+=2; } |
||||
if (g>255) { g=255; b+=2; } |
||||
if (b>255) { b=255; } |
||||
} |
||||
}; |
||||
f.createGrayPal = function(pal) { |
||||
var r=0; |
||||
for (var i=0; i<256; i++){ |
||||
pal[i]=dynapi.functions.getColor(r,r,r); |
||||
r+=4; |
||||
if (r>255) { r=255; } |
||||
} |
||||
}; |
||||
f.createBluePal = function(pal){ |
||||
var r=g=b=0; |
||||
for (var i=0; i<256; i++){ |
||||
pal[i]=dynapi.functions.getColor(r,g,b); |
||||
b+=6; |
||||
if (b>255) { b=255; g+=2; } |
||||
if (g>255) { g=255; r+=2; } |
||||
} |
||||
}; |
||||
f.createGreenPal = function(pal) { |
||||
var r=g=b=0; |
||||
for (var i=0; i<256; i++){ |
||||
pal[i]=dynapi.functions.getColor(r,g,b); |
||||
g+=6; |
||||
if (g>255) { g=255; b+=2; } |
||||
if (b>255) { b=255; r+=2; } |
||||
} |
||||
}; |
||||
f.fadeColor = function(from, to, percent){ |
||||
if(!from || !to) return; |
||||
if(percent<0) return from; |
||||
else if(percent>100) to; |
||||
|
||||
if(from.substring(0,1)!='#') from='#'+from; |
||||
if(to.substring(0,1)!='#') to='#'+to; |
||||
|
||||
from = { |
||||
red:parseInt(from.substring(1,3),16), |
||||
green:parseInt(from.substring(3,5),16), |
||||
blue:parseInt(from.substring(5,7),16) |
||||
} |
||||
|
||||
to = { |
||||
red:parseInt(to.substring(1,3),16), |
||||
green:parseInt(to.substring(3,5),16), |
||||
blue:parseInt(to.substring(5,7),16) |
||||
} |
||||
|
||||
var r=from.red+Math.round((percent/100)*(to.red-from.red)); |
||||
var g=from.green+Math.round((percent/100)*(to.green-from.green)); |
||||
var b=from.blue+Math.round((percent/100)*(to.blue-from.blue)); |
||||
|
||||
r = (r < 16 ? '0' : '') + r.toString(16); |
||||
g = (g < 16 ? '0' : '') + g.toString(16); |
||||
b = (b < 16 ? '0' : '') + b.toString(16); |
||||
|
||||
return '#' + r + g + b; |
||||
}; |
||||
@ -1,126 +0,0 @@
@@ -1,126 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
dynapi.functions.Date extension
|
||||
*/ |
||||
|
||||
var f = dynapi.functions; |
||||
f.Date = {}; // used by dynapi.library
|
||||
|
||||
// Date Functions --------------------------------------
|
||||
|
||||
f.dateAdd = function(interval,n,dt){ |
||||
if(!interval||!n||!dt) return;
|
||||
var s=1,m=1,h=1,dd=1,i=interval; |
||||
if(i=='month'||i=='year'){ |
||||
dt=new Date(dt); |
||||
if(i=='month') dt.setMonth(dt.getMonth()+n); |
||||
if(i=='year') dt.setFullYear(dt.getFullYear()+n);
|
||||
}else if (i=='second'||i=='minute'||i=='hour'||i=='day'){ |
||||
dt=Date.parse(dt); |
||||
if(isNaN(dt)) return; |
||||
if(i=='second') s=n; |
||||
if(i=='minute'){s=60;m=n} |
||||
if(i=='hour'){s=60;m=60;h=n}; |
||||
if(i=='day'){s=60;m=60;h=24;dd=n}; |
||||
dt+=((((1000*s)*m)*h)*dd); |
||||
dt=new Date(dt); |
||||
} |
||||
return dt; |
||||
}; |
||||
f.dateDiff=function(interval,dt1,dt2){ |
||||
if(!interval||!dt1||!dt2) return;
|
||||
var v,s=1,m=1,h=1,dd=1,i=interval;
|
||||
if(i=='month'||i=='year'){ |
||||
dt1=new Date(dt1); |
||||
dt2=new Date(dt2); |
||||
years=dt2.getFullYear()-dt1.getFullYear(); |
||||
if (i=='year') v=years; |
||||
else if(i=='month') { |
||||
v=(dt2.getMonth()+1)-(dt1.getMonth()+1); |
||||
if(years!=0) v+=(years*12);
|
||||
} |
||||
}else if (i=='second'||i=='minute'||i=='hour'||i=='day'){ |
||||
dt1=Date.parse(dt1); |
||||
dt2=Date.parse(dt2); |
||||
if(isNaN(dt1)||isNaN(dt2)) return; |
||||
v=dt2-dt1; |
||||
if(i=='second') s=1000; |
||||
if(i=='minute') s=60000; |
||||
if(i=='hour'){s=60000;m=60}; |
||||
if(i=='day'){s=60000;m=60;h=24;}; |
||||
v=((((v/s)/m)/h)/dd); |
||||
} |
||||
return v; |
||||
}; |
||||
f.formatDate = function(date,format){ |
||||
if(!date) return ''; |
||||
var dt=new Date(date); |
||||
var mm=dt.getMonth(); |
||||
var dd=dt.getDate(); |
||||
var day=dt.getDay(); |
||||
var yyyy=dt.getFullYear(); |
||||
var hh=dt.getHours(); |
||||
var nn=dt.getMinutes(); |
||||
var ss=dt.getSeconds(); |
||||
var ampm; |
||||
|
||||
var days=['Sunday','Monday','Teusday','Wednesday','Thursday','Friday','Saturday']; |
||||
var months=['January','February','March','April','May','June','July','August','September','October','November','December']; |
||||
|
||||
format=(format)? (format+'').toLowerCase():'dddd, mmmm dd, yyyy hh:nn:ss ampm'; |
||||
format=format.replace('mmmm',months[mm]); |
||||
format=format.replace('mmm',months[mm].substr(0,3)); |
||||
format=format.replace('mm',mm+1); |
||||
format=format.replace('dddd',days[day]); |
||||
format=format.replace('ddd',days[day].substr(0,3)); |
||||
format=format.replace('dd',dd); |
||||
format=format.replace('yyyy',yyyy); |
||||
if(format.indexOf('ampm')>0){ |
||||
if(hh>12) hh=hh-12; |
||||
if(hh<12) ampm='AM'; |
||||
else ampm='PM'; |
||||
format=format.replace('ampm',ampm); |
||||
} |
||||
format=format.replace('hh',hh); |
||||
format=format.replace('nn',nn); |
||||
format=format.replace('ss',ss); |
||||
|
||||
return format; |
||||
}; |
||||
f.getDayOfYear = function(dt){ |
||||
dt = new Date(dt); |
||||
if(isNaN(dt)) dt = new Date(); |
||||
var yr = new Date(dt.getFullYear(),0,1); |
||||
yr = yr.getTime() - (yr.getDay()-1)*(24*60*60*1000); |
||||
return(Math.ceil((dt.getTime() - yr)/(24*60*60*1000))); |
||||
}; |
||||
f.isDate = function(dt,format){ |
||||
if (!dt) return false; |
||||
var dd,mm,yyyy; |
||||
var isLeapYear,st=true,delim='/'; |
||||
dt+='';format=(format)? format+'':''; |
||||
if(dt.indexOf('/')>=0) delim='/'; |
||||
else if(dt.indexOf('-')>=0) delim='-'; |
||||
else if(dt.indexOf(' ')>=0) delim=' '; |
||||
dt=dt.split(delim); |
||||
if(format) format=format.replace(/\W/g,'/'); |
||||
else { |
||||
if (dt[0]>=1000) format='yyyy/mm/dd'; |
||||
else if (dt[0]>=12 && dt[1]<=12) format='dd/mm/yyyy'; |
||||
else if (dt[0]<=12 && dt[1]>=12) format='mm/dd/yyyy'; |
||||
}; |
||||
if(format=='yyyy/mm/dd'){yyyy=dt[0];mm=dt[1];dd=dt[2];} |
||||
else if(format=='mm/dd/yyyy'){mm=dt[0];dd=dt[1];yyyy=dt[2];} |
||||
else if(format=='dd/mm/yyyy'){dd=dt[0];mm=dt[1];yyyy=dt[2];} |
||||
if(isNaN(dd)||isNaN(mm)||isNaN(yyyy)) st=false; |
||||
else if(dd<1 || dd>31) st=false; |
||||
else if(yyyy>9999) st=false; |
||||
else if (mm < 1 || mm > 12) st=false; |
||||
else if((mm==4 || mm==6 || mm==9 || mm==11) && dd==31) st=false; |
||||
else if(mm==2) { // check for leap year and february 29th
|
||||
isLeapYear = (yyyy % 4 == 0 && (yyyy % 100 != 0 || yyyy % 400 == 0)); |
||||
if (dd > 29 || (dd==29 && !isLeapYear)) st=false; |
||||
} |
||||
return st; |
||||
}; |
||||
|
||||
@ -1,124 +0,0 @@
@@ -1,124 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
dynapi.functions.Image extension
|
||||
*/ |
||||
|
||||
var f = dynapi.functions; |
||||
f.Image = {}; // used by dynapi.library
|
||||
|
||||
// Image Functions ---------------------------
|
||||
|
||||
f._imgTTL = 30000; // Image Time To Load (ms)
|
||||
f.getImage = function(src,w,h,params) { |
||||
var img,name,p=params; |
||||
if(!p) name=src; |
||||
else name=(!p.alias)? src:p.alias; |
||||
img = dynapi.ximages[name]; |
||||
if(!img || (img && img.params!=params)){ // if user enters a new set of params then create a new image object
|
||||
img=dynapi.ximages[name] = (w!=null&&h!=null)? new Image(w,h) : new Image(); |
||||
img.w=w||null; |
||||
img.h=h||null; |
||||
img.src=src;img.params=p; |
||||
img.getHTML=dynapi._imageGetHTML; |
||||
img.reload=dynapi._imageReload; |
||||
img.dtStart=new Date(); |
||||
if(p) { |
||||
var f=dynapi.functions; |
||||
if(p.oversrc) f.getImage(p.oversrc); |
||||
if(p.downsrc) f.getImage(p.downsrc); |
||||
} |
||||
if(!this._imgTmr && this._imgProgFn) this._imageProgress(); |
||||
} |
||||
return img; |
||||
}; |
||||
f.getFailedImages = function(){ |
||||
var ar=[]; |
||||
for(i in dynapi.ximages){ |
||||
img=dynapi.ximages[i]; |
||||
if(img && img.failed) ar[ar.length]=img; |
||||
} |
||||
return ar; |
||||
}; |
||||
f.captureImageProgress=function(fn){ //fn = fn(completed,failed,total);
|
||||
this._imgProgFn=fn; |
||||
this._imageProgress(); |
||||
}; |
||||
f._imageProgress = function(){ |
||||
var i,c=0,f=0,t=0; |
||||
var img,dtEnd = new Date; |
||||
var fn=this._imgProgFn; |
||||
for(i in dynapi.ximages){ |
||||
img=dynapi.ximages[i]; |
||||
if(img && img.complete!=null){ |
||||
t++; |
||||
img.failed=(!img.complete && (dtEnd-img.dtStart)>this._imgTTL)? true:false; |
||||
if (img.complete) c++; |
||||
else if(img.failed) f++; |
||||
} |
||||
} |
||||
if(fn) fn(c,f,t); |
||||
if(c+f<t) this._imgTmr=window.setTimeout('dynapi.functions._imageProgress()',100); |
||||
else this._imgTmr=0; |
||||
}; |
||||
f.setImageTTL = function(ms){
|
||||
this._imgTTL=ms; |
||||
}; |
||||
|
||||
|
||||
dynapi._imageReload = function(){ |
||||
var t=this.src; |
||||
this.src=''; |
||||
this.src=t;
|
||||
this.dtStart=new Date(); |
||||
this.failed=false; |
||||
dynapi.functions._imageProgress(); |
||||
}; |
||||
dynapi._imageHookArray={}; |
||||
dynapi._imageHook=function(anc,id,img,act,iSrc){ |
||||
var rt,f,tf,p=dynapi._imageHookArray[id]; |
||||
if(img && iSrc) img.src = iSrc; |
||||
if(p) {
|
||||
f=p['on'+((act!='click')?'mouse':'')+act];tf=typeof(f); |
||||
if(f) rt=((tf=='string')? eval(f):f(act,anc,img,iSrc)); |
||||
if(anc && !dynapi.ua.ns4) anc.blur(); |
||||
} |
||||
return (!rt)? false:rt; |
||||
}; |
||||
dynapi._imageGetHTML=function(params){ |
||||
var c,i,t,text,dir,xtags=''; |
||||
var p=(params)? params:{}; |
||||
var lparams=(this.params)? this.params:{}; // opera can't do a for(i in object) on a null variable?
|
||||
var forbid =',width,height,alias,src,tooltip,link,text,textdir,' |
||||
+'oversrc,downsrc,onclick,onmouseover,onmouseout,onmouseup,onmousedown,'; |
||||
for(i in lparams) {if(p[i]==null) p[i]=lparams[i]}; |
||||
if(!p.name) p.name='XImage'+dynapi.ximages['__xCnTer__']++; |
||||
if(p.border==null) p.border=0; |
||||
// setup width & height
|
||||
if(this.width && this.w==null) this.w=this.width; |
||||
if(this.height && this.h==null) this.h=this.height; |
||||
text=p['text']; dir=p['textdir']; |
||||
t= '<img src="'+this.src+'"' |
||||
+((this.w)? ' width="'+this.w+'"':'') |
||||
+((this.h)? ' height="'+this.h+'"':'') |
||||
+((p['tooltip'])?' alt="'+p['tooltip']+'"':''); |
||||
c='return dynapi._imageHook(this,\''+p.name+'\','+((dynapi.ua.ns4)? '((this._dynobj)? this._dynobj.doc:document)':'document')+'.images[\''; |
||||
if(p.onclick) xtags=' onclick="'+c+p.name+'\'],\'click\');"'; |
||||
if(p.onmouseover||p.oversrc) xtags+=' onmouseover="'+c+p.name+'\'],\'over\',\''+((p.oversrc)?p.oversrc:'')+'\');"'; |
||||
if(p.onmouseout||p.oversrc) xtags+=' onmouseout="'+c+p.name+'\'],\'out\',\''+((p.oversrc)?this.src:'')+'\');"'; |
||||
if(p.onmousedown||p.downsrc) xtags+=' onmousedown="'+c+p.name+'\'],\'down\',\''+((p.downsrc)?p.downsrc:'')+'\');"'; |
||||
if(p.onmouseup||p.downsrc) xtags+=' onmouseup="'+c+p.name+'\'],\'up\',\''+((p.downsrc)?((p.oversrc)?p.oversrc:this.src):'')+'\');"'; |
||||
if(!p.link && (p.onclick||p.oversrc||p.downsrc)) p.link='javascript:;'; |
||||
if(!xtags && p.name.indexOf('XImage')==0) p.name=null; // remove name if not needed
|
||||
for(i in p){if(forbid.indexOf(','+i+',')<0 && p[i]!=null) t+=' '+i+'="'+p[i]+'"';}
|
||||
t+='>'; |
||||
if (text){ |
||||
dir=(dir)?(dir+'').toUpperCase():'E'; |
||||
if (dir=='N') t=text+'<br>'+t; |
||||
else if (dir=='S') t=t+'<br>'+text; |
||||
else if (dir=='E') t=t+text; |
||||
else if (dir=='W') t=text+t; |
||||
} |
||||
if(p.link) t='<a title="'+((p.tooltip)? p.tooltip:'')+'" href="'+p['link']+'"'+xtags+'>'+t+'</a>'; |
||||
if(xtags && p.name) dynapi._imageHookArray[p.name]=p; |
||||
return t; |
||||
}; |
||||
@ -1,85 +0,0 @@
@@ -1,85 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
dynapi.functions.Math extension
|
||||
|
||||
Math and Path functions |
||||
*/ |
||||
|
||||
var f = dynapi.functions; |
||||
f.Math = {}; // used by dynapi.library
|
||||
|
||||
// Math Functions --------------------------
|
||||
|
||||
f.radianToDegree = function(radian) { |
||||
return radian*180/Math.PI; |
||||
}; |
||||
f.degreeToRadian = function(degree) { |
||||
return degree*Math.PI/180; |
||||
}; |
||||
f.sintable = function(lsin) { |
||||
for (var i=0; i<361; i+=1) lsin[i]=Math.sin((i/180)*Math.PI); |
||||
}; |
||||
f.costable = function(lcos) { |
||||
for (var i=0; i<361; i+=1) lcos[i]=Math.cos((i/180)*Math.PI); |
||||
}; |
||||
f.getRandomNumber = function(n) { |
||||
var t=new Date(); |
||||
n=(n)? n: parseInt(Math.random()*10000); |
||||
return Math.round((Math.abs(Math.sin(t.getTime()))*(Math.random()*1000)))%n+1; |
||||
}; |
||||
f.getGUID = function() { // Globally Unique ID
|
||||
var n1,n2,n3,n4; |
||||
var l,r,m,c=Math.random()+''; |
||||
c=c.substr(c.indexOf('.')+1); |
||||
m=(c.length-1)/2; |
||||
l=c.substr(0,m); r=c.substr(m); |
||||
n1=this.getRandomNumber(1000); |
||||
n2=this.getRandomNumber(255);n3=this.getRandomNumber(255);n4=this.getRandomNumber(255); |
||||
n2 = (n2 < 16 ? '0' : '') + n2.toString(16); |
||||
n3 = (n3 < 16 ? '0' : '') + n3.toString(16); |
||||
n4 = (n4 < 16 ? '0' : '') + n4.toString(16);
|
||||
return (n1+n2+'-'+l+'-'+n3+n4+'-'+r).toUpperCase(); |
||||
}; |
||||
|
||||
// Path Functions ------------------------
|
||||
|
||||
// Combines separate [x1,x2],[y1,y2] arrays into a path array [x1,y1,x2,y2]
|
||||
f.interlacePaths = function (x,y) { |
||||
var l = Math.max(x.length,y.length); |
||||
var a = new Array(l*2); |
||||
for (var i=0; i<l; i++) { |
||||
a[i*2] = x[i]; |
||||
a[i*2+1] = y[i]; |
||||
} |
||||
return a; |
||||
}; |
||||
|
||||
// Returns correct angle in radians between 2 points
|
||||
f.getNormalizedAngle = function (x1,y1,x2,y2) { |
||||
var distx = Math.abs(x1-x2); |
||||
var disty = Math.abs(y1-y2); |
||||
if (distx==0 && disty==0) angle = 0; |
||||
else if (distx==0) angle = Math.PI/2; |
||||
else angle = Math.atan(disty/distx); |
||||
if (x1<x2) { |
||||
if (y1<y2) angle = Math.PI*2-angle; |
||||
} |
||||
else { |
||||
if (y1<y2) angle = Math.PI+angle; |
||||
else angle = Math.PI-angle; |
||||
} |
||||
return angle; |
||||
}; |
||||
|
||||
// Generates a path between 2 points in N steps
|
||||
f.generateLinePath = function(x1,y1,x2,y2,N) { |
||||
if (N==0) return []; |
||||
var dx = (x2 == x1)? 0 : (x2 - x1)/N; |
||||
var dy = (y2 == y1)? 0 : (y2 - y1)/N; |
||||
var path = new Array(); |
||||
for (var i=0;i<=N;i++) { |
||||
path[i*2] = Math.round(x1 + i*dx); |
||||
path[i*2+1] = Math.round(y1 + i*dy); |
||||
} |
||||
return path; |
||||
}; |
||||
@ -1,78 +0,0 @@
@@ -1,78 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
dynapi.functions.Numeric extension
|
||||
*/ |
||||
|
||||
var f = dynapi.functions; |
||||
f.Numeric = Numeric = {}; // used by dynapi.library
|
||||
|
||||
// Numeric Function ---------------------------------
|
||||
|
||||
f.formatNumber = function(n,format){ |
||||
if(isNaN(n)) return; |
||||
var i,c,f,comma,symbol='',sign='',decimals='',integers=''; |
||||
var fInt,fDec,nInt,nDec,len=0,cnt=0; |
||||
if(n<0) sign='-'; |
||||
n+='';if(sign) n=n.replace('-',''); |
||||
format=(format)? format+'':'#,##0.00'; |
||||
if(format.indexOf(',')>=0) comma=','; |
||||
if(format.indexOf('$')>=0) symbol='$'; |
||||
else if(format.indexOf('%')>=0) symbol='%'; |
||||
s=format.split('.'); |
||||
fInt=((s[0]==''||s[0]==null||s[0]=='undefinded')? '':s[0]); |
||||
fInt=fInt.split('').reverse().join(''); |
||||
fDec=(s[1]==''||s[1]==null||s[1]=='undefinded')? '':s[1]; |
||||
s=n.split('.'); |
||||
nInt=((s[0]==''||s[0]==null||s[0]=='undefinded')? '':s[0]); |
||||
nInt=nInt.split('').reverse().join('');; |
||||
nDec=(s[1]==''||s[1]==null||s[1]=='undefinded')? '':s[1]; |
||||
if (nInt) len=nInt.length; |
||||
if (fInt.length>len) len=fInt.length;
|
||||
for(i=0;i<len;i++){ |
||||
c=nInt.charAt(i); |
||||
f=fInt.charAt(i); |
||||
cnt++; |
||||
if (cnt==4 && comma && (c||f=='0')) integers+=comma; |
||||
if(f=='0' && !c) integers+='0'; |
||||
else if(c) integers+=c; |
||||
if (cnt==4) cnt=1; |
||||
} |
||||
if(fDec) len=fDec.length; |
||||
for(i=0;i<len;i++){ |
||||
c=nDec.charAt(i); |
||||
f=fDec.charAt(i); |
||||
if(f=='0' && !c) decimals+='0'; |
||||
else if((f=='#' || f=='0') && c) decimals+=c; |
||||
} |
||||
f=((integers+'').split('').reverse().join(''))+((decimals)? '.'+decimals:''); |
||||
if(symbol=='%') f+=symbol; |
||||
else f=symbol+f; |
||||
return sign+f; |
||||
}; |
||||
f.isFloat=function(n){ |
||||
if(typeof(n)=='number' && (n+'').indexOf('.')>=0) return true; |
||||
else return false; |
||||
}; |
||||
f.isInteger=function(n){ |
||||
if(typeof(n)=='number' && (n+'').indexOf('.')<0) return true; |
||||
else return false;; |
||||
}; |
||||
f.toInteger=function(dt){ |
||||
var vl; |
||||
if(!dt) return 0; |
||||
if(isNaN(dt)) vl=parseInt((dt+'').replace(/\,/g,'')); |
||||
else vl= parseInt(dt); |
||||
if (isNaN(vl)) vl = 0; |
||||
return vl; |
||||
}; |
||||
f.toFloat=function(dt){ |
||||
var vl; |
||||
if(!dt) return 0; |
||||
if(isNaN(dt)) vl=parseFloat((dt+'').replace(/\,/g,'')); |
||||
else vl = parseFloat(dt); |
||||
if (isNaN(vl)) vl = 0; |
||||
return vl; |
||||
}; |
||||
f.toBoolean = function(dt) { |
||||
return (dt=='true'||dt>=1)? true:false; |
||||
}; |
||||
@ -1,52 +0,0 @@
@@ -1,52 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
dynapi.functions.String extension
|
||||
*/ |
||||
|
||||
var f = dynapi.functions; |
||||
f.String = {}; // used by dynapi.library
|
||||
|
||||
|
||||
// String Functions --------------------------------
|
||||
|
||||
f.sprintf = function(t){ |
||||
var ar = arguments; |
||||
var i=1,inx = t.indexOf("%s"); |
||||
while(inx>=0){ |
||||
t = t.substr(0, inx) + ar[i++] + t.substr(inx+2); |
||||
inx = t.indexOf("%s"); |
||||
} |
||||
return t; |
||||
}; |
||||
f.strRepeat = function(s,n) { |
||||
if(!s) return ''; |
||||
var i,a=[]; |
||||
for(i=1;i<=n;i++){ |
||||
a[a.length]=s; |
||||
} |
||||
return a.join(''); |
||||
}; |
||||
f.strReverse = function(s) { |
||||
if(!s) return ''; |
||||
var a=(s+'').split(''); |
||||
a.reverse(); |
||||
return a.join(''); |
||||
}; |
||||
f.strStuff = function(s,v,index) { |
||||
if(!s) return '';
|
||||
if (index==null) s=s+v+''; |
||||
else { |
||||
var t1=t2=s+''; |
||||
s=t1.substr(0,index)+v+t2.substr(index,t2.length-index); |
||||
} |
||||
return s; |
||||
}; |
||||
f.trim = function(s,dir){ |
||||
if(!s) return; |
||||
else s+=''; // make sure s is a string
|
||||
dir=(dir)? dir:'<>'; |
||||
if(dir=='<'||dir=='<>') s=s.replace(/^(\s+)/g,''); |
||||
if(dir=='>'||dir=='<>') s=s.replace(/(\s+)$/g,''); |
||||
return s; |
||||
|
||||
}; |
||||
@ -1,87 +0,0 @@
@@ -1,87 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
dynapi.functions.System extension
|
||||
*/ |
||||
|
||||
var f = dynapi.functions; |
||||
f.System = System = {}; // used by dynapi.library
|
||||
|
||||
// System Functions ---------------------------------
|
||||
|
||||
f.coalesce=function(){ |
||||
var a,i; |
||||
for(i=0;arguments.length;i++){ |
||||
a=arguments[i]; |
||||
if(a!=null && a!='' && a!=undefined) return a; |
||||
} |
||||
} |
||||
f.choose = function(index){ |
||||
if(isNaN(index)) return; |
||||
if (arguments.length>index) return arguments[index+1]; |
||||
}; |
||||
f.cloneObject = function(src) { |
||||
if(!src) return; |
||||
var i,tar; |
||||
if(typeof(src)!='object') return src; |
||||
else { |
||||
if((src.constructor+'')==(Array+'')) tar=[]; |
||||
else if((src.constructor+'')==(Date+'')) return src; |
||||
else tar={}; |
||||
}; |
||||
for(i in src) { |
||||
if(typeof(src[i])!='object') tar[i]=src[i]; |
||||
else tar[i]=this.cloneObject(src[i]); |
||||
} |
||||
return tar; |
||||
}; |
||||
f.copyObject = function(from,to,noclone) { |
||||
var i; |
||||
if (to && !noclone) to=this.cloneObject(to); |
||||
else if(to && noclone) to=to; |
||||
else { |
||||
if(typeof(from)=='object') { |
||||
if((from.constructor+'')==(Array+'')) to=[]; |
||||
else if((from.constructor+'')==(Date+'')) return from; |
||||
else to={}; |
||||
}; |
||||
} |
||||
for(i in from) { |
||||
if(typeof(from[i])!='object') to[i]=from[i]; |
||||
else to[i]=this.copyObject(from[i],to[i],true); |
||||
} |
||||
return to; |
||||
}; |
||||
f.getElementById = function(id,parentLyr){ |
||||
if (document.all) return document.all[id]; |
||||
else if(document.getElementById) return document.getElementById(id); |
||||
else if(document.layers){ |
||||
var i,nLayers,layer; |
||||
parentLyr = (parentLyr)? parentLyr:document; |
||||
nLayers = parentLyr.layers; |
||||
for (i=0;i<nLayers;i++){ |
||||
layer=nLayers[i]; |
||||
if (layer.id == id) return layer; |
||||
else if (layer.layers.length){ |
||||
layer = this.getElementById(id,layer); |
||||
if (layer) return layer; |
||||
}
|
||||
} |
||||
} |
||||
}; |
||||
f.isNull=function(value,_default){ |
||||
if(value==null||value==''||value=='undefined') return _default; |
||||
else return value; |
||||
}; |
||||
f.lookUp = function(value,array){ |
||||
var i; if(!array) return; |
||||
for(i=0;i<array.length;i++){ |
||||
if(value==array[i]) return i; |
||||
} |
||||
}; |
||||
f.nullIf = function(){ |
||||
var a,i; |
||||
for(i=0;arguments.length;i++){ |
||||
a=arguments[i]; |
||||
if(a!=null && a!='' && a!=undefined) return null; |
||||
} |
||||
}; |
||||
|
Before Width: | Height: | Size: 267 B |
|
Before Width: | Height: | Size: 489 B |
|
Before Width: | Height: | Size: 514 B |
|
Before Width: | Height: | Size: 714 B |
|
Before Width: | Height: | Size: 795 B |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 950 B |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 615 B |
|
Before Width: | Height: | Size: 667 B |
|
Before Width: | Height: | Size: 406 B |
|
Before Width: | Height: | Size: 421 B |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 940 B |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 408 B |
|
Before Width: | Height: | Size: 426 B |
|
Before Width: | Height: | Size: 444 B |
|
Before Width: | Height: | Size: 454 B |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 962 B |
|
Before Width: | Height: | Size: 1.1 KiB |
@ -1,3 +0,0 @@
@@ -1,3 +0,0 @@
|
||||
<script> |
||||
dynapi.library._handleLoad(this); |
||||
</script> |
||||
@ -1,232 +0,0 @@
@@ -1,232 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
Dynamic Loading extension to dynapi.library |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
*/ |
||||
|
||||
// begin loading the object
|
||||
DynAPILibrary.prototype.load = function(n,fn) { |
||||
var list = this._queue(n,null,arguments[2]); |
||||
//return dynapi.debug.print('going to load: '+list);
|
||||
if (list.length) { |
||||
var s,src; |
||||
for (var i=0;i<list.length;i++) { |
||||
src = list[i]; |
||||
s = this.scripts[list[i]]; |
||||
if (i==list.length-1 && fn!=null) s.fn = fn; |
||||
this.loadList[this.loadList.length] = src; |
||||
} |
||||
this._load(); |
||||
} |
||||
else if (fn) fn(); |
||||
}; |
||||
|
||||
// reload the object
|
||||
DynAPILibrary.prototype.reload = function(n,fn,force) { |
||||
var s = this.objects[n]; |
||||
if (s) { |
||||
s.loaded = false; |
||||
this.load(n,fn,force); |
||||
} |
||||
}; |
||||
|
||||
// load a script that is not added to the library
|
||||
DynAPILibrary.prototype.loadScript = function(src,fn) { |
||||
if (!this.scripts[src]) { |
||||
var n = 'unnamed'+this._c++; |
||||
s = this.add(n,src); // generate a name for the script
|
||||
s.unnamed = true; |
||||
s.fn = null; |
||||
s.dep = []; |
||||
this.load(n,fn); |
||||
} |
||||
}; |
||||
|
||||
// reload a script
|
||||
DynAPILibrary.prototype.reloadScript = function(src,fn,force) { |
||||
var s=this.scripts[src]; |
||||
if(s) this.load(s.objects[0],fn,force); |
||||
} |
||||
|
||||
// inserts the script element into the page
|
||||
DynAPILibrary.prototype._load = function() { |
||||
if (this.busy) return; // dynapi.debug.print('Library Warning: busy');
|
||||
else { |
||||
if (this.loadIndex<this.loadList.length-1) { |
||||
this.busy = true; |
||||
this.loadIndex++; |
||||
var src = this.loadList[this.loadIndex]; |
||||
//if (!confirm('load: '+src+' ?')) return;
|
||||
var rsrc = src + '?'+Math.random(); // random ensures cached files are not loaded
|
||||
var s = this.scripts[src]; |
||||
if (dynapi.ua.ns4) { |
||||
// delete the constructors
|
||||
for (var j=0;j<s.objects.length;j++) { |
||||
var n = s.objects[j]; |
||||
if (dynapi.frame[n]) { |
||||
dynapi.frame[n] = null; |
||||
if (s.pkg) dynapi.frame[s.pkg+'.'+n] = null; |
||||
} |
||||
} |
||||
//NS4 does not like "/" inside the ?name=value
|
||||
src=src.replace(/\//g,'+'); //substitute "/" for "+"
|
||||
this.elm.src = dynapi._path+'ext/library.html?js='+src; |
||||
} |
||||
else if (dynapi.ua.ie && (dynapi.ua.v==4 || dynapi.ua.mac)) { |
||||
dynapi.frame.document.body.insertAdjacentHTML('beforeEnd','<script type="text/javascript" language="javascript" src="'+rsrc+'" defer><\/script>'); |
||||
this._export(src); |
||||
} |
||||
else { |
||||
var elm = s.elm = dynapi.frame.document.createElement('script'); |
||||
elm.src = rsrc; |
||||
elm.type = 'text/javascript'; |
||||
elm.defer = true; |
||||
if (dynapi.ua.ie) { |
||||
elm.C = 0; |
||||
var o = this; |
||||
elm.onreadystatechange = function() { |
||||
elm.C++; |
||||
if (elm.C==2 || elm.readyState=="complete") { // use 2nd statechange for onload
|
||||
o._export(src); |
||||
} |
||||
} |
||||
} |
||||
dynapi.frame.document.getElementsByTagName('head')[0].appendChild(elm); |
||||
|
||||
// I could not find way to know when the script is complete in Moz v0.9.3
|
||||
if (dynapi.ua.ns6) setTimeout(this+'._export("'+src+'")',100); |
||||
} |
||||
} |
||||
} |
||||
}; |
||||
|
||||
// executed after a script is finished loading, run main() functions
|
||||
DynAPILibrary.prototype._export = function(src) { |
||||
var src = this.loadList[this.loadIndex]; |
||||
var s = this.scripts[src]; |
||||
if (s) { |
||||
this._register(s); |
||||
|
||||
// run elm.main)() before global main()
|
||||
if (dynapi.ua.ns4 && typeof(this.elm.main)=="function") { |
||||
this.elm.main(); |
||||
this.elm.main = null; |
||||
} |
||||
|
||||
// run global main() if available
|
||||
if (typeof(main)=="function") { |
||||
main(); |
||||
main = null; |
||||
} |
||||
|
||||
// clear out all functions in the layer's scope
|
||||
if (dynapi.ua.ns4) { |
||||
for (var i in this.elm) { |
||||
if (typeof(this.elm[i])=="function") delete this.elm[i]; |
||||
} |
||||
} |
||||
this.busy = false; |
||||
|
||||
// load next file
|
||||
this._load(); |
||||
} |
||||
//else return alert('Library Error: unknown script '+src);
|
||||
}; |
||||
|
||||
// registers the script as loaded, exports the objects
|
||||
DynAPILibrary.prototype._register = function(s) { |
||||
//dynapi.debug.print('loaded "'+s.src+'"');
|
||||
s.loaded = true; |
||||
s.queued = false; |
||||
if (!s.unnamed) { |
||||
var n,found; |
||||
// loop through each object that the script contains
|
||||
for (var i=0;i<s.objects.length;i++) { |
||||
found = false; |
||||
n = s.objects[i]; |
||||
|
||||
// scope local objects in the layer to the DynAPI frame
|
||||
if (dynapi.ua.ns4 && this.elm && typeof(this.elm[n])!="undefined") { |
||||
dynapi.frame[n] = this.elm[n]; |
||||
found = true; |
||||
} |
||||
else if (typeof(dynapi.frame[n])!="undefined") found = true; |
||||
else if (n.indexOf('.')>0) { |
||||
var ns = n.split('.'), o = dynapi.frame, b = false; |
||||
for (var j=0;j<ns.length;j++) { |
||||
o = o[ns[j]]; |
||||
} |
||||
if (typeof(o)!="undefined") found = true; |
||||
} |
||||
else if (typeof(dynapi[n])!="undefined") found = true; |
||||
|
||||
if (found) { |
||||
if (s.pkg) { |
||||
// make package link: dynapi.api.DynLayer = DynLayer
|
||||
if (s.pkg!="dynapi") this.packages[s.pkg][n] = dynapi.frame[n]; |
||||
n = s.pkg+'.'+n; |
||||
} |
||||
dynapi.debug.print('loaded ['+n+']'); |
||||
} |
||||
else { |
||||
dynapi.debug.print('Library Error: could not find ['+n+']'); |
||||
} |
||||
} |
||||
} |
||||
// run handler if available
|
||||
if (s.fn) { |
||||
s.fn(); |
||||
delete s.fn; |
||||
} |
||||
}; |
||||
|
||||
// called from /lib/dynapi/library.html to write the <script>, NS4 only
|
||||
DynAPILibrary.prototype._handleLoad = function(elm) { |
||||
var args = dynapi.functions.getURLArguments(elm.src); |
||||
var js = args["js"]; |
||||
if (js) { |
||||
js=js.replace(/\+/g,'/'); // convert + to /
|
||||
if (js.indexOf('http')!=0) { |
||||
var l = dynapi.frame.document.location; |
||||
if (js.substr(0,1)=='/') js = l.port+'//'+host+src; |
||||
else js = dynapi.documentPath+js; |
||||
} |
||||
elm.document.write('<script type="text/javascript" language="JavaScript" src="'+js+'?r'+Math.random()+'"><\/script>'); |
||||
elm.document.close(); |
||||
elm.onload = function() { |
||||
dynapi.library._export(js); |
||||
} |
||||
} |
||||
}; |
||||
|
||||
// inserts the layer for NS4, register included scripts
|
||||
DynAPILibrary.prototype._create = function() { |
||||
// ensure a previous main function is wiped out
|
||||
if (typeof(main)=="function") main = null; |
||||
|
||||
// register objects from scripts included by dynapi.library.include() or manually
|
||||
var s,n; |
||||
for (var i in this.scripts) { |
||||
s = this.scripts[i]; |
||||
n=s.objects[0]; |
||||
if(s.pkg=='dynapi.functions') { // used to avoid conflicts with intrinsic objects such as String, Image, Date and Math objects
|
||||
if(dynapi.functions[n]) this._register(s); |
||||
} |
||||
else if (s.loaded || (s.objects[0] && dynapi.frame[s.objects[0]])) this._register(s); |
||||
} |
||||
|
||||
// create NS4 layer to load scripts into
|
||||
if (dynapi.ua.ns4) this.elm = new Layer(0, dynapi.frame); |
||||
this.busy = false; |
||||
|
||||
// load any scripts before proceeding
|
||||
if (this.loadList.length) { |
||||
var s = this.scripts[this.loadList[this.loadList.length-1]]; |
||||
s.fn = function() { |
||||
setTimeout('dynapi._onLoad()',1); |
||||
} |
||||
this._load(); |
||||
} |
||||
else setTimeout('dynapi._onLoad()',1); |
||||
}; |
||||
@ -1,146 +0,0 @@
@@ -1,146 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
Package File |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
*/ |
||||
|
||||
var l = dynapi.library; |
||||
var p = dynapi.library.path; |
||||
l._pakLoaded=true; |
||||
|
||||
l.addPackage('dynapi',p); |
||||
l.add('dynapi.library','ext/library.js'); |
||||
l.add('dynapi.debug','ext/debug.js','dynapi.functions.Image'); |
||||
|
||||
// Functions
|
||||
l.addPackage('dynapi.functions',p+'ext/'); |
||||
l.add('dynapi.functions.Color','functions.color.js'); |
||||
l.add('dynapi.functions.Math','functions.math.js'); |
||||
l.add('dynapi.functions.Date','functions.date.js'); |
||||
l.add('dynapi.functions.Image','functions.image.js',((dynapi.ua.ns4)? 'MouseEvent':null)); // ns4 required MouseEvent for Image functions
|
||||
l.add('dynapi.functions.Numeric','functions.numeric.js'); |
||||
l.add('dynapi.functions.String','functions.string.js'); |
||||
l.add('dynapi.functions.System','functions.system.js'); |
||||
|
||||
// API - Core Events & DynDocument
|
||||
l.addPackage('dynapi.api',p+'api/'); |
||||
l.add(['dynapi.api.DynEvent','dynapi.api.EventObject','dynapi.api.DynElement'],'event.js'); |
||||
l.add('dynapi.api.DynDocument','dyndocument.js','DynEvent'); |
||||
// DynLayer
|
||||
l.add('dynapi.api.DynLayerBase','dynlayer_base.js','DynDocument'); |
||||
if (dynapi.ua.ns4) l.add('dynapi.api.DynLayer','dynlayer_ns4.js','DynLayerBase'); |
||||
else if (dynapi.ua.ie) l.add('dynapi.api.DynLayer','dynlayer_ie.js','DynLayerBase'); |
||||
else if (dynapi.ua.opera) l.add('dynapi.api.DynLayer','dynlayer_opera.js','DynLayerBase'); |
||||
else l.add('dynapi.api.DynLayer','dynlayer_dom.js','DynLayerBase'); |
||||
// MouseEvent
|
||||
if (dynapi.ua.ns4) l.add('dynapi.api.MouseEvent','mouse_ns4.js','DynLayer'); |
||||
else if(dynapi.ua.ie||dynapi.ua.opera) l.add('dynapi.api.MouseEvent','mouse_ie.js','DynLayer'); |
||||
else l.add('dynapi.api.MouseEvent','mouse_dom.js','DynLayer'); |
||||
|
||||
// Extensions
|
||||
l.addPackage('dynapi.api.ext',p+'api/ext/'); |
||||
l.add('dynapi.api.ext.DragEvent','dragevent.js','DynDocument'); |
||||
l.add(['dynapi.api.ext.DynKeyEvent','dynapi.api.ext.TabManager'],'dynkeyevent.js','DynLayer'); |
||||
l.add('dynapi.api.ext.DynLayerInline','dynlayer.inline.js','DynLayer'); |
||||
|
||||
// FX
|
||||
l.addPackage('dynapi.fx',p+'fx/'); |
||||
l.add('dynapi.fx.Thread','thread.js','DynLayer'); |
||||
l.add('dynapi.fx.PathAnimation','pathanim.js','Thread'); |
||||
l.add('dynapi.fx.SlideAnimation','slideanim.js','Thread'); |
||||
l.add('dynapi.fx.GlideAnimation','glideanim.js',['Thread','dynapi.functions.Math']); |
||||
l.add('dynapi.fx.CircleAnimation','circleanim.js',['Thread','dynapi.functions.Math']); |
||||
l.add('dynapi.fx.HoverAnimation','hoveranim.js',['Thread','dynapi.functions.Math']); |
||||
l.add('dynapi.fx.Bezier','bezier.js','Thread'); |
||||
l.add('dynapi.fx.TimerX','timerx.js','DynLayer'); |
||||
l.add('dynapi.fx.MotionX','motionx.js','DynLayer'); |
||||
l.add('dynapi.fx.SnapX','snapx.js','DynLayer'); |
||||
l.add('dynapi.fx.FlashSound','fsound.js','DynLayer'); |
||||
l.add('dynapi.fx.Fader','fader.js','DynLayer'); |
||||
l.add('dynapi.fx.Swiper','swiper.js','DynLayer'); |
||||
l.add('dynapi.fx.TextAnimation','textanim.js','DynLayer'); |
||||
|
||||
// GUI
|
||||
l.addPackage('dynapi.gui',p+'gui/'); |
||||
l.add('dynapi.gui.BorderManager','bordermanager.js','Highlighter'); |
||||
l.add('dynapi.gui.GroupManager','groupmanager.js','DynLayer'); |
||||
l.add('dynapi.gui.FocusManager','focusmanager.js','DynLayer'); |
||||
l.add('dynapi.gui.StyleManager','stylemanager.js','DynLayer');
|
||||
l.add('dynapi.gui.TemplateManager','templmngr.js','DynLayer'); |
||||
l.add('dynapi.gui.Frame','frame.js','Highlighter'); |
||||
l.add('dynapi.gui.PanelBar','panelbar.js','DynLayer'); |
||||
l.add('dynapi.gui.Label','label.js','DynLayer'); |
||||
l.add('dynapi.gui.NodeItem','nodeitem.js','DynLayer'); |
||||
l.add('dynapi.gui.List','list.js','Label'); |
||||
l.add('dynapi.gui.Tree','tree.js','DynLayer'); |
||||
// Components
|
||||
l.add('dynapi.gui.Highlighter','highlighter.js','DynLayer'); |
||||
l.add('dynapi.gui.ImageClip','imageclip.js','DynLayer'); |
||||
l.add('dynapi.gui.LoadPanel','loadpanel.js','DynLayer'); |
||||
l.add('dynapi.gui.Graphics','graphics.js','DynLayer'); |
||||
l.add('dynapi.gui.Button','button.js','ButtonStyle');
|
||||
l.add('dynapi.gui.Knob','knob.js',['KnobStyle','DragEvent']);
|
||||
l.add('dynapi.gui.ScrollBar','scrollbar.js',['Button','Knob','ScrollBarStyle']);
|
||||
l.add('dynapi.gui.ListBox','listbox.js',['ScrollBar','PoolManager','ListBoxStyle']); |
||||
l.add('dynapi.gui.Marquee','marquee.js','MarqueeStyle'); |
||||
l.add('dynapi.gui.RadioButton','radiobutton.js','RadioButtonStyle'); |
||||
l.add('dynapi.gui.CheckBox','checkbox.js','CheckBoxStyle'); |
||||
l.add('dynapi.gui.Explorer','explorer.js','ExplorerStyle'); |
||||
l.add('dynapi.gui.ViewPane','viewpane.js',['ScrollBar','ViewPaneStyle']); |
||||
l.add('dynapi.gui.ProgressBar','progressbar.js','ProgressBarStyle'); |
||||
l.add('dynapi.gui.Stacker','stacker.js','DynLayer'); |
||||
// Component Styles
|
||||
l.add('dynapi.gui.ButtonStyle','button.style.js',['StyleManager','BorderManager']); |
||||
l.add('dynapi.gui.ButtonFlatStyle','button.flatstyle.js',['StyleManager','BorderManager']); |
||||
l.add('dynapi.gui.ButtonImageStyle','button.imagestyle.js','StyleManager'); |
||||
l.add('dynapi.gui.KnobStyle','knob.style.js',['StyleManager','BorderManager']); |
||||
l.add('dynapi.gui.ScrollBarStyle','scrollbar.style.js','StyleManager'); |
||||
l.add('dynapi.gui.ListBoxStyle','listbox.style.js','StyleManager'); |
||||
l.add('dynapi.gui.MarqueeStyle','marquee.style.js','StyleManager'); |
||||
l.add('dynapi.gui.RadioButtonStyle','radiobutton.style.js','StyleManager'); |
||||
l.add('dynapi.gui.CheckBoxStyle','checkbox.style.js','StyleManager'); |
||||
l.add('dynapi.gui.ExplorerStyle','explorer.style.js','StyleManager'); |
||||
l.add('dynapi.gui.ExplorerBlockStyle','explorer.block.style.js','ExplorerStyle'); |
||||
l.add('dynapi.gui.ViewPaneStyle','viewpane.style.js',['StyleManager','BorderManager']); |
||||
l.add('dynapi.gui.ProgressBarStyle','progressbar.style.js',['StyleManager','BorderManager']); |
||||
// HTML Components
|
||||
l.add('dynapi.gui.HTMLButton','htmlbutton.js','HTMLComponent'); |
||||
l.add('dynapi.gui.HTMLComponent','htmlcomponent.js','DynElement'); |
||||
l.add('dynapi.gui.HTMLContainer','htmlcontainer.js','HTMLComponent'); |
||||
l.add('dynapi.gui.HTMLCalendar','htmlcalendar.js','HTMLContainer'); |
||||
l.add('dynapi.gui.HTMLCheckBox','htmlcheckbox.js','HTMLComponent'); |
||||
l.add('dynapi.gui.HTMLHyperLink','htmlhyperlink.js','HTMLComponent'); |
||||
l.add('dynapi.gui.HTMLRollover','htmlrollover.js',['HTMLHyperLink','Image']); |
||||
l.add('dynapi.gui.HTMLClock','htmlclock.js','HTMLContainer'); |
||||
l.add('dynapi.gui.HTMLMenu','htmlmenu.js','HTMLComponent'); |
||||
l.add('dynapi.gui.HTMLTextBox','htmltextbox.js','HTMLComponent'); |
||||
l.add('dynapi.gui.HTMLTextArea','htmltextarea.js','HTMLComponent'); |
||||
l.add('dynapi.gui.HTMLRadioButton','htmlradiobutton.js','HTMLComponent'); |
||||
l.add('dynapi.gui.HTMLFile','htmlfile.js','HTMLComponent'); |
||||
l.add('dynapi.gui.HTMLListbox','htmllistbox.js','HTMLComponent'); |
||||
l.add('dynapi.gui.HTMLDropDownMenu','htmldropdownmenu.js','HTMLListbox'); |
||||
l.add('dynapi.gui.HTMLDatePicker','htmldatepicker.js','HTMLComponent'); |
||||
l.add('dynapi.gui.HTMLProgressBar','htmlprogressbar.js','HTMLComponent'); |
||||
l.add('dynapi.gui.HTMLColorPicker','htmlcolorpicker.js','HTMLMenu'); |
||||
|
||||
// Util
|
||||
l.addPackage('dynapi.util',p+'util/'); |
||||
l.add('dynapi.util.Cookie','cookie.js'); |
||||
l.add('dynapi.util.IOElement','ioelement.js','DynLayer'); |
||||
l.add('dynapi.util.IOElementSoda','ioelement.soda.js',['Math','IOElement']); |
||||
l.add('dynapi.util.IOElementSync','ioelement.sync.js','IOElement'); |
||||
l.add('dynapi.util.DataSource','datasource.js','IOElement'); |
||||
l.add('dynapi.util.StringBuffer','stringbuffer.js','DynObject'); |
||||
l.add('dynapi.util.PoolManager','poolmanager.js'); |
||||
l.add('dynapi.util.FileReader','filereader.js','IOElementSync'); |
||||
|
||||
|
||||
|
||||
// Load buffered includes ---------
|
||||
if(l._buffer){ |
||||
var i,ar=l._buffer; |
||||
for(i=0;i<ar.length;i++) l.include(true,ar[i]); // pass agruments true and bufferedAgruments
|
||||
l._buffer=null; |
||||
} |
||||
|
||||
@ -1,75 +0,0 @@
@@ -1,75 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
Bezier Class |
||||
|
||||
Bezier Algorithm Reference: http://astronomy.swin.edu.au/~pbourke/curves/bezier/
|
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
requires: dynapi.fx.Thread |
||||
*/ |
||||
|
||||
|
||||
function Bezier(cp, n) { |
||||
var l = cp.length; |
||||
var p = []; |
||||
for (var i=0; i<n; i++) p = p.concat(Bezier._plot(cp,i/n)); |
||||
return p.concat([cp[l-2],cp[l-1]]); |
||||
} |
||||
|
||||
Bezier._plot = function (cp, mu) { |
||||
var n = (cp.length/2)-1; |
||||
var k,kn,nn,nkn; |
||||
var blend; |
||||
var b = [0,0]; |
||||
|
||||
var muk = 1; |
||||
var munk = Math.pow(1-mu, n); |
||||
|
||||
for (k=0;k<=n;k++) { |
||||
nn = n; |
||||
kn = k; |
||||
nkn = n - k; |
||||
blend = muk * munk; |
||||
muk *= mu; |
||||
munk /= (1-mu); |
||||
while (nn >= 1) { |
||||
blend *= nn; |
||||
nn--; |
||||
if (kn > 1) { |
||||
blend /= kn; |
||||
kn--; |
||||
} |
||||
if (nkn > 1) { |
||||
blend /= nkn; |
||||
nkn--; |
||||
} |
||||
} |
||||
|
||||
b[0] += cp[k*2] * blend; |
||||
b[1] += cp[k*2+1] * blend; |
||||
} |
||||
b[0] = Math.round(b[0]); |
||||
b[1] = Math.round(b[1]); |
||||
return b; |
||||
} |
||||
|
||||
/*function Bezier3(cp,mu) { |
||||
var x1=cp[0],y1=cp[1],x2=cp[2],y2=cp[3],x3=cp[4],y3=cp[5]; |
||||
var mu2 = mu * mu; |
||||
var mum1 = 1 - mu; |
||||
var mum12 = mum1 * mum1; |
||||
var x = Math.round(x1 * mum12 + 2 * x2 * mum1 * mu + x3 * mu2); |
||||
var y = Math.round(y1 * mum12 + 2 * y2 * mum1 * mu + y3 * mu2); |
||||
return [x,y]; |
||||
} |
||||
|
||||
function Bezier4(cp,mu) { |
||||
var x1=cp[0],y1=cp[1],x2=cp[2],y2=cp[3],x3=cp[4],y3=cp[5],x4=cp[6],y4=cp[7]; |
||||
var mum1 = 1 - mu; |
||||
var mum13 = mum1 * mum1 * mum1; |
||||
var mu3 = mu * mu * mu; |
||||
var x = Math.round(mum13*x1 + 3*mu*mum1*mum1*x2 + 3*mu*mu*mum1*x3 + mu3*x4); |
||||
var y = Math.round(mum13*y1 + 3*mu*mum1*mum1*y2 + 3*mu*mu*mum1*y3 + mu3*y4); |
||||
return [x,y]; |
||||
}*/ |
||||
@ -1,91 +0,0 @@
@@ -1,91 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
CircleAnimation Class |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
requires: dynapi.functions.Math,dynapi.fx.Thread |
||||
*/ |
||||
|
||||
function CircleAnimation(dlyr) { |
||||
this.Thread = Thread; |
||||
this.Thread(dlyr); |
||||
|
||||
this.offsetX = 0; |
||||
this.offsetY = 0; |
||||
this.playing = false; |
||||
this.radius = 100; |
||||
this.angle = 0; |
||||
this.setAngleIncrement(10); |
||||
}; |
||||
var p = dynapi.setPrototype('CircleAnimation','Thread'); |
||||
p.setRadius = function (r) { |
||||
this.hradius = this.vradius = r; |
||||
}; |
||||
p.setHRadius = function (r) { |
||||
this.hradius = r; |
||||
}; |
||||
p.setVRadius = function (r) { |
||||
this.vradius = r; |
||||
}; |
||||
p.setAngle = function (a) { |
||||
this.angle = dynapi.functions.degreeToRadian(a); |
||||
}; |
||||
p.setAngleIncrement = function (inc) { |
||||
this.angleinc = dynapi.functions.degreeToRadian(inc); |
||||
}; |
||||
p.playAnimation = function () { |
||||
this.playing = true; |
||||
if (this.dlyr!=null) { |
||||
this.offsetX = this.hradius*Math.cos(this.angle); |
||||
this.offsetY = -this.vradius*Math.sin(this.angle); |
||||
this.baseX = this.dlyr.x-this.offsetX; |
||||
this.baseY = this.dlyr.y+this.offsetY; |
||||
this.dlyr.invokeEvent("circlestart"); |
||||
} |
||||
this.start(); |
||||
}; |
||||
p.stopAnimation = function () { |
||||
this.playing = false; |
||||
this.stop(); |
||||
if (this.dlyr!=null) this.dlyr.invokeEvent("circlestop"); |
||||
}; |
||||
p.run = function () { |
||||
if (!this.playing || this.dlyr==null) return;
|
||||
this.angle += this.angleinc; |
||||
this.offsetX = this.hradius*Math.cos(this.angle); |
||||
this.offsetY = -this.vradius*Math.sin(this.angle); |
||||
|
||||
if (this.dlyr!=null) { |
||||
this.dlyr.invokeEvent("circlerun"); |
||||
this.dlyr.setLocation(this.baseX+this.offsetX,this.baseY+this.offsetY); |
||||
} |
||||
}; |
||||
p.reset = function () { |
||||
this.angle = this.offsetX = this.offsetY = 0; |
||||
}; |
||||
p.generatePath = function(centerX,centerY) { |
||||
if (centerX==null) centerX = this.dlyr!=null? this.dlyr.x : 0; |
||||
if (centerY==null) centerY = this.dlyr!=null? this.dlyr.y : 0; |
||||
var path = []; |
||||
var i = 0; |
||||
/* for (var a=this.angle;a<=this.angle+Math.PI*2;a+=this.angleinc) { |
||||
path[i] = Math.round(centerX + this.hradius*Math.cos(a)); |
||||
path[i+1] = Math.round(centerY - this.vradius*Math.sin(a)); |
||||
i+=2; |
||||
}*/ |
||||
|
||||
if (this.angleinc>0) |
||||
for (var a=this.angle;a<=this.angle+Math.PI*2;a+=this.angleinc) { |
||||
path[i] = Math.round(centerX + this.hradius*Math.cos(a)); |
||||
path[i+1] = Math.round(centerY - this.vradius*Math.sin(a)); |
||||
i+=2; |
||||
} |
||||
else |
||||
for (var a=this.angle;a>=this.angle-Math.PI*2;a+=this.angleinc) { |
||||
path[i] = Math.round(centerX + this.hradius*Math.cos(a)); |
||||
path[i+1] = Math.round(centerY - this.vradius*Math.sin(a)); |
||||
i+=2; |
||||
} |
||||
return path; |
||||
}; |
||||
@ -1,69 +0,0 @@
@@ -1,69 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
Fader Animation Extension |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
requires: DynLayer |
||||
*/ |
||||
|
||||
Fader = {}; // used by dynapi.library
|
||||
|
||||
p = DynLayer.prototype; |
||||
|
||||
p._fadeMode = ''; |
||||
p.fadeIn = function(inc,ms){ |
||||
this._opacity=0; |
||||
this._fadeMode='in'; |
||||
this.fadeTo(100,(inc||4),ms); |
||||
}; |
||||
p.fadeOut = function(inc,ms){ |
||||
this._opacity=100; |
||||
this._fadeMode='out'; |
||||
this.fadeTo(0,inc||4,ms); |
||||
}; |
||||
// Fades an object to "opacity" by "inc" increments in every "ms" millisenconds
|
||||
p.fadeTo = function(opacity,inc,ms){ |
||||
if(this._opacity==null) this._opacity=100; |
||||
inc=(inc)? Math.abs(inc):5; |
||||
this._fadeMs=(ms)? ms:50; |
||||
if (this._opacity>opacity) inc*=-1; |
||||
this._fadeInc=inc; |
||||
this._fadeToOpacity = opacity; |
||||
this._fadeTimeout=window.setTimeout(this+'._fade()',this._fadeMs); |
||||
}; |
||||
p._fade = function(){ |
||||
var ua=dynapi.ua; |
||||
var fm=this._fadeMode; |
||||
var inc = this._fadeInc; |
||||
var opac = this._opacity; |
||||
var fopac = this._fadeToOpacity; |
||||
opac+=inc; |
||||
if ((inc<0 && opac<=fopac)|| (inc>0 && opac>=fopac)) opac=fopac; |
||||
this._opacity=opac; |
||||
if(!ua.def) this.setVisible((opac>0)? true:false); |
||||
else if(ua.dom && this.css){ |
||||
if(opac>1 && this.visible==false) this.setVisible(true); |
||||
if(ua.ie) this.css.filter='alpha(opacity=' + opac + ')'; |
||||
else this.css.MozOpacity = parseInt(opac)/100; |
||||
} |
||||
if(opac!=fopac) this._fadeTimeout=window.setTimeout(this+'._fade()',this._fadeMs); |
||||
else { |
||||
this._fadeMode=''; |
||||
window.clearTimeout(this._fadeTimeout); |
||||
this.invokeEvent('fade'+fm); |
||||
|
||||
} |
||||
}; |
||||
|
||||
p.getOpacity = function(){ |
||||
if (this._opacity ||(this._opacity == 0)) return this._opacity; |
||||
else return this._opacity=100; |
||||
}; |
||||
p.setOpacity = function(n){ |
||||
var ua=dynapi.ua; |
||||
if(n>100) n=100; |
||||
else if(n<0)n=0; |
||||
this._opacity = n; |
||||
this.fadeTo(n); |
||||
}; |
||||
@ -1,300 +0,0 @@
@@ -1,300 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
FlashSound Class - for sonifying web pages with the flash player |
||||
Based on the FlashSound API (1.8) Copyright 2001 Hayden Porter, hayden@aviarts.com |
||||
|
||||
For more information please see the FlashSound Quick Reference |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
Requires: DynLayer |
||||
|
||||
*/ |
||||
|
||||
function FlashSound(swfURL,loop,autostart){ |
||||
|
||||
this.DynLayer = DynLayer; |
||||
this.DynLayer(null,-10,-10,1,1); |
||||
|
||||
// add layer to document
|
||||
dynapi.document.addChild(this); |
||||
|
||||
// instance properties
|
||||
this.playerID = this.id + "SWF"; |
||||
FlashSound.players[FlashSound.players.length] = this; |
||||
|
||||
// instance embed properties
|
||||
this.autostart = true; |
||||
this.base = null; |
||||
this.bgcolor = null; |
||||
this.loop = (loop)? loop:false; |
||||
this.src = null; |
||||
|
||||
// setup flash plugin
|
||||
this.setSWF(swfURL);
|
||||
|
||||
}; |
||||
|
||||
|
||||
/* ============== FlashSound Instance methods =============== */ |
||||
|
||||
/* |
||||
javascript embed --------------------------------- |
||||
embeds swf if user has a supported browser and minimum player. |
||||
script sets swf bgcolor attribute to document.bgcolor if no custom color specified. |
||||
*/ |
||||
var p = dynapi.setPrototype('FlashSound','DynLayer'); |
||||
|
||||
p._recognizeMethod = function (objstr){ |
||||
// check for player readiness ----------------------
|
||||
// check for javascript DOM object first then check to see if any frames are loaded in maintimeline
|
||||
if(typeof(this.doc[this.playerID][objstr]) == "undefined") return false; |
||||
else return true; |
||||
}; |
||||
|
||||
p._checkForInstance = function() { |
||||
if(!FlashSound.supportedBrowser || !FlashSound.checkForMinPlayer()) return false; |
||||
if (this.doc[this.playerID] == null) return false; |
||||
return true; |
||||
}; |
||||
|
||||
// Public Methods -------------------
|
||||
|
||||
p.isPlayerReady = function(){ |
||||
if(!FlashSound.engage) return false; |
||||
if(!this._checkForInstance()) return false; |
||||
// block browsers that do not recognize Flash javascript methods
|
||||
if(!this._recognizeMethod("PercentLoaded")) return false; |
||||
if(this.percentLoaded() > 0) return true; |
||||
return false; |
||||
}; |
||||
|
||||
p.getFramesLoaded = function(target){ |
||||
if(!this._checkForInstance()) {return 0;} |
||||
if(target == null) target = "/"; |
||||
var framesloaded = this.doc[this.playerID].TGetProperty(target,12); |
||||
return parseInt(framesloaded); |
||||
}; |
||||
|
||||
p.getTotalFrames = function(target){ |
||||
if(!this.isPlayerReady()) {return 0;} |
||||
if(target == null) target = "/"; |
||||
var totalframes = this.doc[this.playerID].TGetProperty(target,5); |
||||
return parseInt(totalframes); |
||||
}; |
||||
|
||||
// check to see if all frames are loaded for a given timeline.
|
||||
// check before moving playhead to a frame/label incase the frame/label is not yet loaded.
|
||||
p.isLoaded = function(target){ |
||||
if(!this.isPlayerReady()) return false; |
||||
if(target == null) target = "/"; |
||||
if (this.getFramesLoaded(target) == this.getTotalFrames(target)) return true; |
||||
return false; |
||||
}; |
||||
|
||||
/* flash javascript api functions ------------------------ */ |
||||
|
||||
p.gotoAndPlay = function(target,frame){ |
||||
if(!this.isPlayerReady()) return; |
||||
if(typeof(frame) == "number") { |
||||
this.doc[this.playerID].TGotoFrame(target,frame - 1); |
||||
this.doc[this.playerID].TPlay(target); |
||||
} |
||||
if(typeof(frame) == "string") { |
||||
this.doc[this.playerID].TGotoLabel(target,frame); |
||||
this.doc[this.playerID].TPlay(target); |
||||
} |
||||
}; |
||||
|
||||
p.gotoAndStop = function(target,frame){ |
||||
if(!this.isPlayerReady()) return; |
||||
if(typeof(frame) == "number") { |
||||
this.doc[this.playerID].TGotoFrame(target,frame - 1); |
||||
} |
||||
if(typeof(frame) == "string") { |
||||
this.doc[this.playerID].TGotoLabel(target,frame); |
||||
} |
||||
}; |
||||
|
||||
// Is Playing (IsPlaying)
|
||||
p.isPlaying = function(){ |
||||
if(!this.isPlayerReady()) return false; |
||||
return this.doc[this.playerID].IsPlaying(); |
||||
}; |
||||
|
||||
// Load Movie
|
||||
p.loadMovie = function(layerNumber,url){
|
||||
if(!this.isPlayerReady()) return; |
||||
this.doc[this.playerID].LoadMovie(layerNumber,url); |
||||
}; |
||||
|
||||
p.percentLoaded = function(){ |
||||
if(!this._checkForInstance()) return 0; |
||||
var percentLoaded = this.doc[this.playerID].PercentLoaded(); |
||||
return parseInt(percentLoaded); |
||||
}; |
||||
|
||||
p.play = function(target){ |
||||
if(!this.isPlayerReady()) return; |
||||
if(target == null) target = "/"; |
||||
this.doc[this.playerID].TPlay(target); |
||||
}; |
||||
|
||||
// Set SWF
|
||||
p.setSWF = function(swfURL){ |
||||
if (!FlashSound.supportedBrowser || !FlashSound.checkForMinPlayer()) return; |
||||
|
||||
var defaultColor = (document.bgColor != null) ? document.bgColor : "#ffffff"; |
||||
var defaultBase = "."; |
||||
swfURL=(swfURL)? swfURL:''; |
||||
this.bgcolor = (this.bgcolor == null) ? defaultColor : this.bgcolor; |
||||
this.base = (this.base == null) ? defaultBase : this.base;
|
||||
this.src = (swfURL.charAt(0) == "/") ? "http://" + location.host+swfURL : swfURL; |
||||
this.setHTML( |
||||
'<OBJECT ' + |
||||
'CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ' + |
||||
'CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" ' + |
||||
'WIDTH="1" ' + |
||||
'HEIGHT="1" ' + |
||||
'ID="' + this.playerID + '">\n' + |
||||
'<PARAM NAME="movie" VALUE="' + this.src + '">\n' + |
||||
'<PARAM NAME="play" VALUE="' + this.autostart + '">\n' + |
||||
'<PARAM NAME="loop" VALUE="' + this.loop + '">\n' + |
||||
'<PARAM NAME="quality" VALUE="low">\n' + |
||||
'<PARAM NAME="wmode" VALUE="transparent">\n' + |
||||
'<PARAM NAME="bgcolor" VALUE="' + this.bgcolor + '">\n' + |
||||
'<PARAM NAME="base" VALUE="' + this.base + '">\n' + |
||||
'<EMBED \n' + |
||||
'name="' + this.playerID + '"\n' + |
||||
'swLiveConnect="true"\n' + |
||||
'src="' + this.src + '\"' + '\n' + |
||||
'play="' + this.autostart + '\"' + '\n' + |
||||
'loop="' + this.loop + '\"' + '\n' + |
||||
'quality="low"\n' + |
||||
'wmode="transparent"\n' + |
||||
'base="' + this.base + '"\n' + |
||||
'bgcolor="' + this.bgcolor + '"\n' + |
||||
'WIDTH="1"\n' + |
||||
'HEIGHT="2"\n' + |
||||
'TYPE="application/x-shockwave-flash"\n' +
|
||||
'PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">\n' + |
||||
'</EMBED>\n' + |
||||
'</OBJECT>' |
||||
); |
||||
}; |
||||
|
||||
// Stop Play (TStopPlay)
|
||||
p.stopPlay = function(target){ |
||||
if(!this.isPlayerReady()) return; |
||||
if(target == null) target = "/"; |
||||
this.doc[this.playerID].TStopPlay(target); |
||||
}; |
||||
|
||||
|
||||
/* Static Functions & Properties --------------------------- */ |
||||
|
||||
var fs = FlashSound; |
||||
fs.engage = true; // engage
|
||||
fs.playerCount = 0; // player count
|
||||
fs.players = new Array(); // players[]
|
||||
fs.playerVersion = 0; // set playerVersion to 0 for unsupported browsers
|
||||
|
||||
|
||||
// check for LiveConnect - Opera version 6.x with Java Enabled and Netscape versions 4.x but not greater
|
||||
fs.LiveConnect = ((navigator.javaEnabled() &&
|
||||
(dynapi.ua.ns4 && dynapi.ua.v<5)) || dynapi.ua.opera6); |
||||
|
||||
// browser compatibility check -----------------
|
||||
fs.supportedBrowser = ((dynapi.ua.ie && dynapi.ua.win32) ||
|
||||
dynapi.ua.ns6 || FlashSound.LiveConnect) ? true : false; |
||||
|
||||
// player compatibility ------------------
|
||||
|
||||
// checkForMinPlayer sets playerVersion for supported browsers
|
||||
fs.checkForMinPlayer = function(){ |
||||
if(!this.supportedBrowser) return false; |
||||
if(dynapi.ua.ns6) { |
||||
// xpconnect works with version 6 r40 or greater
|
||||
this.playerVersion = this.getPlugInVers(); // get version
|
||||
releaseVers = this.getPlugInReleaseVers(); // get release version
|
||||
//check release vers only for vers 6
|
||||
if(this.playerVersion == 6 && releaseVers >=40) return true;
|
||||
} |
||||
|
||||
if(this.LiveConnect) this.playerVersion = this.getPlugInVers(); |
||||
if(dynapi.ua.ie) this.playerVersion = (Flash_getActiveXVersion()); |
||||
|
||||
if(this.playerVersion >= this.minPlayer) return true; |
||||
else return false; |
||||
}; |
||||
|
||||
// check for flash plug-in in netscape
|
||||
fs.checkForPlugIn = function(){ |
||||
var flashmimeType = "application/x-shockwave-flash"; |
||||
var hasplugin = (navigator.mimeTypes && navigator.mimeTypes[flashmimeType]) ? navigator.mimeTypes[flashmimeType].enabledPlugin : 0; |
||||
return hasplugin; |
||||
}; |
||||
|
||||
// Get Plugin Version
|
||||
fs.getPlugInVers = function(){ |
||||
if(this.checkForPlugIn()){ |
||||
var plugin = navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin; |
||||
var pluginversion = parseInt(plugin.description.substring(plugin.description.indexOf(".")-1)); |
||||
return pluginversion; |
||||
}else{ |
||||
return 0; |
||||
} |
||||
}; |
||||
|
||||
// Get Plugin Release Version
|
||||
fs.getPlugInReleaseVers = function(){ |
||||
if(this.checkForPlugIn()){ |
||||
var plugin = navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin; |
||||
var pluginversion = parseInt(plugin.description.substring(plugin.description.indexOf("r")+1, plugin.description.length)); |
||||
return pluginversion; |
||||
}else{ |
||||
return 0; |
||||
}
|
||||
}; |
||||
|
||||
// vers is integer
|
||||
fs.setMinPlayer = function(vers){ |
||||
if(!this.supportedBrowser) return; |
||||
this.minPlayer = (vers != null && vers >= 4) ? vers : 4; |
||||
if(dynapi.ua.ns6) {
|
||||
this.minPlayer = 6; // set min player to 6 for XPConnect
|
||||
} |
||||
this.checkForMinPlayer(); |
||||
}; |
||||
|
||||
// vbscript get Flash ActiveX control version for windows IE
|
||||
if(dynapi.ua.ie && dynapi.ua.win32){ |
||||
var h='<scr' + 'ipt language="VBScript">' + '\n' + |
||||
'Function Flash_getActiveXVersion()' + '\n' + |
||||
'On Error Resume Next' + '\n' + |
||||
'Dim hasPlayer, playerversion' + '\n' + |
||||
'hasPlayer = false' + '\n' + |
||||
'playerversion = 15' + '\n' + |
||||
'Do While playerversion > 0' + '\n' + |
||||
'hasPlayer = (IsObject(CreateObject(\"ShockwaveFlash.ShockwaveFlash.\" & playerversion)))' + '\n' + |
||||
'If hasPlayer Then Exit Do' + '\n' + |
||||
'playerversion = playerversion - 1' + '\n' + |
||||
'Loop' + '\n' + |
||||
'Flash_getActiveXVersion = playerversion' + '\n' + |
||||
'End Function' + '\n' + |
||||
'<\/scr' + 'ipt>'; |
||||
|
||||
if(!dynapi.loaded) document.write(h); |
||||
else { |
||||
dynapi.document.addChild(new DynLayer({w:0,h:0,visible:false,html:'<iframe name="FSVBS"></iframe'})); |
||||
var elm=document.frames['FSVBS']; |
||||
var doc = elm.document; |
||||
doc.open();doc.write(h);doc.close(); |
||||
dynapi.frame.Flash_getActiveXVersion = function() { |
||||
return elm.Flash_getActiveXVersion(); |
||||
}; |
||||
} |
||||
}; |
||||
|
||||
// set minimum player version - default is 4
|
||||
fs.setMinPlayer(); |
||||
@ -1,82 +0,0 @@
@@ -1,82 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
Glide Animation Extension |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
requires: dynapi.fx.Thread |
||||
*/ |
||||
|
||||
function GlideAnimation(x1,y1,x2,y2,angleinc,startSpeed,endSpeed) { |
||||
if (x2==null) x2 = x1; |
||||
if (y2==null) y2 = y1; |
||||
|
||||
var normAngle = dynapi.functions.getNormalizedAngle(x1,y1,x2,y2); |
||||
var distx = x2-x1; |
||||
var disty = y2-y1; |
||||
var distance = Math.sqrt(Math.pow(distx,2) + Math.pow(disty,2)); |
||||
angleinc = (angleinc==null)? 7 : Math.abs(angleinc); |
||||
|
||||
// a terrible mess but it works
|
||||
var r = 1; |
||||
if (startSpeed == "fast") { |
||||
var centerX = x1; |
||||
var centerY = y1; |
||||
var centerX2 = x2; |
||||
var centerY2 = y2; |
||||
startAngle = 0; |
||||
endAngle = 90; |
||||
if (endSpeed=="fast") distance = distance/2; |
||||
} |
||||
else { |
||||
startAngle = -90; |
||||
endAngle = 0; |
||||
if (endSpeed == "fast") { |
||||
var centerX = x1+distx; |
||||
var centerY = y1+disty; |
||||
} |
||||
else { // default slow,slow
|
||||
var centerX2 = x2-distx/2; |
||||
var centerY2 = y2-disty/2; |
||||
distance = distance/2; |
||||
var centerX = x1+distx/2; |
||||
var centerY = y1+disty/2; |
||||
r = -1; |
||||
} |
||||
} |
||||
|
||||
var i,d,x,y,dx,dy,path=[]; |
||||
for (var a=startAngle; a<endAngle; a+=angleinc) { |
||||
i = path.length; |
||||
d = distance*Math.sin(a*Math.PI/180); |
||||
path[i] = Math.round(centerX + d*Math.cos(normAngle)); |
||||
path[i+1] = Math.round(centerY - d*Math.sin(normAngle)); |
||||
} |
||||
if (startSpeed==endSpeed) { |
||||
for (var a=endAngle; a<endAngle+90; a+=angleinc) { |
||||
i = path.length; |
||||
d = distance*Math.sin(a*Math.PI/180); |
||||
path[i] = Math.round(centerX2 - r*d*Math.cos(normAngle)); |
||||
path[i+1] = Math.round(centerY2 + r*d*Math.sin(normAngle)); |
||||
} |
||||
} |
||||
|
||||
var l = path.length; |
||||
if (path[l-2] != x2 || path[l-1]!=y2) { |
||||
path[l] = x2; |
||||
path[l+1] = y2; |
||||
} |
||||
|
||||
return path; |
||||
}; |
||||
|
||||
DynLayer.prototype.glideStop = function () { |
||||
if (this._thread) this._thread.stop(); |
||||
}; |
||||
DynLayer.prototype.glideTo = function(x2,y2,angleinc,ms,startSpeed,endSpeed) { |
||||
if (this.x!=x2 || this.y!=y2) { |
||||
if (!this._thread) this._thread = new Thread(this); |
||||
if (ms) this._thread.interval = ms; |
||||
this._thread.play(GlideAnimation(this.x,this.y,x2,y2,angleinc,startSpeed,endSpeed) ); |
||||
} |
||||
}; |
||||
@ -1,63 +0,0 @@
@@ -1,63 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
HoverAnimation Class |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
requires: dynapi.functions.Math, dynapi.fx.Thread |
||||
*/ |
||||
|
||||
function HoverAnimation(dlyr) { |
||||
this.Thread = Thread; |
||||
this.Thread(dlyr); |
||||
|
||||
this.offsetX = 0; |
||||
this.offsetY = 0; |
||||
this.playing = false; |
||||
this.amplitude = 100; |
||||
this.angle = 0; |
||||
this.setAngleIncrement(10); |
||||
}; |
||||
var p = dynapi.setPrototype('HoverAnimation','Thread'); |
||||
p.setAmplitude = function (amp) { |
||||
this.amplitude = amp; |
||||
}; |
||||
p.setAngle = function (a) { |
||||
this.angle = dynapi.functions.degreeToRadian(a); |
||||
}; |
||||
p.setAngleIncrement = function (inc) { |
||||
this.angleinc = dynapi.functions.degreeToRadian(inc); |
||||
}; |
||||
p.playAnimation = function () { |
||||
this.playing = true; |
||||
if (this.dlyr!=null) { |
||||
this.offsetX = 0; |
||||
this.offsetY = this.amplitude*Math.sin(this.angle); |
||||
this.baseX = this.dlyr.x; |
||||
this.baseY = this.dlyr.y+this.offsetY; |
||||
this.dlyr.invokeEvent("hoverstart"); |
||||
} |
||||
this.start(); |
||||
}; |
||||
p.stopAnimation = function () { |
||||
this.playing = false; |
||||
this.stop(); |
||||
if (this.dlyr!=null) this.dlyr.invokeEvent("hoverstop"); |
||||
}; |
||||
p.run = function () { |
||||
if (!this.playing || this.dlyr==null) return; |
||||
this.angle += this.angleinc; |
||||
this.offsetX = 0; |
||||
this.offsetY = this.amplitude*Math.sin(this.angle); |
||||
if (this.dlyr!=null) { |
||||
this.dlyr.invokeEvent("hoverrun"); |
||||
this.dlyr.setLocation(this.baseX+this.offsetX,this.baseY+this.offsetY); |
||||
} |
||||
}; |
||||
p.reset = function () { |
||||
this.angle = this.offsetX = this.offsetY = 0; |
||||
}; |
||||
|
||||
p.generatePath = function(centerX,centerY) { |
||||
// to do
|
||||
}; |
||||
@ -1,102 +0,0 @@
@@ -1,102 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
ImageAnimation Class |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
requires: Thread |
||||
*/ |
||||
|
||||
function ImageAnimation(dynimage) { |
||||
this.Thread = Thread; |
||||
this.Thread(dynimage); |
||||
|
||||
this.imgAnim = new Array(); |
||||
this.imgAnim.playing = null; |
||||
} |
||||
var p = dynapi.setPrototype('ImageAnimation','Thread'); |
||||
p.addAnimation = function (imgArray) { |
||||
var animNum = this.imgAnim.length; |
||||
this.imgAnim[animNum] = imgArray; |
||||
this.imgAnim[animNum].loops = false; |
||||
this.imgAnim[animNum].resets = false; |
||||
this.imgAnim[animNum].frame = 0; |
||||
this.imgAnim[animNum].playing = true; |
||||
this.imgAnim[animNum].direction = 0; |
||||
this.imgAnim[animNum].alternates = false; |
||||
return animNum; |
||||
}; |
||||
p.getFrame = function (animNum,frameNum) { |
||||
return this.imgAnim[animNum][frameNum]; |
||||
}; |
||||
|
||||
p.setLoops = function (animNum,loop) { |
||||
this.imgAnim[animNum].loops = loop; |
||||
}; |
||||
p.setResets = function (animNum) { |
||||
this.imgAnim[animNum].resets = true; |
||||
}; |
||||
p.setAlternates = function (animNum,alt) { |
||||
this.imgAnim[animNum].loops = true; |
||||
this.imgAnim[animNum].alternates = alt; |
||||
}; |
||||
|
||||
p.playAnimation = function (animNum) { |
||||
if (animNum!=null && this.imgAnim.playing!=animNum) { |
||||
this.playing = true; |
||||
this.imgAnim.playing = animNum; |
||||
if (this.dlyr!=null) this.dlyr.invokeEvent("imgstart"); |
||||
this.start(); |
||||
} |
||||
}; |
||||
p.stopAnimation = function () { |
||||
this.imgAnim.playing = null; |
||||
this.playing = false; |
||||
this.stop(); |
||||
if (this.dlyr!=null) this.dlyr.invokeEvent("imgrun"); |
||||
}; |
||||
p.run = function () { |
||||
if (!this.playing || this.imgAnim.playing==null || this.dlyr==null) return; |
||||
|
||||
var anim = this.imgAnim[this.imgAnim.playing]; |
||||
|
||||
if (anim.frame==0 && this.img==anim[anim.frame]) { |
||||
anim.frame++; // skip 1st frame if same
|
||||
} |
||||
if (this.dlyr!=null) this.dlyr.invokeEvent("imgrun"); |
||||
this.dlyr.setImage(anim[anim.frame]); |
||||
|
||||
if (anim.frame>=anim.length-1) { |
||||
if (anim.loops) { |
||||
if (anim.alternates && anim.direction==0 && anim.frame==anim.length-1) { |
||||
anim.direction = 1;
|
||||
anim.frame = anim.length-2; |
||||
} |
||||
else anim.frame = 0; |
||||
} |
||||
else if (anim.resets) { |
||||
anim.frame = 0; |
||||
this.stop(); |
||||
} |
||||
else { |
||||
this.stop(); |
||||
} |
||||
} |
||||
else { |
||||
if (anim.alternates) { |
||||
if (anim.frame==0 && anim.direction==1) { |
||||
anim.direction = 0; |
||||
anim.frame = 1; |
||||
} |
||||
else if (anim.direction==0) { |
||||
anim.frame++; |
||||
} |
||||
else if (anim.direction==1) { |
||||
anim.frame--; |
||||
} |
||||
} |
||||
else { |
||||
anim.frame++; |
||||
} |
||||
} |
||||
}; |
||||
@ -1,120 +0,0 @@
@@ -1,120 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
MotionX Class by Raymond Irving (http://dyntools.shorturl.com)
|
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
requires: Dynlayer |
||||
*/ |
||||
|
||||
MotionX = {}; // used by dynapi.library
|
||||
|
||||
DynLayer.prototype.makeSolid=function(){ |
||||
this.isHard=true; |
||||
this._collideX=this.x; |
||||
this._collideY=this.x; |
||||
this.collideEvent ={ |
||||
onlocationchange:function(e) { |
||||
var me=e.getSource(); |
||||
var dirX='',dirY=''; |
||||
// get direction
|
||||
if (me._collideX!=me.x) { |
||||
if (me._collideX<me.x){dirX="E"}else{dirX="W"}; |
||||
} |
||||
if (me._collideY!=me.y){ |
||||
if (me._collideY<me.y){dirY="S"}else{dirY="N"}; |
||||
} |
||||
// get angle direction
|
||||
me._setCollideAngleDirection(me._collideX,me._collideY,me.x,me.y); |
||||
me._collideX=me.x; |
||||
me._collideY=me.y; |
||||
me._collideDirection=dirY+dirX; |
||||
me._checkForCollision(); |
||||
} |
||||
} |
||||
this.addEventListener(this.collideEvent); |
||||
}; |
||||
// reversing the make solid method
|
||||
|
||||
DynLayer.prototype.makeEphemeral = function() { |
||||
this.isHard=false; |
||||
this.removeEventListener(this.collideEvent); |
||||
}; |
||||
|
||||
DynLayer.prototype._setCollideAngleDirection = function(x1,y1,x2,y2) { |
||||
var distx = (x2-x1),disty = (y1-y2),angle; |
||||
//if (distx==0 && disty==0) return 0;
|
||||
var rad=Math.abs(Math.atan2(disty,distx)) |
||||
if (disty>=0) { |
||||
if (distx>=0) angle = 90-(rad*180/Math.PI); |
||||
else angle = 270+(180-(rad*180/Math.PI)); |
||||
}else{ |
||||
angle = 90+(rad*180/Math.PI); |
||||
} |
||||
this._collideAngle=Math.ceil(angle); |
||||
}; |
||||
DynLayer.prototype._checkForCollision=function(){ |
||||
if (!this.parent.children.length>0) return false; |
||||
var ch,chX,sX,sY,colX1,colX2,colY1,colY2,n1,n2; |
||||
this.collideObject==null; |
||||
for (var i in this.parent.children) { |
||||
ch=this.parent.children[i]; |
||||
if (ch!=this && ch.isHard==true) { |
||||
chX=ch.x; |
||||
chY=ch.y; |
||||
sX=this.x; |
||||
sY=this.y; |
||||
colX1=(sX>=chX && sX<=chX+ch.w); |
||||
colX2=(chX>=sX && chX<=sX+this.w); |
||||
colY1=(sY>=chY && sY<=chY+ch.h); |
||||
colY2=(chY>=sY && chY<=sY+this.h); |
||||
if ((colX1 || colX2) && (colY1 || colY2)) { |
||||
if (this._collideDirection=='NE') { |
||||
n1=((chY+ch.h)-this.y);n2=((sX+this.w)-chX); |
||||
if (n1<n2) {face="S"}else{face="W"} |
||||
}else if (this._collideDirection=='NW') { |
||||
n1=((chY+ch.h)-this.y);n2=((chX+ch.w)-sX); |
||||
if (n1<n2) {face="S"}else{face="E"} |
||||
}else if (this._collideDirection=='SE') { |
||||
n1=((sY+this.h)-ch.y);n2=((sX+this.w)-chX); |
||||
if (n1<n2) {face="N"}else{face="W"} |
||||
}else if (this._collideDirection=='SW') { |
||||
n1=((sY+this.h)-ch.y);n2=((chX+ch.w)-sX); |
||||
if (n1<n2) {face="N"}else{face="E"} |
||||
}else if (this._collideDirection=='E') { |
||||
face="W"; |
||||
}else if (this._collideDirection=='W') { |
||||
face="E"; |
||||
}else if (this._collideDirection=='N') { |
||||
face="S"; |
||||
}else if (this._collideDirection=='S') { |
||||
face="N"; |
||||
} |
||||
|
||||
ch._impactSide=face; |
||||
if (face=="W"){this._impactSide="E"} |
||||
if (face=="E"){this._impactSide="W"} |
||||
if (face=="N"){this._impactSide="S"} |
||||
if (face=="S"){this._impactSide="N"} |
||||
|
||||
this._collideObject=ch; |
||||
this.invokeEvent("collide"); |
||||
ch._collideObject=this; |
||||
ch.invokeEvent("collide"); |
||||
} |
||||
} |
||||
} |
||||
return false; |
||||
}; |
||||
DynLayer.prototype.getImpactSide=function(){ |
||||
return this._impactSide; |
||||
} |
||||
DynLayer.prototype.getObstacle=function(){ |
||||
return this._collideObject; |
||||
} |
||||
DynLayer.prototype.getDirection=function(){ |
||||
return this._collideDirection; |
||||
} |
||||
DynLayer.prototype.getDirectionAngle=function(){ |
||||
return this._collideAngle; |
||||
} |
||||
@ -1,96 +0,0 @@
@@ -1,96 +0,0 @@
|
||||
/* |
||||
DS: the extra features of this version will possibly be rebuilt as an advanced timeline object |
||||
|
||||
DynAPI Distribution |
||||
PathAnimation Class |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
requires: dynapi.fx.Thread |
||||
*/ |
||||
|
||||
function PathAnimation(dlyr) { |
||||
this.Thread = Thread; |
||||
this.Thread(dlyr); |
||||
this.paths = []; |
||||
this.pathPlaying = null; |
||||
} |
||||
var p = dynapi.setPrototype('PathAnimation','Thread'); |
||||
|
||||
p.add = function (path, loops, resets) { |
||||
var n = this.paths.length; |
||||
this.paths[n] = path; |
||||
this.setLoops(n,loops); |
||||
this.setResets(n,resets); |
||||
this.setFrame(n,0); |
||||
return n; |
||||
}; |
||||
p.setLoops = function (n, loops) { |
||||
this.paths[n].loops = (loops); |
||||
}; |
||||
p.setResets = function (n, resets) { |
||||
this.paths[n].resets = (resets); |
||||
}; |
||||
p.setFrame = function (n, frame) { |
||||
this.paths[n].frame = frame; |
||||
}; |
||||
p.playAnimation = function (noevt) { |
||||
if (!this.playing) { |
||||
this.pathPlaying = null; |
||||
if (arguments[0]==null) arguments[0] = 0; |
||||
if (typeof(arguments[0]) == "number") { |
||||
this.pathPlaying = this.paths[arguments[0]]; |
||||
} |
||||
else if (typeof(arguments[0]) == "object") {
|
||||
this.pathPlaying = arguments[0]; |
||||
this.pathPlaying.loops = arguments[1]||false; |
||||
this.pathPlaying.resets = arguments[2]||false; |
||||
this.pathPlaying.frame = 0; |
||||
} |
||||
this.playing = true; |
||||
if (this.dlyr!=null && noevt!=false) this.dlyr.invokeEvent("pathstart"); |
||||
this.start(); |
||||
} |
||||
}; |
||||
//p._Thread_stop = Thread.prototype.stop;
|
||||
p.stopAnimation = function (noevt) { |
||||
if (this.pathPlaying && this.pathPlaying.resets && this.dlyr!=null) this.dlyr.setLocation(this.pathPlaying[0],this.pathPlaying[1]); |
||||
this.stop(); |
||||
this.pathPlaying = null; |
||||
this.playing = false; |
||||
if (this.dlyr!=null && noevt!=false) this.dlyr.invokeEvent("pathstop"); |
||||
}; |
||||
p.run = function () { |
||||
if (!this.playing || this.pathPlaying==null) return; |
||||
var anim = this.pathPlaying; |
||||
if (anim.frame>=anim.length/2) { |
||||
if (anim.loops) { |
||||
anim.frame = 0; |
||||
} |
||||
else if (anim.resets) { |
||||
anim.frame = 0; |
||||
if (this.dlyr!=null) this.dlyr.setLocation(anim[0],anim[1]); |
||||
this.stopAnimation(); |
||||
this.dlyr.invokeEvent("pathfinish"); |
||||
return; |
||||
} |
||||
else { |
||||
anim.frame = 0; |
||||
this.stopAnimation(); |
||||
this.dlyr.invokeEvent("pathfinish"); |
||||
return; |
||||
} |
||||
} |
||||
if (anim.frame==0 && (this.dlyr!=null && this.dlyr.x==anim[0] && this.dlyr.y==anim[1])) { |
||||
anim.frame += 1; |
||||
} |
||||
this.newX = anim[anim.frame*2]; |
||||
this.newY = anim[anim.frame*2+1]; |
||||
|
||||
if (this.dlyr!=null) { |
||||
this.dlyr.invokeEvent("pathrun"); |
||||
this.dlyr.setLocation(this.newX,this.newY); |
||||
} |
||||
anim.frame++; |
||||
}; |
||||
|
||||
@ -1,42 +0,0 @@
@@ -1,42 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
Slide Animation Extension |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
requires: dynapi.fx.Thread |
||||
*/ |
||||
|
||||
// Generates a path between 2 points, stepping inc pixels at a time
|
||||
function SlideAnimation(x1,y1,x2,y2,inc) { |
||||
var n,dx,dy,lx,ly,p=[]; |
||||
if (x2==null) x2 = x1; |
||||
if (y2==null) y2 = y1; |
||||
|
||||
lx = x2-x1; |
||||
ly = y2-y1; |
||||
n = Math.sqrt(Math.pow(lx,2) + Math.pow(ly,2))/(inc||10); |
||||
dx = lx/n; |
||||
dy = ly/n; |
||||
for (var i=0;i<n;i++) { |
||||
p[i*2] = x1 + Math.round(dx*i); |
||||
p[i*2+1] = y1 + Math.round(dy*i); |
||||
} |
||||
if (p[i*2-2] != x2 || p[i*2-1] != y2) { |
||||
p[i*2] = x2; |
||||
p[i*2+1] = y2; |
||||
} |
||||
return p; |
||||
}; |
||||
|
||||
|
||||
DynLayer.prototype.slideTo = function(x2,y2,inc,ms) { |
||||
if (this.x!=x2 || this.y!=y2) { |
||||
if (!this._thread) this._thread = new Thread(this); |
||||
if (ms) this._thread.interval = ms; |
||||
this._thread.play(SlideAnimation(this.x,this.y,x2,y2,inc)); |
||||
} |
||||
}; |
||||
DynLayer.prototype.slideStop = function () { |
||||
if (this._thread) this._thread.stop(); |
||||
}; |
||||
@ -1,780 +0,0 @@
@@ -1,780 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
SnapX Class by Leif Westerlind <warp-9.9 (at) usa (dot) net> |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
requires: DynLayer |
||||
*/ |
||||
|
||||
SnapX = {}; // used by dynapi.library
|
||||
|
||||
var p = DynLayer.prototype; |
||||
p._snapSetLocation = p.setLocation; |
||||
p.setLocation = function(x,y){
|
||||
this._snapSetLocation(x,y); |
||||
|
||||
if (this.isSnapEnabled){ |
||||
var dirX = '', dirY = ''; |
||||
|
||||
// get direction
|
||||
if (this._snapX != this.x){ |
||||
if (this._snapX < this.x){ |
||||
dirX="E"; |
||||
} |
||||
else { |
||||
dirX="W"; |
||||
} |
||||
} |
||||
|
||||
if (this._snapY != this.y){ |
||||
if (this._snapY < this.y){ |
||||
dirY="S"; |
||||
} |
||||
else { |
||||
dirY="N"; |
||||
} |
||||
} |
||||
|
||||
this._snapX = this.x; |
||||
this._snapY = this.y; |
||||
this._snapDirection = dirY + dirX; |
||||
this._checkForSnap(); |
||||
} |
||||
}; |
||||
|
||||
p.getSnapDirection = function (){ |
||||
return(this._snapDirection); |
||||
}; |
||||
|
||||
/* |
||||
INPUT: |
||||
|
||||
0 args: use defaults |
||||
1 arg : snap type [normal|null|sticky|grid] |
||||
2 args: snap type [normal|null|sticky|grid], |
||||
boundary type [inner|outer|both] |
||||
3 args: snap type [normal|null|sticky|grid], |
||||
boundary type [inner|outer|both], |
||||
boundary |
||||
4 args: snap type [normal|null|sticky|grid], |
||||
boundary type [inner|outer|both], |
||||
boundary, |
||||
grid size (if applicable) |
||||
*/ |
||||
p.enableSnap = function (){ |
||||
var a = arguments; |
||||
var snapBoundaryDefault = DynLayer._snapBoundaryDefault; |
||||
|
||||
this.isSnapEnabled = true; |
||||
this._snapX = this.x; |
||||
this._snapY = this.y; |
||||
|
||||
if ( a.length >= 0 ){ |
||||
this.setSnapBoundary(); |
||||
this.setSnapBoundaryType(); |
||||
} |
||||
|
||||
if ( a.length >= 1 ){ |
||||
if ( a[0] == 'sticky' || a[0] == 'grid' ){ |
||||
this.setSnapType(a[0]); |
||||
} |
||||
else if ( a[0] == 'normal' || a[0] == null ){ |
||||
this.setSnapType(); |
||||
} |
||||
} |
||||
|
||||
if ( a.length >= 2 ){ |
||||
if ( a[1] == 'inner' || a[1] == 'outer' || a[1] == 'both' ){ |
||||
this.setSnapBoundaryType(a[1]); |
||||
} |
||||
else { |
||||
this.setSnapBoundaryType(); |
||||
} |
||||
} |
||||
|
||||
if ( a.length >= 3 ){ |
||||
if ( typeof(a[2]) == 'number' ){ |
||||
this.setSnapBoundary(a[1],a[2]); |
||||
} |
||||
else { |
||||
this.setSnapBoundary(a[1],snapBoundaryDefault); |
||||
} |
||||
} |
||||
|
||||
if ( a.length >= 4 ){ |
||||
if ( typeof(a[3]) == 'number' ){ |
||||
this.setGridSnapSize(a[3]); |
||||
} |
||||
else { |
||||
this.setGridSnapSize(); |
||||
} |
||||
} |
||||
}; |
||||
p.disableSnap = function(){ |
||||
this.isSnapEnabled = false; |
||||
}; |
||||
|
||||
p.setSnapType = function(t){ |
||||
var a = arguments; |
||||
|
||||
if (a.length == 0){ |
||||
this._snapType = 'normal'; |
||||
} |
||||
else if (a.length == 1 ){ |
||||
if ( a[0] == 'sticky' ){ |
||||
this._snapType = a[0]; |
||||
this.enableStickySnap(); |
||||
} else if ( a[0] == 'grid' ){ |
||||
this._snapType = a[0]; |
||||
this.enableGridSnap(); |
||||
} |
||||
else { |
||||
this._snapType = 'normal'; |
||||
} |
||||
} |
||||
} |
||||
|
||||
p.enableStickySnap = function(){ |
||||
if (arguments.length == 0){ |
||||
this.isStickySnapEnabled = true; |
||||
} |
||||
else if (arguments.length == 1 ){ |
||||
if (arguments[0] === true){ |
||||
this.isStickySnapEnabled = true; |
||||
} |
||||
else if (arguments[0] === false){ |
||||
this.isStickySnapEnabled = false; |
||||
} |
||||
} |
||||
}; |
||||
p.disableStickySnap = function(){ |
||||
this.isStickySnapEnabled = false; |
||||
}; |
||||
|
||||
p.enableGridSnap = function(){ |
||||
this.isGridSnapEnabled = true; |
||||
this.setGridSnapSize(); |
||||
this._snapGridX = null; |
||||
this._snapGridY = null; |
||||
}; |
||||
p.disableGridSnap = function(){ |
||||
this.isGridSnapEnabled = false; |
||||
}; |
||||
|
||||
DynLayer._snapBoundaryTypeDefault = 'outer'; |
||||
p.setSnapBoundaryTypeDefault = function(snapBoundaryType){ |
||||
if (typeof(snapBoundaryType) == 'string') DynLayer._snapBoundaryTypeDefault = snapBoundaryType; |
||||
} |
||||
p.getSnapBoundaryTypeDefault = function(){ |
||||
return(DynLayer._snapBoundaryTypeDefault); |
||||
} |
||||
p.setSnapBoundaryType = function(snapBoundaryType){ |
||||
if (arguments.length == 0){ |
||||
this._snapBoundaryType = DynLayer._snapBoundaryTypeDefault; |
||||
} |
||||
else if (typeof(snapBoundaryType) == 'string'){ |
||||
this._snapBoundaryType = snapBoundaryType; |
||||
} |
||||
}; |
||||
p.getSnapBoundaryType = function(){ |
||||
return(this._snapBoundaryType); |
||||
}; |
||||
|
||||
DynLayer._snapBoundaryDefault = 25; |
||||
p.setSnapBoundaryDefault = function(snapBoundary){ |
||||
if(typeof(snapBoundary) == 'number') DynLayer._snapBoundaryDefault = snapBoundary; |
||||
} |
||||
p.getSnapBoundaryDefault = function(){ |
||||
return(DynLayer._snapBoundaryDefault); |
||||
} |
||||
|
||||
DynLayer._snapGridSizeDefault = 10; |
||||
p.setGridSnapSizeDefault = function(s){ |
||||
DynLayer._snapGridSizeDefault = s; |
||||
} |
||||
p.getGridSnapSizeDefault = function(){ |
||||
return(DynLayer._snapGridSizeDefault); |
||||
} |
||||
p.setGridSnapSize = function(){ |
||||
if (arguments.length == 0){ |
||||
this._snapGridSize = DynLayer._snapGridSizeDefault; |
||||
} |
||||
else if (arguments.length == 1 ){ |
||||
this._snapGridSize = arguments[0]; |
||||
} |
||||
}; |
||||
|
||||
/* |
||||
INPUT: |
||||
0 args: set snapBoundaryType to snapBoundaryTypeDefault, |
||||
set boundary to snapBoundaryDefault |
||||
1 arg : if snapBoundaryType, set boundary to snapBoundaryDefault, |
||||
if boundary, set all sides to boundary |
||||
and snapBoundaryType to snapBoundaryTypeDefault |
||||
2 args: if snapBoundaryType,boundary, set type and boundary for all sides |
||||
if N1,N2 set inner to N1 and outer to N2 and |
||||
set snapBoundaryType to both |
||||
5 args: snapBoundaryType, t, r, b, l |
||||
8 args: ti, ri, bi, li, to, ro, bo, lo |
||||
*/ |
||||
|
||||
p.setSnapBoundary = function(){ |
||||
var a = arguments; |
||||
var snapBoundaryDefault = DynLayer._snapBoundaryDefault; |
||||
|
||||
if (a.length == 0){ |
||||
this.setSnapBoundaryType(); |
||||
this._snapBndTi = snapBoundaryDefault; |
||||
this._snapBndRi = snapBoundaryDefault; |
||||
this._snapBndBi = snapBoundaryDefault; |
||||
this._snapBndLi = snapBoundaryDefault; |
||||
this._snapBndTo = snapBoundaryDefault; |
||||
this._snapBndRo = snapBoundaryDefault; |
||||
this._snapBndBo = snapBoundaryDefault; |
||||
this._snapBndLo = snapBoundaryDefault; |
||||
} |
||||
if (a.length == 1){ |
||||
if(a[0] == 'inner' || a[0] == 'outer' || a[0] == 'both'){ |
||||
this.setSnapBoundaryType(a[0]); |
||||
this._snapBndTi = snapBoundaryDefault; |
||||
this._snapBndRi = snapBoundaryDefault; |
||||
this._snapBndBi = snapBoundaryDefault; |
||||
this._snapBndLi = snapBoundaryDefault; |
||||
this._snapBndTo = snapBoundaryDefault; |
||||
this._snapBndRo = snapBoundaryDefault; |
||||
this._snapBndBo = snapBoundaryDefault; |
||||
this._snapBndLo = snapBoundaryDefault; |
||||
} |
||||
else { |
||||
this.setSnapBoundaryType(); |
||||
this._snapBndTi = a[0]; |
||||
this._snapBndRi = a[0]; |
||||
this._snapBndBi = a[0]; |
||||
this._snapBndLi = a[0]; |
||||
this._snapBndTo = a[0]; |
||||
this._snapBndRo = a[0]; |
||||
this._snapBndBo = a[0]; |
||||
this._snapBndLo = a[0]; |
||||
} |
||||
} |
||||
else if (a.length == 2){ |
||||
if (a[0] == 'inner'){ |
||||
this.setSnapBoundaryType(a[0]); |
||||
this._snapBndTi = a[1]; |
||||
this._snapBndRi = a[1]; |
||||
this._snapBndBi = a[1]; |
||||
this._snapBndLi = a[1]; |
||||
} |
||||
else if (a[0] == 'outer'){ |
||||
this.setSnapBoundaryType(a[0]); |
||||
this._snapBndTo = a[1]; |
||||
this._snapBndRo = a[1]; |
||||
this._snapBndBo = a[1]; |
||||
this._snapBndLo = a[1]; |
||||
} |
||||
else if (a[0] == 'both' || a[0] == null){ |
||||
this.setSnapBoundaryType('both'); |
||||
this._snapBndTi = a[1]; |
||||
this._snapBndRi = a[1]; |
||||
this._snapBndBi = a[1]; |
||||
this._snapBndLi = a[1]; |
||||
this._snapBndTo = a[1]; |
||||
this._snapBndRo = a[1]; |
||||
this._snapBndBo = a[1]; |
||||
this._snapBndLo = a[1]; |
||||
} |
||||
else if (typeof(a[0]) == 'number' && typeof(a[1]) == 'number'){ |
||||
this.setSnapBoundaryType('both'); |
||||
this._snapBndTi = a[0]; |
||||
this._snapBndRi = a[0]; |
||||
this._snapBndBi = a[0]; |
||||
this._snapBndLi = a[0]; |
||||
this._snapBndTo = a[1]; |
||||
this._snapBndRo = a[1]; |
||||
this._snapBndBo = a[1]; |
||||
this._snapBndLo = a[1]; |
||||
} |
||||
} |
||||
else if (a.length == 5){ |
||||
if(a[0] == 'inner' || a[0] == 'outer' || a[0] == 'both'){ |
||||
this.setSnapBoundaryType(a[0]); |
||||
} |
||||
|
||||
if (this._snapBoundaryType == 'inner'){ |
||||
this._snapBndTi = a[1]; |
||||
this._snapBndRi = a[2]; |
||||
this._snapBndBi = a[3]; |
||||
this._snapBndLi = a[4]; |
||||
} |
||||
else if (this._snapBoundaryType == 'outer'){ |
||||
this._snapBndTo = a[1]; |
||||
this._snapBndRo = a[2]; |
||||
this._snapBndBo = a[3]; |
||||
this._snapBndLo = a[4]; |
||||
} |
||||
else if (this._snapBoundaryType == 'both'){ |
||||
this._snapBndTi = a[1]; |
||||
this._snapBndRi = a[2]; |
||||
this._snapBndBi = a[3]; |
||||
this._snapBndLi = a[4]; |
||||
this._snapBndTo = a[1]; |
||||
this._snapBndRo = a[2]; |
||||
this._snapBndBo = a[3]; |
||||
this._snapBndLo = a[4]; |
||||
} |
||||
} |
||||
else if (a.length == 8){ |
||||
this.setSnapBoundaryType('both'); |
||||
this._snapBndTi = a[0]; |
||||
this._snapBndRi = a[1]; |
||||
this._snapBndBi = a[2]; |
||||
this._snapBndLi = a[3]; |
||||
this._snapBndTo = a[4]; |
||||
this._snapBndRo = a[5]; |
||||
this._snapBndBo = a[6]; |
||||
this._snapBndLo = a[7]; |
||||
} |
||||
else { |
||||
this.setSnapBoundaryType(); |
||||
this._snapBndTi = snapBoundaryDefault; |
||||
this._snapBndRi = snapBoundaryDefault; |
||||
this._snapBndBi = snapBoundaryDefault; |
||||
this._snapBndLi = snapBoundaryDefault; |
||||
this._snapBndTo = snapBoundaryDefault; |
||||
this._snapBndRo = snapBoundaryDefault; |
||||
this._snapBndBo = snapBoundaryDefault; |
||||
this._snapBndLo = snapBoundaryDefault; |
||||
} |
||||
}; |
||||
p.getSnapBoundary = function(t){ |
||||
var To,Ro,Bo,Lo,Ti,Ri,Bi,Li,bndAry,X,Y,W,H; |
||||
|
||||
X = this.x; |
||||
Y = this.y; |
||||
W = this.w; |
||||
H = this.h; |
||||
|
||||
Ti = Y + this._snapBndTi; |
||||
Ri = X + W - this._snapBndRi; |
||||
Bi = Y + H - this._snapBndBi; |
||||
Li = X + this._snapBndLi; |
||||
|
||||
To = Y - this._snapBndTo; |
||||
Ro = X + W + this._snapBndRo; |
||||
Bo = Y + H + this._snapBndBo; |
||||
Lo = X - this._snapBndLo; |
||||
|
||||
if (t==null) bndAry = [Ti,Ri,Bi,Li,To,Ro,Bo,Lo]; |
||||
else { |
||||
if (t=='inner') bndAry = [Ti,Ri,Bi,Li]; |
||||
else if (t=='outer') bndAry = [To,Ro,Bo,Lo]; |
||||
else if (t=='both') bndAry = [Ti,Ri,Bi,Li,To,Ro,Bo,Lo]; |
||||
} |
||||
return(bndAry); |
||||
}; |
||||
|
||||
p._checkForSnap = function(){ |
||||
switch (this._snapBoundaryType) { |
||||
case 'outer' : |
||||
this._checkForSnapOuter(); |
||||
break; |
||||
case 'inner' : |
||||
this._checkForSnapInner(); |
||||
break; |
||||
case 'both' : |
||||
this._checkForSnapInner(); |
||||
this._checkForSnapOuter(); |
||||
break; |
||||
default: |
||||
return(false); |
||||
} |
||||
}; |
||||
|
||||
p._checkForSnapInner = function(){ |
||||
if (!this.parent.children.length>0) return(false); |
||||
if (!this.isSnapEnabled==true) return(false); |
||||
|
||||
var ch,chX1,chY1,chX2,chY2, |
||||
chBiX1,chBiY1,chBiX2,chBiY2, |
||||
sX1,sY1,sX2,sY2, |
||||
chBndAry,sDir, |
||||
B1,B2a,B2b,B3,B4a,B4b,B5,B6a,B6b,B7,B8a,B8b, |
||||
D1,D2a,D2b,D3,D4a,D4b,D5,D6a,D6b,D7,D8a,D8b, |
||||
C1,C2a,C2b,C3,C4a,C4b,C5,C6a,C6b,C7,C8a,C8b; |
||||
|
||||
sX1 = this.x; |
||||
sY1 = this.y; |
||||
sW = this.w; |
||||
sH = this.h; |
||||
sX2 = sX1 + sW; |
||||
sY2 = sY1 + sH; |
||||
sDir = this.getSnapDirection(); |
||||
|
||||
for (var i in this.parent.children){ |
||||
ch = this.parent.children[i]; |
||||
if (ch != this && ch.isSnapEnabled == true){ |
||||
chX1 = ch.x; |
||||
chY1 = ch.y; |
||||
chX2 = chX1 + ch.w; |
||||
chY2 = chY1 + ch.h; |
||||
chBndAry = ch.getSnapBoundary('inner'); |
||||
chBiX1 = chBndAry[3]; |
||||
chBiY1 = chBndAry[0]; |
||||
chBiX2 = chBndAry[1]; |
||||
chBiY2 = chBndAry[2]; |
||||
|
||||
// Cases B1 - B8 test TRUE if source corner is in snap border.
|
||||
// Cases D1 - D8 test TRUE if the corresponding direction of
|
||||
// movement of the corner is towards the boundary.
|
||||
// Cases C1 - C8 test TRUE if the corresponding B and D cases
|
||||
// are true for standard or sticky snap.
|
||||
|
||||
// inner top-left corner, source top-left, move N, NW, W
|
||||
B1 = (sX1 <= chBiX1 && sX1 > chX1 && sY1 <= chBiY1 && sY1 > chY1); |
||||
D1 = (sDir == 'N' || sDir == 'NW' || sDir == 'W'); |
||||
C1 = (B1 && (D1 || ch.isStickySnapEnabled || ch.isGridSnapEnabled)); |
||||
|
||||
// inner top-middle side, source top-left, move NE, N, NW
|
||||
B2a = (sX1 > chBiX1 && sX1 < chBiX2 && sY1 <= chBiY1 && sY1 > chY1); |
||||
D2a = (sDir == 'NE' || sDir == 'N' || sDir == 'NW'); |
||||
C2a = (B2a && (D2a || ch.isStickySnapEnabled || ch.isGridSnapEnabled)); |
||||
|
||||
// inner top-middle side, source top-right, move NE, N, NW
|
||||
B2b = (sX2 > chBiX1 && sX2 < chBiX2 && sY1 <= chBiY1 && sY1 > chY1); |
||||
D2b = (sDir == 'NE' || sDir == 'N' || sDir == 'NW'); |
||||
C2b = (B2b && (D2b || ch.isStickySnapEnabled || ch.isGridSnapEnabled)); |
||||
|
||||
// inner top-right corner, source top-right, move E, NE, N
|
||||
B3 = (sX2 >= chBiX2 && sX2 < chX2 && sY1 <= chBiY1 && sY1 > chY1); |
||||
D3 = (sDir == 'E' || sDir == 'NE' || sDir == 'N'); |
||||
C3 = (B3 && (D3 || ch.isStickySnapEnabled || ch.isGridSnapEnabled)); |
||||
|
||||
// inner right-middle side, source top-right, move SE, E, NE
|
||||
B4a = (sX2 >= chBiX2 && sX2 < chX2 && sY1 > chBiY1 && sY1 < chBiY2); |
||||
D4a = (sDir == 'SE' || sDir == 'E' || sDir == 'NE'); |
||||
C4a = (B4a && (D4a || ch.isStickySnapEnabled || ch.isGridSnapEnabled)); |
||||
|
||||
// inner right-middle side, source bottom-right, move SE, E, NE
|
||||
B4b = (sX2 >= chBiX2 && sX2 < chX2 && sY2 > chBiY1 && sY2 < chBiY2); |
||||
D4b = (sDir == 'SE' || sDir == 'E' || sDir == 'NE'); |
||||
C4b = (B4b && (D4b || ch.isStickySnapEnabled || ch.isGridSnapEnabled)); |
||||
|
||||
// inner bottom-right corner, source lower-right, move dir E, SE, S
|
||||
B5 = (sX2 >= chBiX2 && sX2 < chX2 && sY2 >= chBiY2 && sY2 < chY2); |
||||
D5 = (sDir == 'E' || sDir == 'SE' || sDir == 'S'); |
||||
C5 = (B5 && (D5 || ch.isStickySnapEnabled || ch.isGridSnapEnabled)); |
||||
|
||||
// inner bottom-middle side, source lower-left, move SW, S, SE
|
||||
B6a = (sX1 > chBiX1 && sX1 < chBiX2 && sY2 >= chBiY2 && sY2 < chY2); |
||||
D6a = (sDir == 'SW' || sDir == 'S' || sDir == 'SE'); |
||||
C6a = (B6a && (D6a || ch.isStickySnapEnabled || ch.isGridSnapEnabled)); |
||||
|
||||
// inner bottom-middle side, source lower-right, move SW, S, SE
|
||||
B6b = (sX2 > chBiX1 && sX2 < chBiX2 && sY2 >= chBiY2 && sY2 < chY2); |
||||
D6b = (sDir == 'SW' || sDir == 'S' || sDir == 'SE'); |
||||
C6b = (B6b && (D6b || ch.isStickySnapEnabled || ch.isGridSnapEnabled)); |
||||
|
||||
// inner bottom-left corner, source lower-left, move W, SW, S
|
||||
B7 = (sX1 <= chBiX1 && sX1 > chX1 && sY2 >= chBiY2 && sY2 < chY2); |
||||
D7 = (sDir == 'W' || sDir == 'SW' || sDir == 'S'); |
||||
C7 = (B7 && (D7 || ch.isStickySnapEnabled || ch.isGridSnapEnabled)); |
||||
|
||||
// inner left-middle side, source top-left, move NW, W, SW
|
||||
B8a = (sX1 <= chBiX1 && sX1 > chX1 && sY1 > chBiY1 && sY1 < chBiY2); |
||||
D8a = (sDir == 'NW' || sDir == 'W' || sDir == 'SW'); |
||||
C8a = (B8a && (D8a || ch.isStickySnapEnabled || ch.isGridSnapEnabled)); |
||||
|
||||
// inner left-middle side, source bottom-left, move NW, W, SW
|
||||
B8b = (sX1 <= chBiX1 && sX1 > chX1 && sY2 > chBiY1 && sY2 < chBiY2); |
||||
D8b = (sDir == 'NW' || sDir == 'W' || sDir == 'SW'); |
||||
C8b = (B8b && (D8b || ch.isStickySnapEnabled || ch.isGridSnapEnabled)); |
||||
|
||||
if (C1){ |
||||
if (this.isGridSnapEnabled){ |
||||
var tmpX = chX1 + ( Math.floor( ( sX1 - chX1 ) / this._snapGridSize ) ) * this._snapGridSize; |
||||
var tmpY = chY1 + ( Math.floor( ( sY1 - chY1 ) / this._snapGridSize ) ) * this._snapGridSize; |
||||
this._snapSetLocation(tmpX, tmpY); |
||||
} |
||||
else { |
||||
this._snapSetLocation(chX1, chY1); |
||||
} |
||||
} |
||||
else if (C3){ |
||||
if (this.isGridSnapEnabled){ |
||||
var tmpX = chX2 - ( Math.floor( ( chX2 - sX1 ) / this._snapGridSize ) ) * this._snapGridSize; |
||||
var tmpY = chY1 + ( Math.floor( ( sY1 - chY1 ) / this._snapGridSize ) ) * this._snapGridSize; |
||||
this._snapSetLocation(tmpX, tmpY); |
||||
} |
||||
else { |
||||
this._snapSetLocation(chX2-sW, chY1); |
||||
} |
||||
} |
||||
else if (C5){ |
||||
if (this.isGridSnapEnabled){ |
||||
var tmpX = chX2 - ( Math.floor( ( chX2 - sX1 ) / this._snapGridSize ) ) * this._snapGridSize; |
||||
var tmpY = chY2 - sH - ( Math.floor( ( chY2 - sY2 ) / this._snapGridSize ) ) * this._snapGridSize; |
||||
this._snapSetLocation(tmpX, tmpY); |
||||
} |
||||
else { |
||||
this._snapSetLocation(chX2-sW, chY2-sH); |
||||
} |
||||
} |
||||
else if (C7){ |
||||
if (this.isGridSnapEnabled){ |
||||
var tmpX = chX1 + ( Math.floor( ( sX1 - chX1 ) / this._snapGridSize ) ) * this._snapGridSize; |
||||
var tmpY = chY2 - sH - ( Math.floor( ( chY2 - sY2 ) / this._snapGridSize ) ) * this._snapGridSize; |
||||
this._snapSetLocation(tmpX, tmpY); |
||||
} |
||||
else { |
||||
this._snapSetLocation(chX1, chY2-sH); |
||||
} |
||||
} |
||||
else if (C2a || C2b){ |
||||
if (this.isGridSnapEnabled){ |
||||
var tmpX = chX1 + ( Math.floor( ( sX1 - chX1 ) / this._snapGridSize ) ) * this._snapGridSize; |
||||
this._snapSetLocation(tmpX, chY1); |
||||
} |
||||
else { |
||||
this._snapSetLocation(sX1, chY1); |
||||
} |
||||
} |
||||
else if (C4a || C4b){ |
||||
if (this.isGridSnapEnabled){ |
||||
var tmpY = chY1 + ( Math.floor( ( sY1 - chY1 ) / this._snapGridSize ) ) * this._snapGridSize; |
||||
this._snapSetLocation(chX2-sW, tmpY); |
||||
} |
||||
else { |
||||
this._snapSetLocation(chX2-sW, sY1); |
||||
} |
||||
} |
||||
else if (C6a || C6b){ |
||||
if (this.isGridSnapEnabled){ |
||||
var tmpX = chX1 + ( Math.floor( ( sX1 - chX1 ) / this._snapGridSize ) ) * this._snapGridSize; |
||||
this._snapSetLocation(tmpX, chY2-sH); |
||||
} |
||||
else { |
||||
this._snapSetLocation(sX1, chY2-sH); |
||||
} |
||||
} |
||||
else if (C8a || C8b){ |
||||
if (this.isGridSnapEnabled){ |
||||
var tmpY = chY1 + ( Math.floor( ( sY1 - chY1 ) / this._snapGridSize ) ) * this._snapGridSize; |
||||
this._snapSetLocation(chX1 , tmpY); |
||||
} |
||||
else { |
||||
this._snapSetLocation(chX1 , sY1); |
||||
} |
||||
} |
||||
|
||||
if (C1 || C2a || C2b || C3 || C4a || C4b || C5 || C6a || C6b || C7 || C8a || C8b){ |
||||
this._snapObject=ch; |
||||
this.invokeEvent("snap"); |
||||
ch._snapObject=this; |
||||
ch.invokeEvent("snap"); |
||||
} |
||||
} |
||||
} |
||||
}; |
||||
|
||||
p._checkForSnapOuter = function(){ |
||||
if (! this.parent.children.length > 0) return(false); |
||||
if (! this.isSnapEnabled == true) return(false); |
||||
|
||||
var ch,chX1,chY1,chX2,chY2, |
||||
chBoX1,chBoY1,chBoX2,chBoY2, |
||||
sX1,sY1,sX2,sY2, |
||||
chBndAry,sDir, |
||||
B1,B2a,B2b,B3,B4a,B4b,B5,B6a,B6b,B7,B8a,B8b, |
||||
D1,D2a,D2b,D3,D4a,D4b,D5,D6a,D6b,D7,D8a,D8b, |
||||
C1,C2a,C2b,C3,C4a,C4b,C5,C6a,C6b,C7,C8a,C8b; |
||||
|
||||
/* |
||||
if(this.isGridSnapEnabled){ |
||||
if( Math.abs( this._snapX - this._snapGridX ) > this._snapGridSize ) this._snapGridX=null; |
||||
if( Math.abs( this._snapY - this._snapGridY ) > this._snapGridSize ) this._snapGridY=null; |
||||
this._snapSetLocation( this._snapGridX || this._snapX, this._snapGridY || this._snapY ); |
||||
} |
||||
*/ |
||||
|
||||
sX1 = this.x; |
||||
sY1 = this.y; |
||||
sW = this.w; |
||||
sH = this.h; |
||||
sX2 = sX1 + sW; |
||||
sY2 = sY1 + sH; |
||||
sDir = this.getSnapDirection(); |
||||
|
||||
for (var i in this.parent.children){ |
||||
ch = this.parent.children[i]; |
||||
if (ch != this && ch.isSnapEnabled == true){ |
||||
chX1 = ch.x; |
||||
chY1 = ch.y; |
||||
chX2 = chX1 + ch.w; |
||||
chY2 = chY1 + ch.h; |
||||
chBndAry = ch.getSnapBoundary('outer'); |
||||
chBoX1 = chBndAry[3]; |
||||
chBoY1 = chBndAry[0]; |
||||
chBoX2 = chBndAry[1]; |
||||
chBoY2 = chBndAry[2]; |
||||
|
||||
// Cases B1 - B8 test TRUE if source corner is in snap border.
|
||||
// Cases D1 - D8 test TRUE if the corresponding direction of
|
||||
// movement of the corner is towards the boundary.
|
||||
// Cases C1 - C8 test TRUE if the corresponding B and D cases
|
||||
// are true for standard, sticky or grid snap.
|
||||
|
||||
// outer top-left corner, source lower-right, move dir E, SE, S
|
||||
B1 = (sX2 >= chBoX1 && sX2 < chX1 && sY2 >= chBoY1 && sY2 < chY1); |
||||
D1 = (sDir == 'E' || sDir == 'SE' || sDir == 'S'); |
||||
C1 = (B1 && (D1 || ch.isStickySnapEnabled || ch.isGridSnapEnabled)); |
||||
|
||||
// outer top-middle side, source lower-left, move SW, S, SE
|
||||
B2a = (sX1 >= chX1 && sX1 <= chX2 && sY2 >= chBoY1 && sY2 < chY1); |
||||
D2a = (sDir == 'SW' || sDir == 'S' || sDir == 'SE'); |
||||
C2a = (B2a && (D2a || ch.isStickySnapEnabled || ch.isGridSnapEnabled)); |
||||
|
||||
// outer top-middle side, source lower-right, move SW, S, SE
|
||||
B2b = (sX2 >= chX1 && sX2 <= chX2 && sY2 >= chBoY1 && sY2 < chY1); |
||||
D2b = (sDir == 'SW' || sDir == 'S' || sDir == 'SE'); |
||||
C2b = (B2b && (D2b || ch.isStickySnapEnabled || ch.isGridSnapEnabled)); |
||||
|
||||
// outer top-right corner, source lower-left, move W, SW, S
|
||||
B3 = (sX1 <= chBoX2 && sX1 > chX2 && sY2 >= chBoY1 && sY2 < chY1); |
||||
D3 = (sDir == 'W' || sDir == 'SW' || sDir == 'S'); |
||||
C3 = (B3 && (D3 || ch.isStickySnapEnabled || ch.isGridSnapEnabled)); |
||||
|
||||
// outer right-middle side, source top-left, move NW, W, SW
|
||||
B4a = (sX1 <= chBoX2 && sX1 > chX2 && sY1 >= chY1 && sY1 <= chY2); |
||||
D4a = (sDir == 'NW' || sDir == 'W' || sDir == 'SW'); |
||||
C4a = (B4a && (D4a || ch.isStickySnapEnabled || ch.isGridSnapEnabled)); |
||||
|
||||
// outer right-middle side, source bottom-left, move NW, W, SW
|
||||
B4b = (sX1 <= chBoX2 && sX1 > chX2 && sY2 >= chY1 && sY2 <= chY2); |
||||
D4b = (sDir == 'NW' || sDir == 'W' || sDir == 'SW'); |
||||
C4b = (B4b && (D4b || ch.isStickySnapEnabled || ch.isGridSnapEnabled)); |
||||
|
||||
// outer bottom-right corner, source top-left, move N, NW, W
|
||||
B5 = (sX1 <= chBoX2 && sX1 > chX2 && sY1 <= chBoY2 && sY1 > chY2); |
||||
D5 = (sDir == 'N' || sDir == 'NW' || sDir == 'W'); |
||||
C5 = (B5 && (D5 || ch.isStickySnapEnabled || ch.isGridSnapEnabled)); |
||||
|
||||
// outer bottom-middle side, source top-left, move NE, N, NW
|
||||
B6a = (sX1 >= chX1 && sX1 <= chX2 && sY1 <= chBoY2 && sY1 > chY2); |
||||
D6a = (sDir == 'NE' || sDir == 'N' || sDir == 'NW'); |
||||
C6a = (B6a && (D6a || ch.isStickySnapEnabled || ch.isGridSnapEnabled)); |
||||
|
||||
// outer bottom-middle side, source top-right, move NE, N, NW
|
||||
B6b = (sX2 >= chX1 && sX2 <= chX2 && sY1 <= chBoY2 && sY1 > chY2); |
||||
D6b = (sDir == 'NE' || sDir == 'N' || sDir == 'NW'); |
||||
C6b = (B6b && (D6b || ch.isStickySnapEnabled || ch.isGridSnapEnabled)); |
||||
|
||||
// outer bottom-left corner, source top-right, move E, NE, N
|
||||
B7 = (sX2 >= chBoX1 && sX2 < chX1 && sY1 <= chBoY2 && sY1 > chY2); |
||||
D7 = (sDir == 'E' || sDir == 'NE' || sDir == 'N'); |
||||
C7 = (B7 && (D7 || ch.isStickySnapEnabled || ch.isGridSnapEnabled)); |
||||
|
||||
// outer left-middle side, source top-right, move SE, E, NE
|
||||
B8a = (sX2 >= chBoX1 && sX2 < chX1 && sY1 >= chY1 && sY1 <= chY2); |
||||
D8a = (sDir == 'SE' || sDir == 'E' || sDir == 'NE'); |
||||
C8a = (B8a && (D8a || ch.isStickySnapEnabled || ch.isGridSnapEnabled)); |
||||
|
||||
// outer left-middle side, source bottom-right, move SE, E, NE
|
||||
B8b = (sX2 >= chBoX1 && sX2 < chX1 && sY2 >= chY1 && sY2 <= chY2); |
||||
D8b = (sDir == 'SE' || sDir == 'E' || sDir == 'NE'); |
||||
C8b = (B8b && (D8b || ch.isStickySnapEnabled || ch.isGridSnapEnabled)); |
||||
|
||||
if (C1){ |
||||
if (this.isGridSnapEnabled){ |
||||
var tmpX = chX1 - ( Math.floor( ( chX1 - sX1 ) / this._snapGridSize ) ) * this._snapGridSize; |
||||
var tmpY = chY1 - ( Math.floor( ( chY1 - sY1 ) / this._snapGridSize ) ) * this._snapGridSize; |
||||
this._snapSetLocation(tmpX, tmpY); |
||||
} |
||||
else { |
||||
this._snapSetLocation(chX1-sW, chY1-sH); |
||||
} |
||||
} |
||||
else if (C3){ |
||||
if (this.isGridSnapEnabled){ |
||||
var tmpX = chX1 + ( Math.floor( ( sX1 - chX1 ) / this._snapGridSize ) ) * this._snapGridSize; |
||||
var tmpY = chY1 - ( Math.floor( ( chY1 - sY1 ) / this._snapGridSize ) ) * this._snapGridSize; |
||||
this._snapSetLocation(tmpX, tmpY); |
||||
} |
||||
else { |
||||
this._snapSetLocation(chX2, chY1-sH); |
||||
} |
||||
} |
||||
else if (C5){ |
||||
if (this.isGridSnapEnabled){ |
||||
var tmpX = chX1 + ( Math.floor( ( sX1 - chX1 ) / this._snapGridSize ) ) * this._snapGridSize; |
||||
var tmpY = chY1 + ( Math.floor( ( sY1 - chY1 ) / this._snapGridSize ) ) * this._snapGridSize; |
||||
this._snapSetLocation(tmpX, tmpY); |
||||
} |
||||
else { |
||||
this._snapSetLocation(chX2, chY2); |
||||
} |
||||
} |
||||
else if (C7){ |
||||
if (this.isGridSnapEnabled){ |
||||
var tmpX = chX1 - ( Math.floor( ( chX1 - sX1 ) / this._snapGridSize ) ) * this._snapGridSize; |
||||
var tmpY = chY1 + ( Math.floor( ( sY1 - chY1 ) / this._snapGridSize ) ) * this._snapGridSize; |
||||
this._snapSetLocation(tmpX, tmpY); |
||||
} |
||||
else { |
||||
this._snapSetLocation(chX1-sW, chY2); |
||||
} |
||||
} |
||||
else if (C2a || C2b){ |
||||
if (this.isGridSnapEnabled){ |
||||
//if(!this._snapGridY) this._snapGridY=chY1-sH;
|
||||
//this._snapSetLocation(sX1 , this._snapGridY);
|
||||
var tmpX = chX1 + Math.floor( ( sX1 - chX1 ) / this._snapGridSize ) * this._snapGridSize; |
||||
this._snapSetLocation(tmpX , chY1-sH); |
||||
} |
||||
else { |
||||
this._snapSetLocation(sX1, chY1-sH); |
||||
} |
||||
} |
||||
else if (C4a || C4b){ |
||||
if (this.isGridSnapEnabled){ |
||||
//if(!this._snapGridX) this._snapGridX=chX2;
|
||||
//this._snapSetLocation(this._snapGridX, sY1);
|
||||
var tmpY = chY1 + Math.floor( ( sY1 - chY1 ) / this._snapGridSize ) * this._snapGridSize; |
||||
this._snapSetLocation(chX2, tmpY); |
||||
} |
||||
else { |
||||
this._snapSetLocation(chX2, sY1); |
||||
} |
||||
} |
||||
else if (C6a || C6b){ |
||||
if (this.isGridSnapEnabled){ |
||||
//if(!this._snapGridY) this._snapGridY=chY2;
|
||||
//this._snapSetLocation(sX1 , this._snapGridY);
|
||||
var tmpX = chX1 + Math.floor( ( sX1 - chX1 ) / this._snapGridSize ) * this._snapGridSize; |
||||
this._snapSetLocation(tmpX , chY2); |
||||
} |
||||
else { |
||||
this._snapSetLocation(sX1, chY2); |
||||
} |
||||
} |
||||
else if (C8a || C8b){ |
||||
if (this.isGridSnapEnabled){ |
||||
//if(!this._snapGridX) this._snapGridX=chX1-sW;
|
||||
//this._snapSetLocation(chX1-sW , sY1);
|
||||
var tmpY = chY1 + Math.floor( ( sY1 - chY1 ) / this._snapGridSize ) * this._snapGridSize; |
||||
this._snapSetLocation(chX1-sW, tmpY); |
||||
} |
||||
else { |
||||
this._snapSetLocation(chX1-sW, sY1); |
||||
} |
||||
} |
||||
|
||||
if (C1 || C2a || C2b || C3 || C4a || C4b || C5 || C6a || C6b || C7 || C8a || C8b){ |
||||
this._snapObject=ch; |
||||
this.invokeEvent("snap"); |
||||
ch._snapObject=this; |
||||
ch.invokeEvent("snap"); |
||||
} |
||||
} |
||||
} |
||||
}; |
||||
@ -1,182 +0,0 @@
@@ -1,182 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
Swiper Animation Extension - originally designed by Erik Arvidsson (http://web.eae.net)
|
||||
IncDec addon - Created by Daniel Tiru (http://www.tiru.se)
|
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
requires: DynLayer |
||||
|
||||
*/ |
||||
|
||||
Swiper = {}; // used by dynapi.library
|
||||
|
||||
DynLayer.prototype.swipeTo = function(dir, steps, ms, min) { |
||||
|
||||
this._swipeSteps = (steps!=null)? steps: 4; |
||||
this._swipeMS = (ms!=null)? ms:25; |
||||
this._swipeDir=dir; |
||||
this._swiperMin=min; |
||||
if (this._swiperMinimized==null) {
|
||||
this._swiperMinimized = 0 |
||||
} |
||||
|
||||
if (this.swipeTimer != null) window.clearTimeout(this.swipeTimer); |
||||
|
||||
if (!this._swipeCnt) { // No animation yet!
|
||||
this._swipeOrgX = this.getX(); |
||||
this._swipeOrgY = this.getY(); |
||||
this._swipeOrgWidth = this.getWidth(); |
||||
this._swipeOrgHeight = this.getHeight(); |
||||
} |
||||
|
||||
this._swipeCnt = this._swipeSteps; |
||||
if (dir.substr(0,3)!='dec' && dir.substr(0,3)!='inc') { |
||||
this.setClip([0,0,0,0]); |
||||
} |
||||
window.setTimeout(this+"._swipe()", this._swipeMS); |
||||
}; |
||||
DynLayer.prototype._swipe = function() { |
||||
var steps = this._swipeSteps; |
||||
var x = this._swipeOrgX; |
||||
var y = this._swipeOrgY; |
||||
var w = this._swipeOrgWidth; |
||||
var h = this._swipeOrgHeight; |
||||
var min = this._swiperMin; |
||||
|
||||
if (this._swipeCnt == 0) { |
||||
if (this._swipeDir.substr(0,3)!='dec' && this._swipeDir.substr(0,3)!='inc') { |
||||
this.setClip([0, w, h,0]); |
||||
} |
||||
else if(this._swipeDir.substr(0,3)=='dec') { |
||||
this._swiperMinimized=1; |
||||
} |
||||
else if(this._swipeDir.substr(0,3)=='inc') { |
||||
this._swiperMinimized=0; |
||||
} |
||||
this.invokeEvent('swipefinish'); |
||||
return; |
||||
} |
||||
else { |
||||
this._swipeCnt--; |
||||
this.setVisible(true); |
||||
switch (this._swipeDir) { |
||||
case "bottom": //down (see the numpad)
|
||||
this.setClip([h * this._swipeCnt / steps, w, h, 0]); |
||||
this.setY(y - h * this._swipeCnt / steps); |
||||
break; |
||||
case "top": |
||||
this.setClip([0, w, h * (steps - this._swipeCnt) / steps, 0]); |
||||
this.setY(y + h * this._swipeCnt / steps); |
||||
break; |
||||
case "right": |
||||
this.setClip([0, w, h,w * this._swipeCnt / steps]); |
||||
this.setX(x - w * this._swipeCnt / steps); |
||||
break; |
||||
case "left": |
||||
this.setClip([0, w * (steps - this._swipeCnt) / steps, h, 0]); |
||||
this.setX(x + w * this._swipeCnt / steps); |
||||
break; |
||||
case "bottom-right": |
||||
this.setClip([h * this._swipeCnt / steps, w, h, w * this._swipeCnt / steps]); |
||||
this.setX(x - w * this._swipeCnt / steps); |
||||
this.setY(y - h * this._swipeCnt / steps); |
||||
break; |
||||
case "bottom-left": |
||||
this.setClip([h * this._swipeCnt / steps, w * (steps - this._swipeCnt) / steps, h, 0]); |
||||
this.setX(x + w * this._swipeCnt / steps); |
||||
this.setY(y - h * this._swipeCnt / steps); |
||||
break; |
||||
case "top-left": |
||||
this.setClip([0, w * (steps - this._swipeCnt) / steps, h * (steps - this._swipeCnt) / steps, 0]); |
||||
this.setX(x + w * this._swipeCnt / steps); |
||||
this.setY(y + h * this._swipeCnt / steps); |
||||
break; |
||||
case "top-right": |
||||
this.setClip([0, w, h * (steps - this._swipeCnt) / steps, w * this._swipeCnt / steps]); |
||||
this.setX(x - w * this._swipeCnt / steps); |
||||
this.setY(y + h * this._swipeCnt / steps); |
||||
break; |
||||
// inc-dec
|
||||
case "dec-right": |
||||
if (this._swiperMinimized==0) { |
||||
if ((w/steps*this._swipeCnt) > min) { |
||||
this.setClip([0, (w/steps*this._swipeCnt), h, 0]); |
||||
} |
||||
else this.setClip([0, min, h, 0]); |
||||
} |
||||
break; |
||||
case "inc-right": |
||||
//var clippos = this.getClip().toString().split(',');
|
||||
if (this.getClip()[1] < w-(w/steps*this._swipeCnt)) { |
||||
if (this._swiperMinimized==1) { |
||||
this.setClip([0, w-(w/steps*this._swipeCnt), h, 0]); |
||||
} |
||||
} |
||||
break; |
||||
case "dec-left": |
||||
if (this._swiperMinimized==0) { |
||||
if ((w/steps*this._swipeCnt) > min) { |
||||
this.setClip([0, Math.round(w/steps*this._swipeCnt), h, 0]); |
||||
this.setX(w+(x-(Math.round(w/steps*this._swipeCnt)))); |
||||
} |
||||
else{ |
||||
this.setClip([0, min, h, 0]); |
||||
this.setX(w+x-min); |
||||
} |
||||
} |
||||
break; |
||||
case "inc-left": |
||||
if (this._swiperMinimized==1) { |
||||
if (this.getClip()[1] < w-Math.round(w/steps*this._swipeCnt)) { |
||||
this.setClip([0, w-Math.round(w/steps*this._swipeCnt), h, 0]); |
||||
if (w-(w/steps*this._swipeCnt) < x) { |
||||
this.setX(x-(w-Math.round(w/steps*(this._swipeCnt)+min))); |
||||
} |
||||
else this.setX((steps*w/steps)-(x)); |
||||
} |
||||
} |
||||
break; |
||||
case "dec-down": |
||||
if (this._swiperMinimized==0) { |
||||
if ((h/steps*this._swipeCnt) > min) { |
||||
this.setClip([0, w, (h/steps*this._swipeCnt), 0]); |
||||
} |
||||
else this.setClip([0, w, min, 0]); |
||||
} |
||||
break; |
||||
case "inc-down": |
||||
if (this._swiperMinimized==1) { |
||||
if (this.getClip()[2] < h-(h/steps*this._swipeCnt)) { |
||||
this.setClip([0,w, h-(h/steps*this._swipeCnt), 0]); |
||||
} |
||||
} |
||||
break; |
||||
case "dec-up": |
||||
if (this._swiperMinimized==0) { |
||||
if ((h/steps*this._swipeCnt) > min) { |
||||
this.setClip([0, w, Math.round(h/steps*this._swipeCnt), 0]); |
||||
this.setY((h+y-(Math.round(h/steps*this._swipeCnt)))); |
||||
} |
||||
else{ |
||||
this.setClip([0, w, min, 0]); |
||||
this.setY(h+y-min); |
||||
} |
||||
} |
||||
break; |
||||
case "inc-up": |
||||
if (this._swiperMinimized==1) { |
||||
if (this.getClip()[2] < h-Math.round(h/steps*this._swipeCnt)) { |
||||
this.setClip([0, w, h-Math.round(h/steps*this._swipeCnt), 0]); |
||||
if (h-(h/steps*this._swipeCnt) < y) { |
||||
this.setY(y-(h-Math.round(h/steps*(this._swipeCnt)+min))); |
||||
} |
||||
else this.setY((steps*h/steps)-(y-min)); |
||||
} |
||||
} |
||||
break; |
||||
}
|
||||
this.swipeTimer = window.setTimeout(this+"._swipe()", this._swipeMS); |
||||
} |
||||
}; |
||||
|
||||
@ -1,293 +0,0 @@
@@ -1,293 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
Fader Animation Extension |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
requires: DynLayer, Fader |
||||
*/ |
||||
|
||||
function TextAnimation(x,y,text,animBy,dlyr){ |
||||
this.EventObject = EventObject; |
||||
this.EventObject(); |
||||
|
||||
this._chars=[]; |
||||
this._lyrPool=[]; |
||||
this._text=text; |
||||
this._animBy=null; |
||||
this._inUse=0; |
||||
this._dlyr=(dlyr||dynapi.document); |
||||
|
||||
this.setLocation(x,y); |
||||
this.animateBy(animBy); |
||||
this.visible=true; |
||||
|
||||
var me=this; // use delegate "me"
|
||||
var fn=function(){ |
||||
me._created=true; |
||||
me._split(); |
||||
} |
||||
if(this._dlyr!=dynapi.document) this._dlyr.onCreate(fn); |
||||
else { |
||||
var e={onload:fn}; |
||||
this._dlyr.addEventListener(e); |
||||
} |
||||
}; |
||||
var p = dynapi.setPrototype('TextAnimation','EventObject'); |
||||
p._clear = function(){ |
||||
var l; |
||||
var p=this._lyrPool; |
||||
var c=this._chars; |
||||
for(var i=0;i<c.length;i++){ |
||||
l=c[i]; |
||||
l.setVisible(false); |
||||
l.removeAllEventListeners(); |
||||
p[p.length]=l; |
||||
} |
||||
this._chars.length=0; |
||||
}; |
||||
p._createCharLayer=function(t){ |
||||
var l; |
||||
var p=this._lyrPool; |
||||
if (!p.length) l = this._dlyr.addChild(new DynLayer()); |
||||
else { |
||||
l = p[p.length-1]; |
||||
p.length--; |
||||
}; |
||||
l._ta=this; |
||||
l.setHTML(t); |
||||
if(l._created) { |
||||
// resize char layer
|
||||
l.setSize(1,1); // why mozilla,gecko,ie??
|
||||
l.setSize(l.getContentWidth(),l.getContentHeight()); |
||||
} |
||||
l.setVisible(this.visible); |
||||
if(dynapi.ua.ie) l.css.filter='alpha(opacity=100)'; |
||||
else l.css.MozOpacity = 1; |
||||
return l; |
||||
}; |
||||
p._exec = function(cmd,i){ |
||||
window.setTimeout(cmd,(this._ms*i)+5); |
||||
}; |
||||
p._resize=function(align){ |
||||
var x=this.x; |
||||
var y=this.y; |
||||
var i,l,c=this._chars; |
||||
for(i=0;i<c.length;i++){ |
||||
l=c[i]; // resize char layer
|
||||
if(l._created) { |
||||
l.setSize(1,1); // why mozilla,gecko,ie??
|
||||
l.setSize(l.getContentWidth(),l.getContentHeight()); |
||||
if(align) { |
||||
l.setLocation(x,y); |
||||
x+=l.w; |
||||
} |
||||
} |
||||
} |
||||
}; |
||||
p._split = function(){ |
||||
var i,ar,lyr; |
||||
var t=this._text; |
||||
var c=this._chars; |
||||
var x=this.x; |
||||
var y=this.y; |
||||
if(!t||!this._created) return; |
||||
this._clear(); |
||||
if(this._animBy=='all') { // By all
|
||||
t='<nobr>'+t+'</nobr>'; |
||||
lyr=c[0]=this._createCharLayer(t); |
||||
lyr.setLocation(x,y); |
||||
}else { // By word or letter
|
||||
if (this._animBy=='word') { |
||||
t=t.replace(/\s/g,' '); |
||||
ar=t.split(' '); |
||||
} |
||||
else {
|
||||
ar=t.split(''); |
||||
} |
||||
for(i=0;i<ar.length;i++){ |
||||
if (ar[i]==' ') ar[i]=' '; |
||||
lyr=c[i]=this._createCharLayer(ar[i]); |
||||
lyr.setLocation(x,y); |
||||
x+=lyr.w; |
||||
} |
||||
} |
||||
if(lyr) lyr.addEventListener(TextAnimation._tiggerEvents); |
||||
}; |
||||
p.animateBy=function(s,delay){ // all, letter, word
|
||||
this._animBy=s||this._animBy||'letter'; |
||||
this.setDelay(delay); |
||||
this._split(); |
||||
}; |
||||
p.getCharLayer = function(i){ |
||||
if (i>=0 && i<this.chars.length) return this.chars[i]; |
||||
}; |
||||
p.setDelay = function(delay){ |
||||
this._ms=delay||this._ms||50; |
||||
}; |
||||
p.setFont=function(size,family){ |
||||
|
||||
}; |
||||
p.setLocation=function(x,y){ |
||||
x=x||0; y=y||0; |
||||
var byX=x-this.x; |
||||
var byY=y-this.y; |
||||
var c=this._chars; |
||||
this.x=x; this.y=y; |
||||
for (var i=0;i<c.length;i++){ |
||||
l=c[i]; l.setLocation(l.x+byX,l.y+byY); |
||||
} |
||||
}; |
||||
p.setText=function(t,animBy,delay){ |
||||
this._text=t||''; |
||||
this.setDelay(delay); |
||||
this.animateBy(animBy); |
||||
}; |
||||
p.setVisible = function(b){ |
||||
var c=this._chars; |
||||
this.visible=b; |
||||
for (var i=0;i<c.length;i++) c[i].setVisible(b); |
||||
}; |
||||
|
||||
// Trigger Events
|
||||
var fn = function(e){ |
||||
var o=e.getSource(); |
||||
o._ta._inUse--; |
||||
if(!o._ta._inUse) window.setTimeout(o._ta+'.invokeEvent("animfinish")',55); |
||||
}; |
||||
TextAnimation._tiggerEvents = { |
||||
onpathfinish:fn, |
||||
onfadein:fn, |
||||
onfadeout:fn |
||||
}; |
||||
|
||||
|
||||
// Effects
|
||||
// ------------------------
|
||||
// Apear
|
||||
p.appear = function(){ |
||||
var i,ext,c=this._chars; |
||||
this._exec(this+'.invokeEvent("animstart")',1); |
||||
for (i=0;i<c.length;i++) { |
||||
if(!this._inUse) c[i].setVisible(false); |
||||
if(i==(c.length-1)) ext=c[i]+'.invokeEvent("pathfinish")'; |
||||
this._exec(c[i]+'.setVisible(true);;'+ext,i); |
||||
} |
||||
this._inUse++; |
||||
}; |
||||
// Bounce
|
||||
p.bounce = function(h,modifier){ |
||||
var i,l,c; |
||||
c=this._chars; |
||||
h=(h||100); |
||||
modifier=(modifier<-1)? -1:(modifier||0); |
||||
this._exec(this+'.invokeEvent("animstart")',1); |
||||
// setup bounce chars
|
||||
for (i=0;i<c.length; i++) { |
||||
l=c[i]; |
||||
l._bonctmr=i<<modifier; |
||||
l._boncyv=0; |
||||
l._boncmaxv=8; |
||||
l._boncy=-l.h; |
||||
l.setLocation(null,this.y-h); |
||||
if(!this._inUse) l.setVisible(true); |
||||
this._exec(this+'._startBounce('+i+','+h+');',i); |
||||
} |
||||
this._inUse++; |
||||
}; |
||||
p._startBounce = function(i,h){ |
||||
var l,y,c,ext; |
||||
var c=this._chars; |
||||
l=c[i]; |
||||
if (l._bonctmr>0) l._bonctmr--; |
||||
else { |
||||
yv=l._boncyv; |
||||
//y=l._boncy;
|
||||
l._boncy+=yv; |
||||
if (yv<l._boncmaxv) l._boncyv++; |
||||
if (l._boncy>h-l.h) { |
||||
l._boncy=h-l.h; |
||||
l._boncyv=-l._boncyv; |
||||
if (l._boncmaxv>0) l._boncmaxv--; |
||||
} |
||||
l.setLocation(null,(this.y-h)+l._boncy+l.h); |
||||
} |
||||
|
||||
if(l._boncmaxv!=0){ |
||||
this._exec(this+'._startBounce('+i+','+h+');'+ext,1); |
||||
} |
||||
else if(i==(c.length-1)) { |
||||
this._exec(l+'.invokeEvent("pathfinish")',1); |
||||
}
|
||||
}; |
||||
// Fade In
|
||||
p.fadeIn = function(inc,ms){ |
||||
var i,c=this._chars; |
||||
this._exec(this+'.invokeEvent("animstart")',1); |
||||
for (i=0;i<c.length;i++) this._exec(c[i]+'.fadeIn('+inc+','+ms+');',i); |
||||
this._inUse++; |
||||
}; |
||||
// Fade Out
|
||||
p.fadeOut = function(inc,ms){ |
||||
var i,c=this._chars; |
||||
this._exec(this+'.invokeEvent("animstart")',1); |
||||
for (i=0;i<c.length;i++) this._exec(c[i]+'.fadeOut('+inc+','+ms+');',i); |
||||
this._inUse++; |
||||
}; |
||||
// Fly From
|
||||
p.flyFrom = function(x,y,inc,ms){ |
||||
var i,l,c=this._chars; |
||||
this._exec(this+'.invokeEvent("animstart")',1); |
||||
for (i=0;i<c.length;i++) { |
||||
l=c[i]; |
||||
this._exec( |
||||
((!this._inUse)? l+'.setVisible(true);':'') |
||||
+l+'.slideTo('+l.x+','+l.y+','+inc+','+ms+');' |
||||
,i); |
||||
l.setLocation(x,y); |
||||
} |
||||
this._inUse++;
|
||||
}; |
||||
p.zoomText = function(from,to,inc,ms){ |
||||
var i,l,c; |
||||
c=this._chars; |
||||
this._exec(this+'.invokeEvent("animstart")',1); |
||||
// setup chars
|
||||
for (i=0;i<c.length; i++) { |
||||
l=c[i]; |
||||
l._zTo = to||20; |
||||
l._zFrom = from||10; |
||||
l._zMs=(ms)? ms:50; |
||||
l._zInc=(inc)? Math.abs(inc):5; |
||||
l.css.fontSize=l._zFrom+'px'; |
||||
if (l._zFrom>l._zTo) l._zInc*=-1; |
||||
if(!this._inUse) l.setVisible(true); |
||||
this._exec(this+'._startZoom('+i+');',i); |
||||
} |
||||
this._inUse++; |
||||
}; |
||||
p._startZoom= function(i){ |
||||
var l,y,c,ext; |
||||
var l=this._chars[i]; |
||||
var inc = l._zInc; |
||||
var from = l._zFrom; |
||||
var to = l._zTo; |
||||
from+=inc; |
||||
if ((inc<0 && from<=to)|| (inc>0 && from>=to)) from=to; |
||||
l._zFrom=from; |
||||
l.css.fontSize=from+'px'; |
||||
l.setSize(0,0); // ??
|
||||
l.setSize(l.getContentWidth(),l.getContentHeight()); |
||||
if(i==0) l.setLocation(null,this.y-(l.h/2)); |
||||
else l.setLocation(this._chars[i-1].x+this._chars[i-1].w,this.y-(l.h/2)); |
||||
if(from!=to) l._zTmr=window.setTimeout(this+'._startZoom('+i+')',l._zMs); |
||||
else if(i==(this._chars.length-1)) { |
||||
this._exec(l+'.invokeEvent("pathfinish")',1); |
||||
}
|
||||
}; |
||||
|
||||
|
||||
// to-do:
|
||||
p.wave = function(){}; |
||||
p.nudge = function(){}; |
||||
p.quake = function(){}; |
||||
@ -1,64 +0,0 @@
@@ -1,64 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
Glide Animation Extension |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
requires: DynLayer, dynapi.functions.Math |
||||
*/ |
||||
|
||||
function Thread(dlyr) { |
||||
this.DynObject = DynObject; |
||||
this.DynObject(); |
||||
|
||||
if (dlyr) this.dlyr = dlyr; |
||||
else dlyr = this; // if no dynlayer passed it calls events onto itself
|
||||
|
||||
this._frame = 0; |
||||
this._path = null; |
||||
this.loop = false; |
||||
} |
||||
var p = dynapi.setPrototype('Thread','DynObject'); |
||||
p.interval = 20; |
||||
p.sleep = function (ms) { |
||||
this.interval = Math.abs(parseInt(ms)); |
||||
if (this._timer) this.start(); |
||||
}; |
||||
p._restart = function () { // starts, or restarts if necessary
|
||||
this.stop(false); |
||||
setTimeout(this+'.start()',this.interval+1); |
||||
}; |
||||
p.start = function () { // starts, or restarts if necessary
|
||||
if (this._timer) this._restart(); |
||||
else { |
||||
this.dlyr.invokeEvent("threadstart"); |
||||
this._timer = setInterval(this+'.run()',this.interval); |
||||
} |
||||
}; |
||||
p.run = function () { |
||||
var p=this._path, d=this.dlyr; |
||||
this.dlyr.invokeEvent("threadrun"); |
||||
if (p && this.dlyr!=this && this._timer) { |
||||
if (this._frame>=p.length/2) { |
||||
if (this.loop) this._frame = 0; |
||||
else { |
||||
this.stop(false); |
||||
this.dlyr.invokeEvent("threadfinish"); |
||||
return; |
||||
} |
||||
} |
||||
if (this._frame==0 && (d.x==p[0] && d.y==p[1])) this.frame += 1; // already at 1st coordinate
|
||||
d.setLocation(p[this._frame*2],p[this._frame*2+1]); |
||||
this._frame++; |
||||
} |
||||
}; |
||||
p.stop = function (noevt) { |
||||
clearInterval(this._timer); |
||||
this._timer = null; |
||||
this._frame = 0; |
||||
if (noevt!=false) this.dlyr.invokeEvent("threadstop"); |
||||
}; |
||||
p.play = function (path) { |
||||
this._path = path; |
||||
this.start(); |
||||
}; |
||||
@ -1,44 +0,0 @@
@@ -1,44 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
TimerX Class by Raymond Irving (http://dyntools.shorturl.com)
|
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
requires: Dynlayer |
||||
*/ |
||||
|
||||
TimerX = {}; // used by dynapi.library
|
||||
|
||||
p = DynLayer.prototype; |
||||
p.startTimer=function(interval) { |
||||
if (this.tickTimer>0) this.stopTimer(); |
||||
this._timerInterval=interval||5; |
||||
this._timerTickCount=0; |
||||
this._timerStoped=false; |
||||
this._tickTimer=setTimeout(this+'.tickLoop()',this._timerInterval); |
||||
}; |
||||
p.tickLoop=function() { |
||||
if (this._timerStoped==true||this._timerStoped==null) return; |
||||
this._timerTickCount++; |
||||
this.invokeEvent("timer"); |
||||
this._tickTimer=window.setTimeout(this+'.tickLoop()',this._timerInterval); |
||||
}; |
||||
p.stopTimer=function() { |
||||
this._timerStoped=true; |
||||
clearTimeout(this._tickTimer); |
||||
}; |
||||
p.setTimerInterval=function(interval) { |
||||
this._timerInterval=interval||this._timerInterval; |
||||
}; |
||||
p.getTimerInterval=function() { |
||||
return this._timerInterval; |
||||
}; |
||||
p.getTickCount=function() { |
||||
return this._timerTickCount; |
||||
}; |
||||
p.resetTickCount=function() { |
||||
this._timerTickCount=0; |
||||
}; |
||||
|
||||
|
||||
|
||||
@ -1,196 +0,0 @@
@@ -1,196 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
BorderManager Class |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
Requires: Highlighter |
||||
*/ |
||||
|
||||
BorderManager = {}; |
||||
|
||||
// usage: BorderManager.enableBorder(border_width,border_color,border_type,lyr1,lyr2,...lyrN);
|
||||
BorderManager.enableBorder=function(w,c,style){ |
||||
var lyr,arg=arguments; |
||||
for (var i=3;i<arg.length;i++){ |
||||
lyr=arg[i]; |
||||
if(lyr) lyr.setBorder(w,c,style); |
||||
} |
||||
}; |
||||
|
||||
var p = DynLayer.prototype; |
||||
/* |
||||
Border |
||||
style: inner, css-styles (solid, dotted, inset, outset,groove, etc) |
||||
ns4 will use layers for both inner and css-styles (only solid supported) |
||||
*/ |
||||
p.setBorder = function(w,c,style){ |
||||
var oldW = w,defW = 0; |
||||
var defCol = '#000000'; |
||||
var defStyle = 'solid'; |
||||
var tc,rc,bc,lc; |
||||
var ts,rs,bs,ls; |
||||
var tw=0,rw=0,bw=0,lw=0; |
||||
if(style=='inner') this.setInnerBorder(oldW,c); |
||||
else { |
||||
// handle width
|
||||
if (w==null) w = defW; |
||||
else if(typeof(w)=='object') { |
||||
tw=w.top||w.light; |
||||
rw=w.right||w.dark; |
||||
bw=w.bottom||w.dark; |
||||
lw=w.left||w.light; |
||||
w=defW; |
||||
}; |
||||
this._needBoxFix = true; |
||||
this._fixBoxModel = false; |
||||
this._fixBw = (lw+rw)||(w*2); |
||||
this._fixBh = (tw+bw)||(w*2); |
||||
this._fixBwp = this._fixBhp = 0; |
||||
if(dynapi.ua.ns4) this.setInnerBorder(oldW,c); |
||||
else { |
||||
// handle color
|
||||
if (c==null) c = defCol; |
||||
else if(typeof(c)=='object') { |
||||
tc=c.top||c.light; |
||||
rc=c.right||c.dark; |
||||
bc=c.bottom||c.dark; |
||||
lc=c.left||c.light; |
||||
c=defCol; |
||||
}; |
||||
// Style
|
||||
if (style==null) style = defStyle; |
||||
else if(typeof(style)=='object') { |
||||
ts=style.top||style.light; |
||||
rs=style.right||style.dark; |
||||
bs=style.bottom||style.dark; |
||||
ls=style.left||style.light; |
||||
style=defStyle; |
||||
}; |
||||
// Setup CSS
|
||||
this._cssBorTop = (tw||w)+'px '+(ts||style)+' '+(tc||c); |
||||
this._cssBorRight = (rw||w)+'px '+(rs||style)+' '+(rc||c); |
||||
this._cssBorBottom = (bw||w)+'px '+(bs||style)+' '+(bc||c); |
||||
this._cssBorLeft = (lw||w)+'px '+(ls||style)+' '+(lc||c); |
||||
if(this.elm){ |
||||
var css = this.css; |
||||
css.borderTop = this._cssBorTop; |
||||
css.borderRight = this._cssBorRight; |
||||
css.borderBottom = this._cssBorBottom; |
||||
css.borderLeft = this._cssBorLeft; |
||||
BorderManager.FixBoxModel(this); |
||||
} |
||||
else { |
||||
this._cssBorder = ' border-top:'+this._cssBorTop + |
||||
'; border-right:'+this._cssBorRight + |
||||
'; border-bottom:'+this._cssBorBottom + |
||||
'; border-left:'+this._cssBorLeft+'; ' |
||||
} |
||||
} |
||||
} |
||||
}; |
||||
|
||||
/* |
||||
Inner Border Only. |
||||
useage: setInnerBorder(N,'#000000') |
||||
setInnerBorder(N,{top:'white',bottom:'black'}); |
||||
setInnerBorder(N,{light:'white',dark:'silver'}); |
||||
setInnerBorder({top:2,bottom:1},'#000000'); |
||||
*/ |
||||
p.setInnerBorder = function(w,c){ |
||||
var _bor_tp={top:0,left:0,right:0-this._fixBw}; |
||||
var _bor_rt={top:0,right:0-this._fixBw,bottom:0-this._fixBh}; |
||||
var _bor_bm={bottom:0-this._fixBh,left:0,right:0-this._fixBw}; |
||||
var _bor_lt={top:0,left:0,bottom:0-this._fixBh}; |
||||
var tc,rc,bc,lc; |
||||
var tw=0,rw=0,bw=0,lw=0; |
||||
// handle width
|
||||
if (w==null) w = 0; |
||||
else if(typeof(w)=='object') { |
||||
tw=w.top||w.light; |
||||
rw=w.right||w.dark; |
||||
bw=w.bottom||w.dark; |
||||
lw=w.left||w.light; |
||||
w = 0; |
||||
}; |
||||
// handle color
|
||||
if (c==null) c='#000000'; |
||||
else if(typeof(c)=="object") { |
||||
tc=c.top||c.light; |
||||
rc=c.right||c.dark; |
||||
bc=c.bottom||c.dark; |
||||
lc=c.left||c.light; |
||||
c=null; |
||||
}; |
||||
if(!this._borTp){ |
||||
// create border layers
|
||||
this.addChild(new Highlighter(),'_borTp');//top
|
||||
this.addChild(new Highlighter(),'_borRt');//right
|
||||
this.addChild(new Highlighter(),'_borBm');//bottom
|
||||
this.addChild(new Highlighter(),'_borLt'); //left
|
||||
// setup anchors
|
||||
this._borTp.setAnchor(_bor_tp); |
||||
this._borRt.setAnchor(_bor_rt); |
||||
this._borBm.setAnchor(_bor_bm); |
||||
this._borLt.setAnchor(_bor_lt); |
||||
// z-index
|
||||
this._borTp.setZIndex(10000); |
||||
this._borRt.setZIndex(10000); |
||||
this._borBm.setZIndex(10000); |
||||
this._borLt.setZIndex(10000); |
||||
} |
||||
|
||||
// width
|
||||
this._borTp.setHeight(tw||w); |
||||
this._borRt.setWidth(rw||w); |
||||
this._borBm.setHeight(bw||w); |
||||
this._borLt.setWidth(lw||w); |
||||
// color
|
||||
this._borTp.setBgColor(tc||c); |
||||
this._borRt.setBgColor(rc||c); |
||||
this._borBm.setBgColor(bc||c); |
||||
this._borLt.setBgColor(lc||c); |
||||
// update anchors
|
||||
if (this._updateAnchors) this._updateAnchors(); |
||||
}; |
||||
|
||||
// Fix Box Model
|
||||
BorderManager.FixBoxModel = function(lyr,force){ |
||||
if(!this.compatCheck) { |
||||
var compat = document.compatMode; |
||||
this.compatCheck = true; |
||||
this.compatMode = (typeof compat=="string"&&compat!="BackCompat"); |
||||
} |
||||
|
||||
if (!dynapi.ua.opera && this.compatMode) return; |
||||
else if(!force && (!lyr||!lyr.css||lyr._fixBoxModel)) return; |
||||
|
||||
var fixed,css = lyr.css; |
||||
var p = this.FixBoxModelParseInt; |
||||
var cWidth = lyr.w||p(css.width), cHeight = lyr.h||p(css.height); |
||||
var wBorder = lyr._fixBw;//||(p(css.borderLeftWidth) + p(css.borderRightWidth));
|
||||
var hBorder = lyr._fixBh;//||(p(css.borderTopWidth) + p(css.borderBottomWidth));
|
||||
var wPadding = lyr._fixBwp;//||(p(css.paddingLeft) + p(css.paddingRight));
|
||||
var hPadding = lyr._fixBhp;//||(p(css.paddingTop) + p(css.paddingBottom));
|
||||
if(wBorder>0||wPadding>0) { |
||||
fixed = true; |
||||
cWidth = cWidth + wBorder + wPadding; |
||||
if(!dynapi.ua.gecko) lyr.css.width = cWidth; |
||||
} |
||||
if(hBorder>0||hPadding>0) { |
||||
fixed = true; |
||||
cHeight = cHeight + hBorder + hPadding; |
||||
if(dynapi.ua.ie) lyr.css.height = cHeight; |
||||
} |
||||
if(fixed){ |
||||
lyr.css.clip = 'rect(0px,'+(cWidth)+'px,'+(cHeight)+'px,0px)'; |
||||
lyr._fixBoxModel = true; |
||||
lyr._fixBw = wBorder; |
||||
lyr._fixBh = hBorder; |
||||
lyr._fixBwp = wPadding; |
||||
lyr._fixBhp = hPadding; |
||||
} |
||||
}; |
||||
BorderManager.FixBoxModelParseInt = function(s){ |
||||
return parseInt(s,10)||0; |
||||
}; |
||||
@ -1,95 +0,0 @@
@@ -1,95 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
ButtonFlatStyle |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
Requires: StyleManager, BorderManager, Button |
||||
*/ |
||||
|
||||
function ButtonFlatStyle(){ |
||||
|
||||
var style = new Style(); // create basic style object
|
||||
style.styleName='FlatButtonStyle';
|
||||
// setup mouse over and down color, mouse out will use backColor and foreColor
|
||||
style.mOverBackColor = style.selBackColor; |
||||
style.mDownBackColor = '#FFCC00'; |
||||
//style.mOverForeColor = style.mDownForeColor = style.selForeColor;
|
||||
style.fontSize=2; |
||||
style._coverAnchor ={left:0,right:0,top:0,bottom:0}; |
||||
style._events = { |
||||
onmouseout:function(e){ |
||||
var o=e.getSource(); |
||||
o.setInnerBorder(0); |
||||
o.setBgColor(o.getStyleAttribute('backColor')); |
||||
o.invokeEvent('mouseup',null,true); |
||||
}, |
||||
onmouseover:function(e){ |
||||
var o=e.getSource(); |
||||
if(o._disabled) return null; |
||||
o.setInnerBorder(1,o.getStyleAttribute('borderColor')); |
||||
o.setBgColor(o.getStyleAttribute('mOverBackColor')); |
||||
}, |
||||
onmousedown:function(e){ |
||||
var o=e.getSource(); |
||||
if(o._disabled) return null; |
||||
var bs = (dynapi.ua.ns4)? o._blkBoardElm:o._blkBoardElm.style; |
||||
if(!bs.position) bs.position = 'absolute'; |
||||
bs.left="1"; |
||||
bs.top="1"; |
||||
o.setBgColor(o.getStyleAttribute('mDownBackColor')); |
||||
}, |
||||
onmouseup:function(e,args){ |
||||
var o=e.getSource(); |
||||
if(o._disabled) return null; |
||||
var bs = (dynapi.ua.ns4)? o._blkBoardElm:o._blkBoardElm.style; |
||||
bs.left="0"; |
||||
bs.top="0"; |
||||
if(!args) { |
||||
o.setBgColor(o.getStyleAttribute('mOverBackColor')); |
||||
o.invokeEvent('buttonclick'); // this gives better clicking resolutions in IE. See "Mouse Click Speed Test" - Trouble Shooting
|
||||
} |
||||
} |
||||
}; |
||||
|
||||
// initStyle will act as a function of the DynLayer object
|
||||
style.initStyle = function(){ |
||||
var style = this.style; |
||||
this.enableBlackboard(); |
||||
this.setTextSelectable(false); |
||||
this.setCursor('hand'); |
||||
if(dynapi.ua.ns4) { |
||||
this.addChild(new DynLayer(),'lyrCover'); |
||||
this.lyrCover.setAnchor(this.style._coverAnchor); |
||||
//this.lyrCover.captureMouseEvents();
|
||||
} |
||||
this.addEventListener(style._events); |
||||
this.renderStyle(); |
||||
}; |
||||
|
||||
// renderStyle will act as a function of the DynLayer object
|
||||
style.renderStyle = function(act){ |
||||
var all =!act; |
||||
|
||||
// caption & resize
|
||||
if(all||act=='caption'||act=='resize'){ |
||||
this.setHTML(this._getCapHTML()); |
||||
} |
||||
// set other attributes if rendering all areas
|
||||
if(all){ |
||||
this.setBgColor(this.getStyleAttribute('backColor')); |
||||
} |
||||
}; |
||||
|
||||
// removeStyle will act as a function of the DynLayer object
|
||||
style.removeStyle = function(){ |
||||
this.setInnerBorder(0); |
||||
if(dynapi.ua.ns4) this.lyrCover.deleteFromParent(); |
||||
this.removeEventListener(this.style._events); |
||||
}; |
||||
|
||||
return style; |
||||
}; |
||||
|
||||
// Creates the style once it has been loaded
|
||||
Styles.addStyle('ButtonFlat',ButtonFlatStyle); |
||||
@ -1,114 +0,0 @@
@@ -1,114 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
ButtonImageStyle |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
Requires: StyleManager, Button |
||||
*/ |
||||
|
||||
function ButtonImageStyle(){ |
||||
var style = new Style(); // create basic style object
|
||||
style.styleName='ImageButtonStyle'; |
||||
style._coverAnchor ={left:0,right:0,top:0,bottom:0}; |
||||
style.fontSize=2; |
||||
style.imageOvr = null; |
||||
style.loadImages = function(){ |
||||
// load default images
|
||||
if(!this.imageOff) this.imageOff = Styles.getImage('btn_off.gif',22,22); |
||||
if(!this.imageOn) this.imageOn = Styles.getImage('btn_on.gif',22,22); |
||||
}; |
||||
style._events = { |
||||
onmouseout:function(e){ |
||||
var o=e.getSource(); |
||||
o.invokeEvent('mouseup',null,true); |
||||
}, |
||||
onmouseover:function(e){ |
||||
var o=e.getSource(); |
||||
if(o._disabled) return null; |
||||
var img=o.getStyleAttribute('imageOvr'); |
||||
if(!img) return; |
||||
if(!dynapi.ua.ie) o.setBgImage(img.src); |
||||
else o.lyrImage.setHTML(img.getHTML()); |
||||
}, |
||||
onmouseup:function(e,args){ |
||||
var o=e.getSource(); |
||||
var bs = (dynapi.ua.ns4)? o._blkBoardElm:o._blkBoardElm.style; |
||||
bs.left="0"; bs.top="0"; |
||||
var img=o.getStyleAttribute('imageOff'); |
||||
if(!img) return; |
||||
if(!dynapi.ua.ie) o.setBgImage(img.src); |
||||
else o.lyrImage.setHTML(img.getHTML()); |
||||
if(!args) o.invokeEvent('buttonclick'); // this gives better clicking resolutions in IE. See "Mouse Click Speed Test" - Trouble Shooting
|
||||
}, |
||||
onmousedown:function(e){ |
||||
var o=e.getSource(); |
||||
if(o._disabled) return null; |
||||
var bs = (dynapi.ua.ns4)? o._blkBoardElm:o._blkBoardElm.style; |
||||
if(!bs.position) bs.position = 'absolute'; |
||||
bs.left="1"; bs.top="1"; |
||||
var img=o.getStyleAttribute('imageOn'); |
||||
if(!img) return; |
||||
if(!dynapi.ua.ie) o.setBgImage(img.src); |
||||
else o.lyrImage.setHTML(img.getHTML()); |
||||
} |
||||
}; |
||||
style._setImage = function(ximg,state){ |
||||
if (state=='on') state='imageOn'; |
||||
else if (state=='ovr') state='imageOvr'; |
||||
else state='imageOff'; |
||||
this.setLocalStyleAttribute(state,ximg); |
||||
if(!this._isToggled && state=='imageOff') { |
||||
if(!dynapi.ua.ie) o.setBgImage(img.src); |
||||
else o.lyrImage.setHTML(img.getHTML()); |
||||
} |
||||
}; |
||||
|
||||
// initStyle will act as a function of the DynLayer object
|
||||
style.initStyle = function(){ |
||||
var style = this.style; |
||||
var img=this.getStyleAttribute('imageOff'); |
||||
this.enableBlackboard(); |
||||
this.setTextSelectable(false); |
||||
this.setCursor('hand'); |
||||
this.setBgColor(null); // remove bgcolor
|
||||
this.setImage = style._setImage; |
||||
if(!dynapi.ua.ie) this.setBgImage(img.src); |
||||
else{ |
||||
this.addChild(new DynLayer(img.getHTML(),0,0,img.width,img.height),'lyrImage'); |
||||
this.lyrImage.setZIndex(-1); |
||||
} |
||||
this.setMinimumSize(img.width,img.height); |
||||
this.setMaximumSize(img.width,img.height); |
||||
if(dynapi.ua.ns4) { |
||||
this.addChild(new DynLayer(),'lyrCover'); |
||||
this.lyrCover.setAnchor(this.style._coverAnchor); |
||||
this.lyrCover.captureMouseEvents(); |
||||
} |
||||
this.addEventListener(style._events); |
||||
this.renderStyle(); |
||||
}; |
||||
|
||||
// renderStyle will act as a function of the DynLayer object
|
||||
style.renderStyle = function(act){ |
||||
var all =!act; |
||||
|
||||
// caption & resize
|
||||
if(all||act=='caption'||act=='resize'){ |
||||
this.setHTML(this._getCapHTML()); |
||||
} |
||||
}; |
||||
|
||||
// removeStyle will act as a function of the DynLayer object
|
||||
style.removeStyle = function(){ |
||||
if(dynapi.ua.ns4) this.lyrCover.deleteFromParent(); |
||||
if(!dynapi.ua.ie) this.setBgImage(null); |
||||
else this.lyrImage.deleteFromParent(); |
||||
this.removeEventListener(this.style._events); |
||||
}; |
||||
|
||||
return style; |
||||
}; |
||||
|
||||
// Creates the style once it has been loaded
|
||||
Styles.addStyle('ButtonImage',ButtonImageStyle); |
||||
@ -1,49 +0,0 @@
@@ -1,49 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
Button Component by Raymond Irving (http://dyntools.shorturl.com)
|
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
Requires: StyleManager, ButtonStyle (Optional) |
||||
*/ |
||||
|
||||
function Button(cap,x,y,w,h,style){ |
||||
this.DynLayer = DynLayer; |
||||
this.DynLayer(null,x,y,w,h); |
||||
this._hAlign = 'center'; |
||||
this._vAlign = 'middle'; |
||||
this._caption = cap||''; |
||||
this.setStyle(style||'Button'); |
||||
}; |
||||
p = dynapi.setPrototype('Button','DynLayer'); |
||||
// Private
|
||||
p.BtnOldSetSize = DynLayer.prototype.setSize; |
||||
p._getCapHTML = function(){ |
||||
var c = this._caption; |
||||
var ff=this.getStyleAttribute('fontFamily'); |
||||
var fs=this.getStyleAttribute('fontSize'); |
||||
var fb=this.getStyleAttribute('fontBold'); |
||||
var fi=this.getStyleAttribute('fontItalics'); |
||||
var fu=this.getStyleAttribute('fontUnderline'); |
||||
var fc=(this._disabled)? this.getStyleAttribute('disableColor'):this.getStyleAttribute('foreColor'); |
||||
return Styles.createCell( |
||||
Styles.createText(c,ff,fs,fb,fi,fu,fc), |
||||
this.w,this.h,0,this._vAlign,this._hAlign |
||||
); |
||||
}; |
||||
// Public
|
||||
p.getCaption=function(){return this._caption;}; |
||||
p.setSize = function(w,h){ |
||||
this.BtnOldSetSize(w,h); |
||||
this.renderStyle('resize'); |
||||
}; |
||||
p.setCaption = function(t,hAlign,vAlign){ |
||||
this._caption = t||''; |
||||
this._hAlign = (hAlign)? hAlign:this._hAlign; |
||||
this._vAlign = (vAlign)? vAlign:this._vAlign; |
||||
this.renderStyle('caption'); |
||||
}; |
||||
p.setEnabled = function(b){ |
||||
this._disabled=!b; |
||||
this.renderStyle('caption'); |
||||
}; |
||||
@ -1,100 +0,0 @@
@@ -1,100 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
ButtonStyle (Default) |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
Requires: StyleManager, BorderManager, Button |
||||
*/ |
||||
|
||||
function ButtonStyle(){ |
||||
var style = new Style(); // create basic style object
|
||||
style.styleName='ButtonStyle';
|
||||
style.fontSize=2; |
||||
style._coverAnchor ={left:0,right:0,top:0,bottom:0}; |
||||
style._bor_tp={top:1,left:1,right:1}; |
||||
style._bor_rt={top:1,right:1,bottom:1}; |
||||
style._bor_bm={bottom:1,left:1,right:1}; |
||||
style._bor_lt={top:1,left:1,bottom:1}; |
||||
style._events = { |
||||
onmouseout:function(e){ |
||||
var o=e.getSource(); |
||||
if(o._mouseDn) o.invokeEvent('mouseup',null,true); |
||||
}, |
||||
onmouseup:function(e,args){ |
||||
var o=e.getSource(); |
||||
var bs = (dynapi.ua.ns4)? o._blkBoardElm:o._blkBoardElm.style; |
||||
bs.left="0"; bs.top="0"; |
||||
o._mouseDn = false; |
||||
o.setInnerBorder(1,{ |
||||
light:o.style.getStyleAttribute('lightColor'), |
||||
dark:o.style.getStyleAttribute('darkColor') |
||||
}); |
||||
if(!args) o.invokeEvent('buttonclick'); // this gives better clicking resolutions in IE. See "Mouse Click Speed Test" - Trouble Shooting
|
||||
}, |
||||
onmousedown:function(e){ |
||||
var o=e.getSource(); |
||||
if(o._disabled) return null; |
||||
var bs = (dynapi.ua.ns4)? o._blkBoardElm:o._blkBoardElm.style; |
||||
if(!bs.position) bs.position = 'absolute'; |
||||
bs.left="1"; bs.top="1"; |
||||
o._mouseDn = true; |
||||
o.setInnerBorder(1,{ |
||||
light:o.style.getStyleAttribute('darkColor'), |
||||
dark:o.style.getStyleAttribute('lightColor') |
||||
}); |
||||
} |
||||
}; |
||||
// initStyle will act as a function of the DynLayer object
|
||||
style.initStyle = function(){ |
||||
var style = this.style; |
||||
this.enableBlackboard(); |
||||
this.setTextSelectable(false); |
||||
this.setCursor('hand'); |
||||
if(dynapi.ua.ns4) { |
||||
this.addChild(new DynLayer(),'lyrCover'); |
||||
this.lyrCover.setAnchor(this.style._coverAnchor); |
||||
this.lyrCover.captureMouseEvents(); |
||||
} |
||||
this.addEventListener(style._events); |
||||
this.setInnerBorder(1,{ |
||||
light:this.style.getStyleAttribute('lightColor'), |
||||
dark:this.style.getStyleAttribute('darkColor') |
||||
}); |
||||
|
||||
// adjust borders
|
||||
this._borTp.setAnchor(style._bor_tp); |
||||
this._borRt.setAnchor(style._bor_rt); |
||||
this._borBm.setAnchor(style._bor_bm); |
||||
this._borLt.setAnchor(style._bor_lt); |
||||
|
||||
this.renderStyle(); |
||||
}; |
||||
// renderStyle will act as a function of the DynLayer object
|
||||
style.renderStyle = function(act){ |
||||
var all=!act; |
||||
|
||||
// caption & resize
|
||||
if(all||act=='caption'||act=='resize'){
|
||||
this.setHTML(this._getCapHTML()); |
||||
} |
||||
// set other attributes if rendering all areas
|
||||
if(all){ |
||||
this.setBgColor(this.getStyleAttribute('backColor')); |
||||
} |
||||
}; |
||||
|
||||
// removeStyle will act as a function of the DynLayer object
|
||||
style.removeStyle = function(){ |
||||
this.setInnerBorder(0); |
||||
if(dynapi.ua.ns4) this.lyrCover.deleteFromParent(); |
||||
this.removeEventListener(this.style._events); |
||||
this.deleteAllChildren(); |
||||
this._borTp=this._borRt=this._borBm=this._borLt=null; |
||||
}; |
||||
|
||||
return style; |
||||
}; |
||||
|
||||
// Creates the style once it has been loaded
|
||||
Styles.addStyle('Button',ButtonStyle); |
||||
@ -1,59 +0,0 @@
@@ -1,59 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
CheckBox Component by Raymond Irving (http://dyntools.shorturl.com)
|
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
Requires: StyleManager, CheckBoxStyle (Optional) |
||||
*/ |
||||
|
||||
function CheckBox(itext,x,y,w,h,value,checked,style) { |
||||
this.DynLayer=DynLayer; |
||||
this.DynLayer(null,x,y,w,h); |
||||
|
||||
this._value=value||''; |
||||
this._checked=checked||false; |
||||
|
||||
this.setCaption(itext); |
||||
this.setStyle(style||'CheckBox'); |
||||
}; |
||||
/* Prototype */ |
||||
var p=dynapi.setPrototype('CheckBox','DynLayer'); |
||||
// Private
|
||||
p._setDSValue = function(b){ |
||||
this.setSelected(b); |
||||
}; |
||||
p._getCapHTML = function(){ |
||||
var c = this._caption; |
||||
var ff=this.getStyleAttribute('fontFamily'); |
||||
var fs=this.getStyleAttribute('fontSize'); |
||||
var fb=this.getStyleAttribute('fontBold'); |
||||
var fi=this.getStyleAttribute('fontItalics'); |
||||
var fu=this.getStyleAttribute('fontUnderline'); |
||||
var fc=(this._disabled)? this.getStyleAttribute('disableColor'):this.getStyleAttribute('foreColor'); |
||||
return Styles.createText(c,ff,fs,fb,fi,fu,fc); |
||||
}; |
||||
// Public
|
||||
p.getCaption=function(){return this._iText}; |
||||
p.getValue=function() {return this._value;}; |
||||
p.isChecked=function() {return this._checked;} |
||||
p.setCaption=function(itext,nowrap,fn,fs,fc){ |
||||
if(!itext) itext=''; |
||||
this._iText=itext; |
||||
if(itext && itext.getHTML) itext=itext.getHTML();
|
||||
this._nowrap = (nowrap==null)? true:nowrap; |
||||
this._caption = itext;
|
||||
if(this._created) this.renderStyles('caption'); |
||||
}; |
||||
p.setSelected=function(b) { |
||||
var img; |
||||
if (this._checked==b) return;
|
||||
this._checked=b; |
||||
if (this._checked && this._created) img = this.getStyleAttribute('imageOn'); |
||||
else img = this.getStyleAttribute('imageOff'); |
||||
if(img) this.doc.images[this.id+'imgchk'].src = img.src; |
||||
this.invokeEvent('change'); |
||||
}; |
||||
p.setValue = function(d) { |
||||
this._value=d; |
||||
}; |
||||
@ -1,49 +0,0 @@
@@ -1,49 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
CheckBoxStyle (Default) |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
Requires: StyleManager, CheckBox |
||||
*/ |
||||
|
||||
function CheckBoxStyle (){ |
||||
var style = new Style(); // create basic style object
|
||||
style.styleName='CheckBoxStyle'; |
||||
style.loadImages = function(){ |
||||
if(!this.imageOn) this.imageOn = Styles.getImage('check_on.gif',13,13); |
||||
if(!this.imageOff) this.imageOff = Styles.getImage('check_off.gif',13,13); |
||||
}; |
||||
// initStyle will act as a function of the DynLayer object
|
||||
style.initStyle = function(){ |
||||
this.renderStyle(); |
||||
}; |
||||
// renderStyle will act as a function of the DynLayer object
|
||||
style.renderStyle = function(act) { |
||||
var all=!act; |
||||
var img,tbl; |
||||
var id=this.id+'imgchk'; |
||||
var ion = this.getStyleAttribute('imageOn'); |
||||
var ioff = this.getStyleAttribute('imageOff'); |
||||
|
||||
if(all||act=='caption'){ |
||||
img='<a tabindex="-1" href="javascript:;" onclick="'+this+'.setSelected(!'+this+'._checked);return false;">'; |
||||
if (this._checked && ion) { |
||||
img+='<img id="'+id+'" name="'+id+'" border=0 src="'+ion.src+'"'; |
||||
}else if(ioff){ |
||||
img+='<img id="'+id+'" name="'+id+'" border=0 src="'+ioff.src+'"'; |
||||
} |
||||
img+=' width="'+ioff.width+'" height="'+ioff.height+'"></a>'; |
||||
if(!this._caption) tbl=img; |
||||
else{ |
||||
tbl='<table border=0 cellspacing=1 cellpadding=0><tr><td valign="top">' |
||||
+img+'</td><td valign="top"'+((this._nowrap)?' nowrap':'')+'>' |
||||
+'<a href="javascript:;" onclick="'+this+'.setSelected(!'+this+'._checked);return false;" style="text-decoration:none">' |
||||
+this._getCapHTML()+'</a></td></tr></table>'; |
||||
} |
||||
this.setHTML(tbl); |
||||
} |
||||
}; |
||||
return style; |
||||
}; |
||||
StyleManager.addStyle('CheckBox',CheckBoxStyle); |
||||
@ -1,54 +0,0 @@
@@ -1,54 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
DynImage Class |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
*/ |
||||
|
||||
function DynImage(img,id,alt) { |
||||
this.img = img; |
||||
this.id = id; |
||||
this.alt = alt; |
||||
}; |
||||
DynImage.prototype.toString = function() {
|
||||
return "<img src=\""+this.img.src+"\""+ |
||||
(this.id?" id=\""+this.id+"\"":"")+ |
||||
(this.img.width?" width=\""+this.img.width+"\"":"")+ |
||||
(this.img.height?" height=\""+this.img.height+"\"":"")+ |
||||
(this.alt?" alt=\""+this.alt+"\"":"")+">";
|
||||
}; |
||||
DynImage.image = []; |
||||
DynImage.getImage = function(src,w,h) { |
||||
for (var i=0;i<DynImage.image.length;i++) { |
||||
if (DynImage.image[i].img.src==src) return DynImage.image[i].img; |
||||
} |
||||
var index = DynImage.image.length; |
||||
DynImage.image[index] = {}; |
||||
if (w&&h) { |
||||
DynImage.image[index].img = new Image(w,h); |
||||
DynImage.image[index].img.w = w; |
||||
DynImage.image[index].img.h = h; |
||||
} |
||||
else DynImage.image[index].img = new Image(); |
||||
DynImage.image[index].img.src = src; |
||||
if (!DynImage.timerId) DynImage.timerId=setTimeout('DynImage.loadercheck()',50); |
||||
return DynImage.image[index].img; |
||||
}; |
||||
|
||||
DynImage.loadercheck=function() { |
||||
DynImage.ItemsDone=0; |
||||
var max = DynImage.image.length; |
||||
var dimg = null; |
||||
for (var i=0; i<max; i++) { |
||||
dimg = DynImage.image[i]; |
||||
if (dimg.img.complete) { |
||||
DynImage.ItemsDone+=1; |
||||
if (dimg.img.w) dimg.img.width = dimg.img.w; |
||||
if (dimg.img.h) dimg.img.height = dimg.img.h; |
||||
} |
||||
} |
||||
if (DynImage.ItemsDone<max) DynImage.timerId=setTimeout('DynImage.loadercheck()',25); |
||||
else DynImage.timerId=null; |
||||
}; |
||||
dynapi.onLoad(DynImage.loaderStart); |
||||
|
||||
@ -1,78 +0,0 @@
@@ -1,78 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
ExplorerBlockStyle |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
Requires: StyleManager, Explorer, ExplorerStyle |
||||
*/ |
||||
|
||||
function ExplorerBlockStyle(){ |
||||
var style = ExplorerStyle(); // inherits or extends ExplorerStyle object
|
||||
style.styleName='ExplorerBlockStyle'; |
||||
style.loadImages = function(){ |
||||
// load default images
|
||||
if(!this.imageFile) this.imageFile = Styles.getImage('tvw_file.gif',16,16); |
||||
if(!this.imageFoldOpen) this.imageFoldOpen = Styles.getImage('tvw_foldopen.gif',16,16); |
||||
if(!this.imageFoldClose) this.imageFoldClose = Styles.getImage('tvw_foldclose.gif',16,16); |
||||
if(!this.imageWhite) this.imageWhite = Styles.getImage('tvw_white.gif',15,18); |
||||
if(!this.imageExpand) this.imageExpand = Styles.getImage('tvw_expand.gif',15,18); |
||||
if(!this.imageCollapse) this.imageCollapse= Styles.getImage('tvw_collapse.gif',15,18); |
||||
}; |
||||
style._buildHTML = function(leave,level,last,lD) { |
||||
var niv = level||0; |
||||
var listaD = lD || new Array();
|
||||
|
||||
var tree = leave.tree; |
||||
var iFL = tree.getStyleAttribute('imageFile'); |
||||
var iFOp = tree.getStyleAttribute('imageFoldOpen'); |
||||
var iFCl = tree.getStyleAttribute('imageFoldClose'); |
||||
var iWht = tree.getStyleAttribute('imageWhite'); |
||||
var iEx = tree.getStyleAttribute('imageExpand'); |
||||
var iCx = tree.getStyleAttribute('imageCollapse'); |
||||
|
||||
var csLV = tree.getStyleAttribute('cssLeave')||''; |
||||
var csRLV = tree.getStyleAttribute('cssRootLeave')||''; |
||||
var csCLV = tree.getStyleAttribute('cssCurrentLeave')||''; |
||||
|
||||
var ret = '<tr><td><img src="'+iWht.src+'" height="1" width="5"></td><td valign="top">'; |
||||
ret+='<table border="0" cellspacing="0" cellpadding="0"><tr><td valign="top">'; |
||||
if((niv-1)>=1)ret += '<img src="'+iWht.src+'" width="'+(15*(niv-1))+'" height="18" align=top>'; |
||||
if(niv == 0) ret += ''; |
||||
else if (leave.children.length==0) ret += '<img src="'+iWht.src+'" width="15" height="18" align="top">'; |
||||
else { |
||||
if(leave.open) ret += '<a href="javascript:;" onclick="return '+leave.tree+'.fold(\''+leave.id+'\')"><img border=0 src="'+iCx.src+'" width="15" height="18" align=top></a>'; |
||||
else ret += '<a href="javascript:;" onclick="return '+leave.tree+'.unfold(\''+leave.id+'\')"><img border="0" src="'+iEx.src+'" width="15" height="18" align=top></a>'; |
||||
} |
||||
|
||||
if(niv!=0) { |
||||
var icon = leave.icon||iFCl; |
||||
var icon_sel = leave.icon_sel||iFOp; |
||||
if (leave.open||leave.id == leave.tree.currentPos) ret += '<img src="'+(icon_sel.src)+'" width="16" height="16" align="top">'; |
||||
else ret += '<img src="'+(icon.src)+'" width="16" height="16" align="top">'; |
||||
}
|
||||
//dq 17.1.2007: vorher:
|
||||
//ret += '</td><td valign="top" nowrap><a class="'+(niv==0 ? csRLV: (leave.id == tree.currentPos ? (leave.cssSel||csCLV) : (leave.css||csLV))) + '" href="javascript:;" onclick="return '+leave.tree+'.setCurrent(\''+ leave.id +'\')">';
|
||||
//jetzt:
|
||||
ret += '</td><td valign="top" nowrap><a class="'+(niv==0 ? csRLV: (leave.id == tree.currentPos ? (leave.cssSel||csCLV) : (leave.css||csLV))) + '" title= "'+leave.url+'" href="javascript:'+leave.url+';" onclick="return '+leave.tree+'.setCurrent(\''+ leave.id +'\')">'; |
||||
|
||||
if(niv!=0) ret += ' '; |
||||
ret += leave.text+'</a></td></tr></table>' |
||||
ret+='</td><td><img src="'+iWht.src+'" height="1" width="25"></td></tr>'; |
||||
|
||||
var q=0; |
||||
listaD[niv-1] = last; |
||||
if((leave.open || niv==0) && leave.children.length!=0) { |
||||
for(var i in leave.children) {
|
||||
q++; |
||||
ret += this._buildHTML(leave.children[i],niv+1,q==leave.count,listaD); |
||||
} |
||||
}
|
||||
return ret; |
||||
}; |
||||
|
||||
return style; |
||||
}; |
||||
|
||||
// Creates the style once it has been loaded
|
||||
Styles.addStyle('ExplorerBlock',ExplorerBlockStyle); |
||||
@ -1,112 +0,0 @@
@@ -1,112 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
Explorer Component
|
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
Requires: StyleManager, ExplorerStyle (Optional) |
||||
*/ |
||||
|
||||
function Explorer(x,y,w,h,style) { // Explorer Tree object
|
||||
this.DynLayer = DynLayer; |
||||
this.DynLayer(null,x,y,w,h); |
||||
this.allLeaves = []; |
||||
this.root = new Explorer.Leave(this,this+"Root"); |
||||
this.currentPos = 0; |
||||
this.currentUrl = ""; |
||||
|
||||
this.onCreate(Explorer.CreateEvent); |
||||
this.setStyle(style||'Explorer'); |
||||
}; |
||||
// Create Event
|
||||
Explorer.CreateEvent = function() { |
||||
this.init(); |
||||
this.renderStyle(); |
||||
}; |
||||
// Prototype
|
||||
var p = dynapi.setPrototype('Explorer','DynLayer'); |
||||
p.addLeave = function(id,text,parent,icon,icon_sel,url,css,cssSel) { |
||||
parent=(parent&&(parent!="0"))? parent:this.root.toString(); |
||||
new Explorer.Leave(this,id,text,parent,icon,icon_sel,url,css,cssSel); |
||||
}; |
||||
p.fold = function(id) { |
||||
this.allLeaves[id].open = false; |
||||
this.renderStyle(); |
||||
return false; |
||||
}; |
||||
p.unfold = function(id) { |
||||
this.allLeaves[id].open = true; |
||||
this.renderStyle(); |
||||
return false; |
||||
}; |
||||
p.setCurrent = function(id) { |
||||
this.lastPos = this.currentPos; // set last position
|
||||
this.currentPos = id; |
||||
this.currentUrl = this.allLeaves[id].url; |
||||
this.renderStyle(); |
||||
this.invokeEvent("select"); |
||||
return false; |
||||
}; |
||||
p.unfoldTo = function(id) { |
||||
this.allLeaves[this.firstOne].unfoldTo(id); |
||||
this.currentPos = id; |
||||
}; |
||||
p.getHierarchy = function(leave){ |
||||
var h = {}; |
||||
h[leave.id]=b; |
||||
while (leave.parent) { |
||||
h[leave.parent]=true; |
||||
leave = this.allLeaves[leave.parent]; |
||||
} |
||||
return h; |
||||
}; |
||||
p.init = function() { |
||||
var i,el,pat; |
||||
for(i in this.allLeaves) { |
||||
el = this.allLeaves[i]; |
||||
pat = el.parent; |
||||
//DQ Änderung: wenn parent nicht existiert
|
||||
//vorher: if(pat) {
|
||||
if(pat && this.allLeaves[pat]) { |
||||
this.allLeaves[pat].children[this.allLeaves[pat].children.length] = el; |
||||
this.allLeaves[pat].count++; |
||||
} |
||||
} |
||||
this.initiated = true; |
||||
}; |
||||
|
||||
|
||||
|
||||
// This object represents a leave in our content tree. Notice that it is not dynlayer-inherited
|
||||
Explorer.Leave = function(tree,id,text,parent,icon,icon_sel,url,css,cssSel) { |
||||
var style = tree.style; |
||||
// internal
|
||||
this.id = id; |
||||
this.tree = tree; |
||||
this.icon = icon; |
||||
this.icon_sel = icon_sel||icon; |
||||
this.url = url; |
||||
this.text = text||""; |
||||
this.parent = parent; |
||||
this.children = []; |
||||
this.count = 0; |
||||
this.css = css; |
||||
this.cssSel = cssSel; |
||||
// state
|
||||
this.open = false; |
||||
// init
|
||||
this.tree.allLeaves[this.id] = this; |
||||
}; |
||||
p = Explorer.Leave.prototype; |
||||
p.unfoldTo = function(c) { |
||||
this.open = false; |
||||
for(var i in this.children) if(this.children[i].unfoldTo(c)) this.open = true; |
||||
return this.open || (this.id == c); |
||||
}; |
||||
p.toString = function() { |
||||
return this.id
|
||||
}; |
||||
|
||||
|
||||
|
||||
|
||||
@ -1,133 +0,0 @@
@@ -1,133 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
ExplorerStyle (Default) |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
Requires: StyleManager, Explorer |
||||
*/ |
||||
|
||||
function ExplorerStyle(){ |
||||
var style = new Style(); // create basic style object
|
||||
style.styleName='ExplorerStyle'; |
||||
style.cssLeave = 'ExplorerLeave'; |
||||
style.cssRootLeave = 'ExplorerRootLeave'; |
||||
style.cssCurrentLeave = 'ExplorerCurrentLeave';
|
||||
style.loadImages = function(){ |
||||
// load default images
|
||||
if(!this.imageFile) this.imageFile = Styles.getImage('tvw_file.gif',16,16); |
||||
if(!this.imageFoldOpen) this.imageFoldOpen = Styles.getImage('tvw_foldopen.gif',16,16); |
||||
if(!this.imageFoldClose) this.imageFoldClose = Styles.getImage('tvw_foldclose.gif',16,16); |
||||
if(!this.imageLine) this.imageLine = Styles.getImage('tvw_line.gif',15,18); |
||||
if(!this.imageWhite) this.imageWhite = Styles.getImage('tvw_white.gif',15,18); |
||||
if(!this.imageOpen) this.imageOpen = Styles.getImage('tvw_open.gif',15,18); |
||||
if(!this.imageOpenlast) this.imageOpenlast = Styles.getImage('tvw_openlast.gif',15,18); |
||||
if(!this.imageClose) this.imageClose = Styles.getImage('tvw_close.gif',15,18); |
||||
if(!this.imageCloselast) this.imageCloselast = Styles.getImage('tvw_closelast.gif',15,18); |
||||
if(!this.imageNoChildren) this.imageNoChildren = Styles.getImage('tvw_nochildren.gif',15,18); |
||||
if(!this.imageNoChildrenlast) this.imageNoChildrenlast = Styles.getImage('tvw_nochildrenlast.gif',15,18); |
||||
}; |
||||
style._adjustSize = function(){ |
||||
if(!dynapi.ua.dom) this._OldAdjustSize(); |
||||
else if(this._created){ |
||||
var w,h,tb; |
||||
tb = document.getElementById(this.id+'Explorer'); |
||||
if(tb){ |
||||
w = (this._aSzW)? tb.offsetWidth:null; |
||||
h = (this._aSzH)? tb.offsetHeight:null; |
||||
this.setSize(w,h); |
||||
} |
||||
} |
||||
}; |
||||
style._buildHTML = function(leave,level,last,lD) { |
||||
var niv = level||0; |
||||
var listaD = lD || new Array();
|
||||
|
||||
//if(leave['_html'+leave.open] && !leave.tree._hTree[leave.id]) return leave['_html'+leave.open];
|
||||
|
||||
var tree = leave.tree; |
||||
var iFL = tree.getStyleAttribute('imageFile'); |
||||
var iFOp = tree.getStyleAttribute('imageFoldOpen'); |
||||
var iFCl = tree.getStyleAttribute('imageFoldClose'); |
||||
var iLn = tree.getStyleAttribute('imageLine'); |
||||
var iWht = tree.getStyleAttribute('imageWhite'); |
||||
var iOp = tree.getStyleAttribute('imageOpen'); |
||||
var iOpl = tree.getStyleAttribute('imageOpenlast'); |
||||
var iC = tree.getStyleAttribute('imageClose'); |
||||
var iCL = tree.getStyleAttribute('imageCloselast'); |
||||
var iNC = tree.getStyleAttribute('imageNoChildren'); |
||||
var iNCL = tree.getStyleAttribute('imageNoChildrenlast'); |
||||
|
||||
var csRLV = tree.getStyleAttribute('cssRootLeave')||''; |
||||
var csCLV = tree.getStyleAttribute('cssCurrentLeave')||''; |
||||
var csLV = tree.getStyleAttribute('cssLeave')||''; |
||||
|
||||
var ret = '<tr><td><img src="'+iWht.src+'" height="1" width="5"></td><td valign="top">'; |
||||
for(var i=0;i<(niv-1);i++) ret += '<img src="'+(listaD[i]? iWht.src:iLn.src)+'" width="15" height="18" align=top>'; |
||||
if(niv == 0) ret += ''; |
||||
else if (leave.children.length==0) ret += '<img src="'+(last? iNCL.src:iNC.src)+'" width="15" height="18" align="top">'; |
||||
else { |
||||
if(leave.open) ret += '<a href="javascript:;" onclick="return '+leave.tree+'.fold(\''+leave.id+'\')"><img border=0 src="'+(last? iCL.src:iC.src)+'" width="15" height="18" align=top></a>'; |
||||
else ret += '<a href="javascript:;" onclick="return '+leave.tree+'.unfold(\''+leave.id+'\')"><img border="0" src="'+(last? iOpl.src:iOp.src)+'" width="15" height="18" align=top></a>'; |
||||
} |
||||
|
||||
if(niv!=0) { |
||||
var icon = leave.icon||iFCl; |
||||
var icon_sel = leave.icon_sel||iFOp; |
||||
if (leave.open||leave.id == leave.tree.currentPos) ret += '<img src="'+(icon_sel.src)+'" width="16" height="16" align="top">'; |
||||
else ret += '<img src="'+(icon.src)+'" width="16" height="16" align="top">'; |
||||
}
|
||||
|
||||
ret += '<a class="'+(niv==0 ? csRLV: (leave.id == tree.currentPos ? (leave.cssSel||csCLV) : (leave.css||csLV))) + '" href="javascript:;" onclick="return '+leave.tree+'.setCurrent(\''+ leave.id +'\')">'; |
||||
|
||||
//while(leave.text.indexOf(' ')>=0) leave.text = leave.text.replace(/\s/,' ');
|
||||
leave.text = leave.text.replace(/\s/g,' '); |
||||
if(niv!=0) ret += ' '; |
||||
ret += leave.text+'</a></td><td><img src="'+iWht.src+'" height="1" width="25"></td></tr>'; |
||||
|
||||
var q=0; |
||||
listaD[niv-1] = last; |
||||
if((leave.open || niv==0) && leave.children.length!=0) { |
||||
for(var i in leave.children) {
|
||||
q++; |
||||
ret += this._buildHTML(leave.children[i],niv+1,q==leave.count,listaD); |
||||
} |
||||
} |
||||
|
||||
//leave['_html'+leave.open] = ret;
|
||||
return ret; |
||||
}; |
||||
// initStyle will act as a function of the DynLayer object
|
||||
style.initStyle = function(){ |
||||
this._OldAdjustSize = this._adjustSize; |
||||
this._adjustSize = this.style._adjustSize; |
||||
this.setAutoSize(this.w||true,this.h||true); |
||||
if(this._created) this.renderStyle();
|
||||
};
|
||||
// renderStyle will act as a function of the DynLayer object
|
||||
style.renderStyle = function(act){ |
||||
if(this._created){ |
||||
var html = this.style._buildHTML(this.root); |
||||
this.setHTML('<table id="'+this.id+'Explorer" border="0" cellpadding="0" cellspacing="0">'+html+'</table>'); |
||||
} |
||||
}; |
||||
// removeStyle will act as a function of the DynLayer object
|
||||
style.removeStyle = function(){ |
||||
this._adjustSize = this._OldAdjustSize; |
||||
this._OldAdjustSize = null; |
||||
}; |
||||
|
||||
return style; |
||||
}; |
||||
|
||||
|
||||
// Write Default CSS
|
||||
dynapi.document.writeStyle({ |
||||
ExplorerRootLeave :'font-family: Arial, Helvetica, sans-serif; font-size: 9pt; font-weight: normal; color: #09478C; text-decoration: none;', |
||||
ExplorerCurrentLeave :'font-family: Arial, Helvetica, sans-serif; font-size: 9pt; font-weight: bold; color: #09478C; text-decoration: none;', |
||||
ExplorerLeave :'font-family: Arial, Helvetica, sans-serif; font-size: 9pt; font-weight: normal; color: #09478C; text-decoration: none;', |
||||
'ExplorerLeave:hover' :'font-family: Arial, Helvetica, sans-serif; font-size: 9pt; font-weight: normal; color: #FF0000; text-decoration: none;' |
||||
}); |
||||
|
||||
// Creates the style once it has been loaded
|
||||
Styles.addStyle('Explorer',ExplorerStyle); |
||||
@ -1,77 +0,0 @@
@@ -1,77 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
FocusManager Class |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
requires: DynLayer |
||||
*/ |
||||
|
||||
FocusManager={}; |
||||
|
||||
// usage: FocusManager.enableFocus('auto',true,'click',lyr1,lyr2,...lyrN);
|
||||
FocusManager.enableFocus=function(b,bubble,type){ |
||||
var lyr,arg=arguments; |
||||
for (var i=3;i<arg.length;i++){ |
||||
lyr=arg[i]; |
||||
if(lyr) lyr.setFocus(b,bubble,type); |
||||
} |
||||
}; |
||||
|
||||
DynLayer.prototype.setFocus = function(b,bubble,type){ |
||||
var i,topchild; |
||||
//var d=this.design;
|
||||
bubble=(bubble==null)? true:bubble; |
||||
if(b!=='auto' && !this.parent) return; |
||||
if(b=='auto' && !this._hasFocusEvents) { |
||||
if(type!='hover') type='click'; |
||||
this._focusType=type; |
||||
this._focusBubble=bubble; |
||||
this._hasFocusEvents=true; |
||||
this.addEventListener(DynLayer.FocusEvent); |
||||
} |
||||
else if (b && !this._focused) { |
||||
topchild=this.parent._topMostChild; |
||||
//i = this.parent.children.length;
|
||||
if(topchild && topchild!=this) topchild.setFocus(false,bubble); |
||||
if(this._hasTabManager) this.updateTabManager(); |
||||
this.setZIndex({topmost:true}); |
||||
this.parent._topMostChild=this; |
||||
this._focused=true; |
||||
this.invokeEvent('focus'); |
||||
var o=this.parent; |
||||
if(bubble) while (o && o!=dynapi.document) { |
||||
o.setFocus(b,bubble); |
||||
o=o.parent; |
||||
}; |
||||
}else if(!b && this._focused){ |
||||
topchild=this.parent._topMostChild; |
||||
if (topchild) this.setZIndex({below:topchild}); |
||||
else this.setZIndex(thiz.z-1); |
||||
this._focused=false; |
||||
this.invokeEvent('blur'); |
||||
var o=this.parent; |
||||
var ch=this.children; |
||||
// blur children with focus
|
||||
for(var i=0;i<ch.length;i++) if(ch[i]._focused) ch[i].setFocus(false,bubble); |
||||
if(o && o!=dynapi.document) o.setFocus(false,bubble); |
||||
} |
||||
}; |
||||
|
||||
//DynLayer.prototype.setTabIndex = function(n){
|
||||
//};
|
||||
|
||||
DynLayer.FocusEvent = { |
||||
onclick : function(e){ |
||||
var o=e.getSource(); |
||||
if(o._focusType=='click') { |
||||
o.setFocus(true,o._focusBubble); |
||||
} |
||||
}, |
||||
onmouseover : function(e){ |
||||
var o=e.getSource(); |
||||
if(o._focusType=='hover') { |
||||
o.setFocus(true,o._focusBubble); |
||||
} |
||||
} |
||||
}; |
||||
@ -1,129 +0,0 @@
@@ -1,129 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
BorderManager Class |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
requires: Highlighter |
||||
*/ |
||||
|
||||
/* Outer Border uses Frame class with image support. |
||||
by: |
||||
Kevin Gargan (kevin[at]kegcl.demon.co.uk) |
||||
useage: |
||||
f=new Frame([widths],[sidecolors||sideimages],[cornerimages]) |
||||
and |
||||
f.setBorder([widths],[sidecolors||sideimages],[cornerimages]) |
||||
where |
||||
Parameter widths, sidecolors, sideimages and cornerimages may be scalar |
||||
or array defining top, right, bottom and left (defaulting like css). In |
||||
addition the corner images are defined as from top right, bottom right, |
||||
bottom left and top left. |
||||
e.g. |
||||
1,'white' |
||||
10,'tile.gif' |
||||
[1,2,3,4],['red','green','blue','yellow'] |
||||
10,['t.gif','r.gif'] |
||||
10,['t.gif','r.gif','b.gif','l.gif'],['tr.gif','br.gif','bl.gif','tl.gif'] |
||||
*/ |
||||
function Frame(widths,sideimgs,cornerimgs) { |
||||
this.DynLayer = DynLayer; |
||||
this.DynLayer(); |
||||
|
||||
this.setDefaults(widths,sideimgs,cornerimgs); |
||||
this.addChild(new Skin('n',this.sides[0]),'_fN'); |
||||
this.addChild(new Skin('e',this.sides[1]),'_fE'); |
||||
this.addChild(new Skin('s',this.sides[2]),'_fS'); |
||||
this.addChild(new Skin('w',this.sides[3]),'_fW'); |
||||
if(cornerimgs) { |
||||
this.addChild(new Skin('ne',this.corners[0]),'_fNE'); |
||||
this.addChild(new Skin('se',this.corners[1]),'_fSE'); |
||||
this.addChild(new Skin('sw',this.corners[2]),'_fSW'); |
||||
this.addChild(new Skin('nw',this.corners[3]),'_fNW'); |
||||
} |
||||
} |
||||
Frame._defaults=function(arry,def) { |
||||
var i=(arry==null)?[def]:(typeof(arry)!='object')?[arry]:arry, out=[]; |
||||
out[0]=i[0]; |
||||
out[1]=(i[1]!=null)?i[1]:out[0]; |
||||
out[2]=(i[2]!=null)?i[2]:out[0]; |
||||
out[3]=(i[3]!=null)?i[3]:out[1]; |
||||
return out; |
||||
}; |
||||
Frame._defaultCorners=function(haveCorners,ws,cimgs) { |
||||
var corners=[]; |
||||
corners[0]=[haveCorners?ws[1]:0,haveCorners?ws[0]:0,null,null,null,cimgs[0]]; |
||||
corners[1]=[haveCorners?ws[1]:0,haveCorners?ws[2]:0,null,null,null,cimgs[1]]; |
||||
corners[2]=[haveCorners?ws[3]:0,haveCorners?ws[2]:0,null,null,null,cimgs[2]]; |
||||
corners[3]=[haveCorners?ws[3]:0,haveCorners?ws[0]:0,null,null,null,cimgs[3]]; |
||||
return corners; |
||||
}; |
||||
Frame._defaultSides=function(ws,cs,simgs) { |
||||
var sides=[]; |
||||
var isCol=(simgs[0].indexOf('.')<0); // Color or image.gif file.
|
||||
sides[0]=[null,ws[0],ws[1],cs[3][0],isCol?simgs[0]:null,isCol?null:simgs[0]]; |
||||
sides[1]=[ws[1],null,cs[0][1],ws[2],isCol?simgs[1]:null,isCol?null:simgs[1]]; |
||||
sides[2]=[null,ws[2],cs[1][0],ws[3],isCol?simgs[2]:null,isCol?null:simgs[2]]; |
||||
sides[3]=[ws[3],null,ws[0],cs[2][1],isCol?simgs[3]:null,isCol?null:simgs[3]]; |
||||
return sides; |
||||
}; |
||||
var p = dynapi.setPrototype('Frame','DynLayer'); |
||||
p.setDefaults=function(widths,sideimgs,cornerimgs) { |
||||
this.widths=Frame._defaults(widths,0); |
||||
this.sideimgs=Frame._defaults(sideimgs,'black'); |
||||
this.cornerimgs=Frame._defaults(cornerimgs,null); |
||||
this.corners=Frame._defaultCorners(cornerimgs,this.widths,this.cornerimgs); |
||||
this.sides=Frame._defaultSides(this.widths,this.corners,this.sideimgs); |
||||
}; |
||||
p.setBorder=function(widths,sideimgs,cornerimgs) { |
||||
var wso=this.widths; // Widths old.
|
||||
var eo=wso[1], wo=wso[3], no=wso[0], so=wso[2]; |
||||
this.setDefaults(widths,sideimgs,cornerimgs); |
||||
this._fN.graft(this.sides[0]); |
||||
this._fE.graft(this.sides[1]); |
||||
this._fS.graft(this.sides[2]); |
||||
this._fW.graft(this.sides[3]); |
||||
if(cornerimgs) { |
||||
if(this._fNE==null) this.addChild(new Skin('ne',this.corners[0]),'_fNE'); |
||||
else this._fNE.graft(this.corners[0]); |
||||
if(this._fSE==null) this.addChild(new Skin('se',this.corners[1]),'_fSE'); |
||||
else this._fSE.graft(this.corners[1]); |
||||
if(this._fSW==null) this.addChild(new Skin('sw',this.corners[2]),'_fSW'); |
||||
else this._fSW.graft(this.corners[2]); |
||||
if(this._fNW==null) this.addChild(new Skin('nw',this.corners[3]),'_fNW'); |
||||
else this._fNW.graft(this.corners[3]); |
||||
} |
||||
else { |
||||
if(this._fNE) this._fNE.graft(this.corners[0]); |
||||
if(this._fSE) this._fSE.graft(this.corners[1]); |
||||
if(this._fSW) this._fSW.graft(this.corners[2]); |
||||
if(this._fNW) this._fNW.graft(this.corners[3]); |
||||
} |
||||
var ws=this.widths; // Widths new.
|
||||
var de=ws[1]-eo, dw=ws[3]-wo, dn=ws[0]-no, ds=ws[2]-so; // Deltas.
|
||||
this.setSize(this.w+de+dw,this.h+dn+ds); |
||||
var left=Math.ceil((ws[3]-ws[1])/2), top=Math.ceil((ws[0]-ws[2])/2); |
||||
this._fC.setAnchor({centerH:left,centerV:top}); |
||||
}; |
||||
p.addContent=function(c) { |
||||
if(c._fP) return; |
||||
else c._fP=this; |
||||
this.setLocation(c.x,c.y); |
||||
var ws=this.widths; |
||||
this.setSize(c.w+ws[1]+ws[3],c.h+ws[0]+ws[2]); |
||||
var left=Math.ceil((ws[3]-ws[1])/2), top=Math.ceil((ws[0]-ws[2])/2); |
||||
c.setAnchor({centerH:left,centerV:top}); |
||||
return this.addChild(c,'_fC'); |
||||
}; |
||||
|
||||
// Square Picture Frame
|
||||
function SquarePictureFrame(widths,sideimgs,cornerimgs,image,w,h,color) { |
||||
this.Frame=Frame; |
||||
this.Frame(widths,sideimgs,cornerimgs); |
||||
|
||||
if(color) this.setBgColor(color); |
||||
this.addContent(new DynLayer(image.getHTML(),null,null,w,h)); |
||||
var longest=(w>h)?w:h, ws=this.widths; |
||||
this.setSize(longest+ws[1]+ws[3],longest+ws[0]+ws[2]); |
||||
}; |
||||
p = dynapi.setPrototype('SquarePictureFrame','Frame'); |
||||
@ -1,347 +0,0 @@
@@ -1,347 +0,0 @@
|
||||
// 2D Graphics Package
|
||||
// Drawing routines for DynLayer
|
||||
// Copyright (C) 2000-2001 Dan Steinman, Guoyi Chao, Rob Breeds
|
||||
|
||||
// Guoyi Chao: drawing routines for line, circle, ellipse
|
||||
// Dan Steinman: DynAPI2 support, object wrappers, VML support, improved routines for line, rect, and fills()
|
||||
// Rob Breeds: improve performance on ellipse and circle algorithms, and added line thicknesses support
|
||||
|
||||
// Distributed under the terms of the GNU Library General Public License
|
||||
|
||||
function Graphics(dlyr) { |
||||
this._dlyr = dlyr; |
||||
this._s = "yellow"; |
||||
this._w = 1; |
||||
this._f = "white"; |
||||
}; |
||||
Graphics.prototype.setStrokeColor = function(v) {this._s = v}; |
||||
Graphics.prototype.setStrokeWeight = function(v) {this._w = v}; |
||||
Graphics.prototype.setFillColor = function(v) {this._f = v}; |
||||
Graphics.prototype.drawPixel = function(x,y) { |
||||
drawPixel(x,y,this._s,this._w,this); |
||||
}; |
||||
Graphics.prototype.drawLine = function(x1,y1,x2,y2) { |
||||
var shape; |
||||
if (Graphics.useVML) { |
||||
shape = new VML_Line(x1,y1,x2,y2,this._w,this._s); |
||||
this._dlyr.elm.appendChild(shape.elm); |
||||
} |
||||
else { |
||||
shape = new Line(x1,y1,x2,y2,this._w,this._s); |
||||
this._dlyr.addChild(shape); |
||||
} |
||||
return shape; |
||||
}; |
||||
Graphics.prototype.drawCircle = function(x,y,radius) { |
||||
var shape; |
||||
if (Graphics.useVML) { |
||||
// bug in IE, always fills anyway
|
||||
shape = new VML_Oval(x,y,2*radius,2*radius,this._w,this._s, dynapi.ua.ie5?this._dlyr.bgColor:false); |
||||
this._dlyr.elm.appendChild(shape.elm); |
||||
} |
||||
else { |
||||
shape = new Circle(x,y,radius,this._w,this._s); |
||||
this._dlyr.addChild(shape); |
||||
} |
||||
return shape; |
||||
}; |
||||
Graphics.prototype.fillCircle = function(x,y,r) { |
||||
fillCircle(x+r,y+r,r,this._f,this._dlyr); |
||||
}; |
||||
Graphics.prototype.drawEllipse = function(x,y,w,h) { |
||||
drawEllipse(x+w/2,y+h/2,w,h,this._s,false,this._w,this._dlyr); |
||||
}; |
||||
Graphics.prototype.drawOval = Graphics.prototype.drawEllipse; |
||||
Graphics.prototype.fillEllipse = function(x,y,w,h) { |
||||
drawEllipse(x+w/2,y+h/2,w,h,this._f,true,this._w,this._dlyr); |
||||
}; |
||||
Graphics.prototype.fillOval = Graphics.prototype.fillEllipse; |
||||
Graphics.prototype.drawRect = function(x,y,w,h) { |
||||
drawRect(x,y,w,h,this._s,this._w,this._dlyr); |
||||
}; |
||||
Graphics.prototype.fillRect = function(x,y,w,h) { |
||||
fillRect(x,y,w,h,this._f,this._dlyr); |
||||
}; |
||||
Graphics.prototype.clear = function() { |
||||
this.deleteAllChildren(); |
||||
this.setHTML(''); |
||||
}; |
||||
|
||||
Graphics.useVML = false; |
||||
if (dynapi.ua.ie && dynapi.ua.v>=5) { // include active-x component for IE5+
|
||||
Graphics.useVML = true; |
||||
var str = '<xml:namespace ns="urn:schemas-microsoft-com:vml" prefix="v"/>'+ |
||||
'<object id="VMLRender" codebase="vgx.dll" classid="CLSID:10072CEC-8CC1-11D1-986E-00A0C955B42E"></object>'+ |
||||
'<style>'+ |
||||
'<!--'+ |
||||
'v\\:* { behavior: url(#VMLRender); }'+ |
||||
'-->'+ |
||||
'</style>'; |
||||
|
||||
if (dynapi.loaded) { |
||||
dynapi.frame.document.body.appendChild('beforeEnd',str); |
||||
} |
||||
else { |
||||
document.write(str); |
||||
} |
||||
}; |
||||
|
||||
// Drawing Routines
|
||||
|
||||
function Pixel(x,y,color,t) { // not really needed
|
||||
this.DynLayer = DynLayer; |
||||
this.DynLayer(); |
||||
this.setLocation(x,y); |
||||
this.setSize(t||1,t||1); |
||||
this.setBgColor(color||"black"); |
||||
}; |
||||
Pixel.prototype = new DynLayer(); |
||||
|
||||
function drawPixel(x,y,color,t,lyr) { |
||||
lyr.addChild( new DynLayer('',Math.round(x),Math.round(y),t,t,color) ); |
||||
}; |
||||
|
||||
function Shape() { |
||||
this.DynLayer = DynLayer; |
||||
this.DynLayer(); |
||||
|
||||
this.setStrokeColor("black"); |
||||
this.setStrokeWeight(1); |
||||
}; |
||||
Shape.prototype = new DynLayer(); |
||||
Shape.prototype.setStrokeColor = function(v) {this._s = v}; |
||||
Shape.prototype.setStrokeWeight = function(v) {this._w = v}; |
||||
|
||||
function Line(x1,y1,x2,y2,w,s) { |
||||
this.Shape = Shape; |
||||
this.Shape(); |
||||
this.setStrokeWeight(w); |
||||
this.setStrokeColor(s); |
||||
|
||||
var dx = Math.min(x1,x2); |
||||
var dy = Math.min(y1,y2); |
||||
var width = Math.abs(x2-x1); |
||||
var height = Math.abs(y2-y1); |
||||
this.setLocation(dx, dy); |
||||
|
||||
if(x1==x2||y1==y2) { // straight line
|
||||
this.setBgColor(s); |
||||
if(x1==x2) this.setSize(w,height); // vertical
|
||||
else this.setSize(width,w); //horizontal
|
||||
} |
||||
else { // diagonal
|
||||
this.setSize(width,height); |
||||
var nx1 = x1-dx; |
||||
var ny1 = y1-dy; |
||||
var nx2 = x2-dx; |
||||
var ny2 = y2-dy; |
||||
drawLine(nx1,ny1,nx2,ny2,s,w,this); |
||||
} |
||||
}; |
||||
Line.prototype = new Shape(); |
||||
|
||||
function VMLElement() { |
||||
this.elm = null; |
||||
}; |
||||
VMLElement.prototype.createShape = function(type) { |
||||
this.elm = document.createElement('v:'+type); |
||||
}; |
||||
VMLElement.prototype.setLocation = function() {}; |
||||
|
||||
function VML_Line(x1,y1,x2,y2,w,s) { |
||||
this.VMLElement = VMLElement; |
||||
this.VMLElement(); |
||||
|
||||
this.createShape("line"); |
||||
this.elm.from = x1+'px ,'+y1+'px'; |
||||
this.elm.to = x2+'px ,'+y2+'px'; |
||||
this.elm.strokeColor = s; |
||||
this.elm.innerHTML = '<v:stroke weight="'+w+'px">'; |
||||
|
||||
//this.elm.innerHTML = '<v:stroke weight="'+this.thickness+'px" color="'+this.color+'">';
|
||||
//"<v:line id='line" + nnode + "' from=" + x1 + "," + y1 +"' to='" + x2 + "," + y2 +"'><v:stroke weight='2px' color='black'/></v:line>";
|
||||
}; |
||||
VML_Line.prototype = new VMLElement(); |
||||
|
||||
function VML_Oval(x,y,width,height,w,s,fc) { |
||||
this.VMLElement = VMLElement; |
||||
this.VMLElement(); |
||||
|
||||
this.elm = document.createElement('v:oval'); |
||||
this.elm.style.position = "absolute"; |
||||
this.elm.style.left = x+"px"; |
||||
this.elm.style.top = y+"px"; |
||||
this.elm.style.width = width+"px"; |
||||
this.elm.style.height = height+"px"; |
||||
|
||||
this.elm.strokeColor = s; |
||||
|
||||
if (fc) { |
||||
this.elm.fillColor = fc; |
||||
this.elm.fill = true; |
||||
} |
||||
else this.elm.fill = false; |
||||
|
||||
this.elm.innerHTML = '<v:stroke weight="'+w+'px">'; |
||||
}; |
||||
VML_Oval.prototype = new VMLElement(); |
||||
|
||||
function drawLine(x1,y1,x2,y2,color,t,lyr) { |
||||
var flag = (Math.abs(y2-y1) > Math.abs(x2-x1)); |
||||
var dx,dy,x,y,e,xstep,ystep; |
||||
if (flag) dx=Math.abs(y2-y1),dy=Math.abs(x2-x1),x=y1,y=x1; |
||||
else dx=Math.abs(x2-x1),dy=Math.abs(y2-y1),x=x1,y=y1; |
||||
xstep=x1>x2?-1:1; |
||||
ystep=y1>y2?-1:1; |
||||
if(x1==x2||y1==y2) { |
||||
if(x1==x2) { |
||||
var ny1 = Math.min(y1,y2); |
||||
var ny2 = Math.max(y1,y2); |
||||
lyr.addChild( new DynLayer('',x1,ny1,t,(ny2-ny1)*t,color) ); |
||||
return; |
||||
} |
||||
else { |
||||
var nx1 = Math.min(x1,x2); |
||||
var nx2 = Math.max(x1,x2); |
||||
lyr.addChild( new DynLayer('',nx1,y1,(nx2-nx1)*t,t,color) ); |
||||
return; |
||||
} |
||||
} |
||||
// Bresenham Method Begin
|
||||
var e=-dx; |
||||
for(var count=0;count<=dx;count++) { |
||||
if (flag) drawPixel(y,x,color,t,lyr); |
||||
else drawPixel(x,y,color,t,lyr); |
||||
if (flag) x+=ystep; |
||||
else x+=xstep; |
||||
e+=dy<<1; |
||||
if(e>=0) { |
||||
if(flag) y+=xstep; |
||||
else y+=ystep; |
||||
e-=dx<<1; |
||||
} |
||||
} |
||||
return; |
||||
}; |
||||
function Circle(x,y,radius,w,s) { |
||||
this.Shape = Shape; |
||||
this.Shape(); |
||||
this.setStrokeWeight(w); |
||||
this.setStrokeColor(s); |
||||
|
||||
this.setLocation(x,y); |
||||
this.setSize(2*radius, 2*radius); |
||||
|
||||
drawCircle(0+radius,0+radius,radius-1,this._s,this._w,this); |
||||
}; |
||||
|
||||
Circle.prototype = new Shape(); |
||||
|
||||
function drawCircle(centerX,centerY,radius,color,t,lyr) { |
||||
var x = centerX; |
||||
var y = centerY; |
||||
var cx = 0; |
||||
var cy = radius; |
||||
var df = 1 - radius; |
||||
var d_e = 3; |
||||
var d_se = -(radius<<1) + 5; |
||||
do { |
||||
drawPixel(x+cx, y+cy, color,t,lyr); |
||||
if (cx) drawPixel(x-cx, y+cy, color,t,lyr); |
||||
if (cy) drawPixel(x+cx, y-cy, color,t,lyr); |
||||
if ((cx) && (cy)) drawPixel(x-cx, y-cy, color,t,lyr) ; |
||||
if (cx != cy) { |
||||
drawPixel(x+cy, y+cx, color,t,lyr); |
||||
if (cx) drawPixel(x+cy, y-cx, color,t,lyr); |
||||
if (cy) drawPixel(x-cy, y+cx, color,t,lyr); |
||||
if (cx && cy) drawPixel(x-cy, y-cx, color,t,lyr); |
||||
} |
||||
if (df < 0) { |
||||
df += d_e; |
||||
d_e += 2; |
||||
d_se += 2; |
||||
} |
||||
else { |
||||
df += d_se; |
||||
d_e += 2; |
||||
d_se += 4; |
||||
cy--; |
||||
} |
||||
cx++; |
||||
} while (cx <= cy); |
||||
}; |
||||
|
||||
function fillCircle(x,y,radius,color,lyr) { |
||||
var cx = 0; |
||||
var cy = radius; |
||||
var df = 1 - radius; |
||||
var d_e = 3; |
||||
var d_se = -(radius<<1) + 5; |
||||
do { |
||||
fillRect(x-cy, y-cx, cy<<1, cx<<1, color,lyr); |
||||
if (df < 0) { |
||||
df += d_e; |
||||
d_e += 2; |
||||
d_se += 2; |
||||
} |
||||
else { |
||||
if (cx != cy) fillRect(x-cx, y-cy, cx<<1, cy<<1, color,lyr); |
||||
df += d_se; |
||||
d_e += 2; |
||||
d_se += 4; |
||||
cy--; |
||||
} |
||||
cx++; |
||||
} while (cx <= cy); |
||||
} |
||||
|
||||
function drawEllipse(cx,cy,rx,ry,color,filled,t,lyr) { |
||||
var x,y,a2,b2, S, T; |
||||
a2 = rx*rx; |
||||
b2 = ry*ry; |
||||
x = 0; |
||||
y = ry; |
||||
S = a2*(1-2*ry) + 2*b2; |
||||
T = b2 - 2*a2*(2*ry-1); |
||||
symmPaint(cx,cy,x,y,color,filled,t,lyr); |
||||
do { |
||||
if (S<0) { |
||||
S += 2*b2*(2*x+3); |
||||
T += 4*b2*(x+1); |
||||
x++; |
||||
} else if (T<0) { |
||||
S += 2*b2*(2*x+3) - 4*a2*(y-1); |
||||
T += 4*b2*(x+1) - 2*a2*(2*y-3); |
||||
x++; |
||||
y--; |
||||
} else { |
||||
S -= 4*a2*(y-1); |
||||
T -= 2*a2*(2*y-3); |
||||
y--; |
||||
} |
||||
symmPaint(cx,cy,x,y,color,filled,t,lyr); |
||||
} while (y>0); |
||||
} |
||||
|
||||
//Bresenham's algorithm for ellipses
|
||||
function symmPaint(cx,cy, x, y, color, filled, t, lyr){ |
||||
if (filled) { |
||||
fillRect ( cx-x, cy-y, x<<1, y<<1, color, lyr ); |
||||
} else { |
||||
drawPixel ( cx-x, cy-y, color, t,lyr ); |
||||
drawPixel ( cx+x, cy-y, color, t,lyr ); |
||||
drawPixel ( cx-x, cy+y, color, t,lyr ); |
||||
drawPixel ( cx+x, cy+y, color, t,lyr ); |
||||
} |
||||
} |
||||
|
||||
function drawRect(x,y,w,h,color,t,lyr) { |
||||
lyr.addChild( new DynLayer('',x,y,w,t,color) ); |
||||
lyr.addChild( new DynLayer('',x,y,t,h,color) ); |
||||
lyr.addChild( new DynLayer('',x+w-t,y,t,h,color) ); |
||||
lyr.addChild( new DynLayer('',x,y+h-t,w,t,color) ); |
||||
} |
||||
|
||||
function fillRect(x,y,w,h,color,lyr) { |
||||
lyr.addChild( new DynLayer('',x,y,w,h,color) ); |
||||
} |
||||
@ -1,249 +0,0 @@
@@ -1,249 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
GroupManager Class |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
requires: Dynlayer |
||||
*/ |
||||
|
||||
function GroupManager(){ |
||||
this.EventObject=EventObject; |
||||
this.EventObject(); |
||||
|
||||
this.x = this.y = null; |
||||
this.w = this.h = null; |
||||
this._objects={}; |
||||
|
||||
}; |
||||
GroupManager._NewSetSize = function(w,h){ |
||||
this._OldDynGMSetSize(w,h);
|
||||
this._grpManager._setSize(this); |
||||
this._grpManager._resetSize(); |
||||
this._grpManager.changeLocationBy(0,0); |
||||
}; |
||||
GroupManager._NewSetLocation = function(x,y){ |
||||
var byX=x-this.x; |
||||
var byY=y-this.y; |
||||
if(this._grpUX) byX=0; else x=null; |
||||
if(this._grpUY) byY=0; else y=null; |
||||
if(x!=null || y!=null) this._OldDynGMSetLocation(x,y); |
||||
if(!this._grpUX || !this._grpUY) { |
||||
this._grpManager.changeLocationBy(byX,byY); |
||||
} |
||||
}; |
||||
var p= dynapi.setPrototype("GroupManager","EventObject"); |
||||
p._setSize = function(dlyr){ |
||||
var lw,lh,px,py; |
||||
if(!dlyr) return; |
||||
// store previous x,y
|
||||
px=this.x; py=this.y; |
||||
// calc x,y
|
||||
this.x = (this.x==null||(dlyr.x!=null && this.x>dlyr.x))? dlyr.x:this.x; |
||||
this.y = (this.y==null||(dlyr.y!=null && this.y>dlyr.y))? dlyr.y:this.y; |
||||
// calc w,h
|
||||
lw=(dlyr.x+dlyr.w)-this.x; lh=(dlyr.y+dlyr.h)-this.y; |
||||
this.w = (this.w==null||(dlyr.w!=null && this.w<lw))? lw:this.w; |
||||
this.h = (this.h==null||(dlyr.h!=null && this.h<lh))? lh:this.h; |
||||
// add trailing or leading w/h
|
||||
if(px>dlyr.x) this.w+=(px-dlyr.x); |
||||
if(py>dlyr.y) this.h+=(py-dlyr.y); |
||||
}; |
||||
p._resetSize = function(){ |
||||
var o,objs=this._objects; |
||||
this.x=this.y=this.w=this.h=null; |
||||
for (var i in objs){ |
||||
o=objs[i]; |
||||
this._setSize(o); |
||||
} |
||||
}; |
||||
|
||||
p.add = function(dlyr,unlockX,unlockY){ |
||||
var lw,lh; |
||||
if(!dlyr) return; |
||||
if(this._objects[dlyr.id]) return; |
||||
dlyr._grpManager=this; |
||||
dlyr._grpUX = unlockX; |
||||
dlyr._grpUY = unlockY; |
||||
dlyr._OldDynGMSetSize = dlyr.setSize; |
||||
dlyr._OldDynGMSetLocation = dlyr.setLocation; |
||||
dlyr.setSize = GroupManager._NewSetSize; |
||||
dlyr.setLocation = GroupManager._NewSetLocation; |
||||
if (this.x==dlyr.x && this.w<dlyr.w) this.w=dlyr.w;
|
||||
this._objects[dlyr.id]=dlyr; |
||||
this._setSize(dlyr); |
||||
return dlyr; |
||||
}; |
||||
p.changeLocationBy = function(byX,byY) { |
||||
var o,objs=this._objects; |
||||
for (var i in objs){ |
||||
o=objs[i]; |
||||
o._OldDynGMSetLocation(o.x+byX,o.y+byY,true); |
||||
} |
||||
this.x+=byX; this.y+=byY; |
||||
// Check for boundary, if any
|
||||
if (this._boundary) { |
||||
var x=this.x,y=this.y; |
||||
var dB = this._boundary; |
||||
var b=dB[2]; |
||||
var r=dB[1]; |
||||
var l=dB[3]; |
||||
var t=dB[0]; |
||||
var w=this.w; |
||||
var h=this.h; |
||||
if (this.x<l||this.w>=r) x=l; |
||||
else if (this.x+w>r) x=r-w; |
||||
if (this.y<t||this.h>=b) y=t; |
||||
else if (this.y+h>b) y=b-h; |
||||
if(this.x!=x||this.y!=y) this.setLocation(x,y); |
||||
} |
||||
}; |
||||
p.remove = function(dlyr){ |
||||
if(!dlyr) return; |
||||
dlyr=this._objects[dlyr.id]; |
||||
if(dlyr) { |
||||
this._objects = dynapi.functions.removeFromObject(this._objects,dlyr.id); |
||||
dlyr.setSize = dlyr._OldDynGMSetSize; |
||||
dlyr.setLocation = dlyr._OldDynGMSetLocation; |
||||
dlyr._OldDynGMSetSize = null; |
||||
dlyr._OldDynGMSetLocation = null; |
||||
dlyr._grpManager = null; |
||||
this._resetSize(); |
||||
} |
||||
}; |
||||
p.sendMessage = function(msg,a1,a2,a3,a4,a5,a6,a7){ |
||||
var o,objs=this._objects; |
||||
for (var i in objs){ |
||||
o=objs[i]; |
||||
if(o[msg]) o[msg](a1,a2,a3,a4,a5,a6,a7); |
||||
else eval(o+'.'+msg); |
||||
} |
||||
}; |
||||
p.setBoundary = function(t,r,b,l){ |
||||
if(t==null && arguments.length==1) this._boundary = null; |
||||
else this._boundary = [t,r,b,l]; |
||||
}; |
||||
p.setLocation = function(x,y) { |
||||
var byX=x-this.x; |
||||
var byY=y-this.y; |
||||
this.changeLocationBy(byX,byY); |
||||
}; |
||||
p.unlockX = function(b,dlyr){ |
||||
if(!dlyr) { |
||||
var objs=this._objects; |
||||
for (var i in objs) objs[i]._grpUX=b; |
||||
}else{ |
||||
dlyr=this._objects[dlyr.id]; |
||||
if(dlyr) dlyr._grpUX=b; |
||||
} |
||||
if(!b) this._resetSize(); |
||||
}; |
||||
p.unlockY = function(b,dlyr){ |
||||
var objs=this._objects; |
||||
if(!dlyr) { |
||||
var objs=this._objects; |
||||
for (var i in objs) objs[i]._grpUY=b; |
||||
}else{ |
||||
dlyr=this._objects[dlyr.id]; |
||||
if(dlyr) dlyr._grpUY=b; |
||||
} |
||||
if(!b) this._resetSize(); |
||||
}; |
||||
p.unlockXY = function(b,dlyr){ |
||||
if(!dlyr) { |
||||
var objs=this._objects; |
||||
for (var i in objs) { |
||||
objs[i]._grpUX=b; |
||||
objs[i]._grpUY=b; |
||||
} |
||||
}else{ |
||||
dlyr=this._objects[dlyr.id]; |
||||
if(dlyr) { |
||||
dlyr._grpUX=b; |
||||
dlyr._grpUY=b; |
||||
} |
||||
} |
||||
if(!b) this._resetSize(); |
||||
}; |
||||
p.getUnlockX = function(dlyr){ |
||||
if(!dlyr) { |
||||
var results = new Array(); |
||||
var trueCount = 0; |
||||
var falseCount = 0; |
||||
var objs=this._objects; |
||||
for (var i in objs) { |
||||
results[objs[i]] = objs[i]._grpUX; |
||||
if( objs[i]._grpUX == true ) { |
||||
trueCount++; |
||||
} else { |
||||
falseCount++; |
||||
} |
||||
} |
||||
if( falseCount == 0 ) { |
||||
return true; |
||||
} else if( trueCount == 0 ) { |
||||
return false; |
||||
} else { |
||||
return results; |
||||
} |
||||
} else { |
||||
dlyr=this._objects[dlyr.id]; |
||||
if(dlyr) { |
||||
return dlyr._grpUX; |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
p.getUnlockY = function(dlyr){ |
||||
if(!dlyr) { |
||||
var results = new Array(); |
||||
var trueCount = 0; |
||||
var falseCount = 0; |
||||
var objs=this._objects; |
||||
for (var i in objs) { |
||||
results[objs[i]] = objs[i]._grpUY; |
||||
if( objs[i]._grpUY == true ) { |
||||
trueCount++; |
||||
} else { |
||||
falseCount++; |
||||
} |
||||
} |
||||
if( falseCount == 0 ) { |
||||
return true; |
||||
} else if( trueCount == 0 ) { |
||||
return false; |
||||
} else { |
||||
return results; |
||||
} |
||||
} else { |
||||
dlyr=this._objects[dlyr.id]; |
||||
if(dlyr) { |
||||
return dlyr._grpUY; |
||||
} |
||||
} |
||||
|
||||
} |
||||
p.setUnlockXState = function(values) { |
||||
if( values.length === undefined ) { |
||||
this.unlockX(values); |
||||
} else { |
||||
for( var obj in values ) { |
||||
this.unlockX(values[obj],obj); |
||||
} |
||||
} |
||||
} |
||||
|
||||
p.setUnlockYState = function(values) { |
||||
if( values.length === undefined ) { |
||||
this.unlockY(values); |
||||
} else { |
||||
for( var obj in values ) { |
||||
this.unlockY(values[obj],obj); |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
@ -1,67 +0,0 @@
@@ -1,67 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
Higlighter/Skin Class |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
requires: DynLayer |
||||
*/ |
||||
|
||||
// Highlighter
|
||||
function Highlighter(x,y,w,h,color,image){ |
||||
this.DynLayer=DynLayer; |
||||
if(x && x.constructor==Object) this.DynLayer(x); // use dictionary
|
||||
else this.DynLayer(null,x||0,y||0,w||0,h||0,color,image);
|
||||
}; |
||||
var p = dynapi.setPrototype('Highlighter','DynLayer'); |
||||
p.addChild=dynapi.functions.Null; |
||||
if (!dynapi.ua.ns4){ |
||||
p._hLight= [ |
||||
'\n<div id="',1,'" style="left:',3 ,'px; top:',5,'px; width:',7, |
||||
'px; height:',9,'px; background-color:',11, |
||||
'; z-index:10000; visibility:inherit; background-image:',13,'; position:absolute;font-size:0px;"><!--IE?--></div>' |
||||
]; // some versions of IE (e.g. 6.0) will not set the correct height if the layer hight is smaller than the font height. To fix this I added <!--IE?--> to the div
|
||||
} |
||||
else{ |
||||
p._hLight= [ |
||||
'\n<layer id="',1,'" left="',3 ,'" top="',5,'" width="',7, |
||||
'" height="',9,'" zIndex="10000" bgcolor="',11,'" background="',13,'"></layer>' |
||||
]; |
||||
}; |
||||
p.getOuterHTML = function(){ |
||||
var a=this._hLight; |
||||
a[1]=this.id; |
||||
a[3]=this.x; |
||||
a[5]=this.y; |
||||
a[7]=this.w; |
||||
a[9]=this.h; |
||||
a[11]=this.bgColor||this.parent.bgColor||'none'; |
||||
a[13]=(this.bgImage==null)? 'none':'url('+this.bgImage+')'; // will prevent image reloading in IE
|
||||
return a.join('');
|
||||
}; |
||||
p.getInnerHTML = function(){ |
||||
return '<!--IE?-->'; |
||||
}; |
||||
|
||||
// Skin
|
||||
function Skin(p,a) { |
||||
this.base=Highlighter; |
||||
var w=a[0], h=a[1], d1=a[2], d2=a[3], c=a[4], i=a[5]; this.point=p; |
||||
if(p=='n') this.base({h:h,color:c,image:i,anchor:{top:0,right:d1,left:d2}}); |
||||
if(p=='ne') this.base({w:w,h:h,color:c,image:i,anchor:{top:0,right:0}}); |
||||
if(p=='e') this.base({w:w,color:c,image:i,anchor:{top:d1,right:0,bottom:d2}}); |
||||
if(p=='se') this.base({w:w,h:h,color:c,image:i,anchor:{right:0,bottom:0}}); |
||||
if(p=='s') this.base({h:h,color:c,image:i,anchor:{right:d1,bottom:0,left:d2}}); |
||||
if(p=='sw') this.base({w:w,h:h,color:c,image:i,anchor:{bottom:0,left:0}}); |
||||
if(p=='w') this.base({w:w,color:c,image:i,anchor:{top:d1,bottom:d2,left:0}}); |
||||
if(p=='nw') this.base({w:w,h:h,color:c,image:i,anchor:{top:0,left:0}}); |
||||
}; |
||||
Skin.prototype=new Highlighter(); |
||||
Skin.prototype.graft=function(a) { |
||||
var w=a[0], h=a[1], d1=a[2], d2=a[3], c=a[4], i=a[5], p=this.point; |
||||
this.setSize(w,h); this.setBgColor(c); this.setBgImage(i); |
||||
if(p=='n') this.setAnchor({top:0,right:d1,left:d2}); |
||||
if(p=='e') this.setAnchor({top:d1,right:0,bottom:d2}); |
||||
if(p=='s') this.setAnchor({right:d1,bottom:0,left:d2}); |
||||
if(p=='w') this.setAnchor({top:d1,bottom:d2,left:0}); |
||||
}; |
||||
@ -1,58 +0,0 @@
@@ -1,58 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
HTMLButton Class |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
Requires: HTMLComponent |
||||
*/ |
||||
|
||||
function HTMLButton(css,caption,title,elmName){ |
||||
this.HTMLComponent = HTMLComponent; |
||||
this.HTMLComponent(css); |
||||
|
||||
this._elmId = elmName||(this.id+'BTN'); |
||||
this._title=title||''; |
||||
this._caption=caption||''; |
||||
this._defEvtResponse = true; |
||||
}; |
||||
var p = dynapi.setPrototype('HTMLButton','HTMLComponent'); |
||||
// Methods
|
||||
p._getDSValue = function(){return this._caption}; // DataSource functions
|
||||
p._setDSValue = function(d){this.setCaption(d)}; |
||||
p._assignElm = function(elm){ |
||||
if(!this.parent) return; |
||||
else if(!this.parent._created) return; |
||||
var doc=this.parent.doc; |
||||
if(!elm){ |
||||
if(dynapi.ua.ie) elm=doc.all[this._elmId]; |
||||
else if(dynapi.ua.dom) elm=doc.getElementById(this._elmId); |
||||
else if(dynapi.ua.ns4){ |
||||
for(i=0;i<doc.forms.length;i++){ |
||||
elm=doc.forms[i][this._elmId]; |
||||
if(elm) break; |
||||
} |
||||
} |
||||
if(!elm) return; |
||||
} |
||||
this.elm = elm; |
||||
this.css = (dynapi.ua.ns4)? elm:elm.style; |
||||
this.doc = this.parent.doc; |
||||
}; |
||||
p.getInnerHTML = function(){ |
||||
var evt = this._generateInlineEvents(this); |
||||
var text=this._caption||''; |
||||
return '<input type="button" class="'+this._class+'" id="'+this._elmId+'" name="'+this._elmId+'" value="'+text+'" ' |
||||
+evt+' title="'+this._title+'" />'; |
||||
}; |
||||
p.getCaption = function() { |
||||
return (this.getElm())? this.elm.value:this._text; |
||||
}; |
||||
p.setCaption = function(t) { |
||||
var elm = this.getElm(); |
||||
this._caption = t||''; |
||||
if(elm) elm.value=t; |
||||
}; |
||||
p.setElementName = function(t){ |
||||
if(t) this._elmId = t; |
||||
}; |
||||
@ -1,223 +0,0 @@
@@ -1,223 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
HTMLCalendar Class - based on Basic Calendar script from The JavaScript Source!! (http://javascript.internet.com)
|
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
Requires: HTMLContainer |
||||
*/ |
||||
|
||||
// to-do: add floating drop down menu to the month and year fields
|
||||
function HTMLCalendar(css,date){ |
||||
this.HTMLContainer = HTMLContainer; |
||||
this.HTMLContainer(css,null,240,206);
|
||||
|
||||
this._date = date; |
||||
}; |
||||
var p = dynapi.setPrototype('HTMLCalendar','HTMLContainer'); |
||||
// Design Properties
|
||||
p.borCol = '#BBBBBB'; |
||||
p.titleBgCol ='#CCCCCC'; |
||||
p.titleFgCol ='#000000'; |
||||
p.wkDayBgCol ='#FFFFFF'; |
||||
p.wkDayFgCol = '#000000'; |
||||
p.selBorCol = '#CCCCCC'; |
||||
p.selBgCol = '#DEDEFF'; |
||||
p.selFgCol = '#000000'; |
||||
p.selTDayBgCol = '#EEEEEE'; |
||||
p.selTDayFgCol = '#000000'; |
||||
p.imgDn = dynapi.functions.getImage(dynapi.library.path+'gui/images/arr_down.gif',10,10); |
||||
p.imgToday = dynapi.functions.getImage(dynapi.library.path+'gui/images/today.gif',18,18); |
||||
// Methods
|
||||
p._oldHConGetInnerHTML = HTMLContainer.prototype.getInnerHTML; |
||||
p._getDSValue = function(){return this._date}; // DataSource functions
|
||||
p._setDSValue = function(d){this._build(d)}; |
||||
p._build = function(dt,state,ns4Tmr){ |
||||
var tmp,ua=dynapi.ua; |
||||
// ns4 will crash if you try to replace the content of a layer by clicking on a link inside the layer
|
||||
if(ua.ns4 && !ns4Tmr && this.elm) { |
||||
window.setTimeout(this+'._build("'+(dt||'')+'","'+(state||'')+'",true)',200); |
||||
return; |
||||
} |
||||
var idate=((dt)? dt:this._date)||new Date(); |
||||
idate = new Date(idate.toString()) |
||||
if(isNaN(idate)) { |
||||
alert('Invalid date: '+(dt||'')); |
||||
return; |
||||
} |
||||
this._date = idate; |
||||
var Calendar = new Date(idate.toString()); |
||||
//DQ Deutsch
|
||||
//var day_of_week = new Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
|
||||
//var month_of_year = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
|
||||
var day_of_week = new Array('So','Mo','Di','Mi','Do','Fr','Sa'); |
||||
var month_of_year = new Array('Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'); |
||||
var year = Calendar.getFullYear(),month = Calendar.getMonth(); |
||||
var today = (new Date()).getDate(); |
||||
var todayMonth = (new Date()).getMonth(); |
||||
var todayYear = (new Date()).getFullYear(); |
||||
var selectedDay = Calendar.getDate(),weekday = Calendar.getDay(); |
||||
var DAYS_OF_WEEK = 7,DAYS_OF_MONTH = 31; |
||||
var TR_start = '<tr>',TR_end = '</tr>'; |
||||
|
||||
tmp = '<td><table callpadding="0" cellspacing="0" bgcolor="@1" @2><tr><td width="18"><center><font face="arial" size="2" color="@3"><b>'; |
||||
var highlight_today = tmp.replace(/@1/,this.backCol).replace(/@2/,'background="'+this.imgToday.src+'"').replace(/@3/,this.selTDayFgCol); |
||||
var highlight_start = tmp.replace(/@1/,this.selBgCol).replace(/@2/,((ua.ns4)? 'border="1"':'style="border:2px solid '+this.selBorCol+'"')).replace(/@3/,this.selFgCol); |
||||
var highlight_end = '</b></font></center></td></tr></table></td>'; |
||||
|
||||
tmp = '<td @0 width="30" height="26"><center><font face="arial" size="2" color="@1">';
|
||||
var TD_wkDayStart = tmp.replace(/@0/,'bgcolor="'+this.wkDayBgCol+'"').replace(/@1/,this.wkDayFgCol); |
||||
var TD_start = tmp.replace(/@0/,'').replace(/@1/,this.foreCol); |
||||
var TD_end = '</font></center></td>'; |
||||
|
||||
tmp = (ua.ns4)? 'border="1"':'style="border:1px solid '+this.borCol+'"'; |
||||
var cal='<table '+tmp+' width="240" height="206" bgcolor="'+this.backCol+'" cellspacing="0" cellpadding="0"><tr><td valign="top">'; |
||||
cal+='<table border="0" cellspacing="0" cellpadding="2">' + TR_start; |
||||
cal+='<td colspan="' + DAYS_OF_WEEK + '" bgcolor="'+this.titleBgCol+'"><center><font face="arial" size="2" color="'+this.titleFgCol+'"><b>';
|
||||
idate=(month+1)+"/"+selectedDay+"/"+year;
|
||||
cal+='<a style="text-decoration:none;color:'+this.titleFgCol+'" href="javascript:;" onclick="return '+this+'._showMonths(\''+idate+'\');">'+ month_of_year[month] + ' '+this.imgDn.getHTML()+'</a> '; |
||||
cal+='<a style="text-decoration:none;color:'+this.titleFgCol+'" href="javascript:;" onclick="return '+this+'._showYears(\''+idate+'\');">'+ year +' '+this.imgDn.getHTML()+'</a></b>' + TD_end + TR_end; |
||||
|
||||
// build days-of-week
|
||||
cal+=TR_start; |
||||
Calendar.setDate(1); |
||||
Calendar.setMonth(month); |
||||
for(index=0; index < DAYS_OF_WEEK; index++){ |
||||
tmp = day_of_week[index]; |
||||
if(weekday == index) tmp = '<b>' + day_of_week[index] + '</b>'; |
||||
cal+= TD_wkDayStart + tmp + TD_end; |
||||
} |
||||
cal+= TR_end; |
||||
|
||||
// build days-of-month
|
||||
if(Calendar.getDay()>0){ |
||||
cal+= TR_start; |
||||
for(index=0; index < Calendar.getDay(); index++){ |
||||
cal+= TD_start + ' ' + TD_end; |
||||
} |
||||
} |
||||
for(index=0; index < DAYS_OF_MONTH; index++){ |
||||
if( Calendar.getDate() > index ){ |
||||
week_day =Calendar.getDay(); |
||||
if(week_day == 0) cal+=TR_start; |
||||
if(week_day != DAYS_OF_WEEK){ |
||||
var day = Calendar.getDate(); |
||||
if(selectedDay==Calendar.getDate()){ |
||||
cal+= highlight_start + day + highlight_end; |
||||
}else{ |
||||
idate=year+"/"+(month+1)+"/"+day; |
||||
click='onclick="'+this+'._build(\''+idate+'\');return false;"'; |
||||
click = '<a '+click+' style="text-decoration:none;color:@0" href="javascript:;">'+ day + '</a>'; |
||||
if(today==Calendar.getDate() && todayMonth==month && todayYear==year){ |
||||
click=click.replace(/@0/,this.selTDayFgCol); |
||||
cal+= highlight_today + click + highlight_end; |
||||
} |
||||
else { |
||||
click=click.replace(/@0/,this.foreCol); |
||||
cal+= TD_start +click+TD_end; |
||||
} |
||||
|
||||
} |
||||
} |
||||
if(week_day == (DAYS_OF_WEEK-1)) cal+= TR_end; |
||||
} |
||||
Calendar.setDate(Calendar.getDate()+1); |
||||
} |
||||
if(week_day != (DAYS_OF_WEEK-1)) cal+= TR_end; |
||||
cal+= '</table></td></tr></table>'; |
||||
|
||||
if(!ua.ns4){ |
||||
var v,attrib; |
||||
// display today legend
|
||||
attrib = 'style="left:160px;top:180px;visibility:inherit;position:absolute"';
|
||||
//DQ 20.1.2007
|
||||
//cal+=HTMLComponent.buildLayer(this.id+'LEG',attrib,'<img src="'+this.imgToday.src+'" border="0" align="top" /><font face="arial" size="2"> Today</font>');
|
||||
cal+=HTMLComponent.buildLayer(this.id+'LEG',attrib,'<img src="'+this.imgToday.src+'" border="0" align="top" /><font face="arial" size="2"> Heute</font>'); |
||||
|
||||
attrib = 'onmouseover="'+this+'._showMenu()" onmouseout="'+this+'._hideMenu()" style="left:70px;top:18px;visibility:inherit;position:absolute"';
|
||||
// display months
|
||||
if(state=="sm"){ |
||||
tmp='<table width="70" bgcolor="'+this.backCol+'" border="'+((ua.ns4)? 1:0)+'" style="border:1px black solid"><tr><td><font face="arial" size="1" color="'+this.foreCol+'">'; |
||||
for(i=0;i<month_of_year.length;i++) { |
||||
day=selectedDay;
|
||||
if(i==1 && day>28) day=28; //feb
|
||||
if((i==3||i==5||i==8||i==10) && day>30) day=30; // apr,june,sept,nov
|
||||
idate=year+"/"+(i+1)+"/"+day; |
||||
v=month_of_year[i]; |
||||
if(i==month) v='<u>'+v+'</u>'; |
||||
click='onclick="'+this+'._build(\''+idate+'\');return false;"'; |
||||
tmp+='<a '+click+' style="text-decoration:none;color:'+this.foreCol+'" href="javascript:;">'+v+'</a><br>'; |
||||
} |
||||
tmp+='</font></td></tr></table>'; |
||||
cal+=HTMLComponent.buildLayer(this.id+'MNU',attrib,tmp); |
||||
}
|
||||
// display years
|
||||
if(state=="sy"){ |
||||
var c,m; |
||||
tmp='<table width="'+((ua.ns4)? 170:165)+'" bgcolor="'+this.backCol+'" border="'+((ua.ns4)? 1:0)+'" style="border:1px black solid"><tr><td align="right"><font face="arial" size="1" color="'+this.foreCol+'">'; |
||||
// prev
|
||||
idate=(year-12)+"/"+(month+1)+"/"+selectedDay |
||||
click='onclick="'+this+'._build(\''+idate+'\',\'sy\');return false;"'; |
||||
tmp+='<a '+click+' style="text-decoration:none;color:'+this.foreCol+'" href="javascript:;"><<Prev</a> | '; |
||||
// manual
|
||||
idate=(month+1)+"/"+selectedDay+"/"+year; |
||||
click='onclick="return '+this+'._showInput(\''+idate+'\');"'; |
||||
tmp+='<a '+click+' style="text-decoration:none;color:'+this.foreCol+'" href="javascript:;">Manual</a> | ';
|
||||
// next
|
||||
idate=(year+12)+"/"+(month+1)+"/"+selectedDay |
||||
click='onclick="'+this+'._build(\''+idate+'\',\'sy\');return false;"'; |
||||
tmp+='<a '+click+' style="text-decoration:none;color:'+this.foreCol+'" href="javascript:;">Next>></a><br>'; |
||||
// years
|
||||
for(i=0;i<6;i++) { |
||||
for(c=0;c<5;c++){ |
||||
m=((c*6)-12); |
||||
idate=(year+m+i)+"/"+(month+1)+"/"+selectedDay |
||||
v=(year+m+i); |
||||
if(v==year) v='<u>'+v+'</u>'; |
||||
click='onclick="'+this+'._build(\''+idate+'\');return false;"'; |
||||
tmp+='<a '+click+' style="text-decoration:none;color:'+this.foreCol+'" href="javascript:;">'+v+'</a>'; |
||||
if(c<4) tmp+=' <font color="#eeeeee">|</font> '; |
||||
} |
||||
tmp+='<br>'; |
||||
} |
||||
tmp+='</font></td></tr></table>' |
||||
cal+=HTMLComponent.buildLayer(this.id+'MNU',attrib,tmp); |
||||
}; |
||||
clearTimeout(this._mnuTmr); |
||||
if(state=='sy'||state=='sm') this._mnuTmr = setTimeout(this+'._hideMenu(true)',2500); |
||||
} |
||||
|
||||
this.setHTML(cal); |
||||
this.invokeEvent('change'); |
||||
this._ePlaySnd('change'); |
||||
}; |
||||
p._hideMenu = function(b){ |
||||
if(b) this._build(); |
||||
else this._mnuTmr = setTimeout(this+'._hideMenu(true)',500); |
||||
} |
||||
p._showMenu = function(){ |
||||
clearTimeout(this._mnuTmr); |
||||
} |
||||
p._showInput = function(dt){ |
||||
var r = window.prompt('Please enter a valid year (yyyy) or date (mm/dd/yyyy):',dt||''); |
||||
if(r && r.length==4) r=dt.substr(0,dt.length-4)+r; |
||||
this._build(r); |
||||
}; |
||||
p._showMonths = function(dt){ |
||||
if(dynapi.ua.ns4) this._showInput(dt); |
||||
else this._build(null,'sm'); |
||||
return false; |
||||
}; |
||||
p._showYears = function(dt){ |
||||
if(dynapi.ua.ns4) this._showInput(dt); |
||||
else this._build(null,'sy'); |
||||
return false; |
||||
}; |
||||
p.getInnerHTML = function(){ |
||||
this._build(); |
||||
return this._oldHConGetInnerHTML(); |
||||
}; |
||||
p.getDate = function(dt){return this._date}; |
||||
p.setDate = function(dt){ |
||||
this._build(dt); |
||||
}; |
||||
@ -1,76 +0,0 @@
@@ -1,76 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
HTMLCheckBox Class |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
Requires: HTMLComponent |
||||
*/ |
||||
|
||||
function HTMLCheckBox(css,value,state,title,elmName){ |
||||
this.HTMLComponent = HTMLComponent; |
||||
this.HTMLComponent(css); |
||||
|
||||
this._elmId = elmName||(this.id+'CHK'); |
||||
this._title = title||''; |
||||
this._value = value||''; |
||||
this._state = (state)? true:false; |
||||
this._defEvtResponse = true; |
||||
}; |
||||
var p = dynapi.setPrototype('HTMLCheckBox','HTMLComponent'); |
||||
// Methods
|
||||
p._oldHCCBEvt = HTMLComponent.prototype._e; |
||||
p._getDSValue = function(){ // DataSource functions
|
||||
if(this.getElm()) return (this.elm.checked)? this.getValue():null; |
||||
}; |
||||
p._setDSValue = function(d){ |
||||
if(d==this._value) this.setState(true); |
||||
else this.setState(false); |
||||
}; |
||||
p._e = function(evt,elm,arg){ |
||||
if(evt=='click') this._state=elm.checked; |
||||
return this._oldHCCBEvt(evt,elm,arg); |
||||
}; |
||||
p._assignElm = function(elm){ |
||||
if(!this.parent) return; |
||||
else if(!this.parent._created) return; |
||||
var doc=this.parent.doc; |
||||
if(!elm) { |
||||
if(dynapi.ua.ie) elm=doc.all[this._elmId]; |
||||
else if(dynapi.ua.dom) elm=doc.getElementById(this._elmId); |
||||
else if(dynapi.ua.ns4){ |
||||
for(i=0;i<doc.forms.length;i++){ |
||||
elm=doc.forms[i][this._elmId]; |
||||
if(elm) break; |
||||
} |
||||
} |
||||
if(!elm) return; |
||||
} |
||||
this.elm = elm; |
||||
this.css = (dynapi.ua.ns4)? elm:elm.style; |
||||
this.doc = this.parent.doc; |
||||
}; |
||||
p.getInnerHTML = function(){ |
||||
var evt,value=this._value||''; |
||||
var sel = (this._state)? ' checked ':''; |
||||
evt = this._generateInlineEvents(this); |
||||
return '<input type="checkbox" class="'+this._class+'" id="'+this._elmId+'" name="'+this._elmId+'" value="'+value+'" ' |
||||
+sel+evt+' title="'+this._title+'" />'; |
||||
}; |
||||
p.getState = function(){ |
||||
return (this.getElm())? this.elm.checked:this._state; |
||||
}; |
||||
p.getValue = function() { |
||||
return (this.getElm())? this.elm.value:this._value; |
||||
}; |
||||
p.setElementName = function(t){ |
||||
if(t) this._elmId = t; |
||||
}; |
||||
p.setState = function(b) { |
||||
this._state=(b) ? true:false; |
||||
if(this.getElm()) this.elm.selected=this._state; |
||||
}; |
||||
p.setValue = function(v) { |
||||
this._value=v||''; |
||||
if(this.getElm()) this.elm.value=v; |
||||
}; |
||||
@ -1,129 +0,0 @@
@@ -1,129 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
HTMLClock Class - based on Scrolling Clock script from The JavaScript Source!! (http://javascript.internet.com)
|
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
Requires: HTMLContainer |
||||
*/ |
||||
|
||||
function HTMLClock(css){ |
||||
this.HTMLContainer = HTMLContainer; |
||||
this.HTMLContainer(css,null,90,90);
|
||||
|
||||
this._Ypos =44; |
||||
this._Xpos =44; |
||||
this._Ybase = 8; |
||||
this._Xbase = 8; |
||||
this._dots = 12; |
||||
this._hLn = 4; // # dots for hours
|
||||
this._mLn = 5; // # dots for minutes
|
||||
this._sLn = 6; // # dots for seoncds
|
||||
|
||||
this._showTime();
|
||||
}; |
||||
var p = dynapi.setPrototype('HTMLClock','HTMLContainer'); |
||||
// Design Properties
|
||||
p.digitCol = '000000'; //digit colour.
|
||||
p.secCol = 'ff0000'; //seconds colour.
|
||||
p.minCol = '000000'; //minutes colour.
|
||||
p.hourCol = '000000'; //hours colour.
|
||||
// Methods
|
||||
p._oldHCLKGetInnerHTML = HTMLContainer.prototype.getInnerHTML; |
||||
p._getDSValue = function(){return this._date}; // DataSource functions
|
||||
p._setDSValue = dynapi.functions.Null; |
||||
p._build = function(){ |
||||
var html=''; |
||||
var attr,attrB; |
||||
if(dynapi.ua.ns4) { |
||||
attr = 'top=0 left=0 height=30 width=30'; |
||||
attrB = 'top=0 left=0 bgcolor=@0 clip="0,0,2,2"'; |
||||
for (i = 0; i < this._dots; i++) html+=this.HC.buildLayer(this.id+i+'Digits"',attr,'<center><font face=Arial,Verdana size=1 color='+this.digitCol+'>'+(i+1)+'</font></center>');
|
||||
} |
||||
else { |
||||
attr ='style="visibility:hidden;position:absolute;left:0px;top:0px;width:30px;height:30px;font-family:Arial,Verdana;font-size:10px;color:'+this.digitCol+';text-align:center;padding-top:10px"'; |
||||
attrB = 'style="visibility:hidden;position:absolute;left:0px;top:0px;width:2px;height:2px;font-size:2px;background-color:@0"'; |
||||
for (i = 0; i < this._dots; i++) html+=this.HC.buildLayer(this.id+i+'Digits',attr,(i+1)); |
||||
} |
||||
for (i = 0; i < this._mLn; i++) html+=this.HC.buildLayer(this.id+i+'Y',attrB.replace(/@0/,this.minCol),''); |
||||
for (i = 0; i < this._hLn; i++) html+=this.HC.buildLayer(this.id+i+'Z',attrB.replace(/@0/,this.hourCol),''); |
||||
for (i = 0; i < this._sLn; i++) html+=this.HC.buildLayer(this.id+i+'X',attrB.replace(/@0/,this.secCol),''); |
||||
html='<table border=0 cellspacing=0 width=90 height=90><tr><td>'+html+'</td></tr></table>'; |
||||
this.html=html; |
||||
}; |
||||
p._showTime = function() { |
||||
var x,y,lyr;
|
||||
var time = new Date (); |
||||
var secs = time.getSeconds(); |
||||
var sec = -1.57 + Math.PI * secs/30; |
||||
var mins = time.getMinutes(); |
||||
var min = -1.57 + Math.PI * mins/30; |
||||
var hr = time.getHours();
|
||||
var hrs = -1.57 + Math.PI * hr/6 + Math.PI*parseInt(time.getMinutes())/360; |
||||
|
||||
if (this.getElm()) { |
||||
for (i = 0; i < this._dots; ++i){ |
||||
lyr = this.HC.getLayerById(this.id+i+'Digits',this.doc); |
||||
y = this._Ypos - ((dynapi.ua.ns4)? 5:15) + 40 * Math.sin(-0.49+this._dots+i/1.9); |
||||
x = this._Xpos - ((dynapi.ua.ns4)? 15:14) + 40 * Math.cos(-0.49+this._dots+i/1.9); |
||||
lyr.setLocation(x,y); |
||||
lyr.setVisible(true); |
||||
} |
||||
for (i = 0; i < this._sLn; i++){ |
||||
lyr = this.HC.getLayerById(this.id+i+'X',this.doc); |
||||
y = this._Ypos + i * this._Ybase * Math.sin(sec); |
||||
x = this._Xpos + i * this._Xbase * Math.cos(sec); |
||||
lyr.setLocation(x,y); |
||||
lyr.setVisible(true); |
||||
} |
||||
for (i = 0; i < this._mLn; i++){ |
||||
lyr = this.HC.getLayerById(this.id+i+'Y',this.doc); |
||||
y = this._Ypos + i * this._Ybase * Math.sin(min); |
||||
x = this._Xpos + i * this._Xbase * Math.cos(min); |
||||
lyr.setLocation(x,y); |
||||
lyr.setVisible(true); |
||||
} |
||||
for (i = 0; i < this._hLn; i++){ |
||||
lyr = this.HC.getLayerById(this.id+i+'Z',this.doc); |
||||
y = this._Ypos + i * this._Ybase * Math.sin(hrs); |
||||
x = this._Xpos + i * this._Xbase * Math.cos(hrs); |
||||
lyr.setLocation(x,y); |
||||
lyr.setVisible(true); |
||||
} |
||||
//check alarm
|
||||
if(this._alarm){ |
||||
var a = new Date(this._alarm); |
||||
if (a && ( |
||||
a.getHours()==time.getHours() && |
||||
a.getMinutes()==time.getMinutes() && |
||||
a.getSeconds()==time.getSeconds() |
||||
)) { |
||||
this._alarm=null; |
||||
this.invokeEvent('alarm'); |
||||
this._ePlaySnd('alarm'); |
||||
} |
||||
|
||||
} |
||||
}
|
||||
// loop
|
||||
window.setTimeout(this+'._showTime()', 50); |
||||
}; |
||||
p.getInnerHTML = function(){ |
||||
this._build(); |
||||
return this._oldHCLKGetInnerHTML(); |
||||
}; |
||||
// Time format: [Date object] or Hours:Minutes:Seconds
|
||||
p.setAlarm = function(dt){ |
||||
if(typeof(dt)!='string') { |
||||
dt = new Date(dt); |
||||
if(!isNaN(dt)) this._alarm = dt; |
||||
} |
||||
else { |
||||
var d=new Date(); |
||||
dt=(dt+'').split(':'); |
||||
if(!isNaN(dt[0])) d.setHours(dt[0]||0); |
||||
if(!isNaN(dt[1])) d.setMinutes(dt[1]||0); |
||||
if(!isNaN(dt[2])) d.setSeconds(dt[2]||0); |
||||
this._alarm = d; |
||||
} |
||||
}; |
||||
@ -1,68 +0,0 @@
@@ -1,68 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
HTMLColorPicker Class |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
Requires: HTMLMenu |
||||
*/ |
||||
|
||||
function HTMLColorPicker(css,text,w,h){ |
||||
this.HTMLMenu = HTMLMenu; |
||||
this.HTMLMenu(null); |
||||
|
||||
this._defEvtResponse = true; |
||||
this._mBar = this.createMenuBar('cpMain',w||30,h||20); |
||||
this._mBar.addItem(css,text,'cpCol'); |
||||
w = 240; |
||||
h = (dynapi.ua.ns4)? 50:121; |
||||
this._mBarCol = this.createMenuBar('cpCol',w,h,0,0); |
||||
this._mBarCol.addItem(css||'HCCPick',{contMode:true,text:this._getColorTable()},null,null,null,null,'#EFEBD7','#EFEBD7'); |
||||
}; |
||||
var p = dynapi.setPrototype('HTMLColorPicker','HTMLMenu'); |
||||
// Design Properties
|
||||
p.backCol = '#EFEBD7'; |
||||
// Methods
|
||||
p._chngCol = function(c){ |
||||
var mnu = this._menu[0][1]; |
||||
mnu.backCol = mnu.selBgCol = c; |
||||
mnu = this._menu[1][1]; |
||||
this._col = mnu.backCol = mnu.selBgCol = c; |
||||
if(dynapi.ua.ns4) this._showOnly(0); |
||||
return false; |
||||
} |
||||
p._getColorTable = function(){ |
||||
var color; |
||||
var red,reds=(dynapi.ua.ns4)?['00','66','CC','FF']:['00','22','33','66','77','88','99','BB','CC','DD','EE','FF']; |
||||
var green,greens=['00','66','CC','FF']; |
||||
var blue,blues=['00','66','CC','FF']; |
||||
var table=['<table border="0" bgcolor="#000000" cellspacing="1" cellpadding="1">\n']; |
||||
// Loop through reds
|
||||
for (var red=0;red<reds.length;red++){ |
||||
table[table.length]='<tr>\n'; |
||||
// Loop through greens
|
||||
for(green=0;green<greens.length;green++){ |
||||
// Loop through blues
|
||||
for(blue=0;blue<blues.length;blue++){ |
||||
color = "#" + reds[red] + greens[green] + blues[blue] |
||||
table[table.length]='<td bgcolor="' + color + '"><a href="javascript:;" onclick="return '+this+'._chngCol(\''+color+'\');"><font face="arial" size="2" color="'+color+'">##</font></a></td>\n'; |
||||
} |
||||
} |
||||
table[table.length]='</tr>\n'; |
||||
} |
||||
table[table.length]='</table>\n';
|
||||
table = table.join(''); |
||||
if(dynapi.ua.ns4) table ='<table bgcolor="#000000" cellspacing="0" cellpadding="0" border="0" ><tr><td>'+table+'</td></tr></table>'; |
||||
return table |
||||
}; |
||||
p.getColor = function(){ |
||||
return this._col;
|
||||
}; |
||||
p.setColor = function(c){ |
||||
this._chngCol(c); |
||||
}; |
||||
|
||||
// Write Style to browser
|
||||
HTMLComponent.writeStyle({ |
||||
HCCPick: 'border: 1px solid #C0C0C0' |
||||
}); |
||||
@ -1,185 +0,0 @@
@@ -1,185 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
HTMLComponent (HC) Class - See also quickref.htmlcomponent.html |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
Requires: DynElement |
||||
|
||||
*/ |
||||
|
||||
function HTMLComponent(css){ |
||||
this.DynElement = DynElement; |
||||
this.DynElement(); |
||||
this._class = css||''; |
||||
this._defEvtResponse = false; // default event response type;
|
||||
this.HC = HTMLComponent;
|
||||
this.FSO = null; |
||||
}; |
||||
HTMLComponent.FSO = null; |
||||
HTMLComponent.pixel = dynapi.functions.getImage(dynapi.library.path+'gui/images/pixel.gif',1,1); |
||||
HTMLComponent._lyrSetLocation = function(x,y){ |
||||
if(dynapi.ua.ns4) { |
||||
this.left=x; |
||||
this.top=y; |
||||
} |
||||
else if(dynapi.ua.ie) { |
||||
this.style.pixelLeft=x; |
||||
this.style.pixelTop=y; |
||||
} |
||||
else { |
||||
this.style.left=x+'px'; |
||||
this.style.top=y+'px'; |
||||
} |
||||
}; |
||||
HTMLComponent._lyrSetVisible = function(b){ |
||||
if(this._visible!=b) { |
||||
if(dynapi.ua.ns4) this.visibility = b? "inherit" : "hide"; |
||||
else this.style.visibility = b? "inherit" : "hidden";
|
||||
} |
||||
}; |
||||
HTMLComponent.buildLayer = function(id,attribs,html) { |
||||
var t; |
||||
if(dynapi.ua.ns4) t='\n<layer name="'+id+'" '+(attribs||'')+'>'+(html||'')+'</layer>'; |
||||
else t='<div id="'+id+'" '+(attribs||'')+'>'+(html||'')+'</div>' |
||||
return t; |
||||
}; |
||||
HTMLComponent.getLayerById = function(id,doc){ |
||||
var lyr; |
||||
doc=doc||document; |
||||
if(dynapi.ua.ie) lyr = doc.all[id]; |
||||
else if(dynapi.ua.dom) lyr = doc.getElementById(id); |
||||
else if(dynapi.ua.ns4) { |
||||
lyr=doc.layers[id]; |
||||
if(!lyr){ |
||||
var i,layers; |
||||
layers = doc.layers; |
||||
for (i=0;i<layers.length;i++){ |
||||
lyr=layers[i]; |
||||
if (lyr.id == id) break; |
||||
else if (lyr.layers.length){ |
||||
lyr = this.getLayerById(id,lyr); |
||||
if (lyr) break; |
||||
}
|
||||
} |
||||
} |
||||
} |
||||
if(lyr && !lyr.setLocation) lyr.setLocation = this._lyrSetLocation;
|
||||
if(lyr && !lyr.setVisible) lyr.setVisible = this._lyrSetVisible;
|
||||
return lyr; |
||||
}; |
||||
HTMLComponent.writeStyle = dynapi.document.writeStyle; |
||||
HTMLComponent.setFlashSound = function(fs){
|
||||
this.FSO = fs; // sets FSO for all HCs
|
||||
}; |
||||
var p = dynapi.setPrototype('HTMLComponent','DynElement'); |
||||
// Design Properties
|
||||
p.backCol = '#FFFFFF'; |
||||
p.foreCol = '#000000'; |
||||
p.sndOnClick = ''; // FSO format: target@frame
|
||||
p.sndOnMouseover = ''; // example: /click@start
|
||||
p.sndOnMouseout = ''; // where /click is targeted instance
|
||||
p.sndOnChange = ''; // and start is the name of the label or frame
|
||||
p.sndOnKeypress = ''; |
||||
// Methods
|
||||
p._assignElm = p._create = p._destroyAllChildren = p.getInnerHTML = dynapi.functions.Null; |
||||
p._remove = function(){ |
||||
var p=this.parent; |
||||
if (p && this._alias) p[this._alias]=null;
|
||||
this.elm=null; |
||||
}; |
||||
p._destroy = function(){ |
||||
this._remove(); |
||||
this.parent = this.css = this.doc = null; |
||||
DynObject.all[this.id] = null;
|
||||
}; |
||||
p._createInserted = function(){ |
||||
this._assignElm(); |
||||
DynElement._flagCreate(this); |
||||
}; |
||||
p._inlineEvents = ' onclick="return htc._e(\'click\',this,event);" ' |
||||
+' onmouseover="return htc._e(\'mouseover\',this,event);" ' |
||||
+' onmousedown="return htc._e(\'mousedown\',this,event);" ' |
||||
+' onmouseout="return htc._e(\'mouseout\',this,event);" ' |
||||
+' onfocus="return htc._e(\'focus\',this,event);" ' |
||||
+' onblur="return htc._e(\'blur\',this,event);" '; |
||||
p._generateInlineEvents = function(htc){ |
||||
return this._inlineEvents.replace(/htc/g,htc.toString()); |
||||
}; |
||||
// event handler
|
||||
p._e = function(evt,elm,args){ |
||||
this._evtResponse = this._defEvtResponse; |
||||
if(elm && !this.elm) this._assignElm(elm); |
||||
this._ePlaySnd(evt); // plays a sound
|
||||
this.invokeEvent(evt,null,args); |
||||
return this._evtResponse; |
||||
}; |
||||
// sound event handler
|
||||
p._ePlaySnd = function(evt){ |
||||
var snd = (evt+''); |
||||
snd='sndOn'+(snd.substr(0,1).toUpperCase()+snd.substr(1)); |
||||
if(this[snd]) this.playSound(this[snd]); |
||||
}; |
||||
p.allowEvent = function(){ this._evtResponse = true;}; |
||||
p.cancelEvent = function(){ this._evtResponse = false;}; |
||||
p.getOuterHTML = function() { |
||||
return this.getInnerHTML(); |
||||
}; |
||||
p.getElm = function(){ |
||||
if(!this.e) this._assignElm(); |
||||
return this.elm; |
||||
}; |
||||
p.getCss = function(){ |
||||
if(!this.css) this._assignElm(); |
||||
return this.css; |
||||
}; |
||||
p.playSound = function(t){ |
||||
if(!t) return; |
||||
var fs = this.FSO||this.HC.FSO; |
||||
t = t.split('@'); // separate target and frame
|
||||
if(fs) fs.gotoAndPlay(t[0],t[1]); |
||||
}; |
||||
p.setFlashSound = HTMLComponent.setFlashSound; // sets FSO only for this HC
|
||||
|
||||
|
||||
// HTML Cell - usage: var t = HTMLCell()
|
||||
HTMLCell = function(css,id,text,w,h,evt,backCol,padding,absolute,cssText){ |
||||
var tag,str=''; |
||||
id =(id||''); |
||||
cssText = (cssText||''); |
||||
text = (text||''); |
||||
// In IE4 width must be a miniumum of 3 pixels.
|
||||
if (dynapi.ua.def) { |
||||
str += '<div id="' + id + '" style="left:0px; top:0px; position: '+(absolute? 'absolute':'relative')+'; width: ' + w + '; height: ' + h + '; visibility: inherit; '; |
||||
if (backCol) str += 'background: ' + backCol + '; '; |
||||
str += '" '; |
||||
}else if (dynapi.ua.ns4) { |
||||
tag = (absolute)? 'layer':'ilayer'; |
||||
str += '<'+tag+(absolute? ' left="0" top="0" ':' clip="0 0 0,0" onload="this.clip.width=this.document.width;this.clip.height=this.document.height-19;"')+' id="' + id + '" width="' + w + '" height="' + h + '" visibility="inherit" '; |
||||
if (backCol) str += 'bgcolor="' + backCol + '" '; |
||||
} |
||||
if (css) str += 'class="' + css + '" ';
|
||||
if(evt) str += evt; // Add mouse event handlers.
|
||||
str+='>'; |
||||
|
||||
// In IE/NS6+, add padding if there's a border to emulate NS4's layer padding.
|
||||
str += '<table width="' + (w - 8) + '" border="0" cellspacing="0" cellpadding="' + ((!dynapi.ua.ns4 && css)? padding : 0) + '"><tr>' |
||||
+'<td class="' + cssText + '" align="left" height="' + (h - 7) + '">' + text +'</td>' |
||||
+'</tr></table>' + (dynapi.ua.ns4 ? '</'+tag+'>' : '</div>'); |
||||
return str; |
||||
}; |
||||
|
||||
// HTML Text - usage: var t = HTMLText()
|
||||
HTMLText = function(css,text,color,family,size,bold,italics,underline){ |
||||
var t = (text||''); |
||||
if(css) return '<span class="'+css+'">'+t+'</span>'; |
||||
else { |
||||
var fs =(size==null)? '':' size="'+size+'" '; |
||||
var ff =(family==null)? '':' name="'+family+'" '; |
||||
var fc =(color==null)? '':' color="'+color+'" '; |
||||
if(bold) t='<b>'+t+'</b>'; |
||||
if(italics) t='<i>'+t+'</i>'; |
||||
if(underline) t='<u>'+t+'</u>'; |
||||
return '<font'+ff+fs+fc+'>'+t+'</font>';
|
||||
} |
||||
}; |
||||
@ -1,132 +0,0 @@
@@ -1,132 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
HTMLContainer Class |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
Requires: HTMLComponent |
||||
*/ |
||||
|
||||
function HTMLContainer(css,html,w,h){ |
||||
this.HTMLComponent = HTMLComponent; |
||||
this.HTMLComponent(css);
|
||||
|
||||
this.w=w; this.h=h; |
||||
this.html=html||''; |
||||
}; |
||||
var p = dynapi.setPrototype('HTMLContainer','HTMLComponent'); |
||||
p._ns4IPad='<img src="'+dynapi.library.path+'gui/images/pixel.gif" width="0" height="0">'; |
||||
p._assignElm = function(elm){ |
||||
if(!this.parent) return; |
||||
else if(!this.parent._created) return; |
||||
var id=this.id+'HTC'; |
||||
var doc=this.parent.doc; |
||||
if(!elm) {;
|
||||
if(dynapi.ua.ie) elm=doc.all[id]; |
||||
else if(dynapi.ua.dom) elm=doc.getElementById(id); |
||||
else if(dynapi.ua.ns4) { |
||||
this._ns4ielm=doc.layers[id]; |
||||
elm =this._ns4ielm.document.layers[id+'L']; |
||||
this._ns4ielm.clip.width=elm.document.width; |
||||
this._ns4ielm.clip.height=elm.document.height; |
||||
} |
||||
if(!elm) return; |
||||
} |
||||
this.elm = elm; |
||||
this.css = (dynapi.ua.ns4)? elm:elm.style; |
||||
this.doc = elm.document; |
||||
if(this.w==null) this.autoWidth(); |
||||
if(this.h==null) this.autoHeight(); |
||||
}; |
||||
p.autoHeight = function(){ |
||||
var h,ua=dynapi.ua |
||||
if(ua.ns4) h=this.doc.height; |
||||
else if(ua.ie||ua.opera) { |
||||
if (dynapi.ua.platform=="mac") h=this.elm.offsetHeight; |
||||
else h=parseInt(this.elm.scrollHeight); |
||||
} |
||||
else { |
||||
var th = this.elm.style.height; |
||||
this.elm.style.height = "auto"; |
||||
h = this.elm.offsetHeight; |
||||
this.elm.style.height = th; |
||||
} |
||||
this.h=h; |
||||
if(ua.ns4) this.css.clip.height=h; |
||||
else { |
||||
this.css.height = h+'px'; |
||||
this.css.clip.height=h+'px'; |
||||
} |
||||
}; |
||||
p.autoWidth = function(){ |
||||
var w,ua=dynapi.ua |
||||
if(ua.ns4) w=this.doc.width; |
||||
else if(ua.ie||ua.opera) { |
||||
if (dynapi.ua.platform=="mac") w=this.elm.offsetWidth; |
||||
else w=parseInt(this.elm.scrollWidth); |
||||
} |
||||
else { |
||||
var tw = this.elm.style.width; |
||||
this.elm.style.width = "auto"; |
||||
w = this.elm.offsetWidth; |
||||
this.elm.style.width = tw; |
||||
} |
||||
this.w=w; |
||||
if(ua.ns4) this.css.clip.width=w; |
||||
else { |
||||
this.css.clip.width=w+'px'; |
||||
this.css.width = w+'px'; |
||||
} |
||||
}; |
||||
p.getInnerHTML = function(){ |
||||
var clip=''; |
||||
var h,html = this.html; |
||||
var evts =this._generateInlineEvents(this); |
||||
if(dynapi.ua.ns4) { |
||||
if(this.w==null) html='<nobr>'+html+'</nobr>'; |
||||
if (this.w!=null && this.h!=null) clip=' clip="0,0,'+((this.w>=0)?this.w:0)+','+((this.h>=0)?this.h:0)+'"'; |
||||
h='\n<ilayer visibility="inherit" id="'+this.id+'HTC" ' |
||||
+((this.w)? ' width="'+this.w+'"':'') |
||||
+((this.h)? ' height="'+this.h+'"':'') |
||||
+'><layer '+evts+' class="'+this._class+'" id="'+this.id+'HTCL" '+clip+'>'+this._ns4IPad+html+'</layer></ilayer>'; |
||||
/* NS4 iLayer seems to be having a problem when you're trying to update the content of the layer |
||||
so a layer was used to support document.write() method after page load. |
||||
I've also noticed that at times <layer> will not display a <table> it's nested inside another table.
|
||||
for example <table><tr><td><ilayer><layer><table><tr><td>Content</td></tr></table></layer></ilayer></td></tr></table> |
||||
the _ns4IPad will keep things in tact. *sigh* - NS4!!!! */ |
||||
} |
||||
else { |
||||
if (this.w!=null && this.h!=null) clip=' clip:rect(0px '+this.w+'px '+this.h+'px 0px);';
|
||||
h='<div class="'+this._class+'" id="'+this.id+'HTC" '+evts+' style="position:relative;overflow:hidden;' |
||||
+((this.w)? ' width:'+this.w+'px;':'') |
||||
+((this.h)? ' height:'+this.h+'px;':'') |
||||
+clip+'">'+html+'</div>'; |
||||
} |
||||
return h; |
||||
}; |
||||
p.getHTML = function(html) {return this.html}; |
||||
p.setHTML = function(html) { |
||||
if(this.html==html) return; |
||||
this.html=html |
||||
if(this.getElm()){ |
||||
if(dynapi.ua.ie||dynapi.ua.opera) this.elm.innerHTML=html; // ok?
|
||||
else if(dynapi.ua.ns4) { |
||||
var doc=this.doc; |
||||
if(this.w==null) html='<nobr>'+html+'</nobr>'; |
||||
doc.open(); doc.write(this._ns4IPad+html); doc.close(); |
||||
this._ns4ielm.clip.width=doc.width; |
||||
this._ns4ielm.clip.height=doc.height; |
||||
} |
||||
else{ |
||||
var elm = this.elm; |
||||
elm.innerHTML = html;
|
||||
var sTmp=(this.w==null)? '<nobr>'+this.html+'</nobr>':this.html; |
||||
while (elm.hasChildNodes()) elm.removeChild(elm.firstChild); |
||||
var r=elm.ownerDocument.createRange(); |
||||
r.selectNodeContents(elm); |
||||
r.collapse(true); |
||||
var df=r.createContextualFragment(sTmp); |
||||
elm.appendChild(df); |
||||
} |
||||
} |
||||
}; |
||||
@ -1,124 +0,0 @@
@@ -1,124 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
HTMLDatePicker Class |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
Requires: HTMLComponent |
||||
*/ |
||||
|
||||
function HTMLDatePicker(css,date,title,elmName){ |
||||
this.HTMLComponent = HTMLComponent; |
||||
this.HTMLComponent(css); |
||||
|
||||
this._elmId = elmName||(this.id+'DP'); |
||||
this._title = title||''; |
||||
this._defEvtResponse = true; |
||||
|
||||
this.setDate(date); |
||||
}; |
||||
var p = dynapi.setPrototype('HTMLDatePicker','HTMLComponent'); |
||||
p._inlineEvents+=' onchange="return htc._e(\'change\',this,event);" '; |
||||
// Methods
|
||||
p._oldHCDPEvt = HTMLComponent.prototype._e; |
||||
p._getDSValue = function(){return this._date}; // DataSource functions
|
||||
p._setDSValue = function(d){this.setDate(d)}; |
||||
p._e = function(evt,elm,arg){ |
||||
if(evt=='change') { |
||||
var odt = this._date; |
||||
var dt,f=elm.form; |
||||
var d=this._elmD=this._elmD||f[this._elmId+'D']; |
||||
var m=this._elmM=this._elmM||f[this._elmId+'M']; |
||||
var y=this._elmY=this._elmY||f[this._elmId+'Y']; |
||||
var id=d.options[d.selectedIndex].value; |
||||
var im=m.options[m.selectedIndex].value-1; |
||||
var iy=y.options[y.selectedIndex].value; |
||||
var dim = this._getDIM(im,iy); // get days in month
|
||||
if(id>dim) id=dim; |
||||
dt = new Date(iy,im,id); |
||||
if(isNaN(dt)) dt = new Date(); |
||||
this._date=dt; |
||||
//reload days & years
|
||||
this._buildOptions('days',d); |
||||
if(iy!=odt.getFullYear())this._buildOptions('years',y); |
||||
elm = f[this._elmdId]; |
||||
}; |
||||
return this._oldHCDPEvt(evt,elm,arg); |
||||
}; |
||||
p._assignElm = function(elm){ |
||||
if(!this.parent) return; |
||||
else if(!this.parent._created) return; |
||||
var doc=this.parent.doc; |
||||
if(!elm) { |
||||
if(dynapi.ua.ie) elm=doc.all[this._elmId]; |
||||
else if(dynapi.ua.dom) elm=doc.getElementById(this._elmId); |
||||
else if(dynapi.ua.ns4){ |
||||
for(i=0;i<doc.forms.length;i++){ |
||||
elm=doc.forms[i][this._elmId]; |
||||
if(elm) break; |
||||
} |
||||
} |
||||
if(!elm) return; |
||||
} |
||||
this.elm = elm; |
||||
this.css = (dynapi.ua.ns4)? elm:elm.style; |
||||
this.doc = this.parent.doc; |
||||
}; |
||||
p.getInnerHTML = function(){ |
||||
var dtn,evt,text=this._text||''; |
||||
var readstate = (this._readonly)? ' readonly ':''; |
||||
evt = this._generateInlineEvents(this);
|
||||
if(!this._date) dt =''; |
||||
else { |
||||
var dt = this._date; |
||||
dtn = dt.getMonth() +'/'+ dt.getDay() +'/'+ dt.getYear();
|
||||
} |
||||
return '<input type="hidden" id="'+this._elmId+'" name="'+this._elmId+'" value="'+dtn+'">' |
||||
+'<select id="'+this._elmId+'D" name="'+this._elmId+'D" class="'+this._class+'" '+evt+' title="'+this._title+'">'+this._buildOptions('days')+'</select>' |
||||
+'<select id="'+this._elmId+'M" name="'+this._elmId+'M" class="'+this._class+'" '+evt+' title="'+this._title+'">'+this._buildOptions('months')+'</select>' |
||||
+'<select id="'+this._elmId+'Y" name="'+this._elmId+'Y" class="'+this._class+'" '+evt+' title="'+this._title+'">'+this._buildOptions('years')+'</select>'; |
||||
}; |
||||
p._buildOptions = function(ct,elm){ |
||||
var dt = this._date; |
||||
var s,h=[''];
|
||||
var d = dt.getDate(); |
||||
var m = dt.getMonth(); |
||||
var y = dt.getFullYear(); |
||||
var months = ['Jan','Feb','Mar','Apr','May','June','Jul','Aug','Sep','Oct','Nov','Dec']; |
||||
var lo=0,hi=0; |
||||
if(ct=='days') { |
||||
sel=d; lo=1; hi=this._getDIM(m,y); |
||||
} |
||||
else if(ct=='months') { |
||||
sel=m+1; lo=1; hi=12; |
||||
} |
||||
else if(ct=='years') { |
||||
sel=y; lo=sel-50; hi=sel+50; |
||||
} |
||||
if(elm) elm.options.length=0; |
||||
for(var i=lo;i<=hi;i++){ |
||||
v=(ct=='months')? months[i-1]:i; |
||||
if(sel==i) s=' selected';else s=''; |
||||
if(!elm) h[h.length]='<option value="'+i+'"'+s+'>'+v+'</option>'; |
||||
else { |
||||
o = elm.options[elm.options.length] = new Option(i,v);
|
||||
if(s) o.selected=true; |
||||
} |
||||
} |
||||
return h.join('\n'); |
||||
}; |
||||
// Get Days In Month
|
||||
p._getDIM = function(m,yr){ |
||||
var d=31; |
||||
if(m==1) d=((yr/4)==Math.floor(yr/4))? 29:28; |
||||
else if(m==3||m==5||m==8||m==10) d=30; |
||||
return d; |
||||
}; |
||||
p.getDate = function() { return this._date;}; |
||||
p.setDate = function(dt){ |
||||
dt = new Date(dt); |
||||
this._date = (!isNaN(dt))? dt:new Date(); |
||||
}; |
||||
p.setElementName = function(t){ |
||||
if(t) this._elmId = t; |
||||
}; |
||||
@ -1,25 +0,0 @@
@@ -1,25 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
HTMLDropDownMenu Class |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
Requires: HTMLListbox |
||||
*/ |
||||
|
||||
function HTMLDropDownMenu(css,items,title,elmName){ |
||||
this.HTMLListbox = HTMLListbox; |
||||
this.HTMLListbox(css,items,null,false,title); |
||||
|
||||
this._elmId = elmName||(this.id+'DDM'); |
||||
this._defEvtResponse = true; |
||||
|
||||
}; |
||||
var p = dynapi.setPrototype('HTMLDropDownMenu','HTMLListbox'); |
||||
// Methods
|
||||
p.getInnerHTML = function(){ |
||||
var evt; |
||||
evt = this._generateInlineEvents(this); |
||||
return '<select class="'+this._class+'" id="'+this._elmId+'" name="'+this._elmId+'" size="1"' |
||||
+evt+' title="'+this._title+'">'+this._buildOptions()+'</select>'; |
||||
}; |
||||
@ -1,59 +0,0 @@
@@ -1,59 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
HTMLFile Class |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
Requires: HTMLComponent |
||||
*/ |
||||
|
||||
function HTMLFile(css,hidden,size,title,elmName){ |
||||
this.HTMLComponent = HTMLComponent; |
||||
this.HTMLComponent(css); |
||||
|
||||
this._elmId = elmName||(this.id+'FILE'); |
||||
this._size = size||20; |
||||
this._title = title||''; |
||||
this._hidden = (hidden)? true:false; |
||||
this._defEvtResponse = true; |
||||
}; |
||||
var p = dynapi.setPrototype('HTMLFile','HTMLComponent'); |
||||
p._inlineEvents+=' onkeypress="return htc._e(\'keypress\',this,event);" ' |
||||
+' onkeyup="return htc._e(\'keyup\',this,event);" ' |
||||
+' onkeydown="return htc._e(\'keydown\',this,event);" '; |
||||
// Methods
|
||||
p._assignElm = function(elm){ |
||||
if(!this.parent) return; |
||||
else if(!this.parent._created) return; |
||||
var doc=this.parent.doc; |
||||
if(!elm) { |
||||
if(dynapi.ua.ie) elm=doc.all[this._elmId]; |
||||
else if(dynapi.ua.dom) elm=doc.getElementById(this._elmId); |
||||
else if(dynapi.ua.ns4){ |
||||
for(i=0;i<doc.forms.length;i++){ |
||||
elm=doc.forms[i][this._elmId]; |
||||
if(elm) break; |
||||
} |
||||
} |
||||
if(!elm) return; |
||||
} |
||||
this.elm = elm; |
||||
this.css = (dynapi.ua.ns4)? elm:elm.style; |
||||
this.doc = this.parent.doc; |
||||
}; |
||||
p.getInnerHTML = function(){ |
||||
var style,evt,text=this._text||''; |
||||
evt = this._generateInlineEvents(this); |
||||
style=(this._hidden)? 'style="display:none"':''; |
||||
return '<input type="file" class="'+this._class+'" id="'+this._elmId+'" name="'+this._elmId+'" size="'+this._size+'"' |
||||
+style+evt+' title="'+this._title+'" />'; |
||||
}; |
||||
p.getFileName = function(){ |
||||
return (this.getElm())? this.elm.value:this._text |
||||
}; |
||||
p.browse = function() { |
||||
if(this.getElm()) this.elm.click(); |
||||
}; |
||||
p.setElementName = function(t){ |
||||
if(t) this._elmId = t; |
||||
}; |
||||
@ -1,83 +0,0 @@
@@ -1,83 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
HTMLHyperLink Class |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
Requires: HTMLComponent |
||||
*/ |
||||
|
||||
function HTMLHyperLink(css,text,url,title){ |
||||
this.HTMLComponent = HTMLComponent; |
||||
this.HTMLComponent(css); |
||||
|
||||
this.url=url; |
||||
this._text=text||''; |
||||
this._title=title||''; |
||||
this._defEvtResponse = false; // By default HyperLink <a> events are canceled (return false)
|
||||
}; |
||||
var p = dynapi.setPrototype('HTMLHyperLink','HTMLComponent'); |
||||
// Methods
|
||||
p._assignElm = function(elm){ |
||||
if(!this.parent) return; |
||||
else if(!this.parent._created) return; |
||||
var doc=this.parent.doc; |
||||
if(!elm) { |
||||
if(dynapi.ua.ie) elm=doc.all[this.id]; |
||||
else if(dynapi.ua.dom) elm=doc.getElementById(this.id); |
||||
else { |
||||
for(i=0;i<doc.links.length;i++){ |
||||
elm=doc.links[i]; |
||||
if(elm.name==this.id) break; |
||||
elm=null; |
||||
} |
||||
} |
||||
if(!elm) return; |
||||
} |
||||
this.elm = elm; |
||||
this.css = (dynapi.ua.ns4)? elm:elm.style; |
||||
this.doc = this.parent.doc; //??
|
||||
}; |
||||
p.getInnerHTML = function(){ |
||||
var evt = this._generateInlineEvents(this); |
||||
var url=this.url||'javascript:;'; |
||||
return [ |
||||
'<a class="',this._class,'" id="',this.id,'" name="',this.id,'" href="',url,'" ', |
||||
evt,' title="',this._title,'">',this._text,'</a>' |
||||
].join(''); |
||||
}; |
||||
p.setText = function(t) { |
||||
var elm = this.getElm(); |
||||
if(elm){ |
||||
if(dynapi.ua.ns4) elm.text = t; // not supported in ns4?
|
||||
else elm.innerHTML=t; |
||||
} |
||||
}; |
||||
p.getURL = function(){ |
||||
var url='',elm = this.getElm(); |
||||
if(elm) url=elm.href; |
||||
return url; |
||||
}; |
||||
p.setURL = function(url){ |
||||
url=(url!=null)? url:'javascript:;'; |
||||
var elm = this.getElm(); |
||||
if(elm) elm.href=url;
|
||||
}; |
||||
p.startFlash = function(fCol,tCol,ms){ |
||||
this._fCol=fCol||this._fCol||'#000000'; |
||||
this._tCol=tCol||this._tCol||'#FFFFFF'; |
||||
this._ms=ms||this._ms||1000; |
||||
if(this.getElm()){ |
||||
if(!this._isLit) this._oldCol = this.css.color; |
||||
if(this.css.color==this._fCol) this.css.color=this._tCol; |
||||
else this.css.color=this._fCol; |
||||
this._isLit=true; |
||||
} |
||||
this._tmr = window.setTimeout(this+'.startFlash()',this._ms); |
||||
}; |
||||
p.stopFlash = function(){ |
||||
window.clearTimeout(this._tmr); |
||||
this._tmr = 0; |
||||
this._isLit = false; |
||||
this.css.color = this._oldCol; |
||||
}; |
||||
@ -1,188 +0,0 @@
@@ -1,188 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
HTMLListbox Class |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
Requires: HTMLComponent |
||||
*/ |
||||
|
||||
function HTMLListbox(css,items,length,multiSelect,title,elmName){ |
||||
this.HTMLComponent = HTMLComponent; |
||||
this.HTMLComponent(css); |
||||
|
||||
this._elmId = elmName||(this.id+'LST'); |
||||
this._lIndex = 0; // last index
|
||||
this._opts = items||[]; |
||||
this._length = (length>2)? length:5; |
||||
this._defEvtResponse = true; |
||||
|
||||
this.setMultiSelect(multiSelect); |
||||
}; |
||||
var p = dynapi.setPrototype('HTMLListbox','HTMLComponent'); |
||||
p._inlineEvents+=' onchange="return htc._e(\'change\',this,event);" '; |
||||
// Methods
|
||||
p._oldHCLBEvt = HTMLComponent.prototype._e; |
||||
p._getDSValue = function(){ // DataSource functions
|
||||
return this.getSelected(); |
||||
}; |
||||
p._setDSValue = function(d){ |
||||
this.setSelected(d); |
||||
}; |
||||
p._e = function(evt,elm,arg){ |
||||
if(evt=='change') this._selected = this._getSelValues(); |
||||
return this._oldHCLBEvt(evt,elm,arg); |
||||
}; |
||||
p._assignElm = function(elm){ |
||||
if(!this.parent) return; |
||||
else if(!this.parent._created) return; |
||||
var doc=this.parent.doc; |
||||
if(!elm) { |
||||
if(dynapi.ua.ie) elm=doc.all[this._elmId]; |
||||
else if(dynapi.ua.dom) elm=doc.getElementById(this._elmId); |
||||
else if(dynapi.ua.ns4){ |
||||
for(i=0;i<doc.forms.length;i++){ |
||||
elm=doc.forms[i][this._elmId]; |
||||
if(elm) break; |
||||
} |
||||
} |
||||
if(!elm) return; |
||||
} |
||||
this.elm = elm; |
||||
this.css = (dynapi.ua.ns4)? elm:elm.style; |
||||
this.doc = this.parent.doc; |
||||
}; |
||||
p._buildOptions = function(){ |
||||
var h=[''],o=this._opts; |
||||
var sel = '||'+this._selected+'||'; |
||||
for(var i in o){ |
||||
if(this._selected==i||(this._msel && this._selected[i])) s=' selected';else s=''; |
||||
if(o[i]!=null) h[h.length]='<option value="'+i+'"'+s+'>'+o[i]+'</option>'; |
||||
} |
||||
return h.join('\n'); |
||||
}; |
||||
p._getSelValues = function(){ |
||||
if(!this.getElm()) return this._selected; |
||||
else {
|
||||
var sel; |
||||
var opt = this.elm.options; |
||||
var inx = opt.selectedIndex; |
||||
if(inx<0) return; |
||||
if(!this._msel) sel=opt[inx].value; |
||||
else { |
||||
sel = []; |
||||
for(var i=0;i<opt.length;i++) if(opt[i].selected) sel[opt[i].value]=opt[i].value; |
||||
} |
||||
return sel; |
||||
} |
||||
}; |
||||
p.getInnerHTML = function(){ |
||||
var evt,multi = (this._msel)? ' multiple ':''; |
||||
evt = this._generateInlineEvents(this); |
||||
return '<select class="'+this._class+'" id="'+this._elmId+'" name="'+this._elmId+'" size="'+this._length+'"' |
||||
+multi+evt+' title="'+this._title+'">'+this._buildOptions()+'</select>'; |
||||
}; |
||||
p.addItem = function(text,value,selected){ |
||||
if(value==null) value=this._lIndex; |
||||
this._opts[value]=text; |
||||
if(!this._msel && selected) this._selected=value; |
||||
else if(this._msel && selected) this._selected+=value+'||'; |
||||
if(this.getElm()){ |
||||
var l=this.elm.options.length; |
||||
this.elm.options[l]=new Option(text,value); |
||||
} |
||||
return this._lIndex++; |
||||
}; |
||||
p.getItem = function(index){ |
||||
if(index!=null && this.getElm()) { |
||||
var o = this.elm.options; |
||||
if(typeof(index)=='number' && (index>=0 && index<o.length)) return {text:o[index].text,value:o[index].value}; |
||||
else { |
||||
for(var i=0;i<o.length;i++) if(index==o[i].value) return { |
||||
text:o[i].text, |
||||
value:o[i].value |
||||
} |
||||
} |
||||
}
|
||||
}; |
||||
p.getSelected = function(){ |
||||
if(!this._msel) return this._getSelValues(); |
||||
else { |
||||
var ar=[]; |
||||
var sel = this._selected = this._getSelValues(); |
||||
if(sel==null) return; |
||||
for(var i in sel) ar[ar.length]=i; |
||||
return ar; |
||||
} |
||||
}; |
||||
p.removeAllItems = function(){ |
||||
delete this._opts; |
||||
this._opts = []; |
||||
this._lIndex = 0; |
||||
if(this.getElm()) this.elm.options.length = 0; |
||||
}; |
||||
p.removeItem = function(index){ |
||||
if(!index) return; |
||||
if(this.getElm()) { |
||||
if(typeof(index)=='number') { |
||||
var tmp=o[index].value; |
||||
o[index]=null; |
||||
index=tmp; |
||||
} |
||||
else{ |
||||
var o = this.elm.options; |
||||
for(var i=0;i<o.length;i++){ |
||||
if(index==o[i].value) o[i]=null; |
||||
} |
||||
} |
||||
this._opts[index]=null; |
||||
delete this._opts[o[index]]; |
||||
} |
||||
}; |
||||
p.setElementName = function(t){ |
||||
if(t) this._elmId = t; |
||||
}; |
||||
p.setItems = function(o){ |
||||
for (var i in o) this.addItem(o[i],i); |
||||
}; |
||||
p.setSelected = function(index){ |
||||
if(!index) return; |
||||
if(!this._msel) this._selected = index; |
||||
else this._selected[index]=index; |
||||
if(this.getElm()) { |
||||
var o=this.elm.options; |
||||
if(typeof(index)=='number') o[index].selected = true; |
||||
else for(var i=0;i<o.length;i++){ |
||||
if(index==o[i].value) o[i].selected=true;
|
||||
} |
||||
} |
||||
}; |
||||
p.setMultiSelect = function(b){ |
||||
this._msel = (b)? true:false; |
||||
if(this.getElm()) this.elm.multiple='multiple'; |
||||
if(this._msel) this._selected = []; |
||||
else { |
||||
delete this._selected; |
||||
this._selected = null; |
||||
} |
||||
}; |
||||
// sort either by value or by text
|
||||
p.sortBy = function(vt,desc){ |
||||
var v,dt,ar=[]; |
||||
var link = []; |
||||
var o=this._opts; |
||||
for(var i in o){ |
||||
v=i; |
||||
if(vt=='text') v=o[i];
|
||||
ar[ar.length]=v;
|
||||
link[v]=i; // store value;
|
||||
} |
||||
ar.sort(); |
||||
if(desc && ar.reverse) ar.reverse(); |
||||
if(this.getElm()) this.elm.options.length=0; |
||||
for(i=0;i<ar.length;i++){ |
||||
v=link[ar[i]];
|
||||
if(o[v]) this.addItem(o[v],v); |
||||
} |
||||
|
||||
}; |
||||
@ -1,362 +0,0 @@
@@ -1,362 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
HTMLMenu Class - based on Cascading Menu script from The JavaScript Source!! (http://javascript.internet.com)
|
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
Requires: HTMLComponent |
||||
*/ |
||||
|
||||
|
||||
function HTMLMenu(css,orientation){ |
||||
this.HTMLComponent = HTMLComponent; |
||||
this.HTMLComponent(css); |
||||
this._menu = []; // store menu items
|
||||
this._menuLink = []; // store menu link ids
|
||||
this._mnuTmr = 0; |
||||
this._litNow = []; |
||||
this._vertOrient = (orientation && orientation=='vert')? true:false; |
||||
this.onCreate(this._assignElm); // necessary as menus needs to be created after page loads
|
||||
}; |
||||
HTMLMenu._addItem = function(css,text,linkId,callback,length,spacing,backCol,selBgCol,cssText){ |
||||
var itm = {}; |
||||
var len = this._src._menu[this._mnuid].length; |
||||
itm.id = this.id+len; |
||||
itm.lid = linkId; |
||||
if(typeof(text)!='object') { |
||||
itm.text = text||''; |
||||
itm.image = null; |
||||
itm.contMode = (dynapi.ua.def)? true:false;
|
||||
} |
||||
else { |
||||
itm.image=text.image; |
||||
itm.text=text.text||''; |
||||
itm.contMode = text.contMode; // container mode
|
||||
};
|
||||
itm.callback = (!callback && linkId)? false:callback; |
||||
itm.length = length||this.height||this._src.mnuItmHeight; |
||||
itm.cssName = css||this._src.cssMenuItem; |
||||
itm.cssTextName = cssText||this._src.cssMenuText; |
||||
itm.spacing = spacing||0; |
||||
itm.backCol = backCol||this._src.backCol; |
||||
itm.selBgCol = selBgCol||this._src.selBgCol; |
||||
this._src._menu[this._mnuid][len] = itm; |
||||
return itm.id; |
||||
}; |
||||
var p = dynapi.setPrototype('HTMLMenu','HTMLComponent'); |
||||
// Design Properties
|
||||
p.backCol = '#003366'; |
||||
p.selBgCol = '#336699'; |
||||
p.cssMenuItem = 'HCMNUItm'; |
||||
p.cssMenuText = 'HCMNUItmText'; |
||||
p.mnuItmWidth = 40; |
||||
p.mnuItmHeight = 20; |
||||
p.mnuArrow = dynapi.functions.getImage(dynapi.library.path+'gui/images/menuarrow.gif',8,9).getHTML(); |
||||
// Methods
|
||||
p._assignElm = function(elm){ |
||||
var i,c,id,lyr,plyr; |
||||
var mnu,itmName; |
||||
if(!this._created) return; |
||||
for (i = 0; i < this._menu.length; i++) { |
||||
id = this.id+'Mnu' + i + 'Div'; |
||||
if(i==0){ |
||||
// assign root menu css
|
||||
plyr = this.HC.getLayerById(id,this.parent.doc);
|
||||
if(!plyr) { |
||||
this._created = false; // not yet created
|
||||
return; |
||||
} |
||||
plyr.setVisible(true); |
||||
mnu = this._menu[i][0]; |
||||
mnu.elm = plyr;
|
||||
mnu.css = (dynapi.ua.ns4)? plyr:plyr.style; |
||||
this.elm = plyr; |
||||
this.css = (dynapi.ua.ns4)? plyr:plyr.style; |
||||
this.doc = plyr.document;
|
||||
} |
||||
else { |
||||
// create other menu items inside document
|
||||
if(this['Menu'+i+'Embedded']) plyr = this['Menu'+i+'Embedded']; |
||||
else { |
||||
plyr = this._buildMenu(i); |
||||
mnu = this._menu[i][0]; |
||||
mnu.elm = plyr;
|
||||
mnu.css = (dynapi.ua.ns4)? plyr:plyr.style; |
||||
this['Menu'+i+'Embedded'] = plyr; // menu item now exist inside the document
|
||||
} |
||||
} |
||||
// setup menu items
|
||||
for (c = 1; c < this._menu[i].length; c++) { |
||||
itmName = this.id+'Mnu' + i + 'Itm' + c; |
||||
lyr = this.HC.getLayerById(itmName,plyr.document); |
||||
this._menu[i][c].elm =lyr; |
||||
this._menu[i][c].css = (!dynapi.ua.ns4)? lyr.style:plyr.document[itmName]; |
||||
} |
||||
} |
||||
//this._showOnly(0);
|
||||
}; |
||||
p._buildMenu = function(currMenu){ |
||||
var mnuImage,mnuImgAlg; |
||||
var targetMenu; |
||||
var w,h,itemID,mnu = this._menu[currMenu]; |
||||
var str = '', itemX = 0, itemY = 0; |
||||
|
||||
if(!mnu) return ''; |
||||
if(currMenu>0) mnu[0].css=null; // reset css to force _assignElm during TM generate
|
||||
|
||||
// Items start from 1 in the array (0 is menu object itself, above).
|
||||
// Also use properties of each item nested in the other with() for construction.
|
||||
for (var currItem = 1; currItem < mnu.length; currItem++) with (mnu[currItem]) { |
||||
itemID = this.id + 'Mnu' + currMenu + 'Itm' + currItem; |
||||
|
||||
// The width and height of the menu item - dependent on orientation!
|
||||
w = (!mnu[0].isRoot ? mnu[0].width : length); |
||||
h = (!mnu[0].isRoot ? length : mnu[0].width); |
||||
|
||||
// In IE4 width must be a miniumum of 3 pixels.
|
||||
if (dynapi.ua.def) { |
||||
str += '<div id="' + itemID + '" onclick="return '+this+'._e(\'click\','+currMenu+','+currItem+')" style="position: absolute; left: ' + itemX + 'px; top: ' + itemY + 'px; width: ' + w + 'px; height: ' + h + 'px; visibility: inherit; '; |
||||
if (backCol) str += 'background: ' + backCol + '; '; |
||||
str += '" '; |
||||
}else if (dynapi.ua.ns4) { |
||||
str += '<layer id="' + itemID + '" left="' + itemX + '" top="' + itemY + '" width="' + w + '" height="' + h + '" visibility="inherit" '; |
||||
if (backCol) str += 'bgcolor="' + backCol + '" '; |
||||
} |
||||
if (cssName) str += 'class="' + cssName + '" '; |
||||
|
||||
// Add mouseover handlers and finish div/layer.
|
||||
str += 'onmouseover="'+this+'._e(\'mouseover\',' + currMenu + ',' + currItem + ')" onmouseout="'+this+'._e(\'mouseout\',' + currMenu + ',' + currItem + ')">'; |
||||
|
||||
// Setup menu image
|
||||
var imgParams |
||||
if(!image) mnuImage =''; |
||||
else { |
||||
imgParams = image.params; |
||||
mnuImgAlg = (imgParams && imgParams.align)? imgParams.align:'absmiddle'; |
||||
mnuImage = '<img name="'+this.id+id+'" src="'+image.src+'" width="'+image.w+'" height="'+image.h+'" border="0" align="'+mnuImgAlg+'">' |
||||
} |
||||
|
||||
// Setup Image Text Direction
|
||||
dir = (imgParams && imgParams.textdir)? imgParams.textdir:'W'; |
||||
dir = (dir+'').toUpperCase(); |
||||
if(dir=='E') text = text+mnuImage; |
||||
if(dir=='N') text = mnuImage+'<br>'+text; |
||||
if(dir=='S') text = text+'<br>'+mnuImage; |
||||
else text = mnuImage+text; |
||||
|
||||
// In IE/NS6+, add padding if there's a border to emulate NS4's layer padding.
|
||||
str += '<table width="' + (w - 8) + '" border="0" cellspacing="0" cellpadding="' + ((!dynapi.ua.ns4 && cssName)? mnu[0].padding : 0) + '"><tr><td align="left" height="' + (h - 7) + '" class="' + cssTextName + '">'
|
||||
+ (contMode? text:'<a class="' + cssTextName + '" href="javascript:;" onclick="'+((!dynapi.ua.ns4)? 'this.blur(); return false;':'return '+this+'._e(\'click\','+currMenu+','+currItem+');')+'">' + text + '</a>') |
||||
+'</td>'; |
||||
if(lid && this._menuLink[lid]) { |
||||
// Set target's parents to this menu item.
|
||||
linkMnu=this._menuLink[lid]; |
||||
this._menu[linkMnu][0].parentMnu = currMenu; |
||||
this._menu[linkMnu][0].parentItm = currItem; |
||||
|
||||
// Add popout indicator.
|
||||
if(currMenu!=0) str += '<td class="' + cssTextName + '" align="right">'+this.mnuArrow+'</td>'; |
||||
} |
||||
str += '</tr></table>' + (dynapi.ua.ns4 ? '</layer>' : '</div>'); |
||||
if (!mnu[0].isRoot) itemY += length + spacing; |
||||
else itemX += length + spacing; |
||||
} |
||||
|
||||
var id = this.id+'Mnu' + currMenu + 'Div'; |
||||
if(currMenu==0){ |
||||
// first menu must be relatively positioned
|
||||
var attr; |
||||
if(dynapi.ua.ns4) str = '<ilayer id="'+id+'" visibility="inherit" height="'+(h+3)+'">'+str+'</ilayer>'; |
||||
else str = '<div id="'+id+'" style="position:relative; visibility: inherit; height:'+(h+mnu[0].padding)+'px;">'+str+'</div>'; |
||||
return str; |
||||
} |
||||
else if(this._created){ |
||||
// add all other menus inside the document object
|
||||
var lyr; |
||||
if (dynapi.ua.ie||dynapi.ua.opera) { |
||||
document.body.insertAdjacentHTML('beforeEnd', '<div id="' + id + '" style="position: absolute; top: -100px; visibility: hidden; z-index:10000">' + str + '</div>'); |
||||
lyr = document.all[id]; |
||||
lyr.style.visibility = "hidden"; |
||||
} |
||||
else if (dynapi.ua.dom) {
|
||||
var ptxt,r = document.body.ownerDocument.createRange(); |
||||
r.setStartBefore(document.body); |
||||
ptxt = r.createContextualFragment('<div id="' + id + '" style="position: absolute; top: -100px; visibility: hidden; z-index:10000">' + str + '</div>'); |
||||
document.body.appendChild(ptxt); |
||||
lyr = document.body.lastChild; |
||||
} |
||||
else if (dynapi.ua.ns4) { |
||||
lyr = new Layer(0); |
||||
lyr.document.write(str); |
||||
lyr.document.close(); |
||||
lyr.zIndex = 10000; |
||||
lyr.top = -100; |
||||
lyr.visibility="hide"; |
||||
} |
||||
return lyr; |
||||
} |
||||
}; |
||||
p._e = function(evt,mnuNum,itmNum){ |
||||
var mnu = this._menu[mnuNum]; |
||||
var index = mnu[0].id+itmNum; |
||||
this._ePlaySnd(evt); // plays ordinary sound events: click, over & out
|
||||
if(evt=='click'){ |
||||
this._evtResponse = this._defEvtResponse; |
||||
if(mnu[itmNum] && mnu[itmNum].callback) { |
||||
if(typeof(mnu[itmNum].callback)=='function') mnu[itmNum].callback(index); |
||||
else eval(mnu[itmNum].callback); |
||||
} |
||||
if (mnu[itmNum].callback!=false) this._showOnly(0); |
||||
} |
||||
else if(evt=='mouseover'){ |
||||
window.clearTimeout(this._mnuTmr); |
||||
if(!mnu[itmNum].elm) return; |
||||
lid=mnu[itmNum].lid; |
||||
if(this._created && mnu[0].css==null) this._assignElm(); |
||||
this._showOnly(mnuNum); |
||||
this._litNow = this._getHierarchy(mnuNum, itmNum); |
||||
mnu[0].lastItem = itmNum; // set last item
|
||||
this._changeCol(this._litNow, true); |
||||
targetNum = this._menuLink[lid]; |
||||
if (targetNum > 0) { |
||||
if(mnuNum==0) { |
||||
thisX = (dynapi.ua.ns4)? mnu[0].elm.pageX:parseInt(mnu[0].elm.offsetLeft||0); |
||||
thisY = (dynapi.ua.ns4)? mnu[0].elm.pageY:parseInt(mnu[0].elm.offsetTop||0); |
||||
if(!dynapi.ua.ns4){ |
||||
thisX+=this.parent.getPageX(); |
||||
thisY+=this.parent.getPageY(); |
||||
} |
||||
}else { |
||||
thisX = parseInt(mnu[0].css.left||0); |
||||
thisY = parseInt(mnu[0].css.top||0); |
||||
} |
||||
if(dynapi.ua.ns4){ |
||||
if(!mnu[0].isRoot) thisX+=parseInt(mnu[itmNum].css.clip.width||0) |
||||
else thisY+=parseInt(mnu[itmNum].css.clip.height||0) |
||||
} |
||||
else{ |
||||
if(!mnu[0].isRoot) thisX+=parseInt(mnu[itmNum].css.width||0) + mnu[0].subMnuOffset; |
||||
else thisY+=parseInt(mnu[itmNum].css.height||0) + mnu[0].subMnuOffset; |
||||
} |
||||
thisX += parseInt(mnu[itmNum].css.left||0); |
||||
thisY += parseInt(mnu[itmNum].css.top||0); |
||||
|
||||
// auto-fold sub-menus
|
||||
var tarMnu = this._menu[targetNum]; |
||||
if((thisX+tarMnu[0].width)>dynapi.document.getWidth()) { |
||||
if(mnu[0]._mnuid) thisX-=(mnu[0].width+tarMnu[0].width); |
||||
else { |
||||
thisX=dynapi.document.getWidth()-tarMnu[0].width; |
||||
} |
||||
// remove subMenuOffset when sub-menus are folded inward
|
||||
if(!mnu[0].isRoot) thisX-=mnu[0].subMnuOffset; |
||||
} |
||||
if((thisY+(tarMnu[0].height*(tarMnu.length-1)))>dynapi.document.getHeight()) { |
||||
if(mnu[0].isRoot && !mnu[0]._mnuid) thisY-=(tarMnu[0].height*tarMnu.length); |
||||
else { |
||||
thisY = dynapi.document.getHeight() - (tarMnu[0].height*(tarMnu.length-1)); |
||||
} |
||||
} |
||||
|
||||
with (tarMnu[0].css) { |
||||
left = thisX + (dynapi.ua.def ? 'px':''); |
||||
top = thisY + (dynapi.ua.def ? 'px':''); |
||||
visibility = (dynapi.ua.ns4)? 'show':'visible'; |
||||
} |
||||
|
||||
// plays special pop-up sound event
|
||||
if(this._lTargetNum!=targetNum) this._ePlaySnd('menuopen'); |
||||
this._lTargetNum=targetNum; |
||||
}else this._lTargetNum = mnu[0]._mnuid; |
||||
} |
||||
else if(evt=='mouseout'){ |
||||
if ((mnuNum == 0) && !mnu[itmNum].lid) this._showOnly(0); |
||||
else this._mnuTmr = window.setTimeout(this+'._showOnly(0)', 500); |
||||
} |
||||
|
||||
// invoke event
|
||||
this.invokeEvent(evt,null,index); |
||||
return this._evtResponse; |
||||
}; |
||||
p._getHierarchy = function(mnuNum, itmNum) { |
||||
var mnu; |
||||
var itmArray = [this._menu.length]; |
||||
while(1) { |
||||
itmArray[mnuNum] = itmNum; |
||||
if (mnuNum == 0) return itmArray; |
||||
mnu = this._menu[mnuNum][0]; |
||||
itmNum = mnu.parentItm; |
||||
mnuNum = mnu.parentMnu;
|
||||
} |
||||
}; |
||||
p._changeCol = function(changeArray, isOver) { |
||||
var mnu,lmnu; |
||||
var lastItem,newCol; |
||||
var i,menu = this._menu; |
||||
for (i = 0; i < changeArray.length; i++) { |
||||
if(changeArray[i]) { |
||||
lastItem = menu[i][0].lastItem; |
||||
lmnu = menu[i][lastItem]; |
||||
mnu = menu[i][changeArray[i]]; |
||||
// Change the image of the menu
|
||||
if(lmnu.image) { |
||||
img = lmnu.image; |
||||
src = (img )? img.src:''; |
||||
oversrc = (img && img.params && img.params.oversrc)? img.params.oversrc:src; |
||||
newImg = isOver ? oversrc:src; |
||||
img = (dynapi.ua.ns4)? mnu.elm.document.images[this.id+mnu.id]:document.images[this.id+mnu.id]; |
||||
img.src = newImg; |
||||
} |
||||
|
||||
// Change the colours of the div/layer background.
|
||||
newCol = isOver ? menu[i][lastItem].selBgCol:menu[i][lastItem].backCol; |
||||
with (mnu.css) { |
||||
if (dynapi.ua.ns4) bgColor = newCol; |
||||
else backgroundColor = newCol; |
||||
} |
||||
} |
||||
} |
||||
}; |
||||
p._showOnly = function(mnuNum) { |
||||
var opnMnu = this._getHierarchy(mnuNum, 1); |
||||
for (count = 0; count < this._menu.length; count++) { |
||||
if (!opnMnu[count]) with(this._menu[count][0].css){ |
||||
visibility = (dynapi.ua.ns4)? 'hide':'hidden'; |
||||
left = -100; |
||||
top = -100; |
||||
} |
||||
} |
||||
this._changeCol(this._litNow, false); |
||||
}; |
||||
p.createMenuBar = function(id,itmWidth,itmHeight,subMnuOffset,padding){ |
||||
var mnu = {}; |
||||
var len = this._menu.length; |
||||
mnu.id = id; |
||||
mnu._mnuid = len; //menu id;
|
||||
mnu.isRoot = (!this._vertOrient && this._menu.length==0)? true:false; |
||||
mnu.width = itmWidth||this.mnuItmWidth; |
||||
mnu.height = itmHeight||this.mnuItmHeight; |
||||
mnu.subMnuOffset = (subMnuOffset==null)? 0:subMnuOffset; |
||||
mnu.addItem = HTMLMenu._addItem; |
||||
mnu.padding = (padding==null)? 3:padding; |
||||
mnu._src=this; |
||||
if(mnu.isRoot) { |
||||
// swap width & height if horizontal
|
||||
var tmp = mnu.width; |
||||
mnu.width=mnu.height; |
||||
mnu.height = tmp; |
||||
} |
||||
this._menu[len]=[mnu]; |
||||
this._menuLink[id] = len; |
||||
return mnu; |
||||
}; |
||||
p.getInnerHTML = function(){ |
||||
this.html = this._buildMenu(0); |
||||
return this.html; |
||||
}; |
||||
|
||||
// Write Style to browser
|
||||
HTMLComponent.writeStyle({ |
||||
HCMNUItm: 'border: 1px solid #002851', |
||||
HCMNUItmText: 'cursor: default; text-decoration: none; color: #FFFFFF; font: 12px Arial, Helvetica' |
||||
}); |
||||
@ -1,92 +0,0 @@
@@ -1,92 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
HTMLProgressBar Class |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
Requires: HTMLComponent |
||||
*/ |
||||
|
||||
function HTMLProgressBar(css,w,h,value,min,max){ |
||||
this.HTMLComponent = HTMLComponent; |
||||
this.HTMLComponent(css||'HCPBar'); |
||||
|
||||
this.w=w||100; |
||||
this.h=h||20; |
||||
this._elmId = this.id+'HCPBar'; |
||||
this._defEvtResponse = true; |
||||
|
||||
this.setRange(min,max); |
||||
this.setValue(value); |
||||
}; |
||||
var p = dynapi.setPrototype('HTMLProgressBar','HTMLComponent'); |
||||
// Design Properties
|
||||
p.backCol = '#FFFFFF'; |
||||
p.barCol = '#0000AA'; |
||||
p.barImage = null; |
||||
// Methods
|
||||
p._assignElm = function(elm){ |
||||
if(!this.parent) return; |
||||
else if(!this.parent._created) return; |
||||
var doc=this.parent.doc; |
||||
if(!elm) { |
||||
id = this._elmId; |
||||
if(dynapi.ua.ie) elm=doc.all[id]; |
||||
else if(dynapi.ua.dom) elm=doc.getElementById(id); |
||||
else if(dynapi.ua.ns4) elm = doc.layers[id]; |
||||
if(!elm) return; |
||||
// get gauge elm
|
||||
id = this._elmId+'Gauge'; |
||||
if(dynapi.ua.ie) belm=doc.all[id]; |
||||
else if(dynapi.ua.dom) belm=doc.getElementById(id); |
||||
else if(dynapi.ua.ns4) belm = elm.document.layers[id]; |
||||
} |
||||
this.elm = elm; |
||||
this.belm =belm; |
||||
this.css = (dynapi.ua.ns4)? elm:elm.style; |
||||
this.doc = this.parent.doc; |
||||
}; |
||||
p.getInnerHTML = function(){ |
||||
var ua=dynapi.ua; |
||||
var w=this.w; |
||||
var h=this.h; |
||||
w=w-4; |
||||
if(ua.ns4) h-=3; |
||||
else if(ua.ie) h-=4; |
||||
else h-=2; |
||||
w=parseInt(w*(((this._value/this._max)*100)/100)); |
||||
if(ua.ns4) { |
||||
bar = '<layer id="'+this._elmId+'Gauge" left="2" top="2" width="'+w+'" height="'+h+'" ' |
||||
+(this.barImage ? 'background="'+this.barImage.src+'"':'bgcolor="'+this.barCol+'"')+' z-index="1"></layer>'; |
||||
} |
||||
else { |
||||
bar = '<div id="'+this._elmId+'Gauge" style="left:1px; top:1px; width:'+w+'px; height:'+(h)+'px; ' |
||||
+(this.barImage ? 'background-image:url('+this.barImage.src+');':'background-color:'+this.barCol+';')+' z-index:1; display:block; font-size:1px; position:absolute;"></div>'; |
||||
} |
||||
return HTMLCell(this._class,this._elmId,bar,this.w,this.h,null,this.backCol,0,false); |
||||
}; |
||||
p.getValue = function(){ |
||||
return this._value; |
||||
}; |
||||
p.setValue = function(v){ |
||||
var w=this.w; |
||||
if(v<this._min) v = this._min; |
||||
if(v>this._max) v = this._max; |
||||
this._value = v; |
||||
if(this.getElm()){ |
||||
w=w-4; |
||||
w=w*(v/this._max); |
||||
if(w<1) w=0; else w=parseInt(w); |
||||
if(dynapi.ua.ns4) this.belm.clip.width = w; |
||||
else this.belm.style.width = w; |
||||
} |
||||
}; |
||||
p.setRange = function(min,max){ |
||||
this._min = min||0; |
||||
this._max = max||100; |
||||
}; |
||||
|
||||
// Write Style to browser
|
||||
HTMLComponent.writeStyle({ |
||||
HCPBar: 'border: 1px solid #000000' |
||||
}); |
||||
@ -1,84 +0,0 @@
@@ -1,84 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
HTMLRadioButton Class |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
Requires: HTMLComponent |
||||
*/ |
||||
|
||||
function HTMLRadioButton(css,group,value,state,title,elmName){ |
||||
this.HTMLComponent = HTMLComponent; |
||||
this.HTMLComponent(css); |
||||
|
||||
this._group = (group||'Main'); |
||||
this._elmId = elmName||(this.id+'Radio'); |
||||
|
||||
this._title = title||''; |
||||
this._value = value||''; |
||||
this._state = (state)? true:false; |
||||
this._defEvtResponse = true; |
||||
}; |
||||
HTMLRadioButton._groups = []; |
||||
HTMLRadioButton.incGroup = function(grp){ |
||||
if(!this._groups[grp]) this._groups[grp]=0; |
||||
return this._groups[grp]++; |
||||
}; |
||||
var p = dynapi.setPrototype('HTMLRadioButton','HTMLComponent'); |
||||
// Methods
|
||||
p._oldHCRBEvt = HTMLComponent.prototype._e; |
||||
p._getDSValue = function(){ // DataSource functions
|
||||
if(this.getElm()) return (this.elm.checked)? this.getValue():null; |
||||
}; |
||||
p._setDSValue = function(d){ |
||||
if(d==this._value) this.setState(true); |
||||
else this.setState(false); |
||||
}; |
||||
p._e = function(evt,elm,arg){ |
||||
if(evt=='click') this._state=elm.checked; |
||||
return this._oldHCRBEvt(evt,elm,arg); |
||||
}; |
||||
p._assignElm = function(elm){ |
||||
if(!this.parent) return; |
||||
else if(!this.parent._created) return; |
||||
var doc=this.parent.doc; |
||||
if(!elm) { |
||||
if(dynapi.ua.ie) elm=doc.all[this._elmId]; |
||||
else if(dynapi.ua.dom) elm=doc.getElementById(this._elmId); |
||||
else if(dynapi.ua.ns4){ |
||||
for(i=0;i<doc.forms.length;i++){ |
||||
elm=doc.forms[i][this._elmId]; |
||||
if(elm) break; |
||||
} |
||||
} |
||||
if(!elm) return; |
||||
} |
||||
this.elm = (!elm.length)? elm:elm[this._index]; |
||||
this.css = (dynapi.ua.ns4)? elm:elm.style; |
||||
this.doc = this.parent.doc; |
||||
}; |
||||
p.getInnerHTML = function(){ |
||||
var evt,value=this._value||''; |
||||
var sel = (this._state)? ' checked ':''; |
||||
evt = this._generateInlineEvents(this); |
||||
this._index = HTMLRadioButton.incGroup(this._group); |
||||
return '<input type="radio" class="'+this._class+'" id="'+this._elmId+'" name="'+this._group+'" value="'+value+'" ' |
||||
+sel+evt+' title="'+this._title+'" />'; |
||||
}; |
||||
p.getState = function(){ |
||||
return (this.getElm())? this.elm.checked:this._state; |
||||
}; |
||||
p.getValue = function() { |
||||
return (this.getElm())? this.elm.value:this._value; |
||||
}; |
||||
p.setElementName = function(t){ |
||||
if(t) this._elmId = t; |
||||
}; |
||||
p.setState = function(b) { |
||||
this._state=(b) ? true:false; |
||||
if(this.getElm()) this.elm.checked=this._state; |
||||
}; |
||||
p.setValue = function(v) { |
||||
this._value=v||''; |
||||
if(this.getElm()) this.elm.value=v; |
||||
}; |
||||
@ -1,50 +0,0 @@
@@ -1,50 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
HTMLRollover Class - a wrapper around XImage and HTMLHyperLink |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
Requires: HTMLHyperLink |
||||
*/ |
||||
|
||||
|
||||
function HTMLRollover(css,w,h,offSrc,onSrc,dnSrc,url,title){ |
||||
this.HTMLHyperLink = HTMLHyperLink; |
||||
this.HTMLHyperLink(css,null,url,title);
|
||||
|
||||
this._imgid=this.id+'HRO'; |
||||
this._img = dynapi.functions.getImage(offSrc,w,h,{ |
||||
name :this._imgid, |
||||
link :url, |
||||
oversrc :onSrc, |
||||
downsrc :dnSrc, |
||||
tooltip :title, |
||||
onclick :this+"._e('click',anc);", |
||||
onmouseout :this+"._e('mouseout',anc)", |
||||
onmouseover :this+"._e('mouseover',anc)", |
||||
onmousedown :this+"._e('mousedown',anc)" |
||||
}); |
||||
|
||||
}; |
||||
var p = dynapi.setPrototype('HTMLRollover','HTMLHyperLink'); |
||||
// Methods
|
||||
p.getInnerHTML = function(){ |
||||
var h=this._img.getHTML(); |
||||
// attach id,name and class to <a>
|
||||
h=h.replace(/\<a/,'<a id="'+this.id+'" name="'+this.id+'" class="'+this._class+'"'); |
||||
return h; |
||||
}; |
||||
p.setBorder = function(w) { |
||||
w=w||0; |
||||
this._img.params.border=w; |
||||
if(this.getElm()) { |
||||
img=this.doc.images[this._imgid]; |
||||
if(img) img.border=w; |
||||
} |
||||
}; |
||||
p.setSrc = function(src){ |
||||
if(this.getElm()) { |
||||
img=this.doc.images[this._imgid]; |
||||
if(img) img.src=src; |
||||
} |
||||
}; |
||||
@ -1,99 +0,0 @@
@@ -1,99 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
HTMLTextArea Class |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
Requires: HTMLComponent |
||||
*/ |
||||
|
||||
function HTMLTextArea(css,text,cols,rows,maxLength,title,elmName){ |
||||
this.HTMLComponent = HTMLComponent; |
||||
this.HTMLComponent(css); |
||||
|
||||
this._elmId = elmName||(this.id+'TXTA'); |
||||
this._cols = cols||20; |
||||
this._rows = rows||5; |
||||
this._title = title||''; |
||||
this._text = text||''; |
||||
this._wrap = true; |
||||
this._maxLen = maxLength; |
||||
this._defEvtResponse = true; |
||||
// set max length
|
||||
if(maxLength>0 && this._text.length>maxLength) { |
||||
this._text = this._text.substr(0,maxLength) |
||||
} |
||||
}; |
||||
var p = dynapi.setPrototype('HTMLTextArea','HTMLComponent'); |
||||
p._inlineEvents+=' onkeypress="return htc._e(\'keypress\',this,event);" ' |
||||
+' onkeyup="return htc._e(\'keyup\',this,event);" ' |
||||
+' onkeydown="return htc._e(\'keydown\',this,event);" ' |
||||
+' onchange="return htc._e(\'change\',this,event);" '; |
||||
// Methods
|
||||
p._oldHCTAEvt = HTMLComponent.prototype._e; |
||||
p._getDSValue = function(){return this._text}; // DataSource functions
|
||||
p._setDSValue = function(d){this.setText(d)}; |
||||
p._e = function(evt,elm,arg){ |
||||
// set max length
|
||||
if(this._maxLen>0 && elm.value.length>this._maxLen){ |
||||
this._text = elm.value.substr(0,this._maxLen); |
||||
elm.value = this._text; |
||||
} |
||||
var rt = this._oldHCTAEvt(evt,elm,arg); |
||||
if(dynapi.ua.ns4 && evt=='focus' && this._readonly) this.elm.blur(); |
||||
return rt;
|
||||
}; |
||||
p._assignElm = function(elm){ |
||||
if(!this.parent) return; |
||||
else if(!this.parent._created) return; |
||||
var doc=this.parent.doc; |
||||
if(!elm) { |
||||
if(dynapi.ua.ie) elm=doc.all[this._elmId]; |
||||
else if(dynapi.ua.dom) elm=doc.getElementById(this._elmId); |
||||
else if(dynapi.ua.ns4){ |
||||
for(i=0;i<doc.forms.length;i++){ |
||||
elm=doc.forms[i][this._elmId]; |
||||
if(elm) break; |
||||
} |
||||
} |
||||
if(!elm) return; |
||||
} |
||||
this.elm = elm; |
||||
this.css = (dynapi.ua.ns4)? elm:elm.style; |
||||
this.doc = this.parent.doc; |
||||
}; |
||||
p.getInnerHTML = function(){ |
||||
var ua = dynapi.ua; |
||||
var wrap,evt,text=this._text||''; |
||||
var readstate = (this._readonly)? ' readonly ':''; |
||||
if(ua.ns4) wrap=(!this._wrap)? ' wrap="off" ':' wrap="soft" '; |
||||
else if(ua.ie) wrap=(!this._wrap)? ' wrap="off" ':' wrap="virtual" '; |
||||
else wrap=(!this._wrap)?' style="white-space:nowrap;" ':''; |
||||
evt = this._generateInlineEvents(this); |
||||
return '<textarea class="'+this._class+'" id="'+this._elmId+'" name="'+this._elmId+'" cols="'+this._cols+'" rows="'+this._rows+'" ' |
||||
+wrap+readstate+evt+' title="'+this._title+'">'+text+'</textarea>'; |
||||
}; |
||||
p.getText = function() { |
||||
return (this.getElm())? this.elm.value:this._text |
||||
}; |
||||
p.setElementName = function(t){ |
||||
if(t) this._elmId = t; |
||||
}; |
||||
p.setReadOnly = function(b){ |
||||
this._readonly = b; |
||||
if(this.getElm()) this.elm.readonly=(b)? 'readonly':''; |
||||
}; |
||||
p.setText = function(t) { |
||||
var elm = this.getElm(); |
||||
this._text = t||''; |
||||
if(elm) elm.value=this._text; |
||||
}; |
||||
p.setWrap = function(b){ |
||||
var ua = dynapi.ua; |
||||
this._wrap = b; |
||||
if(this.getElm()) { |
||||
if(ua.ns4) this.elm.wrap = (!b)? 'off':'soft'; |
||||
else if(ua.ie) this.elm.wrap = (!b)? 'off':'virtual'; |
||||
else this.css.whiteSpace = (!b)? 'nowrap':'normal'; |
||||
} |
||||
}; |
||||
@ -1,77 +0,0 @@
@@ -1,77 +0,0 @@
|
||||
/* |
||||
DynAPI Distribution |
||||
HTMLTextBox Class |
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||||
|
||||
Requires: HTMLComponent |
||||
*/ |
||||
|
||||
function HTMLTextBox(css,text,size,maxLength,mask,title,elmName){ |
||||
this.HTMLComponent = HTMLComponent; |
||||
this.HTMLComponent(css); |
||||
|
||||
this._elmId = elmName||(this.id+'TXT'); |
||||
this._size = size||20; |
||||
this._title = title||''; |
||||
this._mask = (mask)? true:false; |
||||
this._text = text||''; |
||||
this._maxLen = maxLength; |
||||
this._defEvtResponse = true; |
||||
}; |
||||
var p = dynapi.setPrototype('HTMLTextBox','HTMLComponent'); |
||||
p._inlineEvents+=' onkeypress="return htc._e(\'keypress\',this,event);" ' |
||||
+' onkeyup="return htc._e(\'keyup\',this,event);" ' |
||||
+' onkeydown="return htc._e(\'keydown\',this,event);" ' |
||||
+' onchange="return htc._e(\'change\',this,event);" '; |
||||
// Methods
|
||||
p._oldHCTBEvt = HTMLComponent.prototype._e; |
||||
p._getDSValue = function(){return this._text}; // DataSource functions
|
||||
p._setDSValue = function(d){this.setText(d)}; |
||||
p._e = function(evt,elm,arg){ |
||||
var rt = this._oldHCTBEvt(evt,elm,arg); |
||||
if(dynapi.ua.ns4 && evt=='focus' && this._readonly) this.elm.blur(); |
||||
return rt; |
||||
}; |
||||
p._assignElm = function(elm){ |
||||
if(!this.parent) return; |
||||
else if(!this.parent._created) return; |
||||
var doc=this.parent.doc; |
||||
if(!elm) { |
||||
if(dynapi.ua.ie) elm=doc.all[this._elmId]; |
||||
else if(dynapi.ua.dom) elm=doc.getElementById(this._elmId); |
||||
else if(dynapi.ua.ns4){ |
||||
for(i=0;i<doc.forms.length;i++){ |
||||
elm=doc.forms[i][this._elmId]; |
||||
if(elm) break; |
||||
} |
||||
} |
||||
if(!elm) return; |
||||
} |
||||
this.elm = elm; |
||||
this.css = (dynapi.ua.ns4)? elm:elm.style; |
||||
this.doc = this.parent.doc; |
||||
}; |
||||
p.getInnerHTML = function(){ |
||||
var max,evt,text=this._text||''; |
||||
var readstate = (this._readonly)? ' readonly ':''; |
||||
evt = this._generateInlineEvents(this); |
||||
max = (this._maxLen)? ' maxlength="'+this._maxLen+'" ':''; |
||||
return '<input type="'+((!this._mask)? 'text':'password')+'" class="'+this._class+'" id="'+this._elmId+'" name="'+this._elmId+'" size="'+this._size+'" value="'+text+'" ' |
||||
+readstate+max+evt+' title="'+this._title+'" />'; |
||||
}; |
||||
p.getText = function() { |
||||
return (this.getElm())? this.elm.value:this._text |
||||
}; |
||||
p.setElementName = function(t){ |
||||
if(t) this._elmId = t; |
||||
}; |
||||
p.setReadOnly = function(b){ |
||||
this._readonly = b; |
||||
if(this.getElm()) this.elm.readonly=(b)? 'readonly':''; |
||||
}; |
||||
p.setText = function(t) { |
||||
var elm = this.getElm(); |
||||
this._text= t||''; |
||||
if(elm) elm.value=this._text; |
||||
}; |
||||