Skip to content
This repository has been archived by the owner on Aug 30, 2018. It is now read-only.

Icons and Modernizer Adjustments #85

Merged
merged 9 commits into from
Jun 4, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 3 additions & 19 deletions assets/ajaxify.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,18 @@
* show the cart in a modal, or a 3D drawer.
*
* This file includes:
* - Modernizer | Slim custom build
* - Basic Shopify Ajax API calls
* - Ajaxify plugin
*
* This requires:
* - jQuery 1.8+
* - handlebars.min.js (for cart template)
* - modernizer.min.js
* - snippet/ajax-cart-template.liquid
*/

/*
* Plugin Documentation
*
* View the complete documentation at http://shopify.com/timber
* Plugin Documentation - http://shopify.github.io/Timber/#ajax-cart
*/

// JQUERY API (c) Copyright 2009-2014 Shopify Inc. Author: Caroline Schnapp. All Rights Reserved.
Expand Down Expand Up @@ -230,11 +228,6 @@ Shopify.changeItem = function(variant_id, quantity, callback) {
jQuery.ajax(params);
};

/* Modernizr 2.7.0 (Custom Build) | MIT & BSD
* Build: http://modernizr.com/download/#-csstransforms-csstransforms3d-touch-teststyles-testprop-testallprops-prefixes-domprefixes
*/
;window.Modernizr=function(a,b,c){function y(a){i.cssText=a}function z(a,b){return y(l.join(a+";")+(b||""))}function A(a,b){return typeof a===b}function B(a,b){return!!~(""+a).indexOf(b)}function C(a,b){for(var d in a){var e=a[d];if(!B(e,"-")&&i[e]!==c)return b=="pfx"?e:!0}return!1}function D(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:A(f,"function")?f.bind(d||b):f}return!1}function E(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+n.join(d+" ")+d).split(" ");return A(b,"string")||A(b,"undefined")?C(e,b):(e=(a+" "+o.join(d+" ")+d).split(" "),D(e,b,c))}var d="2.7.0",e={},f=b.documentElement,g="modernizr",h=b.createElement(g),i=h.style,j,k={}.toString,l=" -webkit- -moz- -o- -ms- ".split(" "),m="Webkit Moz O ms",n=m.split(" "),o=m.toLowerCase().split(" "),p={},q={},r={},s=[],t=s.slice,u,v=function(a,c,d,e){var h,i,j,k,l=b.createElement("div"),m=b.body,n=m||b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:g+(d+1),l.appendChild(j);return h=["&#173;",'<style id="s',g,'">',a,"</style>"].join(""),l.id=g,(m?l:n).innerHTML+=h,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=f.style.overflow,f.style.overflow="hidden",f.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),f.style.overflow=k),!!i},w={}.hasOwnProperty,x;!A(w,"undefined")&&!A(w.call,"undefined")?x=function(a,b){return w.call(a,b)}:x=function(a,b){return b in a&&A(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=t.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(t.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(t.call(arguments)))};return e}),p.touch=function(){var c;return"ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch?c=!0:v(["@media (",l.join("touch-enabled),("),g,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(a){c=a.offsetTop===9}),c},p.csstransforms=function(){return!!E("transform")},p.csstransforms3d=function(){var a=!!E("perspective");return a&&"webkitPerspective"in f.style&&v("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(b,c){a=b.offsetLeft===9&&b.offsetHeight===3}),a};for(var F in p)x(p,F)&&(u=F.toLowerCase(),e[u]=p[F](),s.push((e[u]?"":"no-")+u));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)x(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof enableClasses!="undefined"&&enableClasses&&(f.className+=" "+(b?"":"no-")+a),e[a]=b}return e},y(""),h=j=null,e._version=d,e._prefixes=l,e._domPrefixes=o,e._cssomPrefixes=n,e.testProp=function(a){return C([a])},e.testAllProps=E,e.testStyles=v,e}(this,this.document);

// -------------------------------------------------------------------------------------
// Ajaxify Shopify Add To Cart
// -------------------------------------------------------------------------------------
Expand All @@ -247,7 +240,7 @@ var ajaxifyShopify = (function(module, $) {
var init;

// Private general variables
var settings, cartInit, $drawerHeight, $cssTransforms, $cssTransforms3d, $isTouch, $nojQueryLoad, $w, $body;
var settings, cartInit, $drawerHeight, $cssTransforms, $cssTransforms3d, $nojQueryLoad, $w, $body;

// Private plugin variables
var $formContainer, $btnClass, $wrapperClass, $addToCart, $flipClose, $flipCart, $flipContainer, $cartCountSelector, $cartCostSelector, $toggleCartButton, $modal, $cartContainer, $drawerCaret, $modalContainer, $modalOverlay, $closeCart, $drawerContainer, $prependDrawerTo;
Expand All @@ -262,7 +255,6 @@ var ajaxifyShopify = (function(module, $) {

// Default settings
settings = {
debug: false,
method: 'drawer', // Method options are drawer, modal, and flip. Default is drawer.
formSelector: 'form[action^="/cart/add"]',
addToCartSelector: 'input[type="submit"]',
Expand Down Expand Up @@ -300,19 +292,11 @@ var ajaxifyShopify = (function(module, $) {
// CSS Checks
$cssTransforms = Modernizr.csstransforms;
$cssTransforms3d = Modernizr.csstransforms3d;
$isTouch = Modernizr.touch;

// General Selectors
$w = $(window);
$body = $('body');

// Touch check
if ($isTouch) {
$body.addClass('ajaxify-touch');
} else {
$body.addClass('ajaxify-notouch');
}

// Check if we can use .load
$nojQueryLoad = $('html').hasClass('lt-ie9');
if ($nojQueryLoad) {
Expand Down
8 changes: 4 additions & 4 deletions assets/ajaxify.scss.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ form[action^="/cart/add"] {
input[type="text"] {
@include transition(all 0.1s ease-out);

.ajaxify-notouch & {
.supports-no-touch & {
border: 1px solid rgba(0,0,0,0);
}
}
Expand All @@ -455,7 +455,7 @@ form[action^="/cart/add"] {

.cart-row:hover &,
.ajaxifyCart--product:hover &,
.ajaxify-touch & {
.supports-touch & {
opacity: 1;
@include transition(background-color 0.2s ease-out);
}
Expand Down Expand Up @@ -625,7 +625,7 @@ form[action^="/cart/add"] {
#ajaxifyModal {
.cart-row:hover input[type="text"],
.ajaxifyCart--product:hover input[type="text"],
.ajaxify-touch input[type="text"],
.supports-touch input[type="text"],
.page-header {
border-color: $modalBorderColor;
}
Expand Down Expand Up @@ -709,7 +709,7 @@ form[action^="/cart/add"] {
#ajaxifyDrawer {
.cart-row:hover input[type="text"],
.ajaxifyCart--product:hover input[type="text"],
.ajaxify-touch input[type="text"],
.supports-touch input[type="text"],
.page-header {
border-color: $drawerBorderColor;
}
Expand Down
4 changes: 4 additions & 0 deletions assets/modernizr.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

78 changes: 70 additions & 8 deletions assets/timber.scss.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -1353,6 +1353,61 @@ label.error {
// ==============================================================================
// #Icons
// ==============================================================================
.icon-fallback-text .icon {
display: none;

.supports-fontface & {
display: inline-block;
}
}

.supports-fontface .icon-fallback-text .fallback-text {
/* a generic way to visually hide content while remaining accessible to screen readers (h5bp.com) */
clip: rect(0 0 0 0);
overflow: hidden;
position: absolute;
height: 1px;
width: 1px;
}

.icon:before {
display: none;
}

.supports-fontface .icon:before {
display: inline;
font-family: $socialIconFontStack;
text-decoration: none;
-webkit-font-smoothing: antialiased;
}

// Payment icons
.icon-diners_club:before { content: 'c'; }
.icon-maestro:before { content: 'm'; }
.icon-interact:before { content: 'I'; }
.icon-visa:before { content: 'V'; }
.icon-master:before { content: 'M'; }
.icon-discover:before { content: 'D'; }
.icon-dk:before { content: 'd'; }
.icon-american_express:before { content: 'A'; }
.icon-google:before { content: 'G'; }
.icon-paypal:before { content: 'P'; }
.icon-jcb:before { content: 'J'; }
.icon-cirrus:before { content: 'C'; }
.icon-stripe:before { content: 'S'; }
.icon-bitcoin:before { content: 'B'; }

// Social icons
.icon-twitter:before { content: 'T'; }
.icon-facebook:before { content: 'f'; }
.icon-pinterest:before { content: 'p'; }
.icon-fancy:before { content: 'F'; }
.icon-google:before { content: 'g'; }
.icon-instagram:before { content: 'i'; }
.icon-youtube:before { content: 'y'; }
.icon-vimeo:before { content: 'v'; }
.icon-tumblr:before { content: 't'; }

.payment-icons {
-webkit-user-select: none;
-moz-user-select: none;
Expand All @@ -1363,10 +1418,17 @@ label.error {

li {
margin: 0 $gutter/4 $gutter/4;
font-family: $socialIconFontStack;
color: {{ settings.footer_social_link_color }};
cursor: default;
}

.icon {
font-size: 30px;
line-height: 30px;
color: {{ settings.footer_social_link_color }};
}

.fallback-text {
text-transform: capitalize;
}
}

Expand All @@ -1378,16 +1440,16 @@ label.error {
margin-left: 0;
}

a {
font-family: $socialIconFontStack;
.icon {
font-size: 30px;
line-height: 26px; // same as .social-link height
line-height: 26px;
}

a {
color: {{ settings.footer_social_link_color }};
text-decoration: none;
-webkit-font-smoothing: antialiased;

&:hover {
color: $colorPrimary;
color: darken({{ settings.footer_social_link_color }}, 10%);
}
}
}
Expand Down
34 changes: 1 addition & 33 deletions config/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -143,42 +143,10 @@ <h3 class="heading">Footer Colors</h3>
<td><label for="twitter_link">Twitter link</label></td>
<td colspan="2"><input type="url" id="twitter_link" name="twitter_link" size="50" /></td>
</tr>
<tr>
<td><label for="twitter_link">Twitter link</label></td>
<td colspan="2"><input type="url" id="twitter_link" name="twitter_link" size="50" /></td>
</tr>
<tr>
<td><label for="facebook_link">Facebook link</label></td>
<td colspan="2"><input type="url" id="facebook_link" name="facebook_link" size="50" /></td>
</tr>
<tr>
<td><label for="pinterest_link">Pinterest link</label></td>
<td colspan="2"><input type="url" id="pinterest_link" name="pinterest_link" size="50" /></td>
</tr>
<tr>
<td><label for="google_plus_link">Google Plus link</label></td>
<td colspan="2"><input type="url" id="google_plus_link" name="google_plus_link" size="50" /></td>
</tr>
<tr>
<td><label for="instagram_link">Instagram link</label></td>
<td colspan="2"><input type="url" id="instagram_link" name="instagram_link" size="50" /></td>
</tr>
<tr>
<td><label for="tumblr_link">Tumblr link</label></td>
<td colspan="2"><input type="url" id="tumblr_link" name="tumblr_link" size="50" /></td>
</tr>
<tr>
<td><label for="youtube_link">YouTube link</label></td>
<td colspan="2"><input type="url" id="youtube_link" name="youtube_link" size="50" /></td>
</tr>
<tr>
<td><label for="vimeo_link">Vimeo link</label></td>
<td colspan="2"><input type="url" id="vimeo_link" name="vimeo_link" size="50" /></td>
</tr>
<tr>
<td><label for="fancy_link">Fancy link</label></td>
<td colspan="2"><input type="url" id="fancy_link" name="fancy_link" size="50" /></td>
</tr>
<tr>
<td colspan="3">
<hr />
Expand Down Expand Up @@ -217,7 +185,7 @@ <h3 class="heading">Social Media Meta Tags</h3>
<td colspan="2">Social meta tags include <a href="https://developers.facebook.com/docs/opengraph/using-objects/" title="About Facebook Open Graph Objects">Facebook</a> and <a href="https://developers.pinterest.com/rich_pins/" title="About Pinterest Rich Pins">Pinterest</a> Open Graph Tags and <a href="https://dev.twitter.com/docs/cards/types/product-card" title="About Twitter Product Cards">Twitter Cards</a>. These are enabled by default to make the store more accessible on different platforms, and more readable for search engines.</td>
</tr>
<tr>
<th><label for="twittercard_handle">The site's Twitter Handle</label></th>
<th><label for="twittercard_handle">The Site's Twitter Handle</label></th>
<td>
<input type="text" id="twittercard_handle" name="twittercard_handle" size="50" /><br />
<small>E.g. @Shopify. Required for Twitter Cards.</small>
Expand Down
7 changes: 0 additions & 7 deletions config/settings_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@
"footer_social_title": "Follow Us",
"twitter_link": "https://twitter.com/shopify",
"facebook_link": "https://facebook.com/shopify",
"pinterest_link": "http://www.pinterest.com/shopify/",
"google_plus_link": "https://plus.google.com/+shopify",
"instagram_link": "http://instagram.com/shopify",
"tumblr_link": "http://www.tumblr.com/tagged/shopify",
"youtube_link": "https://www.youtube.com/user/shopify",
"vimeo_link": "http://vimeo.com/shopify",
"fancy_link": "http://fancy.com/search?q=shopify",
"footer_display_newsletter": true,
"footer_newsletter_title": "Newsletter",
"product_quantity": true,
Expand Down
1 change: 1 addition & 0 deletions layout/theme.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
However, jQuery is included here so that it can be used inside the templates, e.g. in product.liquid.
{% endcomment %}
{{ '//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js' | script_tag }}
{{ 'modernizr.min.js' | asset_url | script_tag }}

</head>

Expand Down
Loading