X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/d41dc04ad17d1d9125fb2cf72db2b4782dbe3a8c..76cb34406ceaf9681a76e13b531d7eafa483ad88:/examples/shared/examples.js diff --git a/examples/shared/examples.js b/examples/shared/examples.js index f1759a3b..95d3840f 100644 --- a/examples/shared/examples.js +++ b/examples/shared/examples.js @@ -1,109 +1,108 @@ -/* - * Ext JS Library 2.2.1 - * Copyright(c) 2006-2009, Ext JS, LLC. - * licensing@extjs.com - * - * http://extjs.com/license - */ - -Ext.BLANK_IMAGE_URL = '../../resources/images/default/s.gif'; - -Ext.example = function(){ - var msgCt; - - function createBox(t, s){ - return ['
', - '
', - '

', t, '

', s, '
', - '
', - '
'].join(''); - } - return { - msg : function(title, format){ - if(!msgCt){ - msgCt = Ext.DomHelper.insertFirst(document.body, {id:'msg-div'}, true); - } - msgCt.alignTo(document, 't-t'); - var s = String.format.apply(String, Array.prototype.slice.call(arguments, 1)); - var m = Ext.DomHelper.append(msgCt, {html:createBox(title, s)}, true); - m.slideIn('t').pause(1).ghost("t", {remove:true}); - }, - - init : function(){ - var t = Ext.get('exttheme'); - if(!t){ // run locally? - return; - } - var theme = Cookies.get('exttheme') || 'aero'; - if(theme){ - t.dom.value = theme; - Ext.getBody().addClass('x-'+theme); - } - t.on('change', function(){ - Cookies.set('exttheme', t.getValue()); - setTimeout(function(){ - window.location.reload(); - }, 250); - }); - - var lb = Ext.get('lib-bar'); - if(lb){ - lb.show(); - } - } - }; -}(); - -Ext.example.shortBogusMarkup = '

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed metus nibh, sodales a, porta at, vulputate eget, dui. Pellentesque ut nisl. Maecenas tortor turpis, interdum non, sodales non, iaculis ac, lacus. Vestibulum auctor, tortor quis iaculis malesuada, libero lectus bibendum purus, sit amet tincidunt quam turpis vel lacus. In pellentesque nisl non sem. Suspendisse nunc sem, pretium eget, cursus a, fringilla vel, urna.'; -Ext.example.bogusMarkup = '

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed metus nibh, sodales a, porta at, vulputate eget, dui. Pellentesque ut nisl. Maecenas tortor turpis, interdum non, sodales non, iaculis ac, lacus. Vestibulum auctor, tortor quis iaculis malesuada, libero lectus bibendum purus, sit amet tincidunt quam turpis vel lacus. In pellentesque nisl non sem. Suspendisse nunc sem, pretium eget, cursus a, fringilla vel, urna.

Aliquam commodo ullamcorper erat. Nullam vel justo in neque porttitor laoreet. Aenean lacus dui, consequat eu, adipiscing eget, nonummy non, nisi. Morbi nunc est, dignissim non, ornare sed, luctus eu, massa. Vivamus eget quam. Vivamus tincidunt diam nec urna. Curabitur velit.

'; - -Ext.onReady(Ext.example.init, Ext.example); - - -// old school cookie functions -var Cookies = {}; -Cookies.set = function(name, value){ - var argv = arguments; - var argc = arguments.length; - var expires = (argc > 2) ? argv[2] : null; - var path = (argc > 3) ? argv[3] : '/'; - var domain = (argc > 4) ? argv[4] : null; - var secure = (argc > 5) ? argv[5] : false; - document.cookie = name + "=" + escape (value) + - ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + - ((path == null) ? "" : ("; path=" + path)) + - ((domain == null) ? "" : ("; domain=" + domain)) + - ((secure == true) ? "; secure" : ""); -}; - -Cookies.get = function(name){ - var arg = name + "="; - var alen = arg.length; - var clen = document.cookie.length; - var i = 0; - var j = 0; - while(i < clen){ - j = i + alen; - if (document.cookie.substring(i, j) == arg) - return Cookies.getCookieVal(j); - i = document.cookie.indexOf(" ", i) + 1; - if(i == 0) - break; - } - return null; -}; - -Cookies.clear = function(name) { - if(Cookies.get(name)){ - document.cookie = name + "=" + - "; expires=Thu, 01-Jan-70 00:00:01 GMT"; - } -}; - -Cookies.getCookieVal = function(offset){ - var endstr = document.cookie.indexOf(";", offset); - if(endstr == -1){ - endstr = document.cookie.length; - } - return unescape(document.cookie.substring(offset, endstr)); +/*! + * Ext JS Library 3.0.0 + * Copyright(c) 2006-2009 Ext JS, LLC + * licensing@extjs.com + * http://www.extjs.com/license + */ +Ext.BLANK_IMAGE_URL = '../../resources/images/default/s.gif'; + +Ext.example = function(){ + var msgCt; + + function createBox(t, s){ + return ['
', + '
', + '

', t, '

', s, '
', + '
', + '
'].join(''); + } + return { + msg : function(title, format){ + if(!msgCt){ + msgCt = Ext.DomHelper.insertFirst(document.body, {id:'msg-div'}, true); + } + msgCt.alignTo(document, 't-t'); + var s = String.format.apply(String, Array.prototype.slice.call(arguments, 1)); + var m = Ext.DomHelper.append(msgCt, {html:createBox(title, s)}, true); + m.slideIn('t').pause(1).ghost("t", {remove:true}); + }, + + init : function(){ + /* + var t = Ext.get('exttheme'); + if(!t){ // run locally? + return; + } + var theme = Cookies.get('exttheme') || 'aero'; + if(theme){ + t.dom.value = theme; + Ext.getBody().addClass('x-'+theme); + } + t.on('change', function(){ + Cookies.set('exttheme', t.getValue()); + setTimeout(function(){ + window.location.reload(); + }, 250); + });*/ + + var lb = Ext.get('lib-bar'); + if(lb){ + lb.show(); + } + } + }; +}(); + +Ext.example.shortBogusMarkup = '

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed metus nibh, sodales a, porta at, vulputate eget, dui. Pellentesque ut nisl. Maecenas tortor turpis, interdum non, sodales non, iaculis ac, lacus. Vestibulum auctor, tortor quis iaculis malesuada, libero lectus bibendum purus, sit amet tincidunt quam turpis vel lacus. In pellentesque nisl non sem. Suspendisse nunc sem, pretium eget, cursus a, fringilla vel, urna.'; +Ext.example.bogusMarkup = '

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed metus nibh, sodales a, porta at, vulputate eget, dui. Pellentesque ut nisl. Maecenas tortor turpis, interdum non, sodales non, iaculis ac, lacus. Vestibulum auctor, tortor quis iaculis malesuada, libero lectus bibendum purus, sit amet tincidunt quam turpis vel lacus. In pellentesque nisl non sem. Suspendisse nunc sem, pretium eget, cursus a, fringilla vel, urna.

Aliquam commodo ullamcorper erat. Nullam vel justo in neque porttitor laoreet. Aenean lacus dui, consequat eu, adipiscing eget, nonummy non, nisi. Morbi nunc est, dignissim non, ornare sed, luctus eu, massa. Vivamus eget quam. Vivamus tincidunt diam nec urna. Curabitur velit.

'; + +Ext.onReady(Ext.example.init, Ext.example); + + +// old school cookie functions +var Cookies = {}; +Cookies.set = function(name, value){ + var argv = arguments; + var argc = arguments.length; + var expires = (argc > 2) ? argv[2] : null; + var path = (argc > 3) ? argv[3] : '/'; + var domain = (argc > 4) ? argv[4] : null; + var secure = (argc > 5) ? argv[5] : false; + document.cookie = name + "=" + escape (value) + + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + + ((path == null) ? "" : ("; path=" + path)) + + ((domain == null) ? "" : ("; domain=" + domain)) + + ((secure == true) ? "; secure" : ""); +}; + +Cookies.get = function(name){ + var arg = name + "="; + var alen = arg.length; + var clen = document.cookie.length; + var i = 0; + var j = 0; + while(i < clen){ + j = i + alen; + if (document.cookie.substring(i, j) == arg) + return Cookies.getCookieVal(j); + i = document.cookie.indexOf(" ", i) + 1; + if(i == 0) + break; + } + return null; +}; + +Cookies.clear = function(name) { + if(Cookies.get(name)){ + document.cookie = name + "=" + + "; expires=Thu, 01-Jan-70 00:00:01 GMT"; + } +}; + +Cookies.getCookieVal = function(offset){ + var endstr = document.cookie.indexOf(";", offset); + if(endstr == -1){ + endstr = document.cookie.length; + } + return unescape(document.cookie.substring(offset, endstr)); }; \ No newline at end of file