Normalize line endings VIVO-101
This commit is contained in:
parent
b097a4d754
commit
54f79f2ea7
587 changed files with 91501 additions and 91501 deletions
|
@ -8,114 +8,114 @@
|
|||
http://dojotoolkit.org/community/licensing.shtml
|
||||
*/
|
||||
|
||||
dojo.provide("dojo.html.layout");
|
||||
|
||||
dojo.require("dojo.lang");
|
||||
dojo.require("dojo.string");
|
||||
dojo.require("dojo.style");
|
||||
dojo.require("dojo.html");
|
||||
|
||||
/**
|
||||
* Layout a bunch of child dom nodes within a parent dom node
|
||||
* Input is an array of objects like:
|
||||
* @ container - parent node
|
||||
* @ layoutPriority - "top-bottom" or "left-right"
|
||||
* @ children an array like [ {domNode: foo, layoutAlign: "bottom" }, {domNode: bar, layoutAlign: "client"} ]
|
||||
*/
|
||||
dojo.html.layout = function(container, children, layoutPriority) {
|
||||
dojo.html.addClass(container, "dojoLayoutContainer");
|
||||
|
||||
// Copy children array and remove elements w/out layout.
|
||||
// Also record each child's position in the input array, for sorting purposes.
|
||||
children = dojo.lang.filter(children, function(child, idx){
|
||||
child.idx = idx;
|
||||
return dojo.lang.inArray(["top","bottom","left","right","client","flood"], child.layoutAlign)
|
||||
});
|
||||
|
||||
// Order the children according to layoutPriority.
|
||||
// Multiple children w/the same layoutPriority will be sorted by their position in the input array.
|
||||
if(layoutPriority && layoutPriority!="none"){
|
||||
var rank = function(child){
|
||||
switch(child.layoutAlign){
|
||||
case "flood":
|
||||
return 1;
|
||||
case "left":
|
||||
case "right":
|
||||
return (layoutPriority=="left-right") ? 2 : 3;
|
||||
case "top":
|
||||
case "bottom":
|
||||
return (layoutPriority=="left-right") ? 3 : 2;
|
||||
default:
|
||||
return 4;
|
||||
}
|
||||
};
|
||||
children.sort(function(a,b){
|
||||
return (rank(a)-rank(b)) || (a.idx - b.idx);
|
||||
});
|
||||
}
|
||||
|
||||
// remaining space (blank area where nothing has been written)
|
||||
var f={
|
||||
top: dojo.style.getPixelValue(container, "padding-top", true),
|
||||
left: dojo.style.getPixelValue(container, "padding-left", true),
|
||||
height: dojo.style.getContentHeight(container),
|
||||
width: dojo.style.getContentWidth(container)
|
||||
};
|
||||
|
||||
// set positions/sizes
|
||||
dojo.lang.forEach(children, function(child){
|
||||
var elm=child.domNode;
|
||||
var pos=child.layoutAlign;
|
||||
// set elem to upper left corner of unused space; may move it later
|
||||
with(elm.style){
|
||||
left = f.left+"px";
|
||||
top = f.top+"px";
|
||||
bottom = "auto";
|
||||
right = "auto";
|
||||
}
|
||||
dojo.html.addClass(elm, "dojoAlign" + dojo.string.capitalize(pos));
|
||||
|
||||
// set size && adjust record of remaining space.
|
||||
// note that setting the width of a <div> may affect it's height.
|
||||
// TODO: same is true for widgets but need to implement API to support that
|
||||
if ( (pos=="top")||(pos=="bottom") ) {
|
||||
dojo.style.setOuterWidth(elm, f.width);
|
||||
var h = dojo.style.getOuterHeight(elm);
|
||||
f.height -= h;
|
||||
if(pos=="top"){
|
||||
f.top += h;
|
||||
}else{
|
||||
elm.style.top = f.top + f.height + "px";
|
||||
}
|
||||
}else if(pos=="left" || pos=="right"){
|
||||
dojo.style.setOuterHeight(elm, f.height);
|
||||
var w = dojo.style.getOuterWidth(elm);
|
||||
f.width -= w;
|
||||
if(pos=="left"){
|
||||
f.left += w;
|
||||
}else{
|
||||
elm.style.left = f.left + f.width + "px";
|
||||
}
|
||||
} else if(pos=="flood" || pos=="client"){
|
||||
dojo.style.setOuterWidth(elm, f.width);
|
||||
dojo.style.setOuterHeight(elm, f.height);
|
||||
}
|
||||
|
||||
// TODO: for widgets I want to call resizeTo(), but for top/bottom
|
||||
// alignment I only want to set the width, and have the size determined
|
||||
// dynamically. (The thinner you make a div, the more height it consumes.)
|
||||
if(child.onResized){
|
||||
child.onResized();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// This is essential CSS to make layout work (it isn't "styling" CSS)
|
||||
// make sure that the position:absolute in dojoAlign* overrides other classes
|
||||
dojo.style.insertCssText(
|
||||
".dojoLayoutContainer{ position: relative; display: block; }\n" +
|
||||
"body .dojoAlignTop, body .dojoAlignBottom, body .dojoAlignLeft, body .dojoAlignRight { position: absolute; overflow: hidden; }\n" +
|
||||
"body .dojoAlignClient { position: absolute }\n" +
|
||||
".dojoAlignClient { overflow: auto; }\n"
|
||||
);
|
||||
|
||||
dojo.provide("dojo.html.layout");
|
||||
|
||||
dojo.require("dojo.lang");
|
||||
dojo.require("dojo.string");
|
||||
dojo.require("dojo.style");
|
||||
dojo.require("dojo.html");
|
||||
|
||||
/**
|
||||
* Layout a bunch of child dom nodes within a parent dom node
|
||||
* Input is an array of objects like:
|
||||
* @ container - parent node
|
||||
* @ layoutPriority - "top-bottom" or "left-right"
|
||||
* @ children an array like [ {domNode: foo, layoutAlign: "bottom" }, {domNode: bar, layoutAlign: "client"} ]
|
||||
*/
|
||||
dojo.html.layout = function(container, children, layoutPriority) {
|
||||
dojo.html.addClass(container, "dojoLayoutContainer");
|
||||
|
||||
// Copy children array and remove elements w/out layout.
|
||||
// Also record each child's position in the input array, for sorting purposes.
|
||||
children = dojo.lang.filter(children, function(child, idx){
|
||||
child.idx = idx;
|
||||
return dojo.lang.inArray(["top","bottom","left","right","client","flood"], child.layoutAlign)
|
||||
});
|
||||
|
||||
// Order the children according to layoutPriority.
|
||||
// Multiple children w/the same layoutPriority will be sorted by their position in the input array.
|
||||
if(layoutPriority && layoutPriority!="none"){
|
||||
var rank = function(child){
|
||||
switch(child.layoutAlign){
|
||||
case "flood":
|
||||
return 1;
|
||||
case "left":
|
||||
case "right":
|
||||
return (layoutPriority=="left-right") ? 2 : 3;
|
||||
case "top":
|
||||
case "bottom":
|
||||
return (layoutPriority=="left-right") ? 3 : 2;
|
||||
default:
|
||||
return 4;
|
||||
}
|
||||
};
|
||||
children.sort(function(a,b){
|
||||
return (rank(a)-rank(b)) || (a.idx - b.idx);
|
||||
});
|
||||
}
|
||||
|
||||
// remaining space (blank area where nothing has been written)
|
||||
var f={
|
||||
top: dojo.style.getPixelValue(container, "padding-top", true),
|
||||
left: dojo.style.getPixelValue(container, "padding-left", true),
|
||||
height: dojo.style.getContentHeight(container),
|
||||
width: dojo.style.getContentWidth(container)
|
||||
};
|
||||
|
||||
// set positions/sizes
|
||||
dojo.lang.forEach(children, function(child){
|
||||
var elm=child.domNode;
|
||||
var pos=child.layoutAlign;
|
||||
// set elem to upper left corner of unused space; may move it later
|
||||
with(elm.style){
|
||||
left = f.left+"px";
|
||||
top = f.top+"px";
|
||||
bottom = "auto";
|
||||
right = "auto";
|
||||
}
|
||||
dojo.html.addClass(elm, "dojoAlign" + dojo.string.capitalize(pos));
|
||||
|
||||
// set size && adjust record of remaining space.
|
||||
// note that setting the width of a <div> may affect it's height.
|
||||
// TODO: same is true for widgets but need to implement API to support that
|
||||
if ( (pos=="top")||(pos=="bottom") ) {
|
||||
dojo.style.setOuterWidth(elm, f.width);
|
||||
var h = dojo.style.getOuterHeight(elm);
|
||||
f.height -= h;
|
||||
if(pos=="top"){
|
||||
f.top += h;
|
||||
}else{
|
||||
elm.style.top = f.top + f.height + "px";
|
||||
}
|
||||
}else if(pos=="left" || pos=="right"){
|
||||
dojo.style.setOuterHeight(elm, f.height);
|
||||
var w = dojo.style.getOuterWidth(elm);
|
||||
f.width -= w;
|
||||
if(pos=="left"){
|
||||
f.left += w;
|
||||
}else{
|
||||
elm.style.left = f.left + f.width + "px";
|
||||
}
|
||||
} else if(pos=="flood" || pos=="client"){
|
||||
dojo.style.setOuterWidth(elm, f.width);
|
||||
dojo.style.setOuterHeight(elm, f.height);
|
||||
}
|
||||
|
||||
// TODO: for widgets I want to call resizeTo(), but for top/bottom
|
||||
// alignment I only want to set the width, and have the size determined
|
||||
// dynamically. (The thinner you make a div, the more height it consumes.)
|
||||
if(child.onResized){
|
||||
child.onResized();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// This is essential CSS to make layout work (it isn't "styling" CSS)
|
||||
// make sure that the position:absolute in dojoAlign* overrides other classes
|
||||
dojo.style.insertCssText(
|
||||
".dojoLayoutContainer{ position: relative; display: block; }\n" +
|
||||
"body .dojoAlignTop, body .dojoAlignBottom, body .dojoAlignLeft, body .dojoAlignRight { position: absolute; overflow: hidden; }\n" +
|
||||
"body .dojoAlignClient { position: absolute }\n" +
|
||||
".dojoAlignClient { overflow: auto; }\n"
|
||||
);
|
||||
|
||||
|
|
|
@ -8,72 +8,72 @@
|
|||
http://dojotoolkit.org/community/licensing.shtml
|
||||
*/
|
||||
|
||||
dojo.provide("dojo.html.shadow");
|
||||
|
||||
dojo.require("dojo.lang");
|
||||
dojo.require("dojo.uri");
|
||||
|
||||
dojo.html.shadow = function(node) {
|
||||
this.init(node);
|
||||
}
|
||||
|
||||
dojo.lang.extend(dojo.html.shadow, {
|
||||
|
||||
shadowPng: dojo.uri.dojoUri("src/html/images/shadow"),
|
||||
shadowThickness: 8,
|
||||
shadowOffset: 15,
|
||||
|
||||
init: function(node){
|
||||
this.node=node;
|
||||
|
||||
// make all the pieces of the shadow, and position/size them as much
|
||||
// as possible (but a lot of the coordinates are set in sizeShadow
|
||||
this.pieces={};
|
||||
var x1 = -1 * this.shadowThickness;
|
||||
var y0 = this.shadowOffset;
|
||||
var y1 = this.shadowOffset + this.shadowThickness;
|
||||
this._makePiece("tl", "top", y0, "left", x1);
|
||||
this._makePiece("l", "top", y1, "left", x1, "scale");
|
||||
this._makePiece("tr", "top", y0, "left", 0);
|
||||
this._makePiece("r", "top", y1, "left", 0, "scale");
|
||||
this._makePiece("bl", "top", 0, "left", x1);
|
||||
this._makePiece("b", "top", 0, "left", 0, "crop");
|
||||
this._makePiece("br", "top", 0, "left", 0);
|
||||
},
|
||||
|
||||
_makePiece: function(name, vertAttach, vertCoord, horzAttach, horzCoord, sizing){
|
||||
var img;
|
||||
var url = this.shadowPng + name.toUpperCase() + ".png";
|
||||
if(dojo.render.html.ie){
|
||||
img=document.createElement("div");
|
||||
img.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+url+"'"+
|
||||
(sizing?", sizingMethod='"+sizing+"'":"") + ")";
|
||||
}else{
|
||||
img=document.createElement("img");
|
||||
img.src=url;
|
||||
}
|
||||
img.style.position="absolute";
|
||||
img.style[vertAttach]=vertCoord+"px";
|
||||
img.style[horzAttach]=horzCoord+"px";
|
||||
img.style.width=this.shadowThickness+"px";
|
||||
img.style.height=this.shadowThickness+"px";
|
||||
this.pieces[name]=img;
|
||||
this.node.appendChild(img);
|
||||
},
|
||||
|
||||
size: function(width, height){
|
||||
var sideHeight = height - (this.shadowOffset+this.shadowThickness+1);
|
||||
with(this.pieces){
|
||||
l.style.height = sideHeight+"px";
|
||||
r.style.height = sideHeight+"px";
|
||||
b.style.width = (width-1)+"px";
|
||||
bl.style.top = (height-1)+"px";
|
||||
b.style.top = (height-1)+"px";
|
||||
br.style.top = (height-1)+"px";
|
||||
tr.style.left = (width-1)+"px";
|
||||
r.style.left = (width-1)+"px";
|
||||
br.style.left = (width-1)+"px";
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
dojo.provide("dojo.html.shadow");
|
||||
|
||||
dojo.require("dojo.lang");
|
||||
dojo.require("dojo.uri");
|
||||
|
||||
dojo.html.shadow = function(node) {
|
||||
this.init(node);
|
||||
}
|
||||
|
||||
dojo.lang.extend(dojo.html.shadow, {
|
||||
|
||||
shadowPng: dojo.uri.dojoUri("src/html/images/shadow"),
|
||||
shadowThickness: 8,
|
||||
shadowOffset: 15,
|
||||
|
||||
init: function(node){
|
||||
this.node=node;
|
||||
|
||||
// make all the pieces of the shadow, and position/size them as much
|
||||
// as possible (but a lot of the coordinates are set in sizeShadow
|
||||
this.pieces={};
|
||||
var x1 = -1 * this.shadowThickness;
|
||||
var y0 = this.shadowOffset;
|
||||
var y1 = this.shadowOffset + this.shadowThickness;
|
||||
this._makePiece("tl", "top", y0, "left", x1);
|
||||
this._makePiece("l", "top", y1, "left", x1, "scale");
|
||||
this._makePiece("tr", "top", y0, "left", 0);
|
||||
this._makePiece("r", "top", y1, "left", 0, "scale");
|
||||
this._makePiece("bl", "top", 0, "left", x1);
|
||||
this._makePiece("b", "top", 0, "left", 0, "crop");
|
||||
this._makePiece("br", "top", 0, "left", 0);
|
||||
},
|
||||
|
||||
_makePiece: function(name, vertAttach, vertCoord, horzAttach, horzCoord, sizing){
|
||||
var img;
|
||||
var url = this.shadowPng + name.toUpperCase() + ".png";
|
||||
if(dojo.render.html.ie){
|
||||
img=document.createElement("div");
|
||||
img.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+url+"'"+
|
||||
(sizing?", sizingMethod='"+sizing+"'":"") + ")";
|
||||
}else{
|
||||
img=document.createElement("img");
|
||||
img.src=url;
|
||||
}
|
||||
img.style.position="absolute";
|
||||
img.style[vertAttach]=vertCoord+"px";
|
||||
img.style[horzAttach]=horzCoord+"px";
|
||||
img.style.width=this.shadowThickness+"px";
|
||||
img.style.height=this.shadowThickness+"px";
|
||||
this.pieces[name]=img;
|
||||
this.node.appendChild(img);
|
||||
},
|
||||
|
||||
size: function(width, height){
|
||||
var sideHeight = height - (this.shadowOffset+this.shadowThickness+1);
|
||||
with(this.pieces){
|
||||
l.style.height = sideHeight+"px";
|
||||
r.style.height = sideHeight+"px";
|
||||
b.style.width = (width-1)+"px";
|
||||
bl.style.top = (height-1)+"px";
|
||||
b.style.top = (height-1)+"px";
|
||||
br.style.top = (height-1)+"px";
|
||||
tr.style.left = (width-1)+"px";
|
||||
r.style.left = (width-1)+"px";
|
||||
br.style.left = (width-1)+"px";
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue