From 6607068f8f8892dfa9d18f505894f0b39416d11d Mon Sep 17 00:00:00 2001 From: Jason Dorweiler Date: Sun, 1 Jun 2014 08:12:56 -0400 Subject: [PATCH 1/9] guidebox: convert to media template --- share/spice/guidebox/getid/buy.handlebars | 15 ++ share/spice/guidebox/getid/guidebox_getid.css | 49 +--- .../guidebox/getid/guidebox_getid.handlebars | 9 - share/spice/guidebox/getid/guidebox_getid.js | 209 ++++++++---------- .../getid/guidebox_getid_details.handlebars | 15 -- 5 files changed, 110 insertions(+), 187 deletions(-) create mode 100644 share/spice/guidebox/getid/buy.handlebars delete mode 100644 share/spice/guidebox/getid/guidebox_getid.handlebars delete mode 100644 share/spice/guidebox/getid/guidebox_getid_details.handlebars diff --git a/share/spice/guidebox/getid/buy.handlebars b/share/spice/guidebox/getid/buy.handlebars new file mode 100644 index 0000000000..9cfd16f258 --- /dev/null +++ b/share/spice/guidebox/getid/buy.handlebars @@ -0,0 +1,15 @@ +
+

+ Watch Now + {{#guideBox_checkSeason season_number episode_number}} + {{{episode_name}}} (Season {{season_number}}, #{{episode_number}}) + {{/guideBox_checkSeason}} + {{#unless is_free_web}} Paid Content{{/unless}} +

+ +

+ {{overview}} +

+ + Originally aired {{guideBox_getDate first_aired}} on {{guideBox_getNetwork}} +
\ No newline at end of file diff --git a/share/spice/guidebox/getid/guidebox_getid.css b/share/spice/guidebox/getid/guidebox_getid.css index 1063b1ca34..3d5db28f8a 100644 --- a/share/spice/guidebox/getid/guidebox_getid.css +++ b/share/spice/guidebox/getid/guidebox_getid.css @@ -1,48 +1,7 @@ -.zci--guidebox li.ddgc_item img { - max-width: 100% !important; - max-height: 68px !important; +.detail--guidebox .red { + color: #B57367; } -.zci--guidebox div.image_wrap { - position: relative; -} - -.zci--guidebox .gb_info { - white-space: nowrap; - word-wrap: break-word; - text-overflow: ellipsis; - overflow: hidden; - margin: 0px !important -} - -.zci--guidebox .button { - display: inline-block; - border-radius: 3px; - padding: 3px 9px; - background: #fefefe; - border: 1px solid #bbb; - color: black; - margin-right: 10px; -} - -.zci--guidebox .button:hover { - border: 1px solid #80b5ff; - cursor: pointer; - text-decoration: none; -} - -.zci--guidebox #ddgc_detail p { - margin-bottom: 10px; -} - -.zci--guidebox .grey { - color: grey; -} - -.zci--guidebox .red { - color: #B57367 -} - -.zci--guidebox .small { - font-size: 13px; +.detail--guidebox .small { + font-size: 0.98em; } \ No newline at end of file diff --git a/share/spice/guidebox/getid/guidebox_getid.handlebars b/share/spice/guidebox/getid/guidebox_getid.handlebars deleted file mode 100644 index 95dcfe064f..0000000000 --- a/share/spice/guidebox/getid/guidebox_getid.handlebars +++ /dev/null @@ -1,9 +0,0 @@ -
- -
- - {{#checkSeason season_number episode_number}} - Season {{season_number}}, Ep. {{episode_number}} - {{/checkSeason}} - {{{episode_name}}} - \ No newline at end of file diff --git a/share/spice/guidebox/getid/guidebox_getid.js b/share/spice/guidebox/getid/guidebox_getid.js index 772f600b1e..a488e2dce4 100644 --- a/share/spice/guidebox/getid/guidebox_getid.js +++ b/share/spice/guidebox/getid/guidebox_getid.js @@ -1,141 +1,114 @@ -function ddg_spice_guidebox_getid (api_result) { +(function(env) { "use strict"; + env.ddg_spice_guidebox_getid = function(api_result) { - if (!api_result.results) { - return; - } + if (!api_result || !api_result.results) { + return Spice.failed('guidebox'); + } - var SKIP_ARRAY = ["online","tv","episode","episodes","free","guidebox","watch","full"], - results = api_result.results.result, - relevant; + var SKIP_ARRAY = ["online","tv","episode","episodes","free","guidebox","watch","full"], + results = api_result.results.result, relevant; - // Check which show is relevant to our query. - $.each(results, function(key, result) { - if (DDG.isRelevant(result.title, SKIP_ARRAY, 3) && !relevant) { - relevant = result; + // Check which show is relevant to our query. + $.each(results, function(key, result) { + if (DDG.isRelevant(result.title, SKIP_ARRAY, 3) && !relevant) { + relevant = result; + } + }); + + // Exit if we didn't find anything relevant. + if (!relevant) { + return; } - }); - // Exit if we didn't find anything relevant. - if (!relevant) { - return; + // Prevent jQuery from appending "_={timestamp}" in our url. + $.ajaxSetup({ + cache: true + }); + + var metadata = { + res_title : relevant.title, + network : relevant.network, + more : relevant.url + }; + + ddg_spice_guidebox_getid.metadata = metadata; + $.getScript("/js/spice/guidebox/lastshows/series/" + relevant.id); } - // Prevent jQuery from appending "_={timestamp}" in our url. - $.ajaxSetup({ - cache: true - }); + env.ddg_spice_guidebox_lastshows = function (api_result) { - var script = $('[src*="/js/spice/guidebox/getid/"]')[0], - source = decodeURIComponent($(script).attr("src")), - matched = source.match(/\/js\/spice\/guidebox\/getid\/([a-zA-Z0-9\s]+)/), - query = matched[1]; + if(!api_result){ + return Spice.failed('guidebox'); + } - var metadata = { - res_title : relevant.title, - network : relevant.network, - more : relevant.url, - query : query, - }; - - ddg_spice_guidebox_getid.metadata = metadata; - $.getScript("/js/spice/guidebox/lastshows/series/" + relevant.id); -} + var metadata = ddg_spice_guidebox_getid.metadata; + + function toArray(obj) { + var result = []; + if($.isArray(obj)) { + return obj; + } else { + $.each(obj, function(key, value) { + result[key] = value; + }); + return result; + } + } -function ddg_spice_guidebox_lastshows (api_result) { - "use strict"; + Spice.add({ + id: 'guidebox', + name: 'TV', + data: toArray(api_result.results.result), + meta: { + sourceName: "Guidebox", + sourceUrl: metadata.more, + itemType: 'episodes of ' + metadata.res_title + }, + templates: { + group: 'media', + detail: 'products_detail', + item_detail: 'products_item_detail', + options: { + variant: "video", + buy: Spice.guidebox_getid.buy + } + }, + normalize: function(item){ + return { + image: item.thumbnail_304x171, + img: item.thumbnail_400x225, + title: item.episode_name, + ratingText: 'Season '+ item.season_number + ' #'+ item.episode_number, + heading: item.episode_name, + url: item.smart_url + } + } + }); + }; - var metadata = ddg_spice_guidebox_getid.metadata; - - function toArray(obj) { - var result = []; - if($.isArray(obj)) { - return obj; - } else { - $.each(obj, function(key, value) { - result[key] = value; - }); - return result; - } - } + Handlebars.registerHelper("guideBox_checkSeason", function(season_number, episode_number, options) { - Spice.add({ - data : toArray(api_result.results.result), - header1 : metadata.res_title + " (TV - " + metadata.network + ")", - sourceName : "Guidebox", - sourceUrl : metadata.more, - view: "Tiles", - id : "guidebox", - templates : { - items : api_result.results.result, - item: Spice.guidebox_getid.guidebox_getid, - detail: Spice.guidebox_getid.guidebox_getid_details, - li_width : 120, - li_height : 105 + if(season_number !== "0") { + return options.fn({ + season_number: season_number, + episode_number: episode_number + }); } }); -}; - -Handlebars.registerHelper("checkSeason", function(season_number, episode_number, options) { - "use strict"; - - if(season_number !== "0") { - return options.fn({ - season_number: season_number, - episode_number: episode_number - }); - } -}); - -Handlebars.registerHelper("getQuery", function() { - "use strict"; - - return ddg_spice_guidebox_getid.metadata.query; -}); - -Handlebars.registerHelper("getTitle", function() { - "use strict"; - return ddg_spice_guidebox_getid.metadata.res_title; -}); + Handlebars.registerHelper("guideBox_getDate", function(first_aired) { -Handlebars.registerHelper("getDate", function(first_aired) { - "use strict"; - - var aired = DDG.getDateFromString(first_aired), + var aired = DDG.getDateFromString(first_aired), days = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'], months = [ 'January','February','March','April','May','June','July','August','September','October','November','December']; - return days[aired.getDay()] + ", " + months[aired.getMonth()] + " " + aired.getDate() + ", " + aired.getFullYear() -}); - -Handlebars.registerHelper("pluralize", function(string, options) { - "use strict"; - - if (options.hash && options.hash.singular && options.hash.plural){ - var arr = string.split("|"); - return arr.length > 1 ? options.hash.plural : options.hash.singular - } - return ""; -}); - -Handlebars.registerHelper("split", function(string) { - "use strict"; - - return string.replace(/^\||\|$/g, "").replace(/\|/g, ", "); -}); + return days[aired.getDay()] + ", " + months[aired.getMonth()] + " " + aired.getDate() + ", " + aired.getFullYear() + }); -Handlebars.registerHelper("creators", function(options) { - "use strict"; - - if (this.writers.length || this.directors.length){ - return options.fn(this) - } - return ""; -}); + Handlebars.registerHelper("guideBox_getNetwork", function(options) { -Handlebars.registerHelper("get_network", function(options) { - "use strict"; + return ddg_spice_guidebox_getid.metadata.network; + }); - return ddg_spice_guidebox_getid.metadata.network; -}); +}(this)); \ No newline at end of file diff --git a/share/spice/guidebox/getid/guidebox_getid_details.handlebars b/share/spice/guidebox/getid/guidebox_getid_details.handlebars deleted file mode 100644 index 49fa403e40..0000000000 --- a/share/spice/guidebox/getid/guidebox_getid_details.handlebars +++ /dev/null @@ -1,15 +0,0 @@ -
-

- Watch Now - {{#checkSeason season_number episode_number}} - {{{episode_name}}} (season {{season_number}}, #{{episode_number}}) - {{/checkSeason}} - {{#unless is_free_web}} Paid Content{{/unless}} -

- -

- {{overview}} -

- - Originally aired {{getDate first_aired}} on {{get_network}} -
\ No newline at end of file From 19f10692b277d60dd72a2c4bd2e5bc861b3d56c5 Mon Sep 17 00:00:00 2001 From: Jason Dorweiler Date: Wed, 4 Jun 2014 13:41:48 -0400 Subject: [PATCH 2/9] guidebox: remove use getJSON and add relevancy --- lib/DDG/Spice/Guidebox/Lastshows.pm | 2 - share/spice/guidebox/getid/buy.handlebars | 4 +- share/spice/guidebox/getid/guidebox_getid.js | 121 +++++++++---------- 3 files changed, 56 insertions(+), 71 deletions(-) diff --git a/lib/DDG/Spice/Guidebox/Lastshows.pm b/lib/DDG/Spice/Guidebox/Lastshows.pm index 44d398c1e4..fac159c470 100644 --- a/lib/DDG/Spice/Guidebox/Lastshows.pm +++ b/lib/DDG/Spice/Guidebox/Lastshows.pm @@ -6,8 +6,6 @@ triggers any => "///***never_trigger***///"; spice to => 'http://api-public.guidebox.com/v1.3/json/{{ENV{DDG_SPICE_GUIDEBOX_APIKEY}}}/$1/watch/all/20'; -spice wrap_jsonp_callback => 1; - handle remainder => sub { # TODO diff --git a/share/spice/guidebox/getid/buy.handlebars b/share/spice/guidebox/getid/buy.handlebars index 9cfd16f258..07f10b7d0e 100644 --- a/share/spice/guidebox/getid/buy.handlebars +++ b/share/spice/guidebox/getid/buy.handlebars @@ -1,9 +1,7 @@

Watch Now - {{#guideBox_checkSeason season_number episode_number}} {{{episode_name}}} (Season {{season_number}}, #{{episode_number}}) - {{/guideBox_checkSeason}} {{#unless is_free_web}} Paid Content{{/unless}}

@@ -11,5 +9,5 @@ {{overview}}

- Originally aired {{guideBox_getDate first_aired}} on {{guideBox_getNetwork}} + Originally aired {{guideBox_getDate first_aired}} on {{network}}
\ No newline at end of file diff --git a/share/spice/guidebox/getid/guidebox_getid.js b/share/spice/guidebox/getid/guidebox_getid.js index a488e2dce4..0b5b7c9cfa 100644 --- a/share/spice/guidebox/getid/guidebox_getid.js +++ b/share/spice/guidebox/getid/guidebox_getid.js @@ -1,13 +1,14 @@ -(function(env) { - "use strict"; +(function(env){ env.ddg_spice_guidebox_getid = function(api_result) { + "use strict"; if (!api_result || !api_result.results) { return Spice.failed('guidebox'); } var SKIP_ARRAY = ["online","tv","episode","episodes","free","guidebox","watch","full"], - results = api_result.results.result, relevant; + results = api_result.results.result, + relevant; // Check which show is relevant to our query. $.each(results, function(key, result) { @@ -31,71 +32,65 @@ network : relevant.network, more : relevant.url }; - - ddg_spice_guidebox_getid.metadata = metadata; - $.getScript("/js/spice/guidebox/lastshows/series/" + relevant.id); - } - - env.ddg_spice_guidebox_lastshows = function (api_result) { - - if(!api_result){ - return Spice.failed('guidebox'); - } - var metadata = ddg_spice_guidebox_getid.metadata; + var url = '/js/spice/guidebox/lastshows/series/' + relevant.id; - function toArray(obj) { - var result = []; - if($.isArray(obj)) { - return obj; - } else { - $.each(obj, function(key, value) { - result[key] = value; - }); - return result; + $.getJSON(url, function(api_result) { + + if(!api_result){ + return Spice.failed('guidebox'); } - } - Spice.add({ - id: 'guidebox', - name: 'TV', - data: toArray(api_result.results.result), - meta: { - sourceName: "Guidebox", - sourceUrl: metadata.more, - itemType: 'episodes of ' + metadata.res_title - }, - templates: { - group: 'media', - detail: 'products_detail', - item_detail: 'products_item_detail', - options: { - variant: "video", - buy: Spice.guidebox_getid.buy - } - }, - normalize: function(item){ - return { - image: item.thumbnail_304x171, - img: item.thumbnail_400x225, - title: item.episode_name, - ratingText: 'Season '+ item.season_number + ' #'+ item.episode_number, - heading: item.episode_name, - url: item.smart_url + Spice.add({ + id: 'guidebox', + name: 'TV', + data: toArray(api_result.results.result), + meta: { + sourceName: "Guidebox", + sourceUrl: metadata.more, + itemType: 'episodes of ' + metadata.res_title + }, + templates: { + group: 'media', + detail: 'products_detail', + item_detail: 'products_item_detail', + options: { + variant: "video", + buy: Spice.guidebox_getid.buy + } + }, + normalize: function(item){ + return { + image: item.thumbnail_304x171, + img: item.thumbnail_400x225, + title: item.episode_name, + ratingText: 'Season '+ item.season_number + ' #'+ item.episode_number, + heading: item.episode_name, + url: item.smart_url, + network: metadata.network + } + }, + relevancy: { + primary: [ + {required: 'season_number'}, + {required: 'episode_number'} + ] } - } + }); }); - }; - - Handlebars.registerHelper("guideBox_checkSeason", function(season_number, episode_number, options) { - - if(season_number !== "0") { - return options.fn({ - season_number: season_number, - episode_number: episode_number +} + + function toArray(obj) { + var result = []; + if($.isArray(obj)) { + return obj; + } else { + $.each(obj, function(key, value) { + result[key] = value; }); + return result; } - }); + } Handlebars.registerHelper("guideBox_getDate", function(first_aired) { @@ -105,10 +100,4 @@ return days[aired.getDay()] + ", " + months[aired.getMonth()] + " " + aired.getDate() + ", " + aired.getFullYear() }); - - Handlebars.registerHelper("guideBox_getNetwork", function(options) { - - return ddg_spice_guidebox_getid.metadata.network; - }); - }(this)); \ No newline at end of file From 85c12d75eb494c8d30bb43ce3348a056fb884bdb Mon Sep 17 00:00:00 2001 From: Jason Dorweiler Date: Wed, 11 Jun 2014 17:58:24 -0400 Subject: [PATCH 3/9] guidebox: working on mobile layout --- share/spice/guidebox/getid/buy.handlebars | 19 +++++---- share/spice/guidebox/getid/guidebox_getid.css | 40 +++++++++++++++++++ share/spice/guidebox/getid/guidebox_getid.js | 6 ++- 3 files changed, 55 insertions(+), 10 deletions(-) diff --git a/share/spice/guidebox/getid/buy.handlebars b/share/spice/guidebox/getid/buy.handlebars index 07f10b7d0e..1d816792eb 100644 --- a/share/spice/guidebox/getid/buy.handlebars +++ b/share/spice/guidebox/getid/buy.handlebars @@ -1,13 +1,16 @@

- Watch Now - {{{episode_name}}} (Season {{season_number}}, #{{episode_number}}) - {{#unless is_free_web}} Paid Content{{/unless}} + Watch Now + (Season {{season_number}}, #{{episode_number}}) + {{#unless is_free_web}} Paid Content{{/unless}}

-

- {{overview}} +

+ {{ellipsis overview 500}} +

+

+ {{ellipsis overview 150}}

- - Originally aired {{guideBox_getDate first_aired}} on {{network}} -
\ No newline at end of file + Originally aired {{guideBox_getDate first_aired}} on {{network}} + +{{{lp smart_url "Watch Now"}}} \ No newline at end of file diff --git a/share/spice/guidebox/getid/guidebox_getid.css b/share/spice/guidebox/getid/guidebox_getid.css index 3d5db28f8a..3b1b8a6adf 100644 --- a/share/spice/guidebox/getid/guidebox_getid.css +++ b/share/spice/guidebox/getid/guidebox_getid.css @@ -4,4 +4,44 @@ .detail--guidebox .small { font-size: 0.98em; +} + +.detail--guidebox .guidebox--btn--mobile{ + display: none; +} + +.is-mobile .detail__tile--pr{ + height:1em; + padding-bottom:1.5em; +} + +.detail--guidebox .guidebox--desc--mobile{ + display: none; +} + +.is-mobile .detail--guidebox .guidebox--btn--detail{ + display: none; +} + +.is-mobile .detail--guidebox .guidebox--btn--mobile{ + display: block; + position: fixed; +} + +.is-mobile .detail--guidebox .guidebox--aired{ + display: none; +} + +.is-mobile .detail--guidebox .guidebox--desc{ + display: none; +} + +.is-mobile .detail--guidebox .guidebox--desc--mobile{ + display: block; + padding-bottom: 1em; + height: 5.5em; +} + +.is-mobile .detail--guidebox .detail__desc{ + display: none; } \ No newline at end of file diff --git a/share/spice/guidebox/getid/guidebox_getid.js b/share/spice/guidebox/getid/guidebox_getid.js index 0b5b7c9cfa..15c3c0c9c2 100644 --- a/share/spice/guidebox/getid/guidebox_getid.js +++ b/share/spice/guidebox/getid/guidebox_getid.js @@ -41,6 +41,8 @@ return Spice.failed('guidebox'); } + console.log(toArray(api_result.results.result)); + Spice.add({ id: 'guidebox', name: 'TV', @@ -60,6 +62,7 @@ } }, normalize: function(item){ + console.log(item); return { image: item.thumbnail_304x171, img: item.thumbnail_400x225, @@ -72,8 +75,7 @@ }, relevancy: { primary: [ - {required: 'season_number'}, - {required: 'episode_number'} + {required: 'episode_name'}, ] } }); From 7648050f5d1d6e69841f92e3202170bee22b1e67 Mon Sep 17 00:00:00 2001 From: Jason Dorweiler Date: Mon, 16 Jun 2014 10:36:19 -0400 Subject: [PATCH 4/9] guidebox: fixed mobile view --- share/spice/guidebox/getid/buy.handlebars | 8 +++--- share/spice/guidebox/getid/guidebox_getid.css | 27 ++++++++++--------- share/spice/guidebox/getid/guidebox_getid.js | 10 +++---- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/share/spice/guidebox/getid/buy.handlebars b/share/spice/guidebox/getid/buy.handlebars index 1d816792eb..b0d18e8698 100644 --- a/share/spice/guidebox/getid/buy.handlebars +++ b/share/spice/guidebox/getid/buy.handlebars @@ -6,11 +6,11 @@

- {{ellipsis overview 500}} + {{ellipsis overview 500}}

- {{ellipsis overview 150}} + {{ellipsis overview 150}}

Originally aired {{guideBox_getDate first_aired}} on {{network}} - -{{{lp smart_url "Watch Now"}}} \ No newline at end of file + {{{lp smart_url "Watch Now"}}} + \ No newline at end of file diff --git a/share/spice/guidebox/getid/guidebox_getid.css b/share/spice/guidebox/getid/guidebox_getid.css index 3b1b8a6adf..1a1bb630cb 100644 --- a/share/spice/guidebox/getid/guidebox_getid.css +++ b/share/spice/guidebox/getid/guidebox_getid.css @@ -1,13 +1,13 @@ .detail--guidebox .red { - color: #B57367; + color: #B57367; } .detail--guidebox .small { - font-size: 0.98em; + font-size: 0.98em; } .detail--guidebox .guidebox--btn--mobile{ - display: none; + display: none; } .is-mobile .detail__tile--pr{ @@ -16,28 +16,29 @@ } .detail--guidebox .guidebox--desc--mobile{ - display: none; + display: none; } -.is-mobile .detail--guidebox .guidebox--btn--detail{ - display: none; +.is-mobile .detail--guidebox .guidebox--aired{ + display: none; } -.is-mobile .detail--guidebox .guidebox--btn--mobile{ - display: block; - position: fixed; +.is-mobile .detail--guidebox .guidebox--btn--detail{ + display: none; } -.is-mobile .detail--guidebox .guidebox--aired{ - display: none; +.is-mobile .detail--guidebox .guidebox--btn--mobile{ + display: block; + position: absolute; + bottom: 1em; } .is-mobile .detail--guidebox .guidebox--desc{ - display: none; + display: none; } .is-mobile .detail--guidebox .guidebox--desc--mobile{ - display: block; + display: block; padding-bottom: 1em; height: 5.5em; } diff --git a/share/spice/guidebox/getid/guidebox_getid.js b/share/spice/guidebox/getid/guidebox_getid.js index 15c3c0c9c2..205965c831 100644 --- a/share/spice/guidebox/getid/guidebox_getid.js +++ b/share/spice/guidebox/getid/guidebox_getid.js @@ -1,6 +1,6 @@ -(function(env){ +(function(env){ + "use strict"; env.ddg_spice_guidebox_getid = function(api_result) { - "use strict"; if (!api_result || !api_result.results) { return Spice.failed('guidebox'); @@ -41,8 +41,6 @@ return Spice.failed('guidebox'); } - console.log(toArray(api_result.results.result)); - Spice.add({ id: 'guidebox', name: 'TV', @@ -62,7 +60,6 @@ } }, normalize: function(item){ - console.log(item); return { image: item.thumbnail_304x171, img: item.thumbnail_400x225, @@ -76,11 +73,12 @@ relevancy: { primary: [ {required: 'episode_name'}, + {required: 'season_number'} ] } }); }); -} + } function toArray(obj) { var result = []; From 18bfa96e1275ff781b5d2920f2d8b34bab194428 Mon Sep 17 00:00:00 2001 From: Jason Dorweiler Date: Mon, 16 Jun 2014 20:51:52 -0400 Subject: [PATCH 5/9] guidebox: changes for mobile and filter out a search term --- lib/DDG/Spice/Guidebox/Getid.pm | 7 +++- share/spice/guidebox/getid/buy.handlebars | 21 +++++------ share/spice/guidebox/getid/guidebox_getid.css | 35 +++---------------- share/spice/guidebox/getid/guidebox_getid.js | 21 +++++++---- 4 files changed, 34 insertions(+), 50 deletions(-) diff --git a/lib/DDG/Spice/Guidebox/Getid.pm b/lib/DDG/Spice/Guidebox/Getid.pm index 28758066ea..1069f94298 100644 --- a/lib/DDG/Spice/Guidebox/Getid.pm +++ b/lib/DDG/Spice/Guidebox/Getid.pm @@ -20,6 +20,10 @@ spice to => 'http://api-public.guidebox.com/v1.3/json/{{ENV{DDG_SPICE_GUIDEBOX_A spice wrap_jsonp_callback => 1; +my %skip = map { $_ => 0 } ( + 'watchmen' +); + handle remainder => sub { if ($loc->country_name eq "United States" || $loc->country_name eq "Canada"){ @@ -38,7 +42,8 @@ handle remainder => sub { } else { $show = $_; } - return $show if $show; + + return $show if $show && !exists $skip{lc $show}; } return; }; diff --git a/share/spice/guidebox/getid/buy.handlebars b/share/spice/guidebox/getid/buy.handlebars index b0d18e8698..fbe2d46c8c 100644 --- a/share/spice/guidebox/getid/buy.handlebars +++ b/share/spice/guidebox/getid/buy.handlebars @@ -1,16 +1,13 @@
-

- Watch Now - (Season {{season_number}}, #{{episode_number}}) +

+ Originally aired {{guideBox_getDate first_aired}} on {{network}} +
+ +
+ + Watch Now + {{#unless is_free_web}} Paid Content{{/unless}} -

+
-

- {{ellipsis overview 500}} -

-

- {{ellipsis overview 150}} -

- Originally aired {{guideBox_getDate first_aired}} on {{network}} - {{{lp smart_url "Watch Now"}}}
\ No newline at end of file diff --git a/share/spice/guidebox/getid/guidebox_getid.css b/share/spice/guidebox/getid/guidebox_getid.css index 1a1bb630cb..679b43c745 100644 --- a/share/spice/guidebox/getid/guidebox_getid.css +++ b/share/spice/guidebox/getid/guidebox_getid.css @@ -1,48 +1,21 @@ .detail--guidebox .red { - color: #B57367; + color: #c9481c; } .detail--guidebox .small { font-size: 0.98em; } -.detail--guidebox .guidebox--btn--mobile{ - display: none; -} - -.is-mobile .detail__tile--pr{ - height:1em; - padding-bottom:1.5em; -} - -.detail--guidebox .guidebox--desc--mobile{ - display: none; +.detail--guidebox .guidebox--aired{ + padding-bottom:0.5em; } .is-mobile .detail--guidebox .guidebox--aired{ display: none; } -.is-mobile .detail--guidebox .guidebox--btn--detail{ - display: none; -} - -.is-mobile .detail--guidebox .guidebox--btn--mobile{ +.is-mobile .detail--guidebox .btn--primary{ display: block; position: absolute; bottom: 1em; -} - -.is-mobile .detail--guidebox .guidebox--desc{ - display: none; -} - -.is-mobile .detail--guidebox .guidebox--desc--mobile{ - display: block; - padding-bottom: 1em; - height: 5.5em; -} - -.is-mobile .detail--guidebox .detail__desc{ - display: none; } \ No newline at end of file diff --git a/share/spice/guidebox/getid/guidebox_getid.js b/share/spice/guidebox/getid/guidebox_getid.js index 205965c831..6e3c275f0f 100644 --- a/share/spice/guidebox/getid/guidebox_getid.js +++ b/share/spice/guidebox/getid/guidebox_getid.js @@ -41,6 +41,8 @@ return Spice.failed('guidebox'); } + var isMobile = $('.is-mobile').length; + Spice.add({ id: 'guidebox', name: 'TV', @@ -52,22 +54,29 @@ }, templates: { group: 'media', - detail: 'products_detail', - item_detail: 'products_item_detail', options: { variant: "video", + detailVariant: 'light', buy: Spice.guidebox_getid.buy } }, normalize: function(item){ + var subtitle = "(Season "+ item.season_number+ ", #" + item.episode_number+")" + + var abstract_length = (isMobile ? 175 : 500); + + var abstract = Handlebars.helpers.ellipsis(item.overview, abstract_length) + return { image: item.thumbnail_304x171, + subtitle_content: subtitle, img: item.thumbnail_400x225, - title: item.episode_name, - ratingText: 'Season '+ item.season_number + ' #'+ item.episode_number, - heading: item.episode_name, + title: item.episode_name, + ratingText: subtitle, + heading: item.episode_name + subtitle, url: item.smart_url, - network: metadata.network + network: metadata.network, + abstract: abstract } }, relevancy: { From f7d67430b620ea4ccb88c0d380c03e77ec4ade9c Mon Sep 17 00:00:00 2001 From: Jason Dorweiler Date: Tue, 17 Jun 2014 10:48:39 -0400 Subject: [PATCH 6/9] guidebox: some changes to buy template --- share/spice/guidebox/getid/buy.handlebars | 8 -------- share/spice/guidebox/getid/guidebox_getid.css | 16 +++++----------- share/spice/guidebox/getid/guidebox_getid.js | 12 ++++++++---- 3 files changed, 13 insertions(+), 23 deletions(-) diff --git a/share/spice/guidebox/getid/buy.handlebars b/share/spice/guidebox/getid/buy.handlebars index fbe2d46c8c..06a7be7a1c 100644 --- a/share/spice/guidebox/getid/buy.handlebars +++ b/share/spice/guidebox/getid/buy.handlebars @@ -1,13 +1,5 @@
-
- Originally aired {{guideBox_getDate first_aired}} on {{network}} -
- -
Watch Now - {{#unless is_free_web}} Paid Content{{/unless}} -
-
\ No newline at end of file diff --git a/share/spice/guidebox/getid/guidebox_getid.css b/share/spice/guidebox/getid/guidebox_getid.css index 679b43c745..91f5a1a1cc 100644 --- a/share/spice/guidebox/getid/guidebox_getid.css +++ b/share/spice/guidebox/getid/guidebox_getid.css @@ -1,16 +1,10 @@ -.detail--guidebox .red { - color: #c9481c; +.detail--guidebox .price{ + font-size: 0.9em; + color: #777777; + font-weight: normal; } -.detail--guidebox .small { - font-size: 0.98em; -} - -.detail--guidebox .guidebox--aired{ - padding-bottom:0.5em; -} - -.is-mobile .detail--guidebox .guidebox--aired{ +.is-mobile .detail--guidebox .price{ display: none; } diff --git a/share/spice/guidebox/getid/guidebox_getid.js b/share/spice/guidebox/getid/guidebox_getid.js index 6e3c275f0f..20369b0139 100644 --- a/share/spice/guidebox/getid/guidebox_getid.js +++ b/share/spice/guidebox/getid/guidebox_getid.js @@ -57,15 +57,19 @@ options: { variant: "video", detailVariant: 'light', + price: true, buy: Spice.guidebox_getid.buy } }, normalize: function(item){ - var subtitle = "(Season "+ item.season_number+ ", #" + item.episode_number+")" + var subtitle = "(Season "+ item.season_number+ ", #" + item.episode_number+")"; var abstract_length = (isMobile ? 175 : 500); - var abstract = Handlebars.helpers.ellipsis(item.overview, abstract_length) + var abstract = Handlebars.helpers.ellipsis(item.overview, abstract_length); + + var aired = "Originally aired "+ Handlebars.helpers.guideBox_getDate(item.first_aired) + + " on "+ metadata.network; return { image: item.thumbnail_304x171, @@ -75,8 +79,8 @@ ratingText: subtitle, heading: item.episode_name + subtitle, url: item.smart_url, - network: metadata.network, - abstract: abstract + abstract: abstract, + price: aired + (item.is_free_web ? '' : ', Paid Content') } }, relevancy: { From 215fa6896a25507c91eb4a4cd4cad289ce52fee4 Mon Sep 17 00:00:00 2001 From: Jason Dorweiler Date: Wed, 18 Jun 2014 13:19:07 -0400 Subject: [PATCH 7/9] guidebox: css changes and button text --- share/spice/guidebox/getid/buy.handlebars | 2 +- share/spice/guidebox/getid/guidebox_getid.css | 14 ++++++++++++++ share/spice/guidebox/getid/guidebox_getid.js | 15 +++++++-------- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/share/spice/guidebox/getid/buy.handlebars b/share/spice/guidebox/getid/buy.handlebars index 06a7be7a1c..5261725ed5 100644 --- a/share/spice/guidebox/getid/buy.handlebars +++ b/share/spice/guidebox/getid/buy.handlebars @@ -1,5 +1,5 @@ \ No newline at end of file diff --git a/share/spice/guidebox/getid/guidebox_getid.css b/share/spice/guidebox/getid/guidebox_getid.css index 91f5a1a1cc..116e3761be 100644 --- a/share/spice/guidebox/getid/guidebox_getid.css +++ b/share/spice/guidebox/getid/guidebox_getid.css @@ -1,4 +1,6 @@ .detail--guidebox .price{ + position: relative; + top: -0.5em; font-size: 0.9em; color: #777777; font-weight: normal; @@ -12,4 +14,16 @@ display: block; position: absolute; bottom: 1em; +} + +.detail--guidebox .detail__body--pr{ + border-left: 0px; +} + +.detail--guidebox .detail__desc{ + padding-bottom: 1em; +} + +.detail--guidebox .btn--primary .paid{ + color: #c9481c; } \ No newline at end of file diff --git a/share/spice/guidebox/getid/guidebox_getid.js b/share/spice/guidebox/getid/guidebox_getid.js index 20369b0139..1ab8f91ef8 100644 --- a/share/spice/guidebox/getid/guidebox_getid.js +++ b/share/spice/guidebox/getid/guidebox_getid.js @@ -56,16 +56,15 @@ group: 'media', options: { variant: "video", - detailVariant: 'light', price: true, buy: Spice.guidebox_getid.buy } }, normalize: function(item){ - var subtitle = "(Season "+ item.season_number+ ", #" + item.episode_number+")"; + var subtitle_tile = "Season "+ item.season_number+ ", #" + item.episode_number; + var subtitle_detail = "(Season "+ item.season_number+ ", #" + item.episode_number+")"; var abstract_length = (isMobile ? 175 : 500); - var abstract = Handlebars.helpers.ellipsis(item.overview, abstract_length); var aired = "Originally aired "+ Handlebars.helpers.guideBox_getDate(item.first_aired) @@ -73,20 +72,20 @@ return { image: item.thumbnail_304x171, - subtitle_content: subtitle, img: item.thumbnail_400x225, title: item.episode_name, - ratingText: subtitle, - heading: item.episode_name + subtitle, + ratingText: subtitle_tile, + heading: item.episode_name + subtitle_detail, url: item.smart_url, abstract: abstract, - price: aired + (item.is_free_web ? '' : ', Paid Content') + price: aired } }, relevancy: { primary: [ {required: 'episode_name'}, - {required: 'season_number'} + {required: 'season_number'}, + {required: 'overview'} ] } }); From 2744db1a1d56763624e784416a56997b767c402c Mon Sep 17 00:00:00 2001 From: Jason Dorweiler Date: Wed, 18 Jun 2014 14:12:22 -0400 Subject: [PATCH 8/9] guidebox: more css changes --- share/spice/guidebox/getid/buy.handlebars | 3 ++- share/spice/guidebox/getid/guidebox_getid.css | 24 +++++++++++++------ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/share/spice/guidebox/getid/buy.handlebars b/share/spice/guidebox/getid/buy.handlebars index 5261725ed5..2cde20cba6 100644 --- a/share/spice/guidebox/getid/buy.handlebars +++ b/share/spice/guidebox/getid/buy.handlebars @@ -1,5 +1,6 @@
- Watch Now {{#unless is_free_content}} {{/unless}} + Watch Now + {{#unless is_free_content}} {{/unless}}
\ No newline at end of file diff --git a/share/spice/guidebox/getid/guidebox_getid.css b/share/spice/guidebox/getid/guidebox_getid.css index 116e3761be..c98b8d0d5c 100644 --- a/share/spice/guidebox/getid/guidebox_getid.css +++ b/share/spice/guidebox/getid/guidebox_getid.css @@ -1,3 +1,7 @@ +.zci__more-at__icon{ + padding-bottom: 0.3em; +} + .detail--guidebox .price{ position: relative; top: -0.5em; @@ -6,24 +10,30 @@ font-weight: normal; } +.detail--guidebox .paid{ + color: #c9481c; + font-weight: bold; +} + .is-mobile .detail--guidebox .price{ display: none; } .is-mobile .detail--guidebox .btn--primary{ - display: block; position: absolute; - bottom: 1em; + bottom: 1.1em; } .detail--guidebox .detail__body--pr{ - border-left: 0px; + border-left: 0px; } .detail--guidebox .detail__desc{ - padding-bottom: 1em; + padding-bottom: 1.3em; } -.detail--guidebox .btn--primary .paid{ - color: #c9481c; -} \ No newline at end of file +.is-mobile .detail--guidebox .paid{ + position: absolute; + padding-left: 7.5em; + bottom: 1.8em; +} From fde98bb1b2aa3c83f202ed6799ebb5f3be2a31a0 Mon Sep 17 00:00:00 2001 From: Jason Dorweiler Date: Wed, 18 Jun 2014 15:23:30 -0400 Subject: [PATCH 9/9] guidebox: add right margin to button --- share/spice/guidebox/getid/guidebox_getid.css | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/share/spice/guidebox/getid/guidebox_getid.css b/share/spice/guidebox/getid/guidebox_getid.css index c98b8d0d5c..4dccd0bb75 100644 --- a/share/spice/guidebox/getid/guidebox_getid.css +++ b/share/spice/guidebox/getid/guidebox_getid.css @@ -32,8 +32,12 @@ padding-bottom: 1.3em; } -.is-mobile .detail--guidebox .paid{ +.is-mobile .detail--guidebox .paid{ position: absolute; padding-left: 7.5em; bottom: 1.8em; } + +.detail--guidebox .btn--primary{ + margin-right: 0.75em; +} \ No newline at end of file