X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/530ef4b6c5b943cfa68b779d11cf7de29aa878bf..0494b8d9b9bb03ab6c22b34dae81261e3cd7e3e6:/examples/init.js diff --git a/examples/init.js b/examples/init.js index f78f1100..d6d0ee63 100644 --- a/examples/init.js +++ b/examples/init.js @@ -1,8 +1,8 @@ /*! - * Ext JS Library 3.2.1 - * Copyright(c) 2006-2010 Ext JS, Inc. - * licensing@extjs.com - * http://www.extjs.com/license + * Ext JS Library 3.3.1 + * Copyright(c) 2006-2010 Sencha Inc. + * licensing@sencha.com + * http://www.sencha.com/license */ Ext.ns('Ext.samples'); @@ -67,95 +67,93 @@ Ext.samples.SamplePanel = SamplePanel; Ext.reg('samplespanel', Ext.samples.SamplePanel); })(); -Ext.onReady(function(){ +Ext.onReady(function() { + (function() { + // Instantiate Ext.App instance + App = new Ext.App({}); + var catalog = Ext.samples.samplesCatalog; -// Instantiate Ext.App instance - App = new Ext.App({}); + for (var i = 0, c; c = catalog[i]; i++) { + c.id = 'sample-' + i; + } - var catalog = Ext.samples.samplesCatalog; + var store = new Ext.data.JsonStore({ + idProperty : 'id', + fields : ['id', 'title', 'samples'], + data : catalog + }); - for(var i = 0, c; c = catalog[i]; i++){ - c.id = 'sample-' + i; - } + var panel = new Ext.Panel({ + frame : true, + renderTo : Ext.get('all-demos'), + height : 300, + autoScroll : true, + items : new SamplePanel({ + store : store + }) + }); - var store = new Ext.data.JsonStore({ - idProperty : 'id', - fields : ['id', 'title', 'samples'], - data : catalog - }); - - var panel = new Ext.Panel({ - frame : true, - renderTo : 'all-demos', - height : 300, - autoScroll : true, - items : new SamplePanel({ - store : store - }) - }); - - var tpl = new Ext.XTemplate( - '
  • {title:stripTags}
  • ' - ); - tpl.overwrite('sample-menu', catalog); - - Ext.select('#sample-spacer').remove(); - - var headerEl = Ext.get('hd'), - footerEl = Ext.get('ft'), - bodyEl = Ext.get('bd'), - sideBoxEl = bodyEl.child('div[class=side-box]'), - titleEl = bodyEl.child('h3:first-child'); - - var doResize = function() { - var windowHeight = Ext.getDoc().getViewSize(false).height; - - var footerHeight = footerEl.getHeight() + footerEl.getMargins().top, - titleElHeight = titleEl.getHeight() + titleEl.getMargins().top, - brElHeight = bodyEl.child('br').getHeight(), - headerHeight = headerEl.getHeight() + titleElHeight + brElHeight; - - var warnEl = Ext.get('fb'); - var warnHeight = warnEl ? warnEl.getHeight() : 0; - - var availHeight = windowHeight - ( footerHeight + headerHeight + 14) - warnHeight; - var sideBoxHeight = sideBoxEl.getHeight(); - - panel.setHeight((availHeight > sideBoxHeight) ? availHeight : sideBoxHeight); - } + var tpl = new Ext.XTemplate( + '
  • {title:stripTags}
  • ' + ); + tpl.overwrite('sample-menu', catalog); - // Resize on demand - Ext.EventManager.onWindowResize(doResize); + Ext.select('#sample-spacer').remove(); - var firebugWarning = function () { - var cp = new Ext.state.CookieProvider(); + var headerEl = Ext.get('hd'), + footerEl = Ext.get('ft'), + bodyEl = Ext.get('bd'), + sideBoxEl = bodyEl.child('div[class=side-box]'), + titleEl = bodyEl.child('h1#pagetitle'); - if(window.console && window.console.firebug && ! cp.get('hideFBWarning')){ - var tpl = new Ext.Template( - '' - ); - var newEl = tpl.insertFirst('all-demos'); + var doResize = function() { + var windowHeight = Ext.getDoc().getViewSize(false).height; - Ext.fly('hideWarning').on('click', function() { - Ext.fly(newEl).slideOut('t',{remove:true}); - cp.set('hideFBWarning', true); - doResize(); - }); - Ext.fly(newEl).slideIn(); - doResize(); - } - } + var footerHeight = footerEl.getHeight() + footerEl.getMargins().top, + titleElHeight = titleEl.getHeight() + titleEl.getMargins().top, + headerHeight = headerEl.getHeight() + titleElHeight; - var hideMask = function () { - Ext.get('loading').remove(); - Ext.fly('loading-mask').fadeOut({ - remove:true, - callback : firebugWarning - }); - } + var warnEl = Ext.get('fb'); + var warnHeight = warnEl ? warnEl.getHeight() : 0; + + var availHeight = windowHeight - ( footerHeight + headerHeight + 14) - warnHeight; + var sideBoxHeight = sideBoxEl.getHeight(); + + panel.setHeight((availHeight > sideBoxHeight) ? availHeight : sideBoxHeight); + }; + + // Resize on demand + Ext.EventManager.onWindowResize(doResize); + + var firebugWarning = function () { + var cp = new Ext.state.CookieProvider(); - hideMask.defer(250); - doResize(); + if(window.console && window.console.firebug && ! cp.get('hideFBWarning')){ + var tpl = new Ext.Template( + '' + ); + var newEl = tpl.insertFirst('all-demos'); + + Ext.fly('hideWarning').on('click', function() { + Ext.fly(newEl).slideOut('t',{remove:true}); + cp.set('hideFBWarning', true); + doResize(); + }); + Ext.fly(newEl).slideIn(); + doResize(); + } + }; + + var hideMask = function () { + Ext.get('loading').remove(); + Ext.fly('loading-mask').fadeOut({ + remove:true, + callback : firebugWarning + }); + }; + hideMask.defer(250); + doResize(); + }).defer(500); }); \ No newline at end of file