This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.extend({ | |
readMore: function(truncate) { | |
return this.each(function() { | |
var $self = $(this); | |
var originalText = $self.text(); | |
if(originalText.length<=truncate) return; | |
$self.text($.trim(originalText).substring(0, truncate)); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Product page variant option selection | |
var VariantSelect = (function() { | |
var $variantSelection; | |
// The selection filters from top to bottom. Only the 2nd and 3rd option | |
// variants can become unavailable | |
function setUnavailable(index) { | |
var option1 = $variantSelection.find('.active[data-index="0"]').data('option1'); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* loadJSONP( url, hollaback [, context] ) -> Null | |
* - url (String): URL to data resource. | |
* - hollaback (Function): Function to call when data is successfully loaded, | |
* it receives one argument: the data. | |
* - context (Object): Context to invoke the hollaback function in. | |
* | |
* Load external data through a JSONP interface. | |
* | |
* ### Examples |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// replace any occurences of str with a matching key:value pair | |
function replacements(template, replacement) { | |
return template.replace(/{([^}]+)}/g, function (match) { | |
return replacement[match]; | |
}); | |
} | |
// usage | |
var template = 'Hi { name }, you are { age } years old.'; | |
console.log( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.imgURL = function(size) { | |
// remove any current image size then add the new image size | |
return this | |
.replace(/_(pico|icon|thumb|small|compact|medium|large|grande|original|1024x1024|2048x2048|master)+\./g, '.') | |
.replace(/\.jpg|\.png|\.gif|\.jpeg/g, function(match) { | |
return '_'+size+match; | |
}) | |
; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* presuming that the a element has a background image */ | |
.grid .column a { | |
width: 100%; | |
overflow: hidden; | |
display: block; | |
/* scale the image proportionally based on the elements height and width */ | |
-webkit-background-size: cover; | |
-moz-background-size: cover; | |
-o-background-size: cover; | |
background-size: cover; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% assign blog_name = get_blog_name.url | remove: '/blogs/' %} | |
{% assign blog_name = blog_name | split: '/' %} | |
{% assign blog_name = blog_name[0] | replace: '-', ' ' | capitalize %} | |
{{ blog_name }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% comment %} | |
blog_handles should contain the handles of each blog you want to pull posts from | |
seperated by commas. | |
{% endcomment %} | |
{% assign blog_handles = 'blog-1,blog-2,blog-3,blog-4,blog-5' | split: ',' %} | |
{% comment %}initialise the previous_article_timestamp as the current time{% endcomment %} | |
{% assign previous_article_timestamp = 'now' | date: '%s' %} | |
{% comment %}i represents the number of featured articles that will be shown{% endcomment %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% assign some_stock = false %} | |
{% assign out_of_stock = 0 %} | |
{% for variant in product.variants %} | |
{% if variant.available == false %} | |
{% assign out_of_stock = out_of_stock | plus: 1 %} | |
{% endif %} | |
{% endfor %} | |
{% if product.variants.size != out_of_stock and out_of_stock > 0 %} | |
{% assign some_stock = true %} | |
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.custom-select { | |
position: relative; | |
width: 100%; | |
} | |
.custom-select > span { | |
border-radius: 3px; | |
border: 1px solid #d3dbe2; | |
padding: 5px 15px; | |
color: #479ccf; | |
cursor: pointer; |