⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 docs.js

📁 用ExtJS做的一个网页聊天工具
💻 JS
📖 第 1 页 / 共 2 页
字号:
                enableToggle: true,                toggleHandler : function(b, pressed){                    mainPanel[pressed ? 'addClass' : 'removeClass']('full-details');                }            }]        })]    })    var viewport = new Ext.Viewport({        layout:'border',        items:[ hd, api, mainPanel ]    });    api.expandPath('/root/apidocs');    // allow for link in    var page = window.location.href.split('?')[1];    if(page){        var ps = Ext.urlDecode(page);        var cls = ps['class'];        mainPanel.loadClass('output/' + cls + '.html', cls, ps.member);    }        viewport.doLayout();		setTimeout(function(){        Ext.get('loading').remove();        Ext.get('loading-mask').fadeOut({remove:true});    }, 250);		var filter = new Ext.tree.TreeFilter(api, {		clearBlank: true,		autoClear: true	});	var hiddenPkgs = [];	function filterTree(e){		var text = e.target.value;		Ext.each(hiddenPkgs, function(n){			n.ui.show();		});		if(!text){			filter.clear();			return;		}		api.expandAll();				var re = new RegExp('^' + Ext.escapeRe(text), 'i');		filter.filterBy(function(n){			return !n.attributes.isClass || re.test(n.text);		});				// hide empty packages that weren't filtered		hiddenPkgs = [];		api.root.cascade(function(n){			if(!n.attributes.isClass && n.ui.ctNode.offsetHeight < 3){				n.ui.hide();				hiddenPkgs.push(n);			}		});	}	});Ext.app.SearchField = Ext.extend(Ext.form.TwinTriggerField, {    initComponent : function(){        if(!this.store.baseParams){			this.store.baseParams = {};		}		Ext.app.SearchField.superclass.initComponent.call(this);		this.on('specialkey', function(f, e){            if(e.getKey() == e.ENTER){                this.onTrigger2Click();            }        }, this);    },    validationEvent:false,    validateOnBlur:false,    trigger1Class:'x-form-clear-trigger',    trigger2Class:'x-form-search-trigger',    hideTrigger1:true,    width:180,    hasSearch : false,    paramName : 'query',    onTrigger1Click : function(){        if(this.hasSearch){            this.store.baseParams[this.paramName] = '';			this.store.removeAll();			this.el.dom.value = '';            this.triggers[0].hide();            this.hasSearch = false;			this.focus();        }    },    onTrigger2Click : function(){        var v = this.getRawValue();        if(v.length < 1){            this.onTrigger1Click();            return;        }		if(v.length < 2){			Ext.Msg.alert('Invalid Search', 'You must enter a minimum of 2 characters to search the API');			return;		}		this.store.baseParams[this.paramName] = v;        var o = {start: 0};        this.store.reload({params:o});        this.hasSearch = true;        this.triggers[0].show();		this.focus();    }});/** * Makes a ComboBox more closely mimic an HTML SELECT.  Supports clicking and dragging * through the list, with item selection occurring when the mouse button is released. * When used will automatically set {@link #editable} to false and call {@link Ext.Element#unselectable} * on inner elements.  Re-enabling editable after calling this will NOT work. * * @author Corey Gilmore * http://extjs.com/forum/showthread.php?t=6392 * * @history 2007-07-08 jvs * Slight mods for Ext 2.0 */Ext.ux.SelectBox = function(config){	this.searchResetDelay = 1000;	config = config || {};	config = Ext.apply(config || {}, {		editable: false,		forceSelection: true,		rowHeight: false,		lastSearchTerm: false,        triggerAction: 'all',        mode: 'local'    });	Ext.ux.SelectBox.superclass.constructor.apply(this, arguments);	this.lastSelectedIndex = this.selectedIndex || 0;};Ext.extend(Ext.ux.SelectBox, Ext.form.ComboBox, {    lazyInit: false,	initEvents : function(){		Ext.ux.SelectBox.superclass.initEvents.apply(this, arguments);		// you need to use keypress to capture upper/lower case and shift+key, but it doesn't work in IE		this.el.on('keydown', this.keySearch, this, true);		this.cshTask = new Ext.util.DelayedTask(this.clearSearchHistory, this);	},	keySearch : function(e, target, options) {		var raw = e.getKey();		var key = String.fromCharCode(raw);		var startIndex = 0;		if( !this.store.getCount() ) {			return;		}		switch(raw) {			case Ext.EventObject.HOME:				e.stopEvent();				this.selectFirst();				return;			case Ext.EventObject.END:				e.stopEvent();				this.selectLast();				return;			case Ext.EventObject.PAGEDOWN:				this.selectNextPage();				e.stopEvent();				return;			case Ext.EventObject.PAGEUP:				this.selectPrevPage();				e.stopEvent();				return;		}		// skip special keys other than the shift key		if( (e.hasModifier() && !e.shiftKey) || e.isNavKeyPress() || e.isSpecialKey() ) {			return;		}		if( this.lastSearchTerm == key ) {			startIndex = this.lastSelectedIndex;		}		this.search(this.displayField, key, startIndex);		this.cshTask.delay(this.searchResetDelay);	},	onRender : function(ct, position) {		this.store.on('load', this.calcRowsPerPage, this);		Ext.ux.SelectBox.superclass.onRender.apply(this, arguments);		if( this.mode == 'local' ) {			this.calcRowsPerPage();		}	},	onSelect : function(record, index, skipCollapse){		if(this.fireEvent('beforeselect', this, record, index) !== false){			this.setValue(record.data[this.valueField || this.displayField]);			if( !skipCollapse ) {				this.collapse();			}			this.lastSelectedIndex = index + 1;			this.fireEvent('select', this, record, index);		}	},	render : function(ct) {		Ext.ux.SelectBox.superclass.render.apply(this, arguments);		if( Ext.isSafari ) {			this.el.swallowEvent('mousedown', true);		}		this.el.unselectable();		this.innerList.unselectable();		this.trigger.unselectable();		this.innerList.on('mouseup', function(e, target, options) {			if( target.id && target.id == this.innerList.id ) {				return;			}			this.onViewClick();		}, this);		this.innerList.on('mouseover', function(e, target, options) {			if( target.id && target.id == this.innerList.id ) {				return;			}			this.lastSelectedIndex = this.view.getSelectedIndexes()[0] + 1;			this.cshTask.delay(this.searchResetDelay);		}, this);		this.trigger.un('click', this.onTriggerClick, this);		this.trigger.on('mousedown', function(e, target, options) {			e.preventDefault();			this.onTriggerClick();		}, this);		this.on('collapse', function(e, target, options) {			Ext.getDoc().un('mouseup', this.collapseIf, this);		}, this, true);		this.on('expand', function(e, target, options) {			Ext.getDoc().on('mouseup', this.collapseIf, this);		}, this, true);	},	clearSearchHistory : function() {		this.lastSelectedIndex = 0;		this.lastSearchTerm = false;	},	selectFirst : function() {		this.focusAndSelect(this.store.data.first());	},	selectLast : function() {		this.focusAndSelect(this.store.data.last());	},	selectPrevPage : function() {		if( !this.rowHeight ) {			return;		}		var index = Math.max(this.selectedIndex-this.rowsPerPage, 0);		this.focusAndSelect(this.store.getAt(index));	},	selectNextPage : function() {		if( !this.rowHeight ) {			return;		}		var index = Math.min(this.selectedIndex+this.rowsPerPage, this.store.getCount() - 1);		this.focusAndSelect(this.store.getAt(index));	},	search : function(field, value, startIndex) {		field = field || this.displayField;		this.lastSearchTerm = value;		var index = this.store.find.apply(this.store, arguments);		if( index !== -1 ) {			this.focusAndSelect(index);		}	},	focusAndSelect : function(record) {		var index = typeof record === 'number' ? record : this.store.indexOf(record);		this.select(index, this.isExpanded());		this.onSelect(this.store.getAt(record), index, this.isExpanded());	},	calcRowsPerPage : function() {		if( this.store.getCount() ) {			this.rowHeight = Ext.fly(this.view.getNode(0)).getHeight();			this.rowsPerPage = this.maxHeight / this.rowHeight;		} else {			this.rowHeight = false;		}	}});Ext.Ajax.on('requestcomplete', function(ajax, xhr, o){    if(typeof urchinTracker == 'function' && o && o.url){        urchinTracker(o.url);    }});

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -