Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove AddThis for social sharing, replace with provider sharing links #1997

Merged
merged 1 commit into from
Mar 25, 2021
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
117 changes: 75 additions & 42 deletions templates/components/common/share.html
Original file line number Diff line number Diff line change
@@ -1,57 +1,90 @@
{{#if settings.add_this.buttons}}
<div class="addthis_toolbox addthis_32x32_style" addthis:url="{{url}}"
addthis:title="{{title}}">
{{assignVar 'encodedUrl' (encodeURI url)}}
{{assignVar 'encodedTitle' (encodeURI head.title)}}
<div>
<ul class="socialLinks">
{{#each settings.add_this.buttons}}
<li class="socialLinks-item socialLinks-item--{{service}}">
<a class="addthis_button_{{service}} socialLinks__link icon icon--{{service}}"
{{#if service '===' 'facebook'}}
<a class="socialLinks__link icon icon--{{service}}"
title="{{{capitalize service}}}"
href="#"
href="https://facebook.com/sharer/sharer.php?u={{getVar 'encodedUrl'}}"
target="_blank"
rel="noopener"
{{{annotation}}}
>
<span class="aria-description--hidden">{{{capitalize service}}}</span>
{{#if service '===' 'facebook'}}
<svg>
<use xlink:href="#icon-facebook"/>
</svg>
{{else if service '===' 'email'}}
<svg>
<use xlink:href="#icon-envelope"/>
</svg>
{{else if service '===' 'print'}}
<svg>
<use xlink:href="#icon-print"/>
</svg>
{{else if service '===' 'twitter'}}
<svg>
<use xlink:href="#icon-twitter"/>
</svg>
{{else if service '===' 'linkedin'}}
<svg>
<use xlink:href="#icon-linkedin"/>
</svg>
{{else if service '===' 'google'}}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completely removed as Google+ is no longer a thing.

<svg>
<use xlink:href="#icon-google"/>
</svg>
{{else if service '===' 'pinterest'}}
<svg>
<use xlink:href="#icon-pinterest"/>
</svg>
{{/if}}
<svg>
<use xlink:href="#icon-facebook"/>
</svg>
</a>
{{else if service '===' 'email'}}
<a class="socialLinks__link icon icon--{{service}}"
title="{{{capitalize service}}}"
href="mailto:?subject={{getVar 'encodedTitle'}}&amp;body={{getVar 'encodedUrl'}}"
target="_self"
rel="noopener"
{{{annotation}}}
>
<span class="aria-description--hidden">{{{capitalize service}}}</span>
<svg>
<use xlink:href="#icon-envelope"/>
</svg>
</a>
{{else if service '===' 'print'}}
<a class="socialLinks__link icon icon--{{service}}"
title="{{{capitalize service}}}"
onclick="window.print();return false;"
{{{annotation}}}
>
<span class="aria-description--hidden">{{{capitalize service}}}</span>
<svg>
<use xlink:href="#icon-print"/>
</svg>
</a>
{{else if service '===' 'twitter'}}
<a class="socialLinks__link icon icon--{{service}}"
href="https://twitter.com/intent/tweet/?text={{getVar 'encodedTitle'}}&amp;url={{getVar 'encodedUrl'}}"
target="_blank"
rel="noopener"
title="{{{capitalize service}}}"
{{{annotation}}}
>
<span class="aria-description--hidden">{{{capitalize service}}}</span>
<svg>
<use xlink:href="#icon-twitter"/>
</svg>
</a>
{{else if service '===' 'linkedin'}}
<a class="socialLinks__link icon icon--{{service}}"
title="{{{capitalize service}}}"
href="https://www.linkedin.com/shareArticle?mini=true&amp;url={{getVar 'encodedUrl'}}&amp;title={{getVar 'encodedTitle'}}&amp;summary={{getVar 'encodedTitle'}}&amp;source={{getVar 'encodedUrl'}}"
target="_blank"
rel="noopener"
{{{annotation}}}
>
<span class="aria-description--hidden">{{{capitalize service}}}</span>
<svg>
<use xlink:href="#icon-linkedin"/>
</svg>
</a>
{{else if service '===' 'pinterest'}}
<a class="socialLinks__link icon icon--{{service}}"
title="{{{capitalize service}}}"
href="https://pinterest.com/pin/create/button/?url={{getVar 'encodedUrl'}}&amp;description={{getVar 'encodedTitle'}}"
target="_blank"
rel="noopener"
{{{annotation}}}
>
<span class="aria-description--hidden">{{{capitalize service}}}</span>
<svg>
<use xlink:href="#icon-pinterest"/>
</svg>
</a>
{{/if}}
</li>
{{/each}}
</ul>
<script type="text/javascript"
defer src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-4e94ed470ee51e32"></script>
<script>
window.addEventListener('DOMContentLoaded', function() {
if (typeof(addthis) === "object") {
addthis.toolbox('.addthis_toolbox');
}
});
</script>
</div>
{{/if}}
{{#if settings.facebook_like_button.enabled}}
Expand Down
4 changes: 1 addition & 3 deletions templates/components/products/product-view.html
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,7 @@ <h2 class="productView-brand"{{#if schema}} itemprop="brand" itemscope itemtype=
{{> components/common/wishlist-dropdown}}
{{/if}}
</div>
{{#unless is_ajax}}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer needed to hide from AJAX (quick view) as we no longer have a JS dependency, and the sharing URL is passed explicitly from the product object.

{{> components/common/share}}
{{/unless}}
{{> components/common/share url=product.url}}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing in url explicitly, which makes this component more re-usable in other contexts if desired.

</section>

<article class="productView-description"{{#if schema}} itemprop="description"{{/if}}>
Expand Down