📄 dijit.js.uncompressed.js
字号:
byId: function(/*String*/ id){ return this._hash[id]; }, byClass: function(/*String*/ cls){ return this.filter(function(widget){ return widget.declaredClass==cls; }); // dijit.WidgetSet } });/*=====dijit.registry = { // summary: A list of widgets on a page. // description: Is an instance of dijit.WidgetSet};=====*/dijit.registry = new dijit.WidgetSet();dijit._widgetTypeCtr = {};dijit.getUniqueId = function(/*String*/widgetType){ // summary // Generates a unique id for a given widgetType var id; do{ id = widgetType + "_" + (widgetType in dijit._widgetTypeCtr ? ++dijit._widgetTypeCtr[widgetType] : dijit._widgetTypeCtr[widgetType] = 0); }while(dijit.byId(id)); return id; // String};if(dojo.isIE){ // Only run this for IE because we think it's only necessary in that case, // and because it causes problems on FF. See bug #3531 for details. dojo.addOnUnload(function(){ dijit.registry.forEach(function(widget){ widget.destroy(); }); });}dijit.byId = function(/*String|Widget*/id){ // summary: // Returns a widget by its id, or if passed a widget, no-op (like dojo.byId()) return (dojo.isString(id)) ? dijit.registry.byId(id) : id; // Widget};dijit.byNode = function(/* DOMNode */ node){ // summary: // Returns the widget as referenced by node return dijit.registry.byId(node.getAttribute("widgetId")); // Widget};dijit.getEnclosingWidget = function(/* DOMNode */ node){ // summary: // Returns the widget whose dom tree contains node or null if // the node is not contained within the dom tree of any widget while(node){ if(node.getAttribute && node.getAttribute("widgetId")){ return dijit.registry.byId(node.getAttribute("widgetId")); } node = node.parentNode; } return null;};// elements that are tab-navigable if they have no tabindex value set// (except for "a", which must have an href attribute)dijit._tabElements = { area: true, button: true, input: true, object: true, select: true, textarea: true};dijit._isElementShown = function(/*Element*/elem){ var style = dojo.style(elem); return (style.visibility != "hidden") && (style.visibility != "collapsed") && (style.display != "none");}dijit.isTabNavigable = function(/*Element*/elem){ // summary: // Tests if an element is tab-navigable if(dojo.hasAttr(elem, "disabled")){ return false; } var hasTabindex = dojo.hasAttr(elem, "tabindex"); var tabindex = dojo.attr(elem, "tabindex"); if(hasTabindex && tabindex >= 0) { return true; // boolean } var name = elem.nodeName.toLowerCase(); if(((name == "a" && dojo.hasAttr(elem, "href")) || dijit._tabElements[name]) && (!hasTabindex || tabindex >= 0)){ return true; // boolean } return false; // boolean};dijit._getTabNavigable = function(/*DOMNode*/root){ // summary: // Finds the following descendants of the specified root node: // * the first tab-navigable element in document order // without a tabindex or with tabindex="0" // * the last tab-navigable element in document order // without a tabindex or with tabindex="0" // * the first element in document order with the lowest // positive tabindex value // * the last element in document order with the highest // positive tabindex value var first, last, lowest, lowestTabindex, highest, highestTabindex; var walkTree = function(/*DOMNode*/parent){ dojo.query("> *", parent).forEach(function(child){ var isShown = dijit._isElementShown(child); if(isShown && dijit.isTabNavigable(child)){ var tabindex = dojo.attr(child, "tabindex"); if(!dojo.hasAttr(child, "tabindex") || tabindex == 0){ if(!first){ first = child; } last = child; }else if(tabindex > 0){ if(!lowest || tabindex < lowestTabindex){ lowestTabindex = tabindex; lowest = child; } if(!highest || tabindex >= highestTabindex){ highestTabindex = tabindex; highest = child; } } } if(isShown){ walkTree(child) } }); }; if(dijit._isElementShown(root)){ walkTree(root) } return { first: first, last: last, lowest: lowest, highest: highest };}dijit.getFirstInTabbingOrder = function(/*String|DOMNode*/root){ // summary: // Finds the descendant of the specified root node // that is first in the tabbing order var elems = dijit._getTabNavigable(dojo.byId(root)); return elems.lowest ? elems.lowest : elems.first; // Element};dijit.getLastInTabbingOrder = function(/*String|DOMNode*/root){ // summary: // Finds the descendant of the specified root node // that is last in the tabbing order var elems = dijit._getTabNavigable(dojo.byId(root)); return elems.last ? elems.last : elems.highest; // Element};}if(!dojo._hasResource["dijit._base.place"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.dojo._hasResource["dijit._base.place"] = true;dojo.provide("dijit._base.place");// ported from dojo.html.utildijit.getViewport = function(){ // summary // Returns the dimensions and scroll position of the viewable area of a browser window var _window = dojo.global; var _document = dojo.doc; // get viewport size var w = 0, h = 0; var de = _document.documentElement; var dew = de.clientWidth, deh = de.clientHeight; if(dojo.isMozilla){ // mozilla // _window.innerHeight includes the height taken by the scroll bar // clientHeight is ideal but has DTD issues: // #4539: FF reverses the roles of body.clientHeight/Width and documentElement.clientHeight/Width based on the DTD! // check DTD to see whether body or documentElement returns the viewport dimensions using this algorithm: var minw, minh, maxw, maxh; var dbw = _document.body.clientWidth; if(dbw > dew){ minw = dew; maxw = dbw; }else{ maxw = dew; minw = dbw; } var dbh = _document.body.clientHeight; if(dbh > deh){ minh = deh; maxh = dbh; }else{ maxh = deh; minh = dbh; } w = (maxw > _window.innerWidth) ? minw : maxw; h = (maxh > _window.innerHeight) ? minh : maxh; }else if(!dojo.isOpera && _window.innerWidth){ //in opera9, dojo.body().clientWidth should be used, instead //of window.innerWidth/document.documentElement.clientWidth //so we have to check whether it is opera w = _window.innerWidth; h = _window.innerHeight; }else if(dojo.isIE && de && deh){ w = dew; h = deh; }else if(dojo.body().clientWidth){ // IE5, Opera w = dojo.body().clientWidth; h = dojo.body().clientHeight; } // get scroll position var scroll = dojo._docScroll(); return { w: w, h: h, l: scroll.x, t: scroll.y }; // object};dijit.placeOnScreen = function( /* DomNode */ node, /* Object */ pos, /* Object */ corners, /* boolean? */ tryOnly){ // summary: // Keeps 'node' in the visible area of the screen while trying to // place closest to pos.x, pos.y. The input coordinates are // expected to be the desired document position. // // Set which corner(s) you want to bind to, such as // // placeOnScreen(node, {x: 10, y: 20}, ["TR", "BL"]) // // The desired x/y will be treated as the topleft(TL)/topright(TR) or // BottomLeft(BL)/BottomRight(BR) corner of the node. Each corner is tested // and if a perfect match is found, it will be used. Otherwise, it goes through // all of the specified corners, and choose the most appropriate one. // // NOTE: node is assumed to be absolutely or relatively positioned. var choices = dojo.map(corners, function(corner){ return { corner: corner, pos: pos }; }); return dijit._place(node, choices);}dijit._place = function(/*DomNode*/ node, /* Array */ choices, /* Function */ layoutNode){ // summary: // Given a list of spots to put node, put it at the first spot where it fits, // of if it doesn't fit anywhere then the place with the least overflow // choices: Array // Array of elements like: {corner: 'TL', pos: {x: 10, y: 20} } // Above example says to put the top-left corner of the node at (10,20) // layoutNode: Function(node, aroundNodeCorner, nodeCorner) // for things like tooltip, they are displayed differently (and have different dimensions) // based on their orientation relative to the parent. This adjusts the popup based on orientation. // get {x: 10, y: 10, w: 100, h:100} type obj representing position of // viewport over document var view = dijit.getViewport(); // This won't work if the node is inside a <div style="position: relative">, // so reattach it to dojo.doc.body. (Otherwise, the positioning will be wrong // and also it might get cutoff) if(!node.parentNode || String(node.parentNode.tagName).toLowerCase() != "body"){ dojo.body().appendChild(node); } var best = null; dojo.some(choices, function(choice){ var corner = choice.corner; var pos = choice.pos; // configure node to be displayed in given position relative to button // (need to do this in order to get an accurate size for the node, because // a tooltips size changes based on position, due to triangle) if(layoutNode){ layoutNode(node, choice.aroundCorner, corner); } // get node's size var style = node.style; var oldDisplay = style.display; var oldVis = style.visibility; style.visibility = "hidden"; style.display = ""; var mb = dojo.marginBox(node); style.display = oldDisplay; style.visibility = oldVis; // coordinates and size of node with specified corner placed at pos, // and clipped by viewport var startX = (corner.charAt(1) == 'L' ? pos.x : Math.max(view.l, pos.x - mb.w)), startY = (corner.charAt(0) == 'T' ? pos.y : Math.max(view.t, pos.y - mb.h)), endX = (corner.charAt(1) == 'L' ? Math.min(view.l + view.w, startX + mb.w) : pos.x), endY = (corner.charAt(0) == 'T' ? Math.min(view.t + view.h, startY + mb.h) : pos.y), width = endX - startX, height = endY - startY, overflow = (mb.w - width) + (mb.h - height); if(best == null || overflow < best.overflow){ best = { corner: corner, aroundCorner: choice.aroundCorner, x: startX, y: startY, w: width, h: height, overflow: overflow }; } return !overflow; }); node.style.left = best.x + "px"; node.style.top = best.y + "px"; if(best.overflow && layoutNode){ layoutNode(node, best.aroundCorner, best.corner); } return best;}dijit.placeOnScreenAroundElement = function( /* DomNode */ node, /* DomNode */ aroundNode, /* Object */ aroundCorners, /* Function */ layoutNode){ // summary // Like placeOnScreen, except it accepts aroundNode instead of x,y // and attempts to place node around it. Uses margin box dimensions. // // aroundCorners // specify Which corner of aroundNode should be // used to place the node => which corner(s) of node to use (see the // corners parameter in dijit.placeOnScreen) // e.g. {'TL': 'BL', 'BL': 'TL'} // // layoutNode: Function(node, aroundNodeCorner, nodeCorner) // for things like tooltip, they are displayed differently (and have different dimensions) // based on their orientation relative to the parent. This adjusts the popup based on orientation. // get coordinates of aroundNode aroundNode = dojo.byId(aroundNode); var oldDisplay = aroundNode.style.display; aroundNode.style.display=""; // #3172: use the slightly tighter border box instead of marginBox var aroundNodeW = aroundNode.offsetWidth; //mb.w; var aroundNodeH = aroundNode.offsetHeight; //mb.h; var aroundNodePos = dojo.coords(aroundNode, true); aroundNode.style.display=oldDisplay; // Generate list of possible positions for node var choices = []; for(var nodeCorner in aroundCorners){ choices.push( { aroundCorner: nodeCorner, corner: aroundCorners[nodeCorner], pos: { x: aroundNodePos.x + (nodeCorner.charAt(1) == 'L' ? 0 : aroundNodeW), y: aroundNodePos.y + (nodeCorner.charAt(0) == 'T' ? 0 : aroundNodeH) } }); } return dijit._place(node, choices, layoutNode);}}if(!dojo._hasResource["dijit._base.window"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.dojo._hasResource["dijit._base.window"] = true;dojo.provide("dijit._base.window");dijit.getDocumentWindow = function(doc){ // summary // Get window object associated with document doc // With Safari, there is not way to retrieve the window from the document, so we must fix it. if(dojo.isSafari && !doc._parentWindow){ /* This is a Safari specific function that fix the reference to the parent window from the document object. TODO: #5711: should the use of document below reference dojo.doc instead in case they're not the same? */ var fix=function(win){ win.document._parentWindow=win; for(var i=0; i<win.frames.length; i++){ fix(win.frames[i]); } } fix(window.top); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -