Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Commit

Permalink
octopart: shorten description on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Dorweiler committed Jun 19, 2014
1 parent c5d3567 commit bf28afd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
8 changes: 3 additions & 5 deletions share/spice/octopart/octopart.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
background-color: #e5e5e5;
}

.is-mobile .detail--octopart .detail__body__content{
position: absolute;
margin-right: 1.6em;
bottom: 4em;
}
.is-mobile .detail--octopart .detail__body.detail__body--pr {
padding-top: 1em;
}
11 changes: 8 additions & 3 deletions share/spice/octopart/octopart.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,30 +36,35 @@ 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',
sourceUrl : 'http://octopart.com/partsearch#search/requestData&q=' + api_result.request.q
},
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
};
},
Expand Down

0 comments on commit bf28afd

Please sign in to comment.