📄 dijit.js.uncompressed.js
字号:
//In some IE versions (at least 6.0), document.parentWindow does not return a //reference to the real window object (maybe a copy), so we must fix it as well //We use IE specific execScript to attach the real window reference to //document._parentWindow for later use //TODO: #5711: should the use of document below reference dojo.doc instead in case they're not the same? if(dojo.isIE && window !== document.parentWindow && !doc._parentWindow){ /* In IE 6, only the variable "window" can be used to connect events (others may be only copies). */ doc.parentWindow.execScript("document._parentWindow = window;", "Javascript"); //to prevent memory leak, unset it after use //another possibility is to add an onUnload handler which seems overkill to me (liucougar) var win = doc._parentWindow; doc._parentWindow = null; return win; // Window } return doc._parentWindow || doc.parentWindow || doc.defaultView; // Window}}if(!dojo._hasResource["dijit._base.popup"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.dojo._hasResource["dijit._base.popup"] = true;dojo.provide("dijit._base.popup");dijit.popup = new function(){ // summary: // This class is used to show/hide widgets as popups. // var stack = [], beginZIndex=1000, idGen = 1; this.prepare = function(/*DomNode*/ node){ // summary: // Prepares a node to be used as a popup // // description: // Attaches node to dojo.doc.body, and // positions it off screen, but not display:none, so that // the widget doesn't appear in the page flow and/or cause a blank // area at the bottom of the viewport (making scrollbar longer), but // initialization of contained widgets works correctly dojo.body().appendChild(node); var s = node.style; if(s.display == "none"){ s.display=""; } s.visibility = "hidden"; // not needed for hiding, but used as flag that node is off-screen s.position = "absolute"; s.top = "-9999px"; }; this.open = function(/*Object*/ args){ // summary: // Popup the widget at the specified position // // args: Object // popup: Widget // widget to display, // parent: Widget // the button etc. that is displaying this popup // around: DomNode // DOM node (typically a button); place popup relative to this node // orient: Object // structure specifying possible positions of popup relative to "around" node // onCancel: Function // callback when user has canceled the popup by // 1. hitting ESC or // 2. by using the popup widget's proprietary cancel mechanism (like a cancel button in a dialog); // ie: whenever popupWidget.onCancel() is called, args.onCancel is called // onClose: Function // callback whenever this popup is closed // onExecute: Function // callback when user "executed" on the popup/sub-popup by selecting a menu choice, etc. (top menu only) // // examples: // 1. opening at the mouse position // dijit.popup.open({popup: menuWidget, x: evt.pageX, y: evt.pageY}); // 2. opening the widget as a dropdown // dijit.popup.open({parent: this, popup: menuWidget, around: this.domNode, onClose: function(){...} }); // // Note that whatever widget called dijit.popup.open() should also listen to it's own _onBlur callback // (fired from _base/focus.js) to know that focus has moved somewhere else and thus the popup should be closed. var widget = args.popup, orient = args.orient || {'BL':'TL', 'TL':'BL'}, around = args.around, id = (args.around && args.around.id) ? (args.around.id+"_dropdown") : ("popup_"+idGen++); // make wrapper div to hold widget and possibly hold iframe behind it. // we can't attach the iframe as a child of the widget.domNode because // widget.domNode might be a <table>, <ul>, etc. var wrapper = dojo.doc.createElement("div"); dijit.setWaiRole(wrapper, "presentation"); wrapper.id = id; wrapper.className="dijitPopup"; wrapper.style.zIndex = beginZIndex + stack.length; wrapper.style.visibility = "hidden"; if(args.parent){ wrapper.dijitPopupParent=args.parent.id; } dojo.body().appendChild(wrapper); var s = widget.domNode.style; s.display = ""; s.visibility = ""; s.position = ""; wrapper.appendChild(widget.domNode); var iframe = new dijit.BackgroundIframe(wrapper); // position the wrapper node var best = around ? dijit.placeOnScreenAroundElement(wrapper, around, orient, widget.orient ? dojo.hitch(widget, "orient") : null) : dijit.placeOnScreen(wrapper, args, orient == 'R' ? ['TR','BR','TL','BL'] : ['TL','BL','TR','BR']); wrapper.style.visibility = "visible"; // TODO: use effects to fade in wrapper var handlers = []; // Compute the closest ancestor popup that's *not* a child of another popup. // Ex: For a TooltipDialog with a button that spawns a tree of menus, find the popup of the button. var getTopPopup = function(){ for(var pi=stack.length-1; pi > 0 && stack[pi].parent === stack[pi-1].widget; pi--){ /* do nothing, just trying to get right value for pi */ } return stack[pi]; } // provide default escape and tab key handling // (this will work for any widget, not just menu) handlers.push(dojo.connect(wrapper, "onkeypress", this, function(evt){ if(evt.keyCode == dojo.keys.ESCAPE && args.onCancel){ dojo.stopEvent(evt); args.onCancel(); }else if(evt.keyCode == dojo.keys.TAB){ dojo.stopEvent(evt); var topPopup = getTopPopup(); if(topPopup && topPopup.onCancel){ topPopup.onCancel(); } } })); // watch for cancel/execute events on the popup and notify the caller // (for a menu, "execute" means clicking an item) if(widget.onCancel){ handlers.push(dojo.connect(widget, "onCancel", null, args.onCancel)); } handlers.push(dojo.connect(widget, widget.onExecute ? "onExecute" : "onChange", null, function(){ var topPopup = getTopPopup(); if(topPopup && topPopup.onExecute){ topPopup.onExecute(); } })); stack.push({ wrapper: wrapper, iframe: iframe, widget: widget, parent: args.parent, onExecute: args.onExecute, onCancel: args.onCancel, onClose: args.onClose, handlers: handlers }); if(widget.onOpen){ widget.onOpen(best); } return best; }; this.close = function(/*Widget*/ popup){ // summary: // Close specified popup and any popups that it parented while(dojo.some(stack, function(elem){return elem.widget == popup;})){ var top = stack.pop(), wrapper = top.wrapper, iframe = top.iframe, widget = top.widget, onClose = top.onClose; if(widget.onClose){ widget.onClose(); } dojo.forEach(top.handlers, dojo.disconnect); // #2685: check if the widget still has a domNode so ContentPane can change its URL without getting an error if(!widget||!widget.domNode){ return; } this.prepare(widget.domNode); iframe.destroy(); dojo._destroyElement(wrapper); if(onClose){ onClose(); } } };}();dijit._frames = new function(){ // summary: cache of iframes var queue = []; this.pop = function(){ var iframe; if(queue.length){ iframe = queue.pop(); iframe.style.display=""; }else{ if(dojo.isIE){ var html="<iframe src='javascript:\"\"'" + " style='position: absolute; left: 0px; top: 0px;" + "z-index: -1; filter:Alpha(Opacity=\"0\");'>"; iframe = dojo.doc.createElement(html); }else{ iframe = dojo.doc.createElement("iframe"); iframe.src = 'javascript:""'; iframe.className = "dijitBackgroundIframe"; } iframe.tabIndex = -1; // Magic to prevent iframe from getting focus on tab keypress - as style didnt work. dojo.body().appendChild(iframe); } return iframe; }; this.push = function(iframe){ iframe.style.display=""; if(dojo.isIE){ iframe.style.removeExpression("width"); iframe.style.removeExpression("height"); } queue.push(iframe); }}();// fill the queueif(dojo.isIE && dojo.isIE < 7){ dojo.addOnLoad(function(){ var f = dijit._frames; dojo.forEach([f.pop()], f.push); });}dijit.BackgroundIframe = function(/* DomNode */node){ // summary: // For IE z-index schenanigans. id attribute is required. // // description: // new dijit.BackgroundIframe(node) // Makes a background iframe as a child of node, that fills // area (and position) of node if(!node.id){ throw new Error("no id"); } if((dojo.isIE && dojo.isIE < 7) || (dojo.isFF && dojo.isFF < 3 && dojo.hasClass(dojo.body(), "dijit_a11y"))){ var iframe = dijit._frames.pop(); node.appendChild(iframe); if(dojo.isIE){ iframe.style.setExpression("width", dojo._scopeName + ".doc.getElementById('" + node.id + "').offsetWidth"); iframe.style.setExpression("height", dojo._scopeName + ".doc.getElementById('" + node.id + "').offsetHeight"); } this.iframe = iframe; }};dojo.extend(dijit.BackgroundIframe, { destroy: function(){ // summary: destroy the iframe if(this.iframe){ dijit._frames.push(this.iframe); delete this.iframe; } }});}if(!dojo._hasResource["dijit._base.scroll"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.dojo._hasResource["dijit._base.scroll"] = true;dojo.provide("dijit._base.scroll");dijit.scrollIntoView = function(/* DomNode */node){ // summary // Scroll the passed node into view, if it is not. // don't rely on that node.scrollIntoView works just because the function is there // it doesnt work in Konqueror or Opera even though the function is there and probably // not safari either // native scrollIntoView() causes FF3's whole window to scroll if there is no scroll bar // on the immediate parent // dont like browser sniffs implementations but sometimes you have to use it // #6146: IE scrollIntoView is broken // It's not enough just to scroll the menu node into view if // node.scrollIntoView hides part of the parent's scrollbar, // so just manage the parent scrollbar ourselves var parent = node.parentNode; var parentBottom = parent.scrollTop + dojo.marginBox(parent).h; //PORT was getBorderBox var nodeBottom = node.offsetTop + dojo.marginBox(node).h; if(parentBottom < nodeBottom){ parent.scrollTop += (nodeBottom - parentBottom); }else if(parent.scrollTop > node.offsetTop){ parent.scrollTop -= (parent.scrollTop - node.offsetTop); }};}if(!dojo._hasResource["dijit._base.sniff"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.dojo._hasResource["dijit._base.sniff"] = true;dojo.provide("dijit._base.sniff");// ported from dojo.html.applyBrowserClass (style.js)// summary:// Applies pre-set class names based on browser & version to the// top-level HTML node. Simply doing a require on this module will// establish this CSS. Modified version of Morris' CSS hack.(function(){ var d = dojo; var ie = d.isIE; var opera = d.isOpera; var maj = Math.floor; var ff = d.isFF; var classes = { dj_ie: ie,// dj_ie55: ie == 5.5, dj_ie6: maj(ie) == 6, dj_ie7: maj(ie) == 7, dj_iequirks: ie && d.isQuirks,// NOTE: Opera not supported by dijit dj_opera: opera, dj_opera8: maj(opera) == 8, dj_opera9: maj(opera) == 9, dj_khtml: d.isKhtml, dj_safari: d.isSafari, dj_gecko: d.isMozilla, dj_ff2: maj(ff) == 2 }; // no dojo unsupported browsers for(var p in classes){ if(classes[p]){ var html = dojo.doc.documentElement; //TODO browser-specific DOM magic needed? if(html.className){ html.className += " " + p; }else{ html.className = p; } } }})();}if(!dojo._hasResource["dijit._base.bidi"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.dojo._hasResource["dijit._base.bidi"] = true;dojo.provide("dijit._base.bidi");// summary: applies a class to the top of the document for right-to-left stylesheet rulesdojo.addOnLoad(function(){ if(!dojo._isBodyLtr()){ dojo.addClass(dojo.body(), "dijitRtl"); }});}if(!dojo._hasResource["dijit._base.typematic"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.dojo._hasResource["dijit._base.typematic"] = true;dojo.provide("dijit._base.typematic");dijit.typematic = { // summary: // These functions are used to repetitively call a user specified callback // method when a specific key or mouse click over a specific DOM node is // held down for a specific amount of time. // Only 1 such event is allowed to occur on the browser page at 1 time. _fireEventAndReload: function(){ this._timer = null; this._callback(++this._count, this._node, this._evt); this._currentTimeout = (this._currentTimeout < 0) ? this._initialDelay : ((this._subsequentDelay > 1) ? this._subsequentDelay : Math.round(this._currentTimeout * this._subsequentDelay));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -