This file contains hidden or 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
{%- form 'localization', class: 'selectors-form' -%} | |
<select id="currency-list"> | |
{% for currency in form.available_currencies %} | |
<option{% if currency.iso_code == form.current_currency.iso_code %} selected="true"{% endif %} | |
data-name="{{ currency.name }}" value="{{ currency.iso_code }}"> | |
{%- if currency.symbol -%}{{ currency.symbol }}{%- endif -%} {{ currency.iso_code }} | |
</option> | |
{%- endfor -%} | |
</select> | |
<input id="currentCurrencyInp" type="hidden" name="currency_code" value="{{ form.current_currency.iso_code }}"> |
This file contains hidden or 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
function up_the_count( $count ) { | |
global $post; | |
$id = $post->ID; | |
$post_type = get_post_type($id); | |
switch ($post_type) { | |
case 'post': | |
if ( have_rows( 'content', $id ) ): | |
while ( have_rows( 'content', $id ) ) : the_row(); | |
if ( get_row_layout() == 'paragraph_section' ): | |
$count += count( preg_split( '/\s+/', get_sub_field( 'paragraph' ) ) ); |
This file contains hidden or 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
$.getJSON( | |
'https://geolocation-db.com/json/0f761a30-fe14-11e9-b59f-e53803842572', | |
function(data) { | |
console.log(data); | |
if ( data.country_code === "US" || data.country_name === "United States" ) { | |
console.log('Is USA'); | |
} | |
} | |
); |
This file contains hidden or 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
// This example shows us how to update broken swiper after Fancybox carousel closing | |
if (typeof fancyboxInit !== undefined) { | |
// Main approach here is the next row | |
$.fancybox.defaults.backFocus = false; | |
let showCaseSlider = $('.showCaseSlider .swiper-container'); | |
$('[data-fancybox]').fancybox({ | |
afterClose: function() { | |
if (showCaseSlider) { | |
let showCaseSliderInstance = showCaseSlider[0].swiper; | |
showCaseSliderInstance.update(); |
This file contains hidden or 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
function loadAllScripts() { | |
// Put all your scripts here | |
}; | |
const loadScriptsInterval = setInterval(function() { | |
if (window.jQuery && window.Swiper) { | |
// Here we clear interval and fire scripts execution | |
clearInterval(loadScriptsInterval); | |
loadAllScripts(); | |
} |
This file contains hidden or 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
<style id="critical-css"> | |
/* Your styles here */ | |
</style> | |
<script> | |
const criticalStyleTag = document.getElementById('critical-css'); | |
document.addEventListener('DOMContentLoaded', function() { | |
setTimeout(function(){ | |
criticalStyleTag.parentNode.removeChild(criticalStyleTag); | |
}, 2000); | |
}); |
This file contains hidden or 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
(function($) { | |
$(document).ready(function() { | |
// Do stuff now | |
}) | |
})(window.jQuery); |
This file contains hidden or 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
{%- unless shop.enabled_payment_types == empty -%} | |
<div class="footer-group"> | |
<p class="footer__title"> | |
Payment methods | |
</p> | |
<ul class="inline-list payment-icons"> | |
{%- for type in shop.enabled_payment_types -%} | |
<li class="icon--payment"> | |
{{ type | payment_type_svg_tag }} | |
</li> |
This file contains hidden or 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
const target = document.querySelector('.stickyATCtrigger'); | |
function handleIntersection(entries) { | |
entries.map((entry) => { | |
if (entry.isIntersecting) { | |
// element is in viewport | |
$('body').removeClass('sticky-addtocart-mob'); | |
} else { | |
// element is out of viewport | |
$('body').addClass('sticky-addtocart-mob'); | |
} |
This file contains hidden or 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
var target = document.querySelector('#bc-sf-filter-products'); | |
var observer = new MutationObserver(function(mutations) { | |
mutations.forEach(function(mutation) { | |
if (mutation.type === 'childList') { | |
// Do some stuff | |
productsGrid(); | |
} | |
}); | |
}); | |
var config = { attributes: true, childList: true, characterData: true } |