-Ext.onReady(function(){
-
- Ext.QuickTips.init();
-
- var api = new ApiPanel();
- var mainPanel = new MainPanel();
-
- api.on('click', function(node, e){
- if(node.isLeaf()){
- e.stopEvent();
- mainPanel.loadClass(node.attributes.href, node.id);
- }
- });
-
- mainPanel.on('tabchange', function(tp, tab){
- api.selectClass(tab.cclass);
- });
-
- var hd = new Ext.Panel({
- border: false,
- layout:'anchor',
- region:'north',
- cls: 'docs-header',
- height:60,
- items: [{
- xtype:'box',
- el:'header',
- border:false,
- anchor: 'none -25'
- },
- new Ext.Toolbar({
- cls:'top-toolbar',
- items:[ ' ',
- new Ext.form.TextField({
- width: 200,
- emptyText:'Find a Class',
- listeners:{
- render: function(f){
- f.el.on('keydown', filterTree, f, {buffer: 350});
- }
- }
- }), ' ', ' ',
- {
- iconCls: 'icon-expand-all',
- tooltip: 'Expand All',
- handler: function(){ api.root.expand(true); }
- }, '-', {
- iconCls: 'icon-collapse-all',
- tooltip: 'Collapse All',
- handler: function(){ api.root.collapse(true); }
- }, '->', {
- tooltip:'Hide Inherited Members',
- iconCls: 'icon-hide-inherited',
- enableToggle: true,
- toggleHandler : function(b, pressed){
- mainPanel[pressed ? 'addClass' : 'removeClass']('hide-inherited');
- }
- }, '-', {
- tooltip:'Expand All Members',
- iconCls: 'icon-expand-members',
- 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();
- }
-});
-
-