summaryrefslogtreecommitdiff
path: root/skins/jason/main.js
blob: 00c62f6c65184b17e2dbb5c436f0b0c859ccaabf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/*
 * jason - Javascript based skin for xxv
 * Copyright(c) 2008-2012, anbr
 * 
 * http://projects.vdr-developer.org/projects/xxv
 *
 */

var XXV = {
};

Ext.Component.prototype.stateful = false;

Ext.onReady(function(){

    Ext.BLANK_IMAGE_URL = 'extjs/resources/images/default/s.gif';
    Ext.QuickTips.init();
    Ext.state.Manager.setProvider(new Ext.state.CookieProvider(
        {
           // state: Ext.appState,
           expires: new Date(new Date().getTime()+(1000*3600*24*365))
        }));
    Ext.History.init();

    var tpl = Ext.Template.from('preview-tpl', {
        compiled:true
        ,getTitle : function(v, all){
                        var title = v || all.title;
                        if(!all.subtitle) {
                          var Woerter = title.split("~");
                          if(Woerter.length > 1) {
                            /*var subtitle = */Woerter.pop();
                            return Woerter.join('~');
                          }
                        }
                        return title;
        }
        ,getSubtitle : function(v, all){
                        var subtitle = v || all.subtitle;
                        if(!subtitle) {
                          var Woerter = all.title.split("~");
                          if(Woerter.length > 1) {
                            return ' - ' + Woerter.pop();
                          }
                          return ' ';
                        }
                        return ' - ' + subtitle;
        }
        ,getChannel : function(v, all){
                        var channel = v || all.channel;
                        if(!channel) {
                          return ' ';
                        }
                        return channel;

        }
        ,getBody : function(v, all){
            return Ext.util.Format.stripScripts(v || all.description).replace(/\r\n/g, '<br />');
        }
        ,getFooter : function(v, all){
            return Ext.util.Format.stripScripts(v || all.footer || "").replace(/\r\n/g, '<br />');
        }
    });
    XXV.getTemplate = function(){
        return tpl;
    };

    XXV.help = new Ext.xxv.help();
    XXV.side = new Ext.xxv.channelsPanel();
    XXV.tab = new Ext.xxv.tabPanel();
    XXV.menu = new Ext.xxv.MainMenu();

    XXV.viewport = new Ext.Viewport({
        id:"masterlayout",
        layout:'border',
        items:[
            XXV.menu,
            XXV.side,
            XXV.tab
         ]
    });

    // Handle this change event in order to restore the UI to the appropriate history state
    Ext.History.on('change', function(token){
        if(!token){
          token = 'n';
        }
        XXV.tab.openTab(token);
    });

    XXV.tab.on('tabchange', function(tp, tab){
        Ext.xxv.Panel.prototype.DocumentTitle(tab.title);
        Ext.History.add(tab.id);
    });

    XXV.viewport.doLayout();

	  setTimeout(function(){
          var l = Ext.get('loading'); 
          if(l) {
            l.remove();
          }
          var m = Ext.get('loading-mask'); 
          if(m) {
            m.fadeOut({remove:true});
          }
    }, 250);


});