📄 prototype-bridge.js
字号:
/*
* Ext JS Library 2.0
* Copyright(c) 2006-2007, Ext JS, LLC.
* licensing@extjs.com
*
* http://extjs.com/license
*/
(function(){var libFlyweight;Ext.lib.Dom = { getViewWidth : function(full){ return full ? this.getDocumentWidth() : this.getViewportWidth(); }, getViewHeight : function(full){ return full ? this.getDocumentHeight() : this.getViewportHeight(); }, getDocumentHeight: function() { // missing from prototype? var scrollHeight = (document.compatMode != "CSS1Compat") ? document.body.scrollHeight : document.documentElement.scrollHeight; return Math.max(scrollHeight, this.getViewportHeight()); }, getDocumentWidth: function() { // missing from prototype? var scrollWidth = (document.compatMode != "CSS1Compat") ? document.body.scrollWidth : document.documentElement.scrollWidth; return Math.max(scrollWidth, this.getViewportWidth()); }, getViewportHeight: function() { // missing from prototype? var height = self.innerHeight; var mode = document.compatMode; if ( (mode || Ext.isIE) && !Ext.isOpera ) { height = (mode == "CSS1Compat") ? document.documentElement.clientHeight : // Standards document.body.clientHeight; // Quirks } return height; }, getViewportWidth: function() { // missing from prototype? var width = self.innerWidth; // Safari var mode = document.compatMode; if (mode || Ext.isIE) { // IE, Gecko, Opera width = (mode == "CSS1Compat") ? document.documentElement.clientWidth : // Standards document.body.clientWidth; // Quirks } return width; }, isAncestor : function(p, c){ // missing from prototype? p = Ext.getDom(p); c = Ext.getDom(c); if (!p || !c) {return false;} if(p.contains && !Ext.isSafari) { return p.contains(c); }else if(p.compareDocumentPosition) { return !!(p.compareDocumentPosition(c) & 16); }else{ var parent = c.parentNode; while (parent) { if (parent == p) { return true; } else if (!parent.tagName || parent.tagName.toUpperCase() == "HTML") { return false; } parent = parent.parentNode; } return false; } }, getRegion : function(el){ return Ext.lib.Region.getRegion(el); }, getY : function(el){ return this.getXY(el)[1]; }, getX : function(el){ return this.getXY(el)[0]; }, getXY : function(el){ // this initially used Position.cumulativeOffset but it is not accurate enough var p, pe, b, scroll, bd = (document.body || document.documentElement); el = Ext.getDom(el); if(el == bd){ return [0, 0]; } if (el.getBoundingClientRect) { b = el.getBoundingClientRect(); scroll = fly(document).getScroll(); return [b.left + scroll.left, b.top + scroll.top]; } var x = 0, y = 0; p = el; var hasAbsolute = fly(el).getStyle("position") == "absolute"; while (p) { x += p.offsetLeft; y += p.offsetTop; if (!hasAbsolute && fly(p).getStyle("position") == "absolute") { hasAbsolute = true; } if (Ext.isGecko) { pe = fly(p); var bt = parseInt(pe.getStyle("borderTopWidth"), 10) || 0; var bl = parseInt(pe.getStyle("borderLeftWidth"), 10) || 0; x += bl; y += bt; if (p != el && pe.getStyle('overflow') != 'visible') { x += bl; y += bt; } } p = p.offsetParent; } if (Ext.isSafari && hasAbsolute) { x -= bd.offsetLeft; y -= bd.offsetTop; } if (Ext.isGecko && !hasAbsolute) { var dbd = fly(bd); x += parseInt(dbd.getStyle("borderLeftWidth"), 10) || 0; y += parseInt(dbd.getStyle("borderTopWidth"), 10) || 0; } p = el.parentNode; while (p && p != bd) { if (!Ext.isOpera || (p.tagName != 'TR' && fly(p).getStyle("display") != "inline")) { x -= p.scrollLeft; y -= p.scrollTop; } p = p.parentNode; } return [x, y]; }, setXY : function(el, xy){ // this initially used Position.cumulativeOffset but it is not accurate enough el = Ext.fly(el, '_setXY'); el.position(); var pts = el.translatePoints(xy); if(xy[0] !== false){ el.dom.style.left = pts.left + "px"; } if(xy[1] !== false){ el.dom.style.top = pts.top + "px"; } }, setX : function(el, x){ this.setXY(el, [x, false]); }, setY : function(el, y){ this.setXY(el, [false, y]); }};Ext.lib.Event = { getPageX : function(e){ return Event.pointerX(e.browserEvent || e); }, getPageY : function(e){ return Event.pointerY(e.browserEvent || e); }, getXY : function(e){ e = e.browserEvent || e; return [Event.pointerX(e), Event.pointerY(e)]; }, getTarget : function(e){ return Event.element(e.browserEvent || e); }, resolveTextNode: function(node) { if (node && 3 == node.nodeType) { return node.parentNode; } else { return node; } }, getRelatedTarget: function(ev) { // missing from prototype? ev = ev.browserEvent || ev; var t = ev.relatedTarget; if (!t) { if (ev.type == "mouseout") { t = ev.toElement; } else if (ev.type == "mouseover") { t = ev.fromElement; } } return this.resolveTextNode(t); }, on : function(el, eventName, fn){ Event.observe(el, eventName, fn, false); }, un : function(el, eventName, fn){ Event.stopObserving(el, eventName, fn, false); }, purgeElement : function(el){ // no equiv? }, preventDefault : function(e){ // missing from prototype? e = e.browserEvent || e; if(e.preventDefault) { e.preventDefault(); } else { e.returnValue = false; } }, stopPropagation : function(e){ // missing from prototype? e = e.browserEvent || e; if(e.stopPropagation) { e.stopPropagation(); } else { e.cancelBubble = true; } }, stopEvent : function(e){ Event.stop(e.browserEvent || e); }, onAvailable : function(id, fn, scope){ // no equiv var start = new Date(), iid; var f = function(){ if(start.getElapsed() > 10000){ clearInterval(iid); } var el = document.getElementById(id); if(el){ clearInterval(iid); fn.call(scope||window, el); } }; iid = setInterval(f, 50); }};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -