From c053acd84e5cc48a3e70047f228728bf039cfacd Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 31 Oct 2014 16:40:10 +0100 Subject: [PATCH] WEBUI JS: EPG - moved IMDB search to a button, add play button handler --- src/webui/static/app/epg.js | 33 +++++++++++++++++++++++---------- src/webui/static/app/ext.css | 4 ++++ src/webui/static/icons/find.png | 1 + 3 files changed, 28 insertions(+), 10 deletions(-) create mode 120000 src/webui/static/icons/find.png diff --git a/src/webui/static/app/epg.js b/src/webui/static/app/epg.js index f12df975..2a0ed443 100644 --- a/src/webui/static/app/epg.js +++ b/src/webui/static/app/epg.js @@ -120,19 +120,10 @@ tvheadend.epgDetails = function(event) { content += '
Content Type: ' + genre.join(', ') + '
'; } - content += '
Search IMDB
'; content += ''; content += '
'; - now = new Date(); - if (event.start < now && event.stop > now) { - var title = event.title; - if (event.episodeOnscreen) - title += ' / ' + event.episodeOnscreen; - content += '
Play
'; - } - + var now = new Date(); var buttons = []; if (tvheadend.accessUpdate.dvr) { @@ -155,6 +146,15 @@ tvheadend.epgDetails = function(event) { store.load(); buttons.push(new Ext.Button({ + disabled: !event.title, + handler: searchIMDB, + iconCls: 'find', + tooltip: 'Search IMDB (for title)', + text: "Search IMDB" + })); + + buttons.push(new Ext.Button({ + disabled: event.start > now || event.stop < now, handler: playProgram, iconCls: 'control_play', tooltip: 'Play this program', @@ -211,6 +211,19 @@ tvheadend.epgDetails = function(event) { }); win.show(); + function searchIMDB() { + window.open('http://akas.imdb.com/find?q=' + + encodeURIComponent(event.title), '_blank'); + } + + function playProgram() { + var title = event.title; + if (event.episodeOnscreen) + title += ' / ' + event.episodeOnscreen; + window.open('play/stream/channel/' + event.channelUuid + + '?title=' + encodeURIComponent(title), '_blank'); + } + function recordEvent() { record('api/dvr/entry/create_by_event'); } diff --git a/src/webui/static/app/ext.css b/src/webui/static/app/ext.css index 045e5ad5..7f6db7ba 100644 --- a/src/webui/static/app/ext.css +++ b/src/webui/static/app/ext.css @@ -154,6 +154,10 @@ font-style: italic; } +.find { + background-image: url(../icons/find.png) !important; +} + .add { background-image: url(../icons/add.png) !important; } diff --git a/src/webui/static/icons/find.png b/src/webui/static/icons/find.png new file mode 120000 index 00000000..e3fbe40d --- /dev/null +++ b/src/webui/static/icons/find.png @@ -0,0 +1 @@ +../../../../vendor/famfamsilk/find.png \ No newline at end of file