source: trunk/web/addons/job_monarch/lib/extjs-30/examples/shared/examples.js @ 625

Last change on this file since 625 was 625, checked in by ramonb, 15 years ago

lib/extjs-30:

  • new ExtJS 3.0
File size: 4.3 KB
Line 
1/*!
2 * Ext JS Library 3.0.0
3 * Copyright(c) 2006-2009 Ext JS, LLC
4 * licensing@extjs.com
5 * http://www.extjs.com/license
6 */
7Ext.BLANK_IMAGE_URL = '../../resources/images/default/s.gif';
8
9Ext.example = function(){
10    var msgCt;
11
12    function createBox(t, s){
13        return ['<div class="msg">',
14                '<div class="x-box-tl"><div class="x-box-tr"><div class="x-box-tc"></div></div></div>',
15                '<div class="x-box-ml"><div class="x-box-mr"><div class="x-box-mc"><h3>', t, '</h3>', s, '</div></div></div>',
16                '<div class="x-box-bl"><div class="x-box-br"><div class="x-box-bc"></div></div></div>',
17                '</div>'].join('');
18    }
19    return {
20        msg : function(title, format){
21            if(!msgCt){
22                msgCt = Ext.DomHelper.insertFirst(document.body, {id:'msg-div'}, true);
23            }
24            msgCt.alignTo(document, 't-t');
25            var s = String.format.apply(String, Array.prototype.slice.call(arguments, 1));
26            var m = Ext.DomHelper.append(msgCt, {html:createBox(title, s)}, true);
27            m.slideIn('t').pause(1).ghost("t", {remove:true});
28        },
29
30        init : function(){
31            /*
32            var t = Ext.get('exttheme');
33            if(!t){ // run locally?
34                return;
35            }
36            var theme = Cookies.get('exttheme') || 'aero';
37            if(theme){
38                t.dom.value = theme;
39                Ext.getBody().addClass('x-'+theme);
40            }
41            t.on('change', function(){
42                Cookies.set('exttheme', t.getValue());
43                setTimeout(function(){
44                    window.location.reload();
45                }, 250);
46            });*/
47
48            var lb = Ext.get('lib-bar');
49            if(lb){
50                lb.show();
51            }
52        }
53    };
54}();
55
56Ext.example.shortBogusMarkup = '<p>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.';
57Ext.example.bogusMarkup = '<p>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.<br/><br/>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.</p>';
58
59Ext.onReady(Ext.example.init, Ext.example);
60
61
62// old school cookie functions
63var Cookies = {};
64Cookies.set = function(name, value){
65     var argv = arguments;
66     var argc = arguments.length;
67     var expires = (argc > 2) ? argv[2] : null;
68     var path = (argc > 3) ? argv[3] : '/';
69     var domain = (argc > 4) ? argv[4] : null;
70     var secure = (argc > 5) ? argv[5] : false;
71     document.cookie = name + "=" + escape (value) +
72       ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
73       ((path == null) ? "" : ("; path=" + path)) +
74       ((domain == null) ? "" : ("; domain=" + domain)) +
75       ((secure == true) ? "; secure" : "");
76};
77
78Cookies.get = function(name){
79        var arg = name + "=";
80        var alen = arg.length;
81        var clen = document.cookie.length;
82        var i = 0;
83        var j = 0;
84        while(i < clen){
85                j = i + alen;
86                if (document.cookie.substring(i, j) == arg)
87                        return Cookies.getCookieVal(j);
88                i = document.cookie.indexOf(" ", i) + 1;
89                if(i == 0)
90                        break;
91        }
92        return null;
93};
94
95Cookies.clear = function(name) {
96  if(Cookies.get(name)){
97    document.cookie = name + "=" +
98    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
99  }
100};
101
102Cookies.getCookieVal = function(offset){
103   var endstr = document.cookie.indexOf(";", offset);
104   if(endstr == -1){
105       endstr = document.cookie.length;
106   }
107   return unescape(document.cookie.substring(offset, endstr));
108};
Note: See TracBrowser for help on using the repository browser.