mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-13 17:35:56 +00:00
add dijit/dojo stuff; initial ui mockup
This commit is contained in:
299
lib/dijit/_base/focus.js
Normal file
299
lib/dijit/_base/focus.js
Normal file
@@ -0,0 +1,299 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||||
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||||
see: http://dojotoolkit.org/license for details
|
||||
*/
|
||||
|
||||
|
||||
if(!dojo._hasResource["dijit._base.focus"]){
|
||||
dojo._hasResource["dijit._base.focus"]=true;
|
||||
dojo.provide("dijit._base.focus");
|
||||
dojo.require("dojo.window");
|
||||
dojo.require("dijit._base.manager");
|
||||
dojo.mixin(dijit,{_curFocus:null,_prevFocus:null,isCollapsed:function(){
|
||||
return dijit.getBookmark().isCollapsed;
|
||||
},getBookmark:function(){
|
||||
var bm,rg,tg,_1=dojo.doc.selection,cf=dijit._curFocus;
|
||||
if(dojo.global.getSelection){
|
||||
_1=dojo.global.getSelection();
|
||||
if(_1){
|
||||
if(_1.isCollapsed){
|
||||
tg=cf?cf.tagName:"";
|
||||
if(tg){
|
||||
tg=tg.toLowerCase();
|
||||
if(tg=="textarea"||(tg=="input"&&(!cf.type||cf.type.toLowerCase()=="text"))){
|
||||
_1={start:cf.selectionStart,end:cf.selectionEnd,node:cf,pRange:true};
|
||||
return {isCollapsed:(_1.end<=_1.start),mark:_1};
|
||||
}
|
||||
}
|
||||
bm={isCollapsed:true};
|
||||
}else{
|
||||
rg=_1.getRangeAt(0);
|
||||
bm={isCollapsed:false,mark:rg.cloneRange()};
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(_1){
|
||||
tg=cf?cf.tagName:"";
|
||||
tg=tg.toLowerCase();
|
||||
if(cf&&tg&&(tg=="button"||tg=="textarea"||tg=="input")){
|
||||
if(_1.type&&_1.type.toLowerCase()=="none"){
|
||||
return {isCollapsed:true,mark:null};
|
||||
}else{
|
||||
rg=_1.createRange();
|
||||
return {isCollapsed:rg.text&&rg.text.length?false:true,mark:{range:rg,pRange:true}};
|
||||
}
|
||||
}
|
||||
bm={};
|
||||
try{
|
||||
rg=_1.createRange();
|
||||
bm.isCollapsed=!(_1.type=="Text"?rg.htmlText.length:rg.length);
|
||||
}
|
||||
catch(e){
|
||||
bm.isCollapsed=true;
|
||||
return bm;
|
||||
}
|
||||
if(_1.type.toUpperCase()=="CONTROL"){
|
||||
if(rg.length){
|
||||
bm.mark=[];
|
||||
var i=0,_2=rg.length;
|
||||
while(i<_2){
|
||||
bm.mark.push(rg.item(i++));
|
||||
}
|
||||
}else{
|
||||
bm.isCollapsed=true;
|
||||
bm.mark=null;
|
||||
}
|
||||
}else{
|
||||
bm.mark=rg.getBookmark();
|
||||
}
|
||||
}else{
|
||||
console.warn("No idea how to store the current selection for this browser!");
|
||||
}
|
||||
}
|
||||
return bm;
|
||||
},moveToBookmark:function(_3){
|
||||
var _4=dojo.doc,_5=_3.mark;
|
||||
if(_5){
|
||||
if(dojo.global.getSelection){
|
||||
var _6=dojo.global.getSelection();
|
||||
if(_6&&_6.removeAllRanges){
|
||||
if(_5.pRange){
|
||||
var r=_5;
|
||||
var n=r.node;
|
||||
n.selectionStart=r.start;
|
||||
n.selectionEnd=r.end;
|
||||
}else{
|
||||
_6.removeAllRanges();
|
||||
_6.addRange(_5);
|
||||
}
|
||||
}else{
|
||||
console.warn("No idea how to restore selection for this browser!");
|
||||
}
|
||||
}else{
|
||||
if(_4.selection&&_5){
|
||||
var rg;
|
||||
if(_5.pRange){
|
||||
rg=_5.range;
|
||||
}else{
|
||||
if(dojo.isArray(_5)){
|
||||
rg=_4.body.createControlRange();
|
||||
dojo.forEach(_5,function(n){
|
||||
rg.addElement(n);
|
||||
});
|
||||
}else{
|
||||
rg=_4.body.createTextRange();
|
||||
rg.moveToBookmark(_5);
|
||||
}
|
||||
}
|
||||
rg.select();
|
||||
}
|
||||
}
|
||||
}
|
||||
},getFocus:function(_7,_8){
|
||||
var _9=!dijit._curFocus||(_7&&dojo.isDescendant(dijit._curFocus,_7.domNode))?dijit._prevFocus:dijit._curFocus;
|
||||
return {node:_9,bookmark:(_9==dijit._curFocus)&&dojo.withGlobal(_8||dojo.global,dijit.getBookmark),openedForWindow:_8};
|
||||
},focus:function(_a){
|
||||
if(!_a){
|
||||
return;
|
||||
}
|
||||
var _b="node" in _a?_a.node:_a,_c=_a.bookmark,_d=_a.openedForWindow,_e=_c?_c.isCollapsed:false;
|
||||
if(_b){
|
||||
var _f=(_b.tagName.toLowerCase()=="iframe")?_b.contentWindow:_b;
|
||||
if(_f&&_f.focus){
|
||||
try{
|
||||
_f.focus();
|
||||
}
|
||||
catch(e){
|
||||
}
|
||||
}
|
||||
dijit._onFocusNode(_b);
|
||||
}
|
||||
if(_c&&dojo.withGlobal(_d||dojo.global,dijit.isCollapsed)&&!_e){
|
||||
if(_d){
|
||||
_d.focus();
|
||||
}
|
||||
try{
|
||||
dojo.withGlobal(_d||dojo.global,dijit.moveToBookmark,null,[_c]);
|
||||
}
|
||||
catch(e2){
|
||||
}
|
||||
}
|
||||
},_activeStack:[],registerIframe:function(_10){
|
||||
return dijit.registerWin(_10.contentWindow,_10);
|
||||
},unregisterIframe:function(_11){
|
||||
dijit.unregisterWin(_11);
|
||||
},registerWin:function(_12,_13){
|
||||
var _14=function(evt){
|
||||
dijit._justMouseDowned=true;
|
||||
setTimeout(function(){
|
||||
dijit._justMouseDowned=false;
|
||||
},0);
|
||||
if(dojo.isIE&&evt&&evt.srcElement&&evt.srcElement.parentNode==null){
|
||||
return;
|
||||
}
|
||||
dijit._onTouchNode(_13||evt.target||evt.srcElement,"mouse");
|
||||
};
|
||||
var doc=dojo.isIE?_12.document.documentElement:_12.document;
|
||||
if(doc){
|
||||
if(dojo.isIE){
|
||||
doc.attachEvent("onmousedown",_14);
|
||||
var _15=function(evt){
|
||||
if(evt.srcElement.tagName.toLowerCase()!="#document"&&dijit.isTabNavigable(evt.srcElement)){
|
||||
dijit._onFocusNode(_13||evt.srcElement);
|
||||
}else{
|
||||
dijit._onTouchNode(_13||evt.srcElement);
|
||||
}
|
||||
};
|
||||
doc.attachEvent("onactivate",_15);
|
||||
var _16=function(evt){
|
||||
dijit._onBlurNode(_13||evt.srcElement);
|
||||
};
|
||||
doc.attachEvent("ondeactivate",_16);
|
||||
return function(){
|
||||
doc.detachEvent("onmousedown",_14);
|
||||
doc.detachEvent("onactivate",_15);
|
||||
doc.detachEvent("ondeactivate",_16);
|
||||
doc=null;
|
||||
};
|
||||
}else{
|
||||
doc.addEventListener("mousedown",_14,true);
|
||||
var _17=function(evt){
|
||||
dijit._onFocusNode(_13||evt.target);
|
||||
};
|
||||
doc.addEventListener("focus",_17,true);
|
||||
var _18=function(evt){
|
||||
dijit._onBlurNode(_13||evt.target);
|
||||
};
|
||||
doc.addEventListener("blur",_18,true);
|
||||
return function(){
|
||||
doc.removeEventListener("mousedown",_14,true);
|
||||
doc.removeEventListener("focus",_17,true);
|
||||
doc.removeEventListener("blur",_18,true);
|
||||
doc=null;
|
||||
};
|
||||
}
|
||||
}
|
||||
},unregisterWin:function(_19){
|
||||
_19&&_19();
|
||||
},_onBlurNode:function(_1a){
|
||||
dijit._prevFocus=dijit._curFocus;
|
||||
dijit._curFocus=null;
|
||||
if(dijit._justMouseDowned){
|
||||
return;
|
||||
}
|
||||
if(dijit._clearActiveWidgetsTimer){
|
||||
clearTimeout(dijit._clearActiveWidgetsTimer);
|
||||
}
|
||||
dijit._clearActiveWidgetsTimer=setTimeout(function(){
|
||||
delete dijit._clearActiveWidgetsTimer;
|
||||
dijit._setStack([]);
|
||||
dijit._prevFocus=null;
|
||||
},100);
|
||||
},_onTouchNode:function(_1b,by){
|
||||
if(dijit._clearActiveWidgetsTimer){
|
||||
clearTimeout(dijit._clearActiveWidgetsTimer);
|
||||
delete dijit._clearActiveWidgetsTimer;
|
||||
}
|
||||
var _1c=[];
|
||||
try{
|
||||
while(_1b){
|
||||
var _1d=dojo.attr(_1b,"dijitPopupParent");
|
||||
if(_1d){
|
||||
_1b=dijit.byId(_1d).domNode;
|
||||
}else{
|
||||
if(_1b.tagName&&_1b.tagName.toLowerCase()=="body"){
|
||||
if(_1b===dojo.body()){
|
||||
break;
|
||||
}
|
||||
_1b=dojo.window.get(_1b.ownerDocument).frameElement;
|
||||
}else{
|
||||
var id=_1b.getAttribute&&_1b.getAttribute("widgetId"),_1e=id&&dijit.byId(id);
|
||||
if(_1e&&!(by=="mouse"&&_1e.get("disabled"))){
|
||||
_1c.unshift(id);
|
||||
}
|
||||
_1b=_1b.parentNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(e){
|
||||
}
|
||||
dijit._setStack(_1c,by);
|
||||
},_onFocusNode:function(_1f){
|
||||
if(!_1f){
|
||||
return;
|
||||
}
|
||||
if(_1f.nodeType==9){
|
||||
return;
|
||||
}
|
||||
dijit._onTouchNode(_1f);
|
||||
if(_1f==dijit._curFocus){
|
||||
return;
|
||||
}
|
||||
if(dijit._curFocus){
|
||||
dijit._prevFocus=dijit._curFocus;
|
||||
}
|
||||
dijit._curFocus=_1f;
|
||||
dojo.publish("focusNode",[_1f]);
|
||||
},_setStack:function(_20,by){
|
||||
var _21=dijit._activeStack;
|
||||
dijit._activeStack=_20;
|
||||
for(var _22=0;_22<Math.min(_21.length,_20.length);_22++){
|
||||
if(_21[_22]!=_20[_22]){
|
||||
break;
|
||||
}
|
||||
}
|
||||
var _23;
|
||||
for(var i=_21.length-1;i>=_22;i--){
|
||||
_23=dijit.byId(_21[i]);
|
||||
if(_23){
|
||||
_23._focused=false;
|
||||
_23._hasBeenBlurred=true;
|
||||
if(_23._onBlur){
|
||||
_23._onBlur(by);
|
||||
}
|
||||
dojo.publish("widgetBlur",[_23,by]);
|
||||
}
|
||||
}
|
||||
for(i=_22;i<_20.length;i++){
|
||||
_23=dijit.byId(_20[i]);
|
||||
if(_23){
|
||||
_23._focused=true;
|
||||
if(_23._onFocus){
|
||||
_23._onFocus(by);
|
||||
}
|
||||
dojo.publish("widgetFocus",[_23,by]);
|
||||
}
|
||||
}
|
||||
}});
|
||||
dojo.addOnLoad(function(){
|
||||
var _24=dijit.registerWin(window);
|
||||
if(dojo.isIE){
|
||||
dojo.addOnWindowUnload(function(){
|
||||
dijit.unregisterWin(_24);
|
||||
_24=null;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
245
lib/dijit/_base/manager.js
Normal file
245
lib/dijit/_base/manager.js
Normal file
@@ -0,0 +1,245 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||||
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||||
see: http://dojotoolkit.org/license for details
|
||||
*/
|
||||
|
||||
|
||||
if(!dojo._hasResource["dijit._base.manager"]){
|
||||
dojo._hasResource["dijit._base.manager"]=true;
|
||||
dojo.provide("dijit._base.manager");
|
||||
dojo.declare("dijit.WidgetSet",null,{constructor:function(){
|
||||
this._hash={};
|
||||
this.length=0;
|
||||
},add:function(_1){
|
||||
if(this._hash[_1.id]){
|
||||
throw new Error("Tried to register widget with id=="+_1.id+" but that id is already registered");
|
||||
}
|
||||
this._hash[_1.id]=_1;
|
||||
this.length++;
|
||||
},remove:function(id){
|
||||
if(this._hash[id]){
|
||||
delete this._hash[id];
|
||||
this.length--;
|
||||
}
|
||||
},forEach:function(_2,_3){
|
||||
_3=_3||dojo.global;
|
||||
var i=0,id;
|
||||
for(id in this._hash){
|
||||
_2.call(_3,this._hash[id],i++,this._hash);
|
||||
}
|
||||
return this;
|
||||
},filter:function(_4,_5){
|
||||
_5=_5||dojo.global;
|
||||
var _6=new dijit.WidgetSet(),i=0,id;
|
||||
for(id in this._hash){
|
||||
var w=this._hash[id];
|
||||
if(_4.call(_5,w,i++,this._hash)){
|
||||
_6.add(w);
|
||||
}
|
||||
}
|
||||
return _6;
|
||||
},byId:function(id){
|
||||
return this._hash[id];
|
||||
},byClass:function(_7){
|
||||
var _8=new dijit.WidgetSet(),id,_9;
|
||||
for(id in this._hash){
|
||||
_9=this._hash[id];
|
||||
if(_9.declaredClass==_7){
|
||||
_8.add(_9);
|
||||
}
|
||||
}
|
||||
return _8;
|
||||
},toArray:function(){
|
||||
var ar=[];
|
||||
for(var id in this._hash){
|
||||
ar.push(this._hash[id]);
|
||||
}
|
||||
return ar;
|
||||
},map:function(_a,_b){
|
||||
return dojo.map(this.toArray(),_a,_b);
|
||||
},every:function(_c,_d){
|
||||
_d=_d||dojo.global;
|
||||
var x=0,i;
|
||||
for(i in this._hash){
|
||||
if(!_c.call(_d,this._hash[i],x++,this._hash)){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
},some:function(_e,_f){
|
||||
_f=_f||dojo.global;
|
||||
var x=0,i;
|
||||
for(i in this._hash){
|
||||
if(_e.call(_f,this._hash[i],x++,this._hash)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}});
|
||||
(function(){
|
||||
dijit.registry=new dijit.WidgetSet();
|
||||
var _10=dijit.registry._hash,_11=dojo.attr,_12=dojo.hasAttr,_13=dojo.style;
|
||||
dijit.byId=function(id){
|
||||
return typeof id=="string"?_10[id]:id;
|
||||
};
|
||||
var _14={};
|
||||
dijit.getUniqueId=function(_15){
|
||||
var id;
|
||||
do{
|
||||
id=_15+"_"+(_15 in _14?++_14[_15]:_14[_15]=0);
|
||||
}while(_10[id]);
|
||||
return dijit._scopeName=="dijit"?id:dijit._scopeName+"_"+id;
|
||||
};
|
||||
dijit.findWidgets=function(_16){
|
||||
var _17=[];
|
||||
function _18(_19){
|
||||
for(var _1a=_19.firstChild;_1a;_1a=_1a.nextSibling){
|
||||
if(_1a.nodeType==1){
|
||||
var _1b=_1a.getAttribute("widgetId");
|
||||
if(_1b){
|
||||
_17.push(_10[_1b]);
|
||||
}else{
|
||||
_18(_1a);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
_18(_16);
|
||||
return _17;
|
||||
};
|
||||
dijit._destroyAll=function(){
|
||||
dijit._curFocus=null;
|
||||
dijit._prevFocus=null;
|
||||
dijit._activeStack=[];
|
||||
dojo.forEach(dijit.findWidgets(dojo.body()),function(_1c){
|
||||
if(!_1c._destroyed){
|
||||
if(_1c.destroyRecursive){
|
||||
_1c.destroyRecursive();
|
||||
}else{
|
||||
if(_1c.destroy){
|
||||
_1c.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
if(dojo.isIE){
|
||||
dojo.addOnWindowUnload(function(){
|
||||
dijit._destroyAll();
|
||||
});
|
||||
}
|
||||
dijit.byNode=function(_1d){
|
||||
return _10[_1d.getAttribute("widgetId")];
|
||||
};
|
||||
dijit.getEnclosingWidget=function(_1e){
|
||||
while(_1e){
|
||||
var id=_1e.getAttribute&&_1e.getAttribute("widgetId");
|
||||
if(id){
|
||||
return _10[id];
|
||||
}
|
||||
_1e=_1e.parentNode;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
var _1f=(dijit._isElementShown=function(_20){
|
||||
var s=_13(_20);
|
||||
return (s.visibility!="hidden")&&(s.visibility!="collapsed")&&(s.display!="none")&&(_11(_20,"type")!="hidden");
|
||||
});
|
||||
dijit.hasDefaultTabStop=function(_21){
|
||||
switch(_21.nodeName.toLowerCase()){
|
||||
case "a":
|
||||
return _12(_21,"href");
|
||||
case "area":
|
||||
case "button":
|
||||
case "input":
|
||||
case "object":
|
||||
case "select":
|
||||
case "textarea":
|
||||
return true;
|
||||
case "iframe":
|
||||
if(dojo.isMoz){
|
||||
try{
|
||||
return _21.contentDocument.designMode=="on";
|
||||
}
|
||||
catch(err){
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
if(dojo.isWebKit){
|
||||
var doc=_21.contentDocument,_22=doc&&doc.body;
|
||||
return _22&&_22.contentEditable=="true";
|
||||
}else{
|
||||
try{
|
||||
doc=_21.contentWindow.document;
|
||||
_22=doc&&doc.body;
|
||||
return _22&&_22.firstChild&&_22.firstChild.contentEditable=="true";
|
||||
}
|
||||
catch(e){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
default:
|
||||
return _21.contentEditable=="true";
|
||||
}
|
||||
};
|
||||
var _23=(dijit.isTabNavigable=function(_24){
|
||||
if(_11(_24,"disabled")){
|
||||
return false;
|
||||
}else{
|
||||
if(_12(_24,"tabIndex")){
|
||||
return _11(_24,"tabIndex")>=0;
|
||||
}else{
|
||||
return dijit.hasDefaultTabStop(_24);
|
||||
}
|
||||
}
|
||||
});
|
||||
dijit._getTabNavigable=function(_25){
|
||||
var _26,_27,_28,_29,_2a,_2b;
|
||||
var _2c=function(_2d){
|
||||
dojo.query("> *",_2d).forEach(function(_2e){
|
||||
if((dojo.isIE&&_2e.scopeName!=="HTML")||!_1f(_2e)){
|
||||
return;
|
||||
}
|
||||
if(_23(_2e)){
|
||||
var _2f=_11(_2e,"tabIndex");
|
||||
if(!_12(_2e,"tabIndex")||_2f==0){
|
||||
if(!_26){
|
||||
_26=_2e;
|
||||
}
|
||||
_27=_2e;
|
||||
}else{
|
||||
if(_2f>0){
|
||||
if(!_28||_2f<_29){
|
||||
_29=_2f;
|
||||
_28=_2e;
|
||||
}
|
||||
if(!_2a||_2f>=_2b){
|
||||
_2b=_2f;
|
||||
_2a=_2e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(_2e.nodeName.toUpperCase()!="SELECT"){
|
||||
_2c(_2e);
|
||||
}
|
||||
});
|
||||
};
|
||||
if(_1f(_25)){
|
||||
_2c(_25);
|
||||
}
|
||||
return {first:_26,last:_27,lowest:_28,highest:_2a};
|
||||
};
|
||||
dijit.getFirstInTabbingOrder=function(_30){
|
||||
var _31=dijit._getTabNavigable(dojo.byId(_30));
|
||||
return _31.lowest?_31.lowest:_31.first;
|
||||
};
|
||||
dijit.getLastInTabbingOrder=function(_32){
|
||||
var _33=dijit._getTabNavigable(dojo.byId(_32));
|
||||
return _33.last?_33.last:_33.highest;
|
||||
};
|
||||
dijit.defaultDuration=dojo.config["defaultDuration"]||200;
|
||||
})();
|
||||
}
|
||||
111
lib/dijit/_base/place.js
Normal file
111
lib/dijit/_base/place.js
Normal file
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||||
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||||
see: http://dojotoolkit.org/license for details
|
||||
*/
|
||||
|
||||
|
||||
if(!dojo._hasResource["dijit._base.place"]){
|
||||
dojo._hasResource["dijit._base.place"]=true;
|
||||
dojo.provide("dijit._base.place");
|
||||
dojo.require("dojo.window");
|
||||
dojo.require("dojo.AdapterRegistry");
|
||||
dijit.getViewport=function(){
|
||||
return dojo.window.getBox();
|
||||
};
|
||||
dijit.placeOnScreen=function(_1,_2,_3,_4){
|
||||
var _5=dojo.map(_3,function(_6){
|
||||
var c={corner:_6,pos:{x:_2.x,y:_2.y}};
|
||||
if(_4){
|
||||
c.pos.x+=_6.charAt(1)=="L"?_4.x:-_4.x;
|
||||
c.pos.y+=_6.charAt(0)=="T"?_4.y:-_4.y;
|
||||
}
|
||||
return c;
|
||||
});
|
||||
return dijit._place(_1,_5);
|
||||
};
|
||||
dijit._place=function(_7,_8,_9){
|
||||
var _a=dojo.window.getBox();
|
||||
if(!_7.parentNode||String(_7.parentNode.tagName).toLowerCase()!="body"){
|
||||
dojo.body().appendChild(_7);
|
||||
}
|
||||
var _b=null;
|
||||
dojo.some(_8,function(_c){
|
||||
var _d=_c.corner;
|
||||
var _e=_c.pos;
|
||||
if(_9){
|
||||
_9(_7,_c.aroundCorner,_d);
|
||||
}
|
||||
var _f=_7.style;
|
||||
var _10=_f.display;
|
||||
var _11=_f.visibility;
|
||||
_f.visibility="hidden";
|
||||
_f.display="";
|
||||
var mb=dojo.marginBox(_7);
|
||||
_f.display=_10;
|
||||
_f.visibility=_11;
|
||||
var _12=Math.max(_a.l,_d.charAt(1)=="L"?_e.x:(_e.x-mb.w)),_13=Math.max(_a.t,_d.charAt(0)=="T"?_e.y:(_e.y-mb.h)),_14=Math.min(_a.l+_a.w,_d.charAt(1)=="L"?(_12+mb.w):_e.x),_15=Math.min(_a.t+_a.h,_d.charAt(0)=="T"?(_13+mb.h):_e.y),_16=_14-_12,_17=_15-_13,_18=(mb.w-_16)+(mb.h-_17);
|
||||
if(_b==null||_18<_b.overflow){
|
||||
_b={corner:_d,aroundCorner:_c.aroundCorner,x:_12,y:_13,w:_16,h:_17,overflow:_18};
|
||||
}
|
||||
return !_18;
|
||||
});
|
||||
_7.style.left=_b.x+"px";
|
||||
_7.style.top=_b.y+"px";
|
||||
if(_b.overflow&&_9){
|
||||
_9(_7,_b.aroundCorner,_b.corner);
|
||||
}
|
||||
return _b;
|
||||
};
|
||||
dijit.placeOnScreenAroundNode=function(_19,_1a,_1b,_1c){
|
||||
_1a=dojo.byId(_1a);
|
||||
var _1d=_1a.style.display;
|
||||
_1a.style.display="";
|
||||
var _1e=dojo.position(_1a,true);
|
||||
_1a.style.display=_1d;
|
||||
return dijit._placeOnScreenAroundRect(_19,_1e.x,_1e.y,_1e.w,_1e.h,_1b,_1c);
|
||||
};
|
||||
dijit.placeOnScreenAroundRectangle=function(_1f,_20,_21,_22){
|
||||
return dijit._placeOnScreenAroundRect(_1f,_20.x,_20.y,_20.width,_20.height,_21,_22);
|
||||
};
|
||||
dijit._placeOnScreenAroundRect=function(_23,x,y,_24,_25,_26,_27){
|
||||
var _28=[];
|
||||
for(var _29 in _26){
|
||||
_28.push({aroundCorner:_29,corner:_26[_29],pos:{x:x+(_29.charAt(1)=="L"?0:_24),y:y+(_29.charAt(0)=="T"?0:_25)}});
|
||||
}
|
||||
return dijit._place(_23,_28,_27);
|
||||
};
|
||||
dijit.placementRegistry=new dojo.AdapterRegistry();
|
||||
dijit.placementRegistry.register("node",function(n,x){
|
||||
return typeof x=="object"&&typeof x.offsetWidth!="undefined"&&typeof x.offsetHeight!="undefined";
|
||||
},dijit.placeOnScreenAroundNode);
|
||||
dijit.placementRegistry.register("rect",function(n,x){
|
||||
return typeof x=="object"&&"x" in x&&"y" in x&&"width" in x&&"height" in x;
|
||||
},dijit.placeOnScreenAroundRectangle);
|
||||
dijit.placeOnScreenAroundElement=function(_2a,_2b,_2c,_2d){
|
||||
return dijit.placementRegistry.match.apply(dijit.placementRegistry,arguments);
|
||||
};
|
||||
dijit.getPopupAroundAlignment=function(_2e,_2f){
|
||||
var _30={};
|
||||
dojo.forEach(_2e,function(pos){
|
||||
switch(pos){
|
||||
case "after":
|
||||
_30[_2f?"BR":"BL"]=_2f?"BL":"BR";
|
||||
break;
|
||||
case "before":
|
||||
_30[_2f?"BL":"BR"]=_2f?"BR":"BL";
|
||||
break;
|
||||
case "below":
|
||||
_30[_2f?"BL":"BR"]=_2f?"TL":"TR";
|
||||
_30[_2f?"BR":"BL"]=_2f?"TR":"TL";
|
||||
break;
|
||||
case "above":
|
||||
default:
|
||||
_30[_2f?"TL":"TR"]=_2f?"BL":"BR";
|
||||
_30[_2f?"TR":"TL"]=_2f?"BR":"BL";
|
||||
break;
|
||||
}
|
||||
});
|
||||
return _30;
|
||||
};
|
||||
}
|
||||
158
lib/dijit/_base/popup.js
Normal file
158
lib/dijit/_base/popup.js
Normal file
@@ -0,0 +1,158 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||||
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||||
see: http://dojotoolkit.org/license for details
|
||||
*/
|
||||
|
||||
|
||||
if(!dojo._hasResource["dijit._base.popup"]){
|
||||
dojo._hasResource["dijit._base.popup"]=true;
|
||||
dojo.provide("dijit._base.popup");
|
||||
dojo.require("dijit._base.focus");
|
||||
dojo.require("dijit._base.place");
|
||||
dojo.require("dijit._base.window");
|
||||
dijit.popup={_stack:[],_beginZIndex:1000,_idGen:1,moveOffScreen:function(_1){
|
||||
var _2=_1.parentNode;
|
||||
if(!_2||!dojo.hasClass(_2,"dijitPopup")){
|
||||
_2=dojo.create("div",{"class":"dijitPopup",style:{visibility:"hidden",top:"-9999px"}},dojo.body());
|
||||
dijit.setWaiRole(_2,"presentation");
|
||||
_2.appendChild(_1);
|
||||
}
|
||||
var s=_1.style;
|
||||
s.display="";
|
||||
s.visibility="";
|
||||
s.position="";
|
||||
s.top="0px";
|
||||
dojo.style(_2,{visibility:"hidden",top:"-9999px"});
|
||||
},getTopPopup:function(){
|
||||
var _3=this._stack;
|
||||
for(var pi=_3.length-1;pi>0&&_3[pi].parent===_3[pi-1].widget;pi--){
|
||||
}
|
||||
return _3[pi];
|
||||
},open:function(_4){
|
||||
var _5=this._stack,_6=_4.popup,_7=_4.orient||((_4.parent?_4.parent.isLeftToRight():dojo._isBodyLtr())?{"BL":"TL","BR":"TR","TL":"BL","TR":"BR"}:{"BR":"TR","BL":"TL","TR":"BR","TL":"BL"}),_8=_4.around,id=(_4.around&&_4.around.id)?(_4.around.id+"_dropdown"):("popup_"+this._idGen++);
|
||||
var _9=_6.domNode.parentNode;
|
||||
if(!_9||!dojo.hasClass(_9,"dijitPopup")){
|
||||
this.moveOffScreen(_6.domNode);
|
||||
_9=_6.domNode.parentNode;
|
||||
}
|
||||
dojo.attr(_9,{id:id,style:{zIndex:this._beginZIndex+_5.length},"class":"dijitPopup "+(_6.baseClass||_6["class"]||"").split(" ")[0]+"Popup",dijitPopupParent:_4.parent?_4.parent.id:""});
|
||||
if(dojo.isIE||dojo.isMoz){
|
||||
var _a=_9.childNodes[1];
|
||||
if(!_a){
|
||||
_a=new dijit.BackgroundIframe(_9);
|
||||
}
|
||||
}
|
||||
var _b=_8?dijit.placeOnScreenAroundElement(_9,_8,_7,_6.orient?dojo.hitch(_6,"orient"):null):dijit.placeOnScreen(_9,_4,_7=="R"?["TR","BR","TL","BL"]:["TL","BL","TR","BR"],_4.padding);
|
||||
_9.style.visibility="visible";
|
||||
_6.domNode.style.visibility="visible";
|
||||
var _c=[];
|
||||
_c.push(dojo.connect(_9,"onkeypress",this,function(_d){
|
||||
if(_d.charOrCode==dojo.keys.ESCAPE&&_4.onCancel){
|
||||
dojo.stopEvent(_d);
|
||||
_4.onCancel();
|
||||
}else{
|
||||
if(_d.charOrCode===dojo.keys.TAB){
|
||||
dojo.stopEvent(_d);
|
||||
var _e=this.getTopPopup();
|
||||
if(_e&&_e.onCancel){
|
||||
_e.onCancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
if(_6.onCancel){
|
||||
_c.push(dojo.connect(_6,"onCancel",_4.onCancel));
|
||||
}
|
||||
_c.push(dojo.connect(_6,_6.onExecute?"onExecute":"onChange",this,function(){
|
||||
var _f=this.getTopPopup();
|
||||
if(_f&&_f.onExecute){
|
||||
_f.onExecute();
|
||||
}
|
||||
}));
|
||||
_5.push({wrapper:_9,iframe:_a,widget:_6,parent:_4.parent,onExecute:_4.onExecute,onCancel:_4.onCancel,onClose:_4.onClose,handlers:_c});
|
||||
if(_6.onOpen){
|
||||
_6.onOpen(_b);
|
||||
}
|
||||
return _b;
|
||||
},close:function(_10){
|
||||
var _11=this._stack;
|
||||
while(dojo.some(_11,function(_12){
|
||||
return _12.widget==_10;
|
||||
})){
|
||||
var top=_11.pop(),_13=top.wrapper,_14=top.iframe,_15=top.widget,_16=top.onClose;
|
||||
if(_15.onClose){
|
||||
_15.onClose();
|
||||
}
|
||||
dojo.forEach(top.handlers,dojo.disconnect);
|
||||
if(_15&&_15.domNode){
|
||||
this.moveOffScreen(_15.domNode);
|
||||
}else{
|
||||
dojo.destroy(_13);
|
||||
}
|
||||
if(_16){
|
||||
_16();
|
||||
}
|
||||
}
|
||||
}};
|
||||
dijit._frames=new function(){
|
||||
var _17=[];
|
||||
this.pop=function(){
|
||||
var _18;
|
||||
if(_17.length){
|
||||
_18=_17.pop();
|
||||
_18.style.display="";
|
||||
}else{
|
||||
if(dojo.isIE){
|
||||
var _19=dojo.config["dojoBlankHtmlUrl"]||(dojo.moduleUrl("dojo","resources/blank.html")+"")||"javascript:\"\"";
|
||||
var _1a="<iframe src='"+_19+"'"+" style='position: absolute; left: 0px; top: 0px;"+"z-index: -1; filter:Alpha(Opacity=\"0\");'>";
|
||||
_18=dojo.doc.createElement(_1a);
|
||||
}else{
|
||||
_18=dojo.create("iframe");
|
||||
_18.src="javascript:\"\"";
|
||||
_18.className="dijitBackgroundIframe";
|
||||
dojo.style(_18,"opacity",0.1);
|
||||
}
|
||||
_18.tabIndex=-1;
|
||||
dijit.setWaiRole(_18,"presentation");
|
||||
}
|
||||
return _18;
|
||||
};
|
||||
this.push=function(_1b){
|
||||
_1b.style.display="none";
|
||||
_17.push(_1b);
|
||||
};
|
||||
}();
|
||||
dijit.BackgroundIframe=function(_1c){
|
||||
if(!_1c.id){
|
||||
throw new Error("no id");
|
||||
}
|
||||
if(dojo.isIE||dojo.isMoz){
|
||||
var _1d=dijit._frames.pop();
|
||||
_1c.appendChild(_1d);
|
||||
if(dojo.isIE<7){
|
||||
this.resize(_1c);
|
||||
this._conn=dojo.connect(_1c,"onresize",this,function(){
|
||||
this.resize(_1c);
|
||||
});
|
||||
}else{
|
||||
dojo.style(_1d,{width:"100%",height:"100%"});
|
||||
}
|
||||
this.iframe=_1d;
|
||||
}
|
||||
};
|
||||
dojo.extend(dijit.BackgroundIframe,{resize:function(_1e){
|
||||
if(this.iframe&&dojo.isIE<7){
|
||||
dojo.style(this.iframe,{width:_1e.offsetWidth+"px",height:_1e.offsetHeight+"px"});
|
||||
}
|
||||
},destroy:function(){
|
||||
if(this._conn){
|
||||
dojo.disconnect(this._conn);
|
||||
this._conn=null;
|
||||
}
|
||||
if(this.iframe){
|
||||
dijit._frames.push(this.iframe);
|
||||
delete this.iframe;
|
||||
}
|
||||
}});
|
||||
}
|
||||
15
lib/dijit/_base/scroll.js
Normal file
15
lib/dijit/_base/scroll.js
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||||
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||||
see: http://dojotoolkit.org/license for details
|
||||
*/
|
||||
|
||||
|
||||
if(!dojo._hasResource["dijit._base.scroll"]){
|
||||
dojo._hasResource["dijit._base.scroll"]=true;
|
||||
dojo.provide("dijit._base.scroll");
|
||||
dojo.require("dojo.window");
|
||||
dijit.scrollIntoView=function(_1,_2){
|
||||
dojo.window.scrollIntoView(_1,_2);
|
||||
};
|
||||
}
|
||||
12
lib/dijit/_base/sniff.js
Normal file
12
lib/dijit/_base/sniff.js
Normal file
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||||
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||||
see: http://dojotoolkit.org/license for details
|
||||
*/
|
||||
|
||||
|
||||
if(!dojo._hasResource["dijit._base.sniff"]){
|
||||
dojo._hasResource["dijit._base.sniff"]=true;
|
||||
dojo.provide("dijit._base.sniff");
|
||||
dojo.require("dojo.uacss");
|
||||
}
|
||||
87
lib/dijit/_base/typematic.js
Normal file
87
lib/dijit/_base/typematic.js
Normal file
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||||
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||||
see: http://dojotoolkit.org/license for details
|
||||
*/
|
||||
|
||||
|
||||
if(!dojo._hasResource["dijit._base.typematic"]){
|
||||
dojo._hasResource["dijit._base.typematic"]=true;
|
||||
dojo.provide("dijit._base.typematic");
|
||||
dijit.typematic={_fireEventAndReload:function(){
|
||||
this._timer=null;
|
||||
this._callback(++this._count,this._node,this._evt);
|
||||
this._currentTimeout=Math.max(this._currentTimeout<0?this._initialDelay:(this._subsequentDelay>1?this._subsequentDelay:Math.round(this._currentTimeout*this._subsequentDelay)),this._minDelay);
|
||||
this._timer=setTimeout(dojo.hitch(this,"_fireEventAndReload"),this._currentTimeout);
|
||||
},trigger:function(_1,_2,_3,_4,_5,_6,_7,_8){
|
||||
if(_5!=this._obj){
|
||||
this.stop();
|
||||
this._initialDelay=_7||500;
|
||||
this._subsequentDelay=_6||0.9;
|
||||
this._minDelay=_8||10;
|
||||
this._obj=_5;
|
||||
this._evt=_1;
|
||||
this._node=_3;
|
||||
this._currentTimeout=-1;
|
||||
this._count=-1;
|
||||
this._callback=dojo.hitch(_2,_4);
|
||||
this._fireEventAndReload();
|
||||
this._evt=dojo.mixin({faux:true},_1);
|
||||
}
|
||||
},stop:function(){
|
||||
if(this._timer){
|
||||
clearTimeout(this._timer);
|
||||
this._timer=null;
|
||||
}
|
||||
if(this._obj){
|
||||
this._callback(-1,this._node,this._evt);
|
||||
this._obj=null;
|
||||
}
|
||||
},addKeyListener:function(_9,_a,_b,_c,_d,_e,_f){
|
||||
if(_a.keyCode){
|
||||
_a.charOrCode=_a.keyCode;
|
||||
dojo.deprecated("keyCode attribute parameter for dijit.typematic.addKeyListener is deprecated. Use charOrCode instead.","","2.0");
|
||||
}else{
|
||||
if(_a.charCode){
|
||||
_a.charOrCode=String.fromCharCode(_a.charCode);
|
||||
dojo.deprecated("charCode attribute parameter for dijit.typematic.addKeyListener is deprecated. Use charOrCode instead.","","2.0");
|
||||
}
|
||||
}
|
||||
return [dojo.connect(_9,"onkeypress",this,function(evt){
|
||||
if(evt.charOrCode==_a.charOrCode&&(_a.ctrlKey===undefined||_a.ctrlKey==evt.ctrlKey)&&(_a.altKey===undefined||_a.altKey==evt.altKey)&&(_a.metaKey===undefined||_a.metaKey==(evt.metaKey||false))&&(_a.shiftKey===undefined||_a.shiftKey==evt.shiftKey)){
|
||||
dojo.stopEvent(evt);
|
||||
dijit.typematic.trigger(evt,_b,_9,_c,_a,_d,_e,_f);
|
||||
}else{
|
||||
if(dijit.typematic._obj==_a){
|
||||
dijit.typematic.stop();
|
||||
}
|
||||
}
|
||||
}),dojo.connect(_9,"onkeyup",this,function(evt){
|
||||
if(dijit.typematic._obj==_a){
|
||||
dijit.typematic.stop();
|
||||
}
|
||||
})];
|
||||
},addMouseListener:function(_10,_11,_12,_13,_14,_15){
|
||||
var dc=dojo.connect;
|
||||
return [dc(_10,"mousedown",this,function(evt){
|
||||
dojo.stopEvent(evt);
|
||||
dijit.typematic.trigger(evt,_11,_10,_12,_10,_13,_14,_15);
|
||||
}),dc(_10,"mouseup",this,function(evt){
|
||||
dojo.stopEvent(evt);
|
||||
dijit.typematic.stop();
|
||||
}),dc(_10,"mouseout",this,function(evt){
|
||||
dojo.stopEvent(evt);
|
||||
dijit.typematic.stop();
|
||||
}),dc(_10,"mousemove",this,function(evt){
|
||||
evt.preventDefault();
|
||||
}),dc(_10,"dblclick",this,function(evt){
|
||||
dojo.stopEvent(evt);
|
||||
if(dojo.isIE){
|
||||
dijit.typematic.trigger(evt,_11,_10,_12,_10,_13,_14,_15);
|
||||
setTimeout(dojo.hitch(this,dijit.typematic.stop),50);
|
||||
}
|
||||
})];
|
||||
},addListener:function(_16,_17,_18,_19,_1a,_1b,_1c,_1d){
|
||||
return this.addKeyListener(_17,_18,_19,_1a,_1b,_1c,_1d).concat(this.addMouseListener(_16,_19,_1a,_1b,_1c,_1d));
|
||||
}};
|
||||
}
|
||||
64
lib/dijit/_base/wai.js
Normal file
64
lib/dijit/_base/wai.js
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||||
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||||
see: http://dojotoolkit.org/license for details
|
||||
*/
|
||||
|
||||
|
||||
if(!dojo._hasResource["dijit._base.wai"]){
|
||||
dojo._hasResource["dijit._base.wai"]=true;
|
||||
dojo.provide("dijit._base.wai");
|
||||
dijit.wai={onload:function(){
|
||||
var _1=dojo.create("div",{id:"a11yTestNode",style:{cssText:"border: 1px solid;"+"border-color:red green;"+"position: absolute;"+"height: 5px;"+"top: -999px;"+"background-image: url(\""+(dojo.config.blankGif||dojo.moduleUrl("dojo","resources/blank.gif"))+"\");"}},dojo.body());
|
||||
var cs=dojo.getComputedStyle(_1);
|
||||
if(cs){
|
||||
var _2=cs.backgroundImage;
|
||||
var _3=(cs.borderTopColor==cs.borderRightColor)||(_2!=null&&(_2=="none"||_2=="url(invalid-url:)"));
|
||||
dojo[_3?"addClass":"removeClass"](dojo.body(),"dijit_a11y");
|
||||
if(dojo.isIE){
|
||||
_1.outerHTML="";
|
||||
}else{
|
||||
dojo.body().removeChild(_1);
|
||||
}
|
||||
}
|
||||
}};
|
||||
if(dojo.isIE||dojo.isMoz){
|
||||
dojo._loaders.unshift(dijit.wai.onload);
|
||||
}
|
||||
dojo.mixin(dijit,{_XhtmlRoles:/banner|contentinfo|definition|main|navigation|search|note|secondary|seealso/,hasWaiRole:function(_4,_5){
|
||||
var _6=this.getWaiRole(_4);
|
||||
return _5?(_6.indexOf(_5)>-1):(_6.length>0);
|
||||
},getWaiRole:function(_7){
|
||||
return dojo.trim((dojo.attr(_7,"role")||"").replace(this._XhtmlRoles,"").replace("wairole:",""));
|
||||
},setWaiRole:function(_8,_9){
|
||||
var _a=dojo.attr(_8,"role")||"";
|
||||
if(!this._XhtmlRoles.test(_a)){
|
||||
dojo.attr(_8,"role",_9);
|
||||
}else{
|
||||
if((" "+_a+" ").indexOf(" "+_9+" ")<0){
|
||||
var _b=dojo.trim(_a.replace(this._XhtmlRoles,""));
|
||||
var _c=dojo.trim(_a.replace(_b,""));
|
||||
dojo.attr(_8,"role",_c+(_c?" ":"")+_9);
|
||||
}
|
||||
}
|
||||
},removeWaiRole:function(_d,_e){
|
||||
var _f=dojo.attr(_d,"role");
|
||||
if(!_f){
|
||||
return;
|
||||
}
|
||||
if(_e){
|
||||
var t=dojo.trim((" "+_f+" ").replace(" "+_e+" "," "));
|
||||
dojo.attr(_d,"role",t);
|
||||
}else{
|
||||
_d.removeAttribute("role");
|
||||
}
|
||||
},hasWaiState:function(_10,_11){
|
||||
return _10.hasAttribute?_10.hasAttribute("aria-"+_11):!!_10.getAttribute("aria-"+_11);
|
||||
},getWaiState:function(_12,_13){
|
||||
return _12.getAttribute("aria-"+_13)||"";
|
||||
},setWaiState:function(_14,_15,_16){
|
||||
_14.setAttribute("aria-"+_15,_16);
|
||||
},removeWaiState:function(_17,_18){
|
||||
_17.removeAttribute("aria-"+_18);
|
||||
}});
|
||||
}
|
||||
15
lib/dijit/_base/window.js
Normal file
15
lib/dijit/_base/window.js
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||||
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||||
see: http://dojotoolkit.org/license for details
|
||||
*/
|
||||
|
||||
|
||||
if(!dojo._hasResource["dijit._base.window"]){
|
||||
dojo._hasResource["dijit._base.window"]=true;
|
||||
dojo.provide("dijit._base.window");
|
||||
dojo.require("dojo.window");
|
||||
dijit.getDocumentWindow=function(_1){
|
||||
return dojo.window.get(_1);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user