Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
webui: replace 'Play' text with the play image for channels / service…
…s / DVR, cleanups
  • Loading branch information
perexg committed May 5, 2016
1 parent c8c8736 commit eb067e2
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 12 deletions.
3 changes: 1 addition & 2 deletions src/webui/static/app/chconf.js
Expand Up @@ -234,8 +234,7 @@ tvheadend.channel_tab = function(panel, index)
if (r.data['number'])
title += r.data['number'] + ' : ';
title += r.data['name'];
return "<a href='play/stream/channel/" + r.id +
"?title=" + encodeURIComponent(title) + "'>" + _('Play') + "</a>";
return tvheadend.playLink('play/stream/channel/' + r.id, title);
}
}
],
Expand Down
6 changes: 2 additions & 4 deletions src/webui/static/app/dvr.js
Expand Up @@ -451,8 +451,7 @@ tvheadend.dvr_finished = function(panel, index) {
var title = r.data['disp_title'];
if (r.data['episode'])
title += ' / ' + r.data['episode'];
return '<a href="play/dvrfile/' + r.id +
'?title=' + encodeURIComponent(title) + '">' + _('Play') + '</a>';
return tvheadend.playLink('play/dvrfile/' + r.id, title);
}
}],
tbar: [downloadButton, rerecordButton, moveButton],
Expand Down Expand Up @@ -589,8 +588,7 @@ tvheadend.dvr_failed = function(panel, index) {
var title = r.data['disp_title'];
if (r.data['episode'])
title += ' / ' + r.data['episode'];
return '<a href="play/dvrfile/' + r.id +
'?title=' + encodeURIComponent(title) + '">' + _('Play') + '</a>';
return tvheadend.playLink('play/dvrfile/' + r.id, title);
}
}],
tbar: [downloadButton, rerecordButton, moveButton],
Expand Down
7 changes: 7 additions & 0 deletions src/webui/static/app/ext.css
Expand Up @@ -984,6 +984,13 @@
font-weight: bold;
}

.playlink {
margin: -1px;
width: 14px;
height: 14px;
cursor: pointer;
}

/** vim: ts=4:sw=4:nu:fdc=4:nospell
*
* Ext.ux.grid.RowActions.css
Expand Down
18 changes: 12 additions & 6 deletions src/webui/static/app/mpegts.js
Expand Up @@ -121,9 +121,12 @@ tvheadend.muxes = function(panel, index)
header: _('Play'),
tooltip: _('Play'),
renderer: function(v, o, r) {
var title = r.data['name'] + ' / ' + r.data['network'];
return "<a href='play/stream/mux/" + r.id +
"?title=" + encodeURIComponent(title) + "'>" + _("Play") + "</a>";
var title = r.data['name'];
if (r.data['network']) {
if (title) title += ' / ';
title += r.data['network'];
}
return tvheadend.playLink('play/stream/mux/' + r.id, title);
}
}
],
Expand Down Expand Up @@ -317,9 +320,12 @@ tvheadend.services = function(panel, index)
header: _('Play'),
tooltip: _('Play'),
renderer: function(v, o, r) {
var title = r.data['svcname'] + ' / ' + r.data['provider'];
return "<a href='play/stream/service/" + r.id +
"?title=" + encodeURIComponent(title) + "'>" + _('Play') + "</a>";
var title = r.data['svcname'];
if (r.data['provider']) {
if (title) title += ' / ';
title += r.data['provider'];
}
return tvheadend.playLink('play/stream/service/' + r.id, title);
}
},
{
Expand Down
10 changes: 10 additions & 0 deletions src/webui/static/app/tvheadend.js
Expand Up @@ -417,6 +417,16 @@ tvheadend.niceDate = function(dt) {
'<div class="x-nice-time">' + d.toLocaleTimeString() + '</div>';
}

/*
*
*/
tvheadend.playLink = function(link, title) {
if (title) title = '?title=' + encodeURIComponent(title);
return '<a href="' + link + title + '">' +
'<img src="static/icons/control_play.png" class="playlink" title="' +
_('Play this stream') + '" alt="' + _('Play') + '"/></a>';
}

/**
* Displays a mediaplayer using the html5 video element
*/
Expand Down

0 comments on commit eb067e2

Please sign in to comment.