diff --git a/share/spice/octopart/octopart.css b/share/spice/octopart/octopart.css index fdd76c1146..3106b40555 100644 --- a/share/spice/octopart/octopart.css +++ b/share/spice/octopart/octopart.css @@ -1,4 +1,8 @@ -.zci--octopart .btn__datasheet { - margin-right: 2px; - background-color: #e5e5e5; -} \ No newline at end of file +.detail--octopart .btn__datasheet { + margin-right: 2px; + background-color: #e5e5e5; +} + +.is-mobile .detail--octopart .detail__body.detail__body--pr { + padding-top: 1em; +} diff --git a/share/spice/octopart/octopart.js b/share/spice/octopart/octopart.js index a8b01d36a3..c5eb0a2bc9 100644 --- a/share/spice/octopart/octopart.js +++ b/share/spice/octopart/octopart.js @@ -36,12 +36,14 @@ function ddg_spice_octopart (api_result) { // return; // } + var isMobile = $('.is-mobile').length; + Spice.add({ id: 'octopart', name: 'Parts', data: api_result.results, signal: 'high', - + meta: { itemType: 'Parts', sourceName: 'Octopart', @@ -49,17 +51,20 @@ function ddg_spice_octopart (api_result) { }, normalize: function(item) { var img = DDG.getProperty(item, "item.images.0.url_90px"); + var desc_length = 60; + var description = (isMobile ? + Handlebars.helpers.ellipsis(DDG.strip_html(item.item.short_description), desc_length) : + DDG.strip_html(item.item.short_description)); return { brand: item.item.manufacturer.displayname, price: item.item.avg_price[1] + ' ' + item.item.avg_price[0].toFixed(2), img: img, img_m: img, - // url_review: item.item.detail_url, url: item.item.detail_url, title: DDG.strip_html(item.item.mpn).toUpperCase(), heading: DDG.strip_html(item.item.mpn).toUpperCase(), - description: DDG.strip_html(item.item.short_description), + description: description, datasheet: item.item.datasheets[0].url }; }, @@ -68,6 +73,7 @@ function ddg_spice_octopart (api_result) { group: 'products', options: { rating: false, + detailVariant: 'light', buy: Spice.octopart.buy } }