From: pablozg Date: Thu, 13 Sep 2018 21:45:58 +0000 (+0200) Subject: Change search icons to a combobox and fix search string in Thedbtv site X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=35155842f0218695bb7e9f68b857038288e53102;p=thirdparty%2Ftvheadend.git Change search icons to a combobox and fix search string in Thedbtv site --- diff --git a/src/webui/static/app/dvr.js b/src/webui/static/app/dvr.js index 09db21628..7a623658b 100644 --- a/src/webui/static/app/dvr.js +++ b/src/webui/static/app/dvr.js @@ -118,27 +118,36 @@ tvheadend.dvrDetails = function(uuid) { var buttons = []; - buttons.push(new Ext.Button({ - handler: searchIMDB, - iconCls: 'imdb', - tooltip: _('Search IMDB (for title)'), - })); - - buttons.push(new Ext.Button({ - handler: searchTheTVDB, - iconCls: 'thetvdb', - tooltip: _('Search TheTVDB (for title)'), - })); - - function searchIMDB() { - window.open('http://akas.imdb.com/find?q=' + - encodeURIComponent(title), '_blank'); - } + var comboGetInfo = new Ext.form.ComboBox({ + store: new Ext.data.ArrayStore({ + data: [ + [1, 'Find info from IMDB', 'imdb.png'], + [2, 'Find info from TheTVDB', 'thetvdb.png'], + [3, 'Find info from FilmAffinity', 'filmaffinity.png'], + ], + id: 0, + fields: ['value', 'text', 'url'] + }), + triggerAction: 'all', + mode: 'local', + tpl : '' + + '
  {text}
' + + '
', + emptyText:'Find info from ...', + valueField: 'value', + displayField: 'text', + width: 160, + forceSelection : true, + editable: false, + listeners: { + select: function(combo, records, index) { + tvheadend.seachTitleWeb(combo.getValue(), title); + } + }, + }); - function searchTheTVDB(){ - window.open('http://thetvdb.com/?string='+ - encodeURIComponent(title)+'&searchseriesid=&tab=listseries&function=Search','_blank'); - } + if (title) + buttons.push(comboGetInfo); var windowHeight = Ext.getBody().getViewSize().height - 150; diff --git a/src/webui/static/app/epg.js b/src/webui/static/app/epg.js index 0a3f5afc1..56105e8ab 100644 --- a/src/webui/static/app/epg.js +++ b/src/webui/static/app/epg.js @@ -104,6 +104,25 @@ tvheadend.durationLookupRange = function(value) { return durationString; }; +tvheadend.seachTitleWeb = function(index, title){ + switch(index){ + case 1: + window.open('http://akas.imdb.com/find?q=' + encodeURIComponent(title), '_blank'); + break; + case 2: + window.open('https://www.thetvdb.com/search?q='+ encodeURIComponent(title)+'&l=en','_blank'); + break; + case 3: + window.open(tvheadend.filmAffinityLanguage() + encodeURIComponent(title), '_blank'); + break; + } +}; + +tvheadend.filmAffinityLanguage = function() { + if (tvh_locale_lang.search("es") !== -1) return 'https://www.filmaffinity.com/es/search.php?stext='; + else return 'https://www.filmaffinity.com/en/search.php?stext='; +}; + tvheadend.epgDetails = function(event) { var content = ''; @@ -210,19 +229,36 @@ tvheadend.epgDetails = function(event) { var recording = event.dvrState.indexOf('recording') === 0; var scheduled = event.dvrState.indexOf('scheduled') === 0; - buttons.push(new Ext.Button({ - disabled: !event.title, - handler: searchIMDB, - iconCls: 'imdb', - tooltip: _('Search IMDB (for title)'), - })); + var comboGetInfo = new Ext.form.ComboBox({ + store: new Ext.data.ArrayStore({ + data: [ + [1, 'Find info from IMDB', 'imdb.png'], + [2, 'Find info from TheTVDB', 'thetvdb.png'], + [3, 'Find info from FilmAffinity', 'filmaffinity.png'], + ], + id: 0, + fields: ['value', 'text', 'url'] + }), + triggerAction: 'all', + mode: 'local', + tpl : '' + + '
  {text}
' + + '
', + emptyText:'Find info from ...', + valueField: 'value', + displayField: 'text', + width: 160, + forceSelection : true, + editable: false, + listeners: { + select: function(combo, records, index) { + tvheadend.seachTitleWeb(combo.getValue(), event.title); + } + }, + }); - buttons.push(new Ext.Button({ - disabled: !event.title, - handler: searchTheTVDB, - iconCls: 'thetvdb', - tooltip: _('Search TheTVDB (for title)'), - })); + if (event.title) + buttons.push(comboGetInfo); buttons.push(new Ext.Button({ disabled: event.start > now || event.stop < now, @@ -320,16 +356,6 @@ tvheadend.epgDetails = function(event) { }); win.show(); - function searchIMDB() { - window.open('http://akas.imdb.com/find?q=' + - encodeURIComponent(event.title), '_blank'); - } - - function searchTheTVDB(){ - window.open('http://thetvdb.com/?string='+ - encodeURIComponent(event.title)+'&searchseriesid=&tab=listseries&function=Search','_blank'); - } - function playProgram() { var title = event.title; if (event.episodeOnscreen) diff --git a/src/webui/static/icons/filmaffinity.png b/src/webui/static/icons/filmaffinity.png new file mode 100644 index 000000000..3671f4723 Binary files /dev/null and b/src/webui/static/icons/filmaffinity.png differ