📄 dijit-all.js.uncompressed.js
字号:
// do the connects for each <script type="dojo/connect" event="foo"> block and make // all <script type="dojo/method"> tags execute right after construction this.mixins.push(function(){ dojo.forEach(parsedScripts, function(s){ dojo.connect(this, s.event, this, s.func); }, this); }); propList.widgetsInTemplate = true; propList._skipNodeCache = true; propList.templateString = "<"+srcType+" class='"+src.className+"' dojoAttachPoint='"+(src.getAttribute("dojoAttachPoint")||'')+"' dojoAttachEvent='"+(src.getAttribute("dojoAttachEvent")||'')+"' >"+src.innerHTML.replace(/\%7B/g,"{").replace(/\%7D/g,"}")+"</"+srcType+">"; // console.debug(propList.templateString); // strip things so we don't create stuff under us in the initial setup phase dojo.query("[dojoType]", src).forEach(function(node){ node.removeAttribute("dojoType"); }); // create the new widget class dojo.declare( this.widgetClass, this.mixins, propList ); } });}if(!dojo._hasResource["dojo.dnd.common"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.dojo._hasResource["dojo.dnd.common"] = true;dojo.provide("dojo.dnd.common");dojo.dnd._copyKey = navigator.appVersion.indexOf("Macintosh") < 0 ? "ctrlKey" : "metaKey";dojo.dnd.getCopyKeyState = function(e) { // summary: abstracts away the difference between selection on Mac and PC, // and returns the state of the "copy" key to be pressed. // e: Event: mouse event return e[dojo.dnd._copyKey]; // Boolean};dojo.dnd._uniqueId = 0;dojo.dnd.getUniqueId = function(){ // summary: returns a unique string for use with any DOM element var id; do{ id = dojo._scopeName + "Unique" + (++dojo.dnd._uniqueId); }while(dojo.byId(id)); return id;};dojo.dnd._empty = {};dojo.dnd.isFormElement = function(/*Event*/ e){ // summary: returns true, if user clicked on a form element var t = e.target; if(t.nodeType == 3 /*TEXT_NODE*/){ t = t.parentNode; } return " button textarea input select option ".indexOf(" " + t.tagName.toLowerCase() + " ") >= 0; // Boolean};}if(!dojo._hasResource["dojo.dnd.autoscroll"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.dojo._hasResource["dojo.dnd.autoscroll"] = true;dojo.provide("dojo.dnd.autoscroll");dojo.dnd.getViewport = function(){ // summary: returns a viewport size (visible part of the window) // FIXME: need more docs!! var d = dojo.doc, dd = d.documentElement, w = window, b = dojo.body(); if(dojo.isMozilla){ return {w: dd.clientWidth, h: w.innerHeight}; // Object }else if(!dojo.isOpera && w.innerWidth){ return {w: w.innerWidth, h: w.innerHeight}; // Object }else if (!dojo.isOpera && dd && dd.clientWidth){ return {w: dd.clientWidth, h: dd.clientHeight}; // Object }else if (b.clientWidth){ return {w: b.clientWidth, h: b.clientHeight}; // Object } return null; // Object};dojo.dnd.V_TRIGGER_AUTOSCROLL = 32;dojo.dnd.H_TRIGGER_AUTOSCROLL = 32;dojo.dnd.V_AUTOSCROLL_VALUE = 16;dojo.dnd.H_AUTOSCROLL_VALUE = 16;dojo.dnd.autoScroll = function(e){ // summary: // a handler for onmousemove event, which scrolls the window, if // necesary // e: Event: // onmousemove event // FIXME: needs more docs! var v = dojo.dnd.getViewport(), dx = 0, dy = 0; if(e.clientX < dojo.dnd.H_TRIGGER_AUTOSCROLL){ dx = -dojo.dnd.H_AUTOSCROLL_VALUE; }else if(e.clientX > v.w - dojo.dnd.H_TRIGGER_AUTOSCROLL){ dx = dojo.dnd.H_AUTOSCROLL_VALUE; } if(e.clientY < dojo.dnd.V_TRIGGER_AUTOSCROLL){ dy = -dojo.dnd.V_AUTOSCROLL_VALUE; }else if(e.clientY > v.h - dojo.dnd.V_TRIGGER_AUTOSCROLL){ dy = dojo.dnd.V_AUTOSCROLL_VALUE; } window.scrollBy(dx, dy);};dojo.dnd._validNodes = {"div": 1, "p": 1, "td": 1};dojo.dnd._validOverflow = {"auto": 1, "scroll": 1};dojo.dnd.autoScrollNodes = function(e){ // summary: // a handler for onmousemove event, which scrolls the first avaialble // Dom element, it falls back to dojo.dnd.autoScroll() // e: Event: // onmousemove event // FIXME: needs more docs! for(var n = e.target; n;){ if(n.nodeType == 1 && (n.tagName.toLowerCase() in dojo.dnd._validNodes)){ var s = dojo.getComputedStyle(n); if(s.overflow.toLowerCase() in dojo.dnd._validOverflow){ var b = dojo._getContentBox(n, s), t = dojo._abs(n, true); // console.debug(b.l, b.t, t.x, t.y, n.scrollLeft, n.scrollTop); b.l += t.x + n.scrollLeft; b.t += t.y + n.scrollTop; var w = Math.min(dojo.dnd.H_TRIGGER_AUTOSCROLL, b.w / 2), h = Math.min(dojo.dnd.V_TRIGGER_AUTOSCROLL, b.h / 2), rx = e.pageX - b.l, ry = e.pageY - b.t, dx = 0, dy = 0; if(rx > 0 && rx < b.w){ if(rx < w){ dx = -dojo.dnd.H_AUTOSCROLL_VALUE; }else if(rx > b.w - w){ dx = dojo.dnd.H_AUTOSCROLL_VALUE; } } //console.debug("ry =", ry, "b.h =", b.h, "h =", h); if(ry > 0 && ry < b.h){ if(ry < h){ dy = -dojo.dnd.V_AUTOSCROLL_VALUE; }else if(ry > b.h - h){ dy = dojo.dnd.V_AUTOSCROLL_VALUE; } } var oldLeft = n.scrollLeft, oldTop = n.scrollTop; n.scrollLeft = n.scrollLeft + dx; n.scrollTop = n.scrollTop + dy; // if(dx || dy){ console.debug(oldLeft + ", " + oldTop + "\n" + dx + ", " + dy + "\n" + n.scrollLeft + ", " + n.scrollTop); } if(oldLeft != n.scrollLeft || oldTop != n.scrollTop){ return; } } } try{ n = n.parentNode; }catch(x){ n = null; } } dojo.dnd.autoScroll(e);};}if(!dojo._hasResource["dojo.dnd.Mover"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.dojo._hasResource["dojo.dnd.Mover"] = true;dojo.provide("dojo.dnd.Mover");dojo.declare("dojo.dnd.Mover", null, { constructor: function(node, e, host){ // summary: an object, which makes a node follow the mouse, // used as a default mover, and as a base class for custom movers // node: Node: a node (or node's id) to be moved // e: Event: a mouse event, which started the move; // only pageX and pageY properties are used // host: Object?: object which implements the functionality of the move, // and defines proper events (onMoveStart and onMoveStop) this.node = dojo.byId(node); this.marginBox = {l: e.pageX, t: e.pageY}; this.mouseButton = e.button; var h = this.host = host, d = node.ownerDocument, firstEvent = dojo.connect(d, "onmousemove", this, "onFirstMove"); this.events = [ dojo.connect(d, "onmousemove", this, "onMouseMove"), dojo.connect(d, "onmouseup", this, "onMouseUp"), // cancel text selection and text dragging dojo.connect(d, "ondragstart", dojo, "stopEvent"), dojo.connect(d, "onselectstart", dojo, "stopEvent"), firstEvent ]; // notify that the move has started if(h && h.onMoveStart){ h.onMoveStart(this); } }, // mouse event processors onMouseMove: function(e){ // summary: event processor for onmousemove // e: Event: mouse event dojo.dnd.autoScroll(e); var m = this.marginBox; this.host.onMove(this, {l: m.l + e.pageX, t: m.t + e.pageY}); }, onMouseUp: function(e){ if(this.mouseButton == e.button){ this.destroy(); } }, // utilities onFirstMove: function(){ // summary: makes the node absolute; it is meant to be called only once var s = this.node.style, l, t; switch(s.position){ case "relative": case "absolute": // assume that left and top values are in pixels already l = Math.round(parseFloat(s.left)); t = Math.round(parseFloat(s.top)); break; default: s.position = "absolute"; // enforcing the absolute mode var m = dojo.marginBox(this.node); l = m.l; t = m.t; break; } this.marginBox.l = l - this.marginBox.l; this.marginBox.t = t - this.marginBox.t; this.host.onFirstMove(this); dojo.disconnect(this.events.pop()); }, destroy: function(){ // summary: stops the move, deletes all references, so the object can be garbage-collected dojo.forEach(this.events, dojo.disconnect); // undo global settings var h = this.host; if(h && h.onMoveStop){ h.onMoveStop(this); } // destroy objects this.events = this.node = null; }});}if(!dojo._hasResource["dojo.dnd.Moveable"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.dojo._hasResource["dojo.dnd.Moveable"] = true;dojo.provide("dojo.dnd.Moveable");dojo.declare("dojo.dnd.Moveable", null, { // object attributes (for markup) handle: "", delay: 0, skip: false, constructor: function(node, params){ // summary: an object, which makes a node moveable // node: Node: a node (or node's id) to be moved // params: Object: an optional object with additional parameters; // following parameters are recognized: // handle: Node: a node (or node's id), which is used as a mouse handle // if omitted, the node itself is used as a handle // delay: Number: delay move by this number of pixels // skip: Boolean: skip move of form elements // mover: Object: a constructor of custom Mover this.node = dojo.byId(node); if(!params){ params = {}; } this.handle = params.handle ? dojo.byId(params.handle) : null; if(!this.handle){ this.handle = this.node; } this.delay = params.delay > 0 ? params.delay : 0; this.skip = params.skip; this.mover = params.mover ? params.mover : dojo.dnd.Mover; this.events = [ dojo.connect(this.handle, "onmousedown", this, "onMouseDown"), // cancel text selection and text dragging dojo.connect(this.handle, "ondragstart", this, "onSelectStart"), dojo.connect(this.handle, "onselectstart", this, "onSelectStart") ]; }, // markup methods markupFactory: function(params, node){ return new dojo.dnd.Moveable(node, params); }, // methods destroy: function(){ // summary: stops watching for possible move, deletes all references, so the object can be garbage-collected dojo.forEach(this.events, dojo.disconnect); this.events = this.node = this.handle = null; }, // mouse event processors onMouseDown: function(e){ // summary: event processor for onmousedown, creates a Mover for the node // e: Event: mouse event if(this.skip && dojo.dnd.isFormElement(e)){ return; } if(this.delay){ this.events.push(dojo.connect(this.handle, "onmousemove", this, "onMouseMove")); this.events.push(dojo.connect(this.handle, "onmouseup", this, "onMouseUp")); this._lastX = e.pageX; this._lastY = e.pageY; }else{ new this.mover(this.node, e, this); } dojo.stopEvent(e); }, onMouseMove: function(e){ // summary: event processor for onmousemove, used only for delayed drags // e: Event: mouse event if(Math.abs(e.pageX - this._lastX) > this.delay || Math.abs(e.pageY - this._lastY) > this.delay){ this.onMouseUp(e); new this.mover(this.node, e, this); } dojo.stopEvent(e); }, onMouseUp: function(e){ // summary: event processor for onmouseup, used only for delayed delayed drags // e: Event: mouse event dojo.disconnect(this.events.pop()); dojo.disconnect(this.events.pop()); }, onSelectStart: function(e){ // summary: event processor for onselectevent and ondragevent // e: Event: mouse event if(!this.skip || !dojo.dnd.isFormElement(e)){ dojo.stopEvent(e); } }, // local events onMoveStart: function(/* dojo.dnd.Mover */ mover){ // summary: called before every move operation dojo.publish("/dnd/move/start", [mover]); dojo.addClass(dojo.body(), "dojoMove"); dojo.addClass(this.node, "dojoMoveItem"); }, onMoveStop: function(/* dojo.dnd.Mover */ mover){ // summary: called after every move operation dojo.publish("/dnd/move/stop", [mover]); dojo.removeClass(dojo.body(), "dojoMove"); dojo.removeClass(this.node, "dojoMoveItem"); }, onFirstMove: function(/* dojo.dnd.Mover */ mover){ // summary: called during the very first move notification, // can be used to initialize coordinates, can be overwritten. // default implementation does nothing }, onMove: function(/* dojo.dnd.Mover */ mover, /* Object */ leftTop){ // summary: called during every move notification, // should actually move the node, can be overwritten. this.onMoving(mover, leftTop); var s = mover.node.style; s.left = leftTop.l + "px"; s.top = leftTop.t + "px"; this.onMoved(mover, leftTop); }, onMoving: function(/* dojo.dnd.Mover */ mover, /* Object */ leftTop){ // summary: called before every incremental move, // can be overwritten. // default implementation does nothing }, onMoved: function(/* dojo.dnd.Mover */ mover, /* Object */ leftTop){ // summary: called after every incremental move, // can be overwritten. // default implementation does nothing }});}if(!dojo._hasResource["dojo.dnd.TimedMoveable"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.dojo._hasResource["dojo.dnd.TimedMoveable"] = true;dojo.provide("dojo.dnd.TimedMoveable");(function(){ // precalculate long expressions var oldOnMove = dojo.dnd.Moveable.prototype.onMove; dojo.declare("dojo.dnd.TimedMoveable", dojo.dnd.Moveable, { // summary: // A specialized version of Moveable to support an FPS throttling. // This class puts an upper restriction on FPS, which may reduce // the CPU load. The additional parameter "timeout" regulates // the delay before actually moving the moveable object. // object attributes (for markup) timeout: 40, // in ms, 40ms corresponds to 25 fps constructor: function(node, params){ // summary: an object, which makes a node moveable with a timer // node: Node: a node (or node's id) to be moved // params: Object: an optional object with additional parameters. // See dojo.dnd.Moveable for details on general parameters. // Following parameters are specific for this class: // timeout: Number: delay move by this number of ms // accumulating position changes during the timeout // sanitize parameters
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -