Project

General

Profile

Feature #5077 » labelFormatting.diff

Pablo Zerón, 2018-04-18 13:15

View differences:

src/webui/static/app/dvr.js
5 5
/**
6 6
 *
7 7
 */
8

  
9
// Function to support some of the label formatting used with kodi
10
tvheadend.labelFormatting = function(description) {
11
    return description.replace(/\[COLOR\s(.*?)\]/g, '<font style="color:$1">')
12
                      .replace(/\[\/COLOR\]/g, '<\/font>')
13
                      .replace(/\[B\]/g, '<b>')
14
                      .replace(/\[\/B\]/g, '<\/b>')
15
                      .replace(/\[I\]/g, '<i>')
16
                      .replace(/\[CR\]/g, '<br>')
17
                      .replace(/\[\/I\]/g, '<\/i>')
18
                      .replace(/(?<=\[UPPERCASE\])(.*)(?=\[\/UPPERCASE\])/g, function(match) {return match.toUpperCase();})
19
                      .replace(/\[UPPERCASE\]/g, '')
20
                      .replace(/\[\/UPPERCASE\]/g, '')
21
                      .replace(/(?<=\[LOWERCASE\])(.*)(?=\[\/LOWERCASE\])/g, function(match) {return match.toLowerCase();})
22
                      .replace(/\[LOWERCASE\]/g, '')
23
                      .replace(/\[\/LOWERCASE\]/g, '')
24
                      .replace(/(?<=\[CAPITALIZE\])(.*)(?=\[\/CAPITALIZE\])/g, function(match) {return match.split(/\s+/).map(w => w[0].toUpperCase() + w.slice(1)).join(' ');})
25
                      .replace(/\[CAPITALIZE\]/g, '')
26
                      .replace(/\[\/CAPITALIZE\]/g, '');
27
};
28

  
8 29
tvheadend.dvrDetails = function(uuid) {
9 30

  
10 31
    function showit(d) {
......
79 100
        if (summary && (!subtitle || subtitle != summary))
80 101
            content += '<div class="x-epg-summary">' + summary + '</div>';
81 102
        if (desc) {
82
            content += '<div class="x-epg-desc">' + desc + '</div>';
103
            content += '<div class="x-epg-desc">' + tvheadend.labelFormatting(desc) + '</div>';
83 104
            content += '<hr class="x-epg-hr"/>';
84 105
        }
85 106
        content += tvheadend.getDisplayCredits(credits);
......
124 145
                        encodeURIComponent(title)+'&searchseriesid=&tab=listseries&function=Search','_blank');
125 146
        }
126 147

  
148
        var windowHeight = Ext.getBody().getViewSize().height - 100;
149

  
127 150
        var win = new Ext.Window({
128 151
            title: title,
129 152
            iconCls: 'info',
130 153
            layout: 'fit',
131 154
            width: 650,
132
            height: 450,
155
            height: windowHeight, //450
133 156
            constrainHeader: true,
134 157
            buttonAlign: 'center',
158
            autoScroll: true,
135 159
            buttons: buttons,
136 160
            html: content
137 161
        });
src/webui/static/app/epg.js
152 152
    if (event.summary)
153 153
      content += '<div class="x-epg-summary">' + event.summary + '</div>';
154 154
    if (event.description)
155
      content += '<div class="x-epg-desc">' + event.description + '</div>';
155
      content += '<div class="x-epg-desc">' + tvheadend.labelFormatting(event.description) + '</div>';
156 156
    if (event.summary || event.description)
157 157
      content += '<hr class="x-epg-hr"/>';
158 158
    content += tvheadend.getDisplayCredits(event.credits);
......
304 304

  
305 305
    }
306 306

  
307
    var windowHeight = Ext.getBody().getViewSize().height - 100;
308

  
307 309
    var win = new Ext.Window({
308 310
        title: _('Broadcast Details'),
309 311
        iconCls: 'broadcast_details',
310 312
        layout: 'fit',
311 313
        width: 675,
312
        height: 450,
314
        height: windowHeight, //450
313 315
        constrainHeader: true,
314 316
        buttons: buttons,
315 317
        buttonAlign: 'center',
(3-3/4)