first commit

This commit is contained in:
2024-12-17 13:43:22 +01:00
commit 8e6cd8b410
21292 changed files with 3514826 additions and 0 deletions

View File

@@ -0,0 +1,343 @@
import $ from 'jquery';
import prestashop from 'prestashop';
prestashop.cart = prestashop.cart || {};
prestashop.cart.active_inputs = null;
let spinnerSelector = 'input[name="product-quantity-spin"]';
let hasError = false;
let isUpdateOperation = false;
let errorMsg = '';
/**
* Attach Bootstrap TouchSpin event handlers
*/
function createSpin()
{
$.each($(spinnerSelector), function (index, spinner) {
$(spinner).TouchSpin({
verticalbuttons: false,
verticalupclass: 'material-icons touchspin-up',
verticaldownclass: 'material-icons touchspin-down',
buttondown_class: 'btn btn-touchspin js-touchspin js-increase-product-quantity',
buttonup_class: 'btn btn-touchspin js-touchspin js-decrease-product-quantity',
min: parseInt($(spinner).attr('min'), 10),
max: 1000000
});
});
CheckUpdateQuantityOperations.switchErrorStat();
}
$(document).ready(() => {
let productLineInCartSelector = '.js-cart-line-product-quantity';
let promises = [];
prestashop.on('updateCart', () => {
$('.quickview').modal('hide');
});
prestashop.on('updatedCart', () => {
createSpin();
$('#header .row.action .blockcart a').click(function(e) {
e.preventDefault();
$('body').addClass('side_open')
$('.side_menu .side_menu_rel > div').removeClass('show');
$('#side_cart_wrap').addClass('show');
$('.side_close').removeClass('search_close menu_close').addClass('cart_close');
$('.side_menu').find('.cart-prods > li').each(function(i){
var row = $(this);
setTimeout(function(){
row.addClass('show');
}, 300 + i * 160);
});
});
});
createSpin();
let $body = $('body');
function isTouchSpin(namespace) {
return namespace === 'on.startupspin' || namespace === 'on.startdownspin';
}
function shouldIncreaseProductQuantity(namespace) {
return namespace === 'on.startupspin';
}
function findCartLineProductQuantityInput($target) {
var $input = $target.parents('.bootstrap-touchspin').find(productLineInCartSelector);
if ($input.is(':focus')) {
return null;
} else {
return $input;
}
}
function camelize(subject) {
let actionTypeParts = subject.split('-');
let i;
let part;
let camelizedSubject = '';
for (i = 0; i < actionTypeParts.length; i++) {
part = actionTypeParts[i];
if (0 !== i) {
part = part.substring(0, 1).toUpperCase() + part.substring(1);
}
camelizedSubject = camelizedSubject + part;
}
return camelizedSubject;
}
function parseCartAction($target, namespace) {
if (!isTouchSpin(namespace)) {
return {
url: $target.attr('href'),
type: camelize($target.data('link-action'))
}
}
let $input = findCartLineProductQuantityInput($target);
if (!$input) {
return;
}
let cartAction = {};
if (shouldIncreaseProductQuantity(namespace)) {
cartAction = {
url: $input.data('up-url'),
type: 'increaseProductQuantity'
};
} else {
cartAction = {
url: $input.data('down-url'),
type: 'decreaseProductQuantity'
}
}
return cartAction;
}
let abortPreviousRequests = () => {
var promise;
while (promises.length > 0) {
promise = promises.pop();
promise.abort();
}
};
var getTouchSpinInput = ($button) => {
return $($button.parents('.bootstrap-touchspin').find('input'));
};
var handleCartAction = (event) => {
event.preventDefault();
let $target = $(event.currentTarget);
let dataset = event.currentTarget.dataset;
let cartAction = parseCartAction($target, event.namespace);
let requestData = {
ajax: '1',
action: 'update'
};
if (typeof cartAction === 'undefined') {
return;
}
abortPreviousRequests();
$.ajax({
url: cartAction.url,
method: 'POST',
data: requestData,
dataType: 'json',
beforeSend: function (jqXHR) {
promises.push(jqXHR);
}
}).then(function (resp) {
CheckUpdateQuantityOperations.checkUpdateOpertation(resp);
var $quantityInput = getTouchSpinInput($target);
$quantityInput.val(resp.quantity);
// Refresh cart preview
prestashop.emit('updateCart', {
reason: dataset
});
}).fail((resp) => {
prestashop.emit('handleError', {
eventType: 'updateProductInCart',
resp: resp,
cartAction: cartAction.type
});
});
};
$body.on(
'click',
'[data-link-action="delete-from-cart"], [data-link-action="remove-voucher"]',
handleCartAction
);
$body.on('touchspin.on.startdownspin', spinnerSelector, handleCartAction);
$body.on('touchspin.on.startupspin', spinnerSelector, handleCartAction);
function sendUpdateQuantityInCartRequest(updateQuantityInCartUrl, requestData, $target) {
abortPreviousRequests();
return $.ajax({
url: updateQuantityInCartUrl,
method: 'POST',
data: requestData,
dataType: 'json',
beforeSend: function (jqXHR) {
promises.push(jqXHR);
}
}).then(function (resp) {
CheckUpdateQuantityOperations.checkUpdateOpertation(resp);
$target.val(resp.quantity);
var dataset;
if ($target && $target.dataset) {
dataset = $target.dataset;
} else {
dataset = resp;
}
// Refresh cart preview
prestashop.emit('updateCart', {
reason: dataset
});
}).fail((resp) => {
prestashop.emit('handleError', {eventType: 'updateProductQuantityInCart', resp: resp})
});
}
function getRequestData(quantity) {
return {
ajax: '1',
qty: Math.abs(quantity),
action: 'update',
op: getQuantityChangeType(quantity)
}
}
function getQuantityChangeType($quantity) {
return ($quantity > 0) ? 'up' : 'down';
}
function updateProductQuantityInCart(event)
{
let $target = $(event.currentTarget);
let updateQuantityInCartUrl = $target.data('update-url');
let baseValue = $target.attr('value');
// There should be a valid product quantity in cart
let targetValue = $target.val();
if (targetValue != parseInt(targetValue) || targetValue < 0 || isNaN(targetValue)) {
$target.val(baseValue);
return;
}
// There should be a new product quantity in cart
let qty = targetValue - baseValue;
if (qty == 0) {
return;
}
var requestData = getRequestData(qty);
sendUpdateQuantityInCartRequest(updateQuantityInCartUrl, requestData, $target);
}
$body.on(
'focusout',
productLineInCartSelector,
(event) => {
updateProductQuantityInCart(event);
}
);
$body.on(
'keyup',
productLineInCartSelector,
(event) => {
if (event.keyCode == 13) {
updateProductQuantityInCart(event);
}
}
);
$body.on(
'click',
'.js-discount .code',
(event) => {
event.stopPropagation();
var $code = $(event.currentTarget);
var $discountInput = $('[name=discount_name]');
$discountInput.val($code.text());
return false;
}
)
});
const CheckUpdateQuantityOperations = {
'switchErrorStat': () => {
/*
if errorMsg is not empty or if notifications are shown, we have error to display
if hasError is true, quantity was not updated : we don't disable checkout button
*/
let $checkoutBtn = $('.checkout a');
if ($("#notifications article.alert-danger").length || ('' !== errorMsg && !hasError)) {
$checkoutBtn.addClass('disabled');
}
if ('' !== errorMsg) {
let strError = ' <article class="alert alert-danger" role="alert" data-alert="danger"><ul><li>' + errorMsg + '</li></ul></article>';
$('#notifications .container').html(strError);
errorMsg = '';
isUpdateOperation = false;
if (hasError) {
// if hasError is true, quantity was not updated : allow checkout
$checkoutBtn.removeClass('disabled');
}
} else if (!hasError && isUpdateOperation) {
hasError = false;
isUpdateOperation = false;
$('#notifications .container').html('');
$checkoutBtn.removeClass('disabled');
}
},
'checkUpdateOpertation': (resp) => {
/*
resp.hasError can be not defined but resp.errors not empty: quantity is updated but order cannot be placed
when resp.hasError=true, quantity is not updated
*/
hasError = resp.hasOwnProperty('hasError');
let errors = resp.errors || "";
// 1.7.2.x returns errors as string, 1.7.3.x returns array
if (errors instanceof Array) {
errorMsg = errors.join(" ");
} else {
errorMsg = errors;
}
isUpdateOperation = true;
}
};

View File

@@ -0,0 +1,76 @@
/**
* 2007-2018 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2018 PrestaShop SA
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import $ from 'jquery';
import prestashop from 'prestashop';
function setUpCheckout() {
if ($('.js-cancel-address').length !== 0) {
$('.checkout-step:not(.js-current-step) .step-title').addClass('not-allowed');
}
$('.js-terms a').on('click', (event) => {
event.preventDefault();
var url = $(event.target).attr('href');
if (url) {
// TODO: Handle request if no pretty URL
url += `?content_only=1`;
$.get(url, (content) => {
$('#modal').find('.js-modal-content').html($(content).find('.page-cms').contents());
}).fail((resp) => {
prestashop.emit('handleError', {eventType: 'clickTerms', resp: resp});
});
}
$('#modal').modal('show');
});
$('.js-gift-checkbox').on('click', (event) => {
$('#gift').collapse('toggle');
});
}
$(document).ready(() => {
if ($('body#checkout').length === 1) {
setUpCheckout();
}
prestashop.on('updatedDeliveryForm', (params) => {
if (typeof params.deliveryOption === 'undefined' || 0 === params.deliveryOption.length) {
return;
}
// Hide all carrier extra content ...
$(".carrier-extra-content").hide();
// and show the one related to the selected carrier
params.deliveryOption.next(".carrier-extra-content").slideDown();
// active delivery
$('.delivery-option').removeClass('active');
params.deliveryOption.addClass('active');
});
if($('.delivery-option input:radio:checked').length > 0){
$('.delivery-option input:radio:checked').parents('div.delivery-option').addClass('active');
}
});

View File

@@ -0,0 +1,49 @@
/**
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2017 PrestaShop SA
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import prestashop from 'prestashop';
import $ from 'jquery';
prestashop.blockcart = prestashop.blockcart || {};
prestashop.blockcart.showModal = (html) => {
function getBlockCartModal() {
return $('#blockcart-modal');
}
let $blockCartModal = getBlockCartModal();
if ($blockCartModal.length){
$blockCartModal.remove();
}
$('body').append(html);
$blockCartModal = getBlockCartModal();
$blockCartModal.modal('show').on('hidden.bs.modal', (event) => {
prestashop.emit('updateProduct', {
reason: event.currentTarget.dataset
});
});
};

View File

@@ -0,0 +1,54 @@
/**
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2017 PrestaShop SA
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import $ from 'jquery';
export default class DropDown {
constructor(el) {
this.el = el;
}
init() {
this.el.on('show.bs.dropdown', function(e, el) {
if (el) {
$(`#${el}`).find('.dropdown-menu').first().stop(true, true).slideDown();
} else {
$(e.target).find('.dropdown-menu').first().stop(true, true).slideDown();
}
});
this.el.on('hide.bs.dropdown', function(e, el) {
if (el) {
$(`#${el}`).find('.dropdown-menu').first().stop(true, true).slideUp();
} else {
$(e.target).find('.dropdown-menu').first().stop(true, true).slideUp();
}
});
this.el.find('select.link').each(function(idx, el) {
$(el).on('change', function(event) {
window.location = $(this).val();
});
});
}
}

View File

@@ -0,0 +1,55 @@
/**
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2017 PrestaShop SA
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import $ from 'jquery';
export default class Form {
init() {
this.parentFocus();
this.togglePasswordVisibility();
}
parentFocus() {
$('.js-child-focus').focus(function () {
$(this).closest('.js-parent-focus').addClass('focus');
});
$('.js-child-focus').focusout(function () {
$(this).closest('.js-parent-focus').removeClass('focus');
});
}
togglePasswordVisibility() {
$('button[data-action="show-password"]').on('click', function () {
const elm = $(this).closest('.input-group').children('input.js-visible-password');
if (elm.attr('type') === 'password') {
elm.attr('type', 'text');
$(this).html('<i><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-eye"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path><circle cx="12" cy="12" r="3"></circle></svg></i>');
} else {
elm.attr('type', 'password');
$(this).html('<i><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-eye-off"><path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"></path><line x1="1" y1="1" x2="23" y2="23"></line></svg></i>');
}
});
}
}

View File

@@ -0,0 +1,49 @@
/**
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2017 PrestaShop SA
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import $ from 'jquery';
export default class ProductMinitature {
init(){
$('.js-product-miniature').each((index, element) => {
const FLAG_MARGIN = 10;
let $discount = $(element).find('.discount-product');
let $onsale = $(element).find('.on-sale');
let $new = $(element).find('.new');
// if($onsale.length){
// $new.css('top', ($onsale.height() * 2 + 12));
// }
if($(element).find('.color').length > 5){
let count = 0;
$(element).find('.color').each((index, element) =>{
if(index > 4){
$(element).hide();
count ++;
}
});
$(element).find('.js-count').append(`+${count}`);
}
});
}
}

View File

@@ -0,0 +1,84 @@
/**
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2017 PrestaShop SA
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import $ from 'jquery';
import 'velocity-animate';
export default class ProductSelect {
init() {
const MAX_THUMBS = 5;
const FLAG_MARGIN = 10;
let $arrows = $('.js-modal-arrows');
let $thumbnails = $('.js-modal-product-images');
let $onsale = $('.on-sale');
$('body').on('click','.js-modal-thumb', (event) => {
if($('.js-modal-thumb').hasClass('selected')){
$('.js-modal-thumb').removeClass('selected');
}
$(event.currentTarget).addClass('selected');
$('.js-modal-product-cover').attr('src', $(event.target).data('image-large-src'));
$('.js-modal-product-cover').attr('title', $(event.target).attr('title'));
$('.js-modal-product-cover').attr('alt', $(event.target).attr('alt'));
})
.on('click', 'aside#thumbnails', (event) => {
if (event.target.id == 'thumbnails'){
$('#product-modal').modal('hide');
}
});
// if($onsale.length && $('#product').length){
// $('.new').css('top',$onsale.height() + FLAG_MARGIN);
// }
if ($('.js-modal-product-images li').length <= MAX_THUMBS) {
$arrows.css('opacity', '.2');
} else {
$arrows.on('click', (event) => {
if ($(event.target).hasClass('arrow-up') && $thumbnails.position().top < 0) {
this.move('up');
$('.js-modal-arrow-down').css('opacity','1');
} else if ($(event.target).hasClass('arrow-down') && $thumbnails.position().top + $thumbnails.height() > $('.js-modal-mask').height()) {
this.move('down');
$('.js-modal-arrow-up').css('opacity','1');
}
});
}
}
move(direction) {
const THUMB_MARGIN = 10;
var $thumbnails = $('.js-modal-product-images');
var thumbHeight = $('.js-modal-product-images li img').height() + THUMB_MARGIN;
var currentPosition = $thumbnails.position().top;
$thumbnails.velocity({
translateY: (direction === 'up') ? currentPosition + thumbHeight : currentPosition - thumbHeight
},function(){
if ($thumbnails.position().top >= 0) {
$('.js-modal-arrow-up').css('opacity','.2');
} else if ($thumbnails.position().top + $thumbnails.height() <= $('.js-modal-mask').height()) {
$('.js-modal-arrow-down').css('opacity','.2');
}
});
}
}

View File

@@ -0,0 +1,92 @@
/**
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2017 PrestaShop SA
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import $ from 'jquery';
import DropDown from './drop-down';
export default class TopMenu extends DropDown {
init() {
let elmId;
let self = this;
this.el.find('li').hover((e) => {
if (this.el.parent().hasClass('mobile')) {
return;
}
if (elmId !== $(e.currentTarget).attr('id')) {
if ($(e.target).data('depth') === 0) {
$(`#${elmId} .js-sub-menu`).css({
'top': '78px',
'visibility': 'hidden',
'opacity':'0'
});
}
elmId = $(e.currentTarget).attr('id');
}
if (elmId && $(e.target).data('depth') === 0) {
$(`#${elmId} .js-sub-menu`).css({
'top': '68px',
'visibility': 'visible',
'opacity':'1'
});
}
});
$('#menu-icon').on('click', function() {
$('#mobile_top_menu_wrapper').toggle();
self.toggleMobileMenu();
});
$('.js-top-menu').mouseleave(() => {
if (this.el.parent().hasClass('mobile')) {
return;
}
$(`#${elmId} .js-sub-menu`).css({
'top': '78px',
'visibility': 'hidden',
'opacity':'0'
});
});
this.el.on('click', (e) => {
if (this.el.parent().hasClass('mobile')) {
return;
}
e.stopPropagation();
});
prestashop.on('responsive update', function(event) {
$('.js-sub-menu').removeAttr('style');
self.toggleMobileMenu();
});
super.init();
}
toggleMobileMenu() {
if ($('#mobile_top_menu_wrapper').is(":visible")) {
$('#notifications').hide();
$('#wrapper').hide();
$('#footer').hide();
} else {
$('#notifications').show();
$('#wrapper').show();
$('#footer').show();
}
}
}

View File

@@ -0,0 +1,262 @@
import $ from 'jquery';
import prestashop from 'prestashop';
!function($){
"use strict";
var County = function(arg, options){
this.init(arg, options);
};
County.prototype = {
constructor: County,
init: function(arg, options){
this.settings = $.extend({ endDateTime: new Date(), animation: 'fade', reflection: false, reflectionOpacity: 0.2, speed: 500, theme: 'black' }, options);
this.timeoutInterval = null;
this.container = $(arg);
this.createViews();
},
createViews: function() {
var self = this;
if (!this.container.hasClass('county')) {
this.container.addClass('county ' + this.settings.theme);
this.container.append('<div class="county-cell county-days-wrapper first"><span class="county-days">000</span><span class="county-label county-label-days">' + this.settings.titleDays + '</span></div><div class="county-cell county-hours-wrapper"><span class="county-hours">00</span><span class="county-label county-label-hours">' + this.settings.titleHours + '</span></div><div class="county-cell county-minutes-wrapper separator-left separator-left"><span class="county-minutes">00</span><span class="county-label county-label-minutes">' + this.settings.titleMinutes + '</span></div><div class="county-cell county-seconds-wrapper separator-left last"><span class="county-seconds">00</span><span class="county-label county-label-seconds">' + this.settings.titleSeconds + '</span></div>');
}
if (this.container.attr('id') == undefined || this.container.attr('id') == null) {
this.container.attr('id', Math.random());
}
var w = 0;
this.container.find('>span').each(function () {
if ($(this).hasClass('county-days-wrapper') ||
$(this).hasClass('county-hours-wrapper') ||
$(this).hasClass('county-minutes-wrapper') ||
$(this).hasClass('county-seconds-wrapper'))
w += $(this).outerWidth();
});
this.container.css({ width: w });
this.container.find('>span>span').each(function () {
$(this).css({ position: 'absolute', width: $(this).width(), height: $(this).height() });
$(this).parent().css({ width: $(this).width() });
var daysLabel = self.container.find('.county-label-days');
var hoursLabel = self.container.find('.county-label-hours');
var minutesLabel = self.container.find('.county-label-minutes');
var secondsLabel = self.container.find('.county-label-seconds');
if ($(this).hasClass('county-days')) {
daysLabel.css({ width: $(this).parent().outerWidth() });
}
if ($(this).hasClass('county-hours')) {
hoursLabel.css({ width: $(this).parent().outerWidth() });
}
if ($(this).hasClass('county-minutes')) {
minutesLabel.css({ width: $(this).parent().outerWidth() });
}
if ($(this).hasClass('county-seconds')) {
secondsLabel.css({ width: $(this).parent().outerWidth() });
}
});
this.reflectionContainer = this.container.clone().css({ opacity: this.settings.reflectionOpacity }).attr('id', this.container.attr('id') + '-refl').addClass('county-reflection');
if (this.settings.reflection)
this.container.after(this.reflectionContainer);
this.updateCounter();
},
getCountDown: function() {
var self = this;
clearTimeout(this.timeoutInterval);
this.timeoutInterval = setTimeout(function () {
self.updateCounter();
}, 1000);
},
updateCounter: function() {
var countDown = this.getCurrentCountDown();
var days = this.container.find('.county-days');
var hours = this.container.find('.county-hours');
var minutes = this.container.find('.county-minutes');
var seconds = this.container.find('.county-seconds');
var dayVal = days.html();
var hourVal = hours.html();
var minuteVal = minutes.html();
var secondVal = seconds.html();
if (dayVal == countDown.days) {
days.html(countDown.days);
}
else {
if (this.settings.reflection)
this.aimateObject(days, this.reflectionContainer.find('.county-days'), dayVal, countDown.days, this.settings.animation);
else
this.aimateObject(days, null, dayVal, countDown.days, this.settings.animation);
}
if (hourVal == countDown.hours)
hours.html(countDown.hours);
else {
if (this.settings.reflection)
this.aimateObject(hours, this.reflectionContainer.find('.county-hours'), hourVal, countDown.hours, this.settings.animation);
else
this.aimateObject(hours, null, hourVal, countDown.hours, this.settings.animation);
}
if (minuteVal == countDown.minutes)
minutes.html(countDown.minutes);
else {
if (this.settings.reflection)
this.aimateObject(minutes, this.reflectionContainer.find('.county-minutes'), minuteVal, countDown.minutes, this.settings.animation);
else
this.aimateObject(minutes, null, minuteVal, countDown.minutes, this.settings.animation);
}
if (secondVal == countDown.seconds)
seconds.html(countDown.seconds);
else {
if (this.settings.reflection)
this.aimateObject(seconds, this.reflectionContainer.find('.county-seconds'), secondVal, countDown.seconds, this.settings.animation);
else
this.aimateObject(seconds, null, secondVal, countDown.seconds, this.settings.animation);
}
this.getCountDown();
},
aimateObject: function(element, reflectionElement, oldValue, newValue, type) {
if (type == 'fade') {
element.fadeOut('fast').fadeIn('fast').html(newValue);
if (this.settings.reflection)
this.reflectionElement.fadeOut('fast').fadeIn('fast').html(newValue);
}
else if (type == 'none') {
element.html(newValue);
}
else if (type == 'scroll') {
var copy = element.clone();
var reflectionCopy = null;
if (this.settings.reflection)
reflectionCopy = reflectionElement.clone();
var marginTop = copy.outerHeight();
copy.css({ marginTop: -marginTop });
copy.html(newValue);
copy.prependTo(element.parent());
if (this.settings.reflection) {
reflectionCopy.css({ marginTop: -marginTop });
reflectionCopy.html(newValue);
reflectionCopy.prependTo(this.reflectionElement.parent());
}
element.animate({ marginTop: "22px", opacity: 0 }, this.settings.speed, function () { $(this).remove(); });
copy.animate({ marginTop: 0 }, this.settings.speed, function () { });
if (this.settings.reflection) {
this.reflectionElement.animate({ marginTop: marginTop }, this.settings.speed, function () { $(this).remove(); });
reflectionCopy.animate({ marginTop: 0 }, this.settings.speed, function () { });
}
}
},
getCurrentCountDown: function() {
var currentDateTime = new Date();
var diff = parseFloat(this.settings.endDateTime - currentDateTime);
var self = this;
var seconds = 0;
var minutes = 0;
var hours = 0;
var total = parseFloat(((((diff / 1000.0) / 60.0) / 60.0) / 24.0));
var days = parseInt(total);
total -= days;
total *= 24.0;
hours = parseInt(total);
total -= hours;
total *= 60.0;
minutes = parseInt(total);
total -= minutes;
total *= 60;
seconds = parseInt(total);
return { days: self.formatNumber(Math.max(0, days), true), hours: self.formatNumber(Math.max(0, hours), false), minutes: self.formatNumber(Math.max(0, minutes), false), seconds: self.formatNumber(Math.max(0, seconds), false) };
},
formatNumber: function(number, isday) {
var strNumber = number.toString();
if (!isday) {
if (strNumber.length == 1)
return '0' + strNumber;
else
return strNumber;
}
else {
if (strNumber.length == 1)
return strNumber;
else if (strNumber == 2)
return strNumber;
else
return strNumber;
}
},
getHunderth: function(number) {
var strNumber = '' + number;
if (strNumber.length == 3)
return strNumber.substr(0, 1);
else
return '0';
},
getTenth: function(number) {
var strNumber = '' + number;
if (strNumber.length == 2)
return strNumber.substr(0, 1);
else
return '0';
},
getUnit: function(number) {
var strNumber = '' + number;
if (strNumber.length >= 1)
return strNumber.substr(0, 1);
else
return '0';
}
}
$.fn.county = function (option, params) {
var $this = $(this);
var data = $this.data('list');
if (!data) {$this.data('list', (data = new County(this, option)));}
if (typeof option === 'string'){ return data[option](params);}
};
$.fn.county.Constructor = County;
}(window.jQuery);

View File

@@ -0,0 +1,42 @@
/**
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2017 PrestaShop SA
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import $ from 'jquery';
function initRmaItemSelector() {
$('#order-return-form table thead input[type=checkbox]').on('click', function() {
var checked = $(this).prop('checked');
$('#order-return-form table tbody input[type=checkbox]').each(function(_, checkbox) {
$(checkbox).prop('checked', checked);
});
});
}
function setupCustomerScripts() {
if ($('body#order-detail')) {
initRmaItemSelector();
}
}
$(document).ready(setupCustomerScripts);

33
themes/ayon__/_dev/js/lib/anime.min.js vendored Normal file
View File

@@ -0,0 +1,33 @@
/*
2017 Julian Garnier
Released under the MIT license
*/
var $jscomp={scope:{}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(e,r,p){if(p.get||p.set)throw new TypeError("ES3 does not support getters and setters.");e!=Array.prototype&&e!=Object.prototype&&(e[r]=p.value)};$jscomp.getGlobal=function(e){return"undefined"!=typeof window&&window===e?e:"undefined"!=typeof global&&null!=global?global:e};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX="jscomp_symbol_";
$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.symbolCounter_=0;$jscomp.Symbol=function(e){return $jscomp.SYMBOL_PREFIX+(e||"")+$jscomp.symbolCounter_++};
$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var e=$jscomp.global.Symbol.iterator;e||(e=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[e]&&$jscomp.defineProperty(Array.prototype,e,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};$jscomp.arrayIterator=function(e){var r=0;return $jscomp.iteratorPrototype(function(){return r<e.length?{done:!1,value:e[r++]}:{done:!0}})};
$jscomp.iteratorPrototype=function(e){$jscomp.initSymbolIterator();e={next:e};e[$jscomp.global.Symbol.iterator]=function(){return this};return e};$jscomp.array=$jscomp.array||{};$jscomp.iteratorFromArray=function(e,r){$jscomp.initSymbolIterator();e instanceof String&&(e+="");var p=0,m={next:function(){if(p<e.length){var u=p++;return{value:r(u,e[u]),done:!1}}m.next=function(){return{done:!0,value:void 0}};return m.next()}};m[Symbol.iterator]=function(){return m};return m};
$jscomp.polyfill=function(e,r,p,m){if(r){p=$jscomp.global;e=e.split(".");for(m=0;m<e.length-1;m++){var u=e[m];u in p||(p[u]={});p=p[u]}e=e[e.length-1];m=p[e];r=r(m);r!=m&&null!=r&&$jscomp.defineProperty(p,e,{configurable:!0,writable:!0,value:r})}};$jscomp.polyfill("Array.prototype.keys",function(e){return e?e:function(){return $jscomp.iteratorFromArray(this,function(e){return e})}},"es6-impl","es3");var $jscomp$this=this;
(function(e,r){"function"===typeof define&&define.amd?define([],r):"object"===typeof module&&module.exports?module.exports=r():e.anime=r()})(this,function(){function e(a){if(!h.col(a))try{return document.querySelectorAll(a)}catch(c){}}function r(a,c){for(var d=a.length,b=2<=arguments.length?arguments[1]:void 0,f=[],n=0;n<d;n++)if(n in a){var k=a[n];c.call(b,k,n,a)&&f.push(k)}return f}function p(a){return a.reduce(function(a,d){return a.concat(h.arr(d)?p(d):d)},[])}function m(a){if(h.arr(a))return a;
h.str(a)&&(a=e(a)||a);return a instanceof NodeList||a instanceof HTMLCollection?[].slice.call(a):[a]}function u(a,c){return a.some(function(a){return a===c})}function C(a){var c={},d;for(d in a)c[d]=a[d];return c}function D(a,c){var d=C(a),b;for(b in a)d[b]=c.hasOwnProperty(b)?c[b]:a[b];return d}function z(a,c){var d=C(a),b;for(b in c)d[b]=h.und(a[b])?c[b]:a[b];return d}function T(a){a=a.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(a,c,d,k){return c+c+d+d+k+k});var c=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a);
a=parseInt(c[1],16);var d=parseInt(c[2],16),c=parseInt(c[3],16);return"rgba("+a+","+d+","+c+",1)"}function U(a){function c(a,c,b){0>b&&(b+=1);1<b&&--b;return b<1/6?a+6*(c-a)*b:.5>b?c:b<2/3?a+(c-a)*(2/3-b)*6:a}var d=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(a)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(a);a=parseInt(d[1])/360;var b=parseInt(d[2])/100,f=parseInt(d[3])/100,d=d[4]||1;if(0==b)f=b=a=f;else{var n=.5>f?f*(1+b):f+b-f*b,k=2*f-n,f=c(k,n,a+1/3),b=c(k,n,a);a=c(k,n,a-1/3)}return"rgba("+
255*f+","+255*b+","+255*a+","+d+")"}function y(a){if(a=/([\+\-]?[0-9#\.]+)(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(a))return a[2]}function V(a){if(-1<a.indexOf("translate")||"perspective"===a)return"px";if(-1<a.indexOf("rotate")||-1<a.indexOf("skew"))return"deg"}function I(a,c){return h.fnc(a)?a(c.target,c.id,c.total):a}function E(a,c){if(c in a.style)return getComputedStyle(a).getPropertyValue(c.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase())||"0"}function J(a,c){if(h.dom(a)&&
u(W,c))return"transform";if(h.dom(a)&&(a.getAttribute(c)||h.svg(a)&&a[c]))return"attribute";if(h.dom(a)&&"transform"!==c&&E(a,c))return"css";if(null!=a[c])return"object"}function X(a,c){var d=V(c),d=-1<c.indexOf("scale")?1:0+d;a=a.style.transform;if(!a)return d;for(var b=[],f=[],n=[],k=/(\w+)\((.+?)\)/g;b=k.exec(a);)f.push(b[1]),n.push(b[2]);a=r(n,function(a,b){return f[b]===c});return a.length?a[0]:d}function K(a,c){switch(J(a,c)){case "transform":return X(a,c);case "css":return E(a,c);case "attribute":return a.getAttribute(c)}return a[c]||
0}function L(a,c){var d=/^(\*=|\+=|-=)/.exec(a);if(!d)return a;var b=y(a)||0;c=parseFloat(c);a=parseFloat(a.replace(d[0],""));switch(d[0][0]){case "+":return c+a+b;case "-":return c-a+b;case "*":return c*a+b}}function F(a,c){return Math.sqrt(Math.pow(c.x-a.x,2)+Math.pow(c.y-a.y,2))}function M(a){a=a.points;for(var c=0,d,b=0;b<a.numberOfItems;b++){var f=a.getItem(b);0<b&&(c+=F(d,f));d=f}return c}function N(a){if(a.getTotalLength)return a.getTotalLength();switch(a.tagName.toLowerCase()){case "circle":return 2*
Math.PI*a.getAttribute("r");case "rect":return 2*a.getAttribute("width")+2*a.getAttribute("height");case "line":return F({x:a.getAttribute("x1"),y:a.getAttribute("y1")},{x:a.getAttribute("x2"),y:a.getAttribute("y2")});case "polyline":return M(a);case "polygon":var c=a.points;return M(a)+F(c.getItem(c.numberOfItems-1),c.getItem(0))}}function Y(a,c){function d(b){b=void 0===b?0:b;return a.el.getPointAtLength(1<=c+b?c+b:0)}var b=d(),f=d(-1),n=d(1);switch(a.property){case "x":return b.x;case "y":return b.y;
case "angle":return 180*Math.atan2(n.y-f.y,n.x-f.x)/Math.PI}}function O(a,c){var d=/-?\d*\.?\d+/g,b;b=h.pth(a)?a.totalLength:a;if(h.col(b))if(h.rgb(b)){var f=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(b);b=f?"rgba("+f[1]+",1)":b}else b=h.hex(b)?T(b):h.hsl(b)?U(b):void 0;else f=(f=y(b))?b.substr(0,b.length-f.length):b,b=c&&!/\s/g.test(b)?f+c:f;b+="";return{original:b,numbers:b.match(d)?b.match(d).map(Number):[0],strings:h.str(a)||c?b.split(d):[]}}function P(a){a=a?p(h.arr(a)?a.map(m):m(a)):[];return r(a,
function(a,d,b){return b.indexOf(a)===d})}function Z(a){var c=P(a);return c.map(function(a,b){return{target:a,id:b,total:c.length}})}function aa(a,c){var d=C(c);if(h.arr(a)){var b=a.length;2!==b||h.obj(a[0])?h.fnc(c.duration)||(d.duration=c.duration/b):a={value:a}}return m(a).map(function(a,b){b=b?0:c.delay;a=h.obj(a)&&!h.pth(a)?a:{value:a};h.und(a.delay)&&(a.delay=b);return a}).map(function(a){return z(a,d)})}function ba(a,c){var d={},b;for(b in a){var f=I(a[b],c);h.arr(f)&&(f=f.map(function(a){return I(a,
c)}),1===f.length&&(f=f[0]));d[b]=f}d.duration=parseFloat(d.duration);d.delay=parseFloat(d.delay);return d}function ca(a){return h.arr(a)?A.apply(this,a):Q[a]}function da(a,c){var d;return a.tweens.map(function(b){b=ba(b,c);var f=b.value,e=K(c.target,a.name),k=d?d.to.original:e,k=h.arr(f)?f[0]:k,w=L(h.arr(f)?f[1]:f,k),e=y(w)||y(k)||y(e);b.from=O(k,e);b.to=O(w,e);b.start=d?d.end:a.offset;b.end=b.start+b.delay+b.duration;b.easing=ca(b.easing);b.elasticity=(1E3-Math.min(Math.max(b.elasticity,1),999))/
1E3;b.isPath=h.pth(f);b.isColor=h.col(b.from.original);b.isColor&&(b.round=1);return d=b})}function ea(a,c){return r(p(a.map(function(a){return c.map(function(b){var c=J(a.target,b.name);if(c){var d=da(b,a);b={type:c,property:b.name,animatable:a,tweens:d,duration:d[d.length-1].end,delay:d[0].delay}}else b=void 0;return b})})),function(a){return!h.und(a)})}function R(a,c,d,b){var f="delay"===a;return c.length?(f?Math.min:Math.max).apply(Math,c.map(function(b){return b[a]})):f?b.delay:d.offset+b.delay+
b.duration}function fa(a){var c=D(ga,a),d=D(S,a),b=Z(a.targets),f=[],e=z(c,d),k;for(k in a)e.hasOwnProperty(k)||"targets"===k||f.push({name:k,offset:e.offset,tweens:aa(a[k],d)});a=ea(b,f);return z(c,{children:[],animatables:b,animations:a,duration:R("duration",a,c,d),delay:R("delay",a,c,d)})}function q(a){function c(){return window.Promise&&new Promise(function(a){return p=a})}function d(a){return g.reversed?g.duration-a:a}function b(a){for(var b=0,c={},d=g.animations,f=d.length;b<f;){var e=d[b],
k=e.animatable,h=e.tweens,n=h.length-1,l=h[n];n&&(l=r(h,function(b){return a<b.end})[0]||l);for(var h=Math.min(Math.max(a-l.start-l.delay,0),l.duration)/l.duration,w=isNaN(h)?1:l.easing(h,l.elasticity),h=l.to.strings,p=l.round,n=[],m=void 0,m=l.to.numbers.length,t=0;t<m;t++){var x=void 0,x=l.to.numbers[t],q=l.from.numbers[t],x=l.isPath?Y(l.value,w*x):q+w*(x-q);p&&(l.isColor&&2<t||(x=Math.round(x*p)/p));n.push(x)}if(l=h.length)for(m=h[0],w=0;w<l;w++)p=h[w+1],t=n[w],isNaN(t)||(m=p?m+(t+p):m+(t+" "));
else m=n[0];ha[e.type](k.target,e.property,m,c,k.id);e.currentValue=m;b++}if(b=Object.keys(c).length)for(d=0;d<b;d++)H||(H=E(document.body,"transform")?"transform":"-webkit-transform"),g.animatables[d].target.style[H]=c[d].join(" ");g.currentTime=a;g.progress=a/g.duration*100}function f(a){if(g[a])g[a](g)}function e(){g.remaining&&!0!==g.remaining&&g.remaining--}function k(a){var k=g.duration,n=g.offset,w=n+g.delay,r=g.currentTime,x=g.reversed,q=d(a);if(g.children.length){var u=g.children,v=u.length;
if(q>=g.currentTime)for(var G=0;G<v;G++)u[G].seek(q);else for(;v--;)u[v].seek(q)}if(q>=w||!k)g.began||(g.began=!0,f("begin")),f("run");if(q>n&&q<k)b(q);else if(q<=n&&0!==r&&(b(0),x&&e()),q>=k&&r!==k||!k)b(k),x||e();f("update");a>=k&&(g.remaining?(t=h,"alternate"===g.direction&&(g.reversed=!g.reversed)):(g.pause(),g.completed||(g.completed=!0,f("complete"),"Promise"in window&&(p(),m=c()))),l=0)}a=void 0===a?{}:a;var h,t,l=0,p=null,m=c(),g=fa(a);g.reset=function(){var a=g.direction,c=g.loop;g.currentTime=
0;g.progress=0;g.paused=!0;g.began=!1;g.completed=!1;g.reversed="reverse"===a;g.remaining="alternate"===a&&1===c?2:c;b(0);for(a=g.children.length;a--;)g.children[a].reset()};g.tick=function(a){h=a;t||(t=h);k((l+h-t)*q.speed)};g.seek=function(a){k(d(a))};g.pause=function(){var a=v.indexOf(g);-1<a&&v.splice(a,1);g.paused=!0};g.play=function(){g.paused&&(g.paused=!1,t=0,l=d(g.currentTime),v.push(g),B||ia())};g.reverse=function(){g.reversed=!g.reversed;t=0;l=d(g.currentTime)};g.restart=function(){g.pause();
g.reset();g.play()};g.finished=m;g.reset();g.autoplay&&g.play();return g}var ga={update:void 0,begin:void 0,run:void 0,complete:void 0,loop:1,direction:"normal",autoplay:!0,offset:0},S={duration:1E3,delay:0,easing:"easeOutElastic",elasticity:500,round:0},W="translateX translateY translateZ rotate rotateX rotateY rotateZ scale scaleX scaleY scaleZ skewX skewY perspective".split(" "),H,h={arr:function(a){return Array.isArray(a)},obj:function(a){return-1<Object.prototype.toString.call(a).indexOf("Object")},
pth:function(a){return h.obj(a)&&a.hasOwnProperty("totalLength")},svg:function(a){return a instanceof SVGElement},dom:function(a){return a.nodeType||h.svg(a)},str:function(a){return"string"===typeof a},fnc:function(a){return"function"===typeof a},und:function(a){return"undefined"===typeof a},hex:function(a){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(a)},rgb:function(a){return/^rgb/.test(a)},hsl:function(a){return/^hsl/.test(a)},col:function(a){return h.hex(a)||h.rgb(a)||h.hsl(a)}},A=function(){function a(a,
d,b){return(((1-3*b+3*d)*a+(3*b-6*d))*a+3*d)*a}return function(c,d,b,f){if(0<=c&&1>=c&&0<=b&&1>=b){var e=new Float32Array(11);if(c!==d||b!==f)for(var k=0;11>k;++k)e[k]=a(.1*k,c,b);return function(k){if(c===d&&b===f)return k;if(0===k)return 0;if(1===k)return 1;for(var h=0,l=1;10!==l&&e[l]<=k;++l)h+=.1;--l;var l=h+(k-e[l])/(e[l+1]-e[l])*.1,n=3*(1-3*b+3*c)*l*l+2*(3*b-6*c)*l+3*c;if(.001<=n){for(h=0;4>h;++h){n=3*(1-3*b+3*c)*l*l+2*(3*b-6*c)*l+3*c;if(0===n)break;var m=a(l,c,b)-k,l=l-m/n}k=l}else if(0===
n)k=l;else{var l=h,h=h+.1,g=0;do m=l+(h-l)/2,n=a(m,c,b)-k,0<n?h=m:l=m;while(1e-7<Math.abs(n)&&10>++g);k=m}return a(k,d,f)}}}}(),Q=function(){function a(a,b){return 0===a||1===a?a:-Math.pow(2,10*(a-1))*Math.sin(2*(a-1-b/(2*Math.PI)*Math.asin(1))*Math.PI/b)}var c="Quad Cubic Quart Quint Sine Expo Circ Back Elastic".split(" "),d={In:[[.55,.085,.68,.53],[.55,.055,.675,.19],[.895,.03,.685,.22],[.755,.05,.855,.06],[.47,0,.745,.715],[.95,.05,.795,.035],[.6,.04,.98,.335],[.6,-.28,.735,.045],a],Out:[[.25,
.46,.45,.94],[.215,.61,.355,1],[.165,.84,.44,1],[.23,1,.32,1],[.39,.575,.565,1],[.19,1,.22,1],[.075,.82,.165,1],[.175,.885,.32,1.275],function(b,c){return 1-a(1-b,c)}],InOut:[[.455,.03,.515,.955],[.645,.045,.355,1],[.77,0,.175,1],[.86,0,.07,1],[.445,.05,.55,.95],[1,0,0,1],[.785,.135,.15,.86],[.68,-.55,.265,1.55],function(b,c){return.5>b?a(2*b,c)/2:1-a(-2*b+2,c)/2}]},b={linear:A(.25,.25,.75,.75)},f={},e;for(e in d)f.type=e,d[f.type].forEach(function(a){return function(d,f){b["ease"+a.type+c[f]]=h.fnc(d)?
d:A.apply($jscomp$this,d)}}(f)),f={type:f.type};return b}(),ha={css:function(a,c,d){return a.style[c]=d},attribute:function(a,c,d){return a.setAttribute(c,d)},object:function(a,c,d){return a[c]=d},transform:function(a,c,d,b,f){b[f]||(b[f]=[]);b[f].push(c+"("+d+")")}},v=[],B=0,ia=function(){function a(){B=requestAnimationFrame(c)}function c(c){var b=v.length;if(b){for(var d=0;d<b;)v[d]&&v[d].tick(c),d++;a()}else cancelAnimationFrame(B),B=0}return a}();q.version="2.2.0";q.speed=1;q.running=v;q.remove=
function(a){a=P(a);for(var c=v.length;c--;)for(var d=v[c],b=d.animations,f=b.length;f--;)u(a,b[f].animatable.target)&&(b.splice(f,1),b.length||d.pause())};q.getValue=K;q.path=function(a,c){var d=h.str(a)?e(a)[0]:a,b=c||100;return function(a){return{el:d,property:a,totalLength:N(d)*(b/100)}}};q.setDashoffset=function(a){var c=N(a);a.setAttribute("stroke-dasharray",c);return c};q.bezier=A;q.easings=Q;q.timeline=function(a){var c=q(a);c.pause();c.duration=0;c.add=function(d){c.children.forEach(function(a){a.began=
!0;a.completed=!0});m(d).forEach(function(b){var d=z(b,D(S,a||{}));d.targets=d.targets||a.targets;b=c.duration;var e=d.offset;d.autoplay=!1;d.direction=c.direction;d.offset=h.und(e)?b:L(e,b);c.began=!0;c.completed=!0;c.seek(d.offset);d=q(d);d.began=!0;d.completed=!0;d.duration>b&&(c.duration=d.duration);c.children.push(d)});c.seek(0);c.reset();c.autoplay&&c.restart();return c};return c};q.random=function(a,c){return Math.floor(Math.random()*(c-a+1))+a};return q});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,10 @@
/*
Sticky-kit v1.1.3 | MIT | Leaf Corcoran 2015 | http://leafo.net
*/
(function(){var c,f;c=window.jQuery;f=c(window);c.fn.stick_in_parent=function(b){var A,w,J,n,B,K,p,q,L,k,E,t;null==b&&(b={});t=b.sticky_class;B=b.inner_scrolling;E=b.recalc_every;k=b.parent;q=b.offset_top;p=b.spacer;w=b.bottoming;null==q&&(q=0);null==k&&(k=void 0);null==B&&(B=!0);null==t&&(t="is_stuck");A=c(document);null==w&&(w=!0);L=function(a){var b;return window.getComputedStyle?(a=window.getComputedStyle(a[0]),b=parseFloat(a.getPropertyValue("width"))+parseFloat(a.getPropertyValue("margin-left"))+
parseFloat(a.getPropertyValue("margin-right")),"border-box"!==a.getPropertyValue("box-sizing")&&(b+=parseFloat(a.getPropertyValue("border-left-width"))+parseFloat(a.getPropertyValue("border-right-width"))+parseFloat(a.getPropertyValue("padding-left"))+parseFloat(a.getPropertyValue("padding-right"))),b):a.outerWidth(!0)};J=function(a,b,n,C,F,u,r,G){var v,H,m,D,I,d,g,x,y,z,h,l;if(!a.data("sticky_kit")){a.data("sticky_kit",!0);I=A.height();g=a.parent();null!=k&&(g=g.closest(k));if(!g.length)throw"failed to find stick parent";
v=m=!1;(h=null!=p?p&&a.closest(p):c("<div />"))&&h.css("position",a.css("position"));x=function(){var d,f,e;if(!G&&(I=A.height(),d=parseInt(g.css("border-top-width"),10),f=parseInt(g.css("padding-top"),10),b=parseInt(g.css("padding-bottom"),10),n=g.offset().top+d+f,C=g.height(),m&&(v=m=!1,null==p&&(a.insertAfter(h),h.detach()),a.css({position:"",top:"",width:"",bottom:""}).removeClass(t),e=!0),F=a.offset().top-(parseInt(a.css("margin-top"),10)||0)-q,u=a.outerHeight(!0),r=a.css("float"),h&&h.css({width:L(a),
height:u,display:a.css("display"),"vertical-align":a.css("vertical-align"),"float":r}),e))return l()};x();if(u!==C)return D=void 0,d=q,z=E,l=function(){var c,l,e,k;if(!G&&(e=!1,null!=z&&(--z,0>=z&&(z=E,x(),e=!0)),e||A.height()===I||x(),e=f.scrollTop(),null!=D&&(l=e-D),D=e,m?(w&&(k=e+u+d>C+n,v&&!k&&(v=!1,a.css({position:"fixed",bottom:"",top:d}).trigger("sticky_kit:unbottom"))),e<F&&(m=!1,d=q,null==p&&("left"!==r&&"right"!==r||a.insertAfter(h),h.detach()),c={position:"",width:"",top:""},a.css(c).removeClass(t).trigger("sticky_kit:unstick")),
B&&(c=f.height(),u+q>c&&!v&&(d-=l,d=Math.max(c-u,d),d=Math.min(q,d),m&&a.css({top:d+"px"})))):e>F&&(m=!0,c={position:"fixed",top:d},c.width="border-box"===a.css("box-sizing")?a.outerWidth()+"px":a.width()+"px",a.css(c).addClass(t),null==p&&(a.after(h),"left"!==r&&"right"!==r||h.append(a)),a.trigger("sticky_kit:stick")),m&&w&&(null==k&&(k=e+u+d>C+n),!v&&k)))return v=!0,"static"===g.css("position")&&g.css({position:"relative"}),a.css({position:"absolute",bottom:b,top:"auto"}).trigger("sticky_kit:bottom")},
y=function(){x();return l()},H=function(){G=!0;f.off("touchmove",l);f.off("scroll",l);f.off("resize",y);c(document.body).off("sticky_kit:recalc",y);a.off("sticky_kit:detach",H);a.removeData("sticky_kit");a.css({position:"",bottom:"",top:"",width:""});g.position("position","");if(m)return null==p&&("left"!==r&&"right"!==r||a.insertAfter(h),h.remove()),a.removeClass(t)},f.on("touchmove",l),f.on("scroll",l),f.on("resize",y),c(document.body).on("sticky_kit:recalc",y),a.on("sticky_kit:detach",H),setTimeout(l,
0)}};n=0;for(K=this.length;n<K;n++)b=this[n],J(c(b));return this}}).call(this);

View File

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,540 @@
/**
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2017 PrestaShop SA
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import $ from 'jquery';
import prestashop from 'prestashop';
import 'velocity-animate';
import ProductMinitature from './components/product-miniature';
$(document).ready(() => {
prestashop.on('clickQuickView', function (elm) {
let data = {
'action': 'quickview',
'id_product': elm.dataset.idProduct,
'id_product_attribute': elm.dataset.idProductAttribute,
};
$.post(prestashop.urls.pages.product, data, null, 'json').then(function (resp) {
$('body').append(resp.quickview_html);
let productModal = $(`#quickview-modal-${resp.product.id}-${resp.product.id_product_attribute}`);
productModal.modal('show');
productConfig(productModal);
productModal.on('hidden.bs.modal', function () {
productModal.remove();
});
}).fail((resp) => {
prestashop.emit('handleError', {eventType: 'clickQuickView', resp: resp});
});
});
var productConfig = (qv) => {
const MAX_THUMBS = 4;
var $arrows = $('.js-arrows');
var $thumbnails = qv.find('.js-qv-product-images');
$('.js-thumb').on('click', (event) => {
if ($('.js-thumb').hasClass('selected')) {
$('.js-thumb').removeClass('selected');
}
$(event.currentTarget).addClass('selected');
$('.js-qv-product-cover').attr('src', $(event.target).data('image-large-src'));
});
if ($thumbnails.find('li').length <= MAX_THUMBS) {
$arrows.hide();
} else {
$arrows.on('click', (event) => {
if ($(event.target).hasClass('arrow-up') && $('.js-qv-product-images').position().top < 0) {
move('up');
$('.arrow-down').css('opacity', '1');
} else if ($(event.target).hasClass('arrow-down') && $thumbnails.position().top + $thumbnails.height() > $('.js-qv-mask').height()) {
move('down');
$('.arrow-up').css('opacity', '1');
}
});
}
qv.find('#quantity_wanted').TouchSpin({
verticalbuttons: false,
verticalupclass: 'material-icons touchspin-up',
verticaldownclass: 'material-icons touchspin-down',
buttondown_class: 'btn btn-touchspin js-touchspin',
buttonup_class: 'btn btn-touchspin js-touchspin',
min: 1,
max: 1000000
});
setTimeout(function() {
qv.find('.product-images').flickity({
draggable:1,
pageDots: false,
cellAlign: 'left',
contain: true,
arrowShape: {
x0: 30,
x1: 60, y1: 50,
x2: 70, y2: 50,
x3: 40
}
});
},300);
};
var move = (direction) => {
const THUMB_MARGIN = 20;
var $thumbnails = $('.js-qv-product-images');
var thumbHeight = $('.js-qv-product-images li img').height() + THUMB_MARGIN;
var currentPosition = $thumbnails.position().top;
$thumbnails.velocity({
translateY: (direction === 'up') ? currentPosition + thumbHeight : currentPosition - thumbHeight
}, function () {
if ($thumbnails.position().top >= 0) {
$('.arrow-up').css('opacity', '.2');
} else if ($thumbnails.position().top + $thumbnails.height() <= $('.js-qv-mask').height()) {
$('.arrow-down').css('opacity', '.2');
}
});
};
const parseSearchUrl = function (event) {
if (event.target.dataset.searchUrl !== undefined) {
return event.target.dataset.searchUrl;
}
if ($(event.target).parent()[0].dataset.searchUrl === undefined) {
throw new Error('Can not parse search URL');
}
return $(event.target).parent()[0].dataset.searchUrl;
};
$('body').on('change', '#search_filters input[data-search-url]', function (event) {
prestashop.emit('updateFacets', parseSearchUrl(event));
});
$('body').on('click', '.js-search-filters-clear-all', function (event) {
prestashop.emit('updateFacets', parseSearchUrl(event));
});
$('body').on('click', '.js-search-link', function (event) {
event.preventDefault();
prestashop.emit('updateFacets', $(event.target).closest('a').get(0).href);
});
$('body').on('change', '#search_filters select', function (event) {
const form = $(event.target).closest('form');
prestashop.emit('updateFacets', '?' + form.serialize());
});
prestashop.on('updateProductList', (data) => {
updateProductListDOM(data);
updateCounters();
hideProds();
showProds();
let target = $("#products");
if (target.length) {
$('html, body').animate({
scrollTop: target.offset().top - 100
}, 240);
}
});
// Grid - list
$('.show_list').click(function(){
document.cookie = "show_list=true; expires=Thu, 30 Jan 2100 12:00:00 UTC; path=/";
$('#main #js-product-list .product-item').addClass('product_show_list');
$(this).addClass('active');
$('.show_grid').removeClass('active');
hideProds();
showProds();
});
$('.show_grid').click(function(){
document.cookie = "show_list=; expires=Thu, 30 Jan 1970 12:00:00 UTC; path=/";
$('#main #js-product-list .product-item').removeClass('product_show_list');
$(this).addClass('active');
$('.show_list').removeClass('active');
hideProds();
showProds();
});
prestashop.on('updateProductList', function (event) {
$('.show_list').click(function(){
$('#main #js-product-list .product-item').addClass('product_show_list');
$(this).addClass('active');
$('.show_grid').removeClass('active');
hideProds();
showProds();
});
$('.show_grid').click(function(){
$('#main #js-product-list .product-item').removeClass('product_show_list');
$(this).addClass('active');
$('.show_list').removeClass('active');
hideProds();
showProds();
});
});
// roythemes show prods
function showProds() {
$('#products #js-product-list').find('.products > .product-item').each(function(i){
var row = $(this);
setTimeout(function(){
row.addClass('show');
}, 360 + i * 140);
});
}
showProds();
function hideProds() {
$('#products #js-product-list').find('.products > .product-item').each(function(i){
$(this).removeClass('show')
});
}
// modez fastview
class Details {
constructor() {
this.DOM = {};
const detailsTmpl = `
<div class="details__bg details__bg--up"></div>
<div class="details__bg details__bg--down"></div>
<div class="details__close"></div>
<img class="details__img" src="" alt="img 01"/>
<h2 class="details__title"></h2>
<div class="details__price"></div>
<p class="details__description"></p>
<button class="details__addtocart">Add to cart</button>
<button class="details__magnifier"><svg class="icon icon--magnifier"><use xlink:href="#icon-magnifier"></use></svg></button>
`;
this.DOM.details = document.createElement('div');
this.DOM.details.className = 'details';
this.DOM.details.innerHTML = detailsTmpl;
DOM.content.appendChild(this.DOM.details);
this.init();
}
init() {
this.DOM.bgUp = this.DOM.details.querySelector('.details__bg--up');
this.DOM.bgDown = this.DOM.details.querySelector('.details__bg--down');
this.DOM.img = this.DOM.details.querySelector('.details__img');
this.DOM.title = this.DOM.details.querySelector('.details__title');
this.DOM.price = this.DOM.details.querySelector('.details__price');
this.DOM.description = this.DOM.details.querySelector('.details__description');
this.DOM.cart = this.DOM.details.querySelector('.details__addtocart');
this.DOM.close = this.DOM.details.querySelector('.details__close');
this.DOM.magnifier = this.DOM.details.querySelector('.details__magnifier');
this.initEvents();
}
initEvents() {
this.DOM.close.addEventListener('click', () => this.isZoomed ? this.zoomOut() : this.close());
this.DOM.magnifier.addEventListener('click', () => this.zoomIn());
}
fill(info) {
this.DOM.img.src = info.img;
this.DOM.title.innerHTML = info.title;
this.DOM.price.innerHTML = info.price;
this.DOM.description.innerHTML = info.description;
}
getProductDetailsRect() {
return {
productBgRect: this.DOM.productBg.getBoundingClientRect(),
detailsBgRect: this.DOM.bgDown.getBoundingClientRect(),
productImgRect: this.DOM.productImg.getBoundingClientRect(),
detailsImgRect: this.DOM.img.getBoundingClientRect()
};
}
open(data) {
if ( this.isAnimating ) return false;
this.isAnimating = true;
this.DOM.details.classList.add('details--open');
this.DOM.productBg = data.productBg;
this.DOM.productImg = data.productImg;
this.DOM.productBg.style.opacity = 0;
this.DOM.productImg.style.opacity = 0;
const rect = this.getProductDetailsRect();
this.DOM.bgDown.style.transform = `translateX(${rect.productBgRect.left-rect.detailsBgRect.left}px) translateY(${rect.productBgRect.top-rect.detailsBgRect.top}px) scaleX(${rect.productBgRect.width/rect.detailsBgRect.width}) scaleY(${rect.productBgRect.height/rect.detailsBgRect.height})`;
this.DOM.bgDown.style.opacity = 1;
this.DOM.img.style.transform = `translateX(${rect.productImgRect.left-rect.detailsImgRect.left}px) translateY(${rect.productImgRect.top-rect.detailsImgRect.top}px) scaleX(${rect.productImgRect.width/rect.detailsImgRect.width}) scaleY(${rect.productImgRect.height/rect.detailsImgRect.height})`;
this.DOM.img.style.opacity = 1;
anime({
targets: [this.DOM.bgDown,this.DOM.img],
duration: (target, index) => index ? 800 : 250,
easing: (target, index) => index ? 'easeOutElastic' : 'easeOutSine',
elasticity: 250,
translateX: 0,
translateY: 0,
scaleX: 1,
scaleY: 1,
complete: () => this.isAnimating = false
});
anime({
targets: [this.DOM.title, this.DOM.price, this.DOM.description, this.DOM.cart, this.DOM.magnifier],
duration: 600,
easing: 'easeOutExpo',
delay: (target, index) => {
return index*60;
},
translateY: (target, index, total) => {
return index !== total - 1 ? [50,0] : 0;
},
scale: (target, index, total) => {
return index === total - 1 ? [0,1] : 1;
},
opacity: 1
});
anime({
targets: this.DOM.bgUp,
duration: 100,
easing: 'linear',
opacity: 0.8
});
anime({
targets: this.DOM.close,
duration: 250,
easing: 'easeOutSine',
translateY: ['100%',0],
opacity: 1
});
}
close() {
if ( this.isAnimating ) return false;
this.isAnimating = true;
this.DOM.details.classList.remove('details--open');
anime({
targets: this.DOM.close,
duration: 250,
easing: 'easeOutSine',
translateY: '100%',
opacity: 0
});
anime({
targets: this.DOM.bgUp,
duration: 100,
easing: 'linear',
opacity: 0
});
anime({
targets: [this.DOM.title, this.DOM.price, this.DOM.description, this.DOM.cart, this.DOM.magnifier],
duration: 20,
easing: 'linear',
opacity: 0
});
const rect = this.getProductDetailsRect();
anime({
targets: [this.DOM.bgDown,this.DOM.img],
duration: 250,
easing: 'easeOutSine',
translateX: (target, index) => {
return index ? rect.productImgRect.left-rect.detailsImgRect.left : rect.productBgRect.left-rect.detailsBgRect.left;
},
translateY: (target, index) => {
return index ? rect.productImgRect.top-rect.detailsImgRect.top : rect.productBgRect.top-rect.detailsBgRect.top;
},
scaleX: (target, index) => {
return index ? rect.productImgRect.width/rect.detailsImgRect.width : rect.productBgRect.width/rect.detailsBgRect.width;
},
scaleY: (target, index) => {
return index ? rect.productImgRect.height/rect.detailsImgRect.height : rect.productBgRect.height/rect.detailsBgRect.height;
},
complete: () => {
this.DOM.bgDown.style.opacity = 0;
this.DOM.img.style.opacity = 0;
this.DOM.bgDown.style.transform = 'none';
this.DOM.img.style.transform = 'none';
this.DOM.productBg.style.opacity = 1;
this.DOM.productImg.style.opacity = 1;
this.isAnimating = false;
}
});
}
zoomIn() {
this.isZoomed = true;
anime({
targets: [this.DOM.title, this.DOM.price, this.DOM.description, this.DOM.cart, this.DOM.magnifier],
duration: 100,
easing: 'easeOutSine',
translateY: (target, index, total) => {
return index !== total - 1 ? [0, index === 0 || index === 1 ? -50 : 50] : 0;
},
scale: (target, index, total) => {
return index === total - 1 ? [1,0] : 1;
},
opacity: 0
});
const imgrect = this.DOM.img.getBoundingClientRect();
const win = {w: window.innerWidth, h: window.innerHeight};
const imgAnimeOpts = {
targets: this.DOM.img,
duration: 250,
easing: 'easeOutCubic',
translateX: win.w/2 - (imgrect.left+imgrect.width/2),
translateY: win.h/2 - (imgrect.top+imgrect.height/2)
};
if ( win.w > 0.8*win.h ) {
this.DOM.img.style.transformOrigin = '50% 50%';
Object.assign(imgAnimeOpts, {
scaleX: 0.95*win.w/parseInt(0.8*win.h),
scaleY: 0.95*win.w/parseInt(0.8*win.h),
rotate: 90
});
}
anime(imgAnimeOpts);
anime({
targets: this.DOM.close,
duration: 250,
easing: 'easeInOutCubic',
scale: 1.8,
rotate: 180
});
}
zoomOut() {
this.isZoomed = false;
anime({
targets: [this.DOM.title, this.DOM.price, this.DOM.description, this.DOM.cart, this.DOM.magnifier],
duration: 250,
easing: 'easeOutCubic',
translateY: 0,
scale: 1,
opacity: 1
});
anime({
targets: this.DOM.img,
duration: 250,
easing: 'easeOutCubic',
translateX: 0,
translateY: 0,
scaleX: 1,
scaleY: 1,
rotate: 0,
complete: () => this.DOM.img.style.transformOrigin = '0 0'
});
anime({
targets: this.DOM.close,
duration: 250,
easing: 'easeInOutCubic',
scale: 1,
rotate: 0
});
}
};
class Item {
constructor(el) {
this.DOM = {};
this.DOM.el = el;
this.DOM.product = this.DOM.el.querySelector('.thumbnail-container');
this.DOM.productBg = this.DOM.product.querySelector('.product-description');
this.DOM.productImg = this.DOM.product.querySelector('.product-image img');
this.DOM.fw = this.DOM.product.querySelector('.fast-view');
this.info = {
img: this.DOM.productImg.src,
title: this.DOM.product.querySelector('.product-title').innerHTML,
description: this.DOM.product.querySelector('.prod-short-desc').innerHTML,
price: this.DOM.product.querySelector('.product-price-and-shipping').innerHTML
};
this.initEvents();
}
initEvents() {
console.log(this.DOM.fw);
this.DOM.fw.addEventListener('click', () => this.open());
}
open() {
DOM.details.fill(this.info);
DOM.details.open({
productBg: this.DOM.productBg,
productImg: this.DOM.productImg
});
}
};
if ( $('product-item ').length){
const DOM = {};
DOM.grid = document.querySelector('#main .products');
DOM.content = DOM.grid.parentNode;
DOM.gridItems = Array.from(DOM.grid.querySelectorAll('.product-item'));
let items = [];
DOM.gridItems.forEach(item => items.push(new Item(item)));
DOM.details = new Details();
}
});
function updateCounters() {
$(".countcontainer").each(function(e) {
var $roycountdown = $(this).find(".roycountdown");
var $roycount = $roycountdown.find(".roycount");
var $dataspecificpriceto = $roycount.attr('data-specific-price-to');
if ($roycountdown.length) {
$roycountdown.county({
endDateTime: new Date($dataspecificpriceto.replace(/-/g, "/")) , reflection: false, animation: 'none', theme: 'black',
titleDays:$roycount.data('days'),titleHours:$roycount.data('hours'),titleMinutes:$roycount.data('minutes'),titleSeconds:$roycount.data('seconds')
});
}
});
}
function updateProductListDOM (data) {
$('#search_filters').replaceWith(data.rendered_facets);
$('#js-active-search-filters').replaceWith(data.rendered_active_filters);
$('#js-product-list-top').replaceWith(data.rendered_products_top);
$('#js-product-list').replaceWith(data.rendered_products);
$('#js-product-list-bottom').replaceWith(data.rendered_products_bottom);
$('#js-active-search-filters-mobile').replaceWith(data.rendered_active_filters);
let productMinitature = new ProductMinitature();
productMinitature.init();
}

View File

@@ -0,0 +1,344 @@
/**
* 2007-2019 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2018 PrestaShop SA
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import $ from 'jquery';
import prestashop from 'prestashop';
import { flickity } from "../node_modules/flickity/dist/flickity.pkgd.min";
import * as PhotoSwipe from 'photoswipe';
import * as PhotoSwipeUI_Default from 'photoswipe/dist/photoswipe-ui-default';
$(document).ready(function () {
createProductSpin();
createInputFile();
coverImage();
thumbsInit();
ppzoom();
whiteborder();
shareclick();
prestashop.on('updatedProduct', function (event) {
createProductSpin()
createInputFile();
coverImage();
if (event && event.product_minimal_quantity) {
const minimalProductQuantity = parseInt(event.product_minimal_quantity, 10);
const quantityInputSelector = '#quantity_wanted';
let quantityInput = $(quantityInputSelector);
// @see http://www.virtuosoft.eu/code/bootstrap-touchspin/ about Bootstrap TouchSpin
quantityInput.trigger('touchspin.updatesettings', {min: minimalProductQuantity});
}
$($('.tabs .nav-link.active').attr('href')).addClass('active').removeClass('fade');
$('.js-product-images-modal').replaceWith(event.product_images_modal);
whiteborder();
updateCounters();
shareclick();
slideqv();
var $uiEl = $('.tip_inside');
$('body').append('<div id="ui_tip"><div class="ui_wrapper"><span class="ui_title"></span></div></div>');
var $uiTip = $('#ui_tip');
var $uiTipTitle = $uiTip.find('.ui_title');
$uiEl.on('mousemove', function(e) {
$uiTip.css({
top: e.clientY,
left: e.clientX
});
var winwidth = $(window).width(),
tipwidth = $('#ui_tip').width(),
tiprightdot = e.clientX + tipwidth + 14 + 40; // plus 40 padding compensation
if (tiprightdot > winwidth) {
$('#ui_tip').addClass('align-right');
} else {
$('#ui_tip').removeClass('align-right');
}
});
$uiEl.on('mouseover', function(e) {
$uiTipTitle.text($(this).find('.tip').text());
setTimeout(function() {
$uiTip.addClass('active')
}, 10);
}).on('mouseout', function(e) {
setTimeout(function() {
$uiTip.removeClass('active');
}, 10);
});
setTimeout( function(){
thumbsInit();
ppzoom();
},200);
});
function thumbsInit() {
var thumbs_count_lis = $('#main .product-thumbs-wrapper li.thumb-container');
if (thumbs_count_lis.length == 1) {
$('#main .product-thumbs-wrapper').addClass('hide_it_pls');
} else if (thumbs_count_lis.length == 2) {
$('#main .product-thumbs-wrapper').addClass('w50');
} else if (thumbs_count_lis.length == 3) {
$('#main .product-thumbs-wrapper').addClass('w33');
} else if (thumbs_count_lis.length >= 4) {
$('#main .product-thumbs-wrapper').addClass('w25');
}
setTimeout( function(){
initslidepp();
$('.product-thumbs-wrapper').addClass('thumbs_go');
$(window).on('load resize', function(){
initslidepp();
});
function slidepp() { // Product page lay sliders
$('.images-container .product-images').flickity({
draggable:1,
pageDots: false,
cellAlign: 'left',
contain: true,
imagesLoaded: true,
arrowShape: {
x0: 30,
x1: 60, y1: 50,
x2: 70, y2: 50,
x3: 40
}
});
$('.images-container .product-thumbs').flickity({
asNavFor: '.images-container .product-images',
draggable:1,
prevNextButtons: false,
pageDots: false,
cellAlign: 'center',
imagesLoaded: true,
contain: true
});
}
function initslidepp() {
if (window.matchMedia('(max-width: 767px)').matches) { // slide it for mobile for all lays
slidepp();
} else if ($('#product .images-container').hasClass('pp_lay1')) { // slide it for 1 lay on desktop
slidepp();
} else { // destroy sliders here for 2 and 3 on resize to bigger resolution
if ($('.images-container .product-images').hasClass('flickity-enabled'))
$('.images-container .product-images').flickity('destroy');
if ($('.images-container .product-thumbs').hasClass('flickity-enabled'))
$('.images-container .product-thumbs').flickity('destroy');
}
}
},100);
}
function ppzoom() {
if ($('.images-container').hasClass('pp_lay1')) {
$('.images-container .product-images').on( 'staticClick.flickity', function( event, pointer, cellElement, cellIndex ) {
// Photoswipe functions
var openPhotoSwipe = function() {
var pswpElement = document.querySelectorAll('.pswp')[0];
// build items array
var items = $.map($('.images-container .product-images').find("img"), function(el) {
return {
"src": el.getAttribute('src'),
"w": el.width,
"h": el.height
}
});
var options = {
history: false,
shareEl: false,
zoomEl: true,
index: cellIndex
};
var gallery = new PhotoSwipe( pswpElement, PhotoSwipeUI_Default, items, options);
gallery.init();
};
openPhotoSwipe();
});
} else {
$('.images-container .product-images li img').click(function(event) {
// build items array
var items = $.map($('.images-container.pp_lay2 .product-images').find("img"), function(el) {
return {
"src": el.getAttribute('src'),
"w": el.width,
"h": el.height
}
});
// Define object and gallery options
var $pswp = $('.pswp')[0],
options = {
index: $(this).parent('.thumb-container').index(),
bgOpacity: 0.85,
zoomEl: true,
showHideOpacity: true
};
var gallery = new PhotoSwipe( $pswp, PhotoSwipeUI_Default, items, options);
gallery.init();
});
}
}
function slideqv() {
$('.quickview .product-images').flickity({
draggable:1,
pageDots: false,
cellAlign: 'left',
contain: true,
imagesLoaded: true,
arrowShape: {
x0: 30,
x1: 60, y1: 50,
x2: 70, y2: 50,
x3: 40
}
});
}
function coverImage() {
$('.js-thumb').on(
'click',
(event) => {
$('.js-modal-product-cover').attr('src',$(event.target).data('image-large-src'));
$('.selected').removeClass('selected');
$(event.target).addClass('selected');
$('.js-qv-product-cover').prop('src', $(event.currentTarget).data('image-large-src'));
}
);
}
function createInputFile()
{
$('.js-file-input').on('change', (event) => {
let target, file;
if ((target = $(event.currentTarget)[0]) && (file = target.files[0])) {
$(target).prev().text(file.name);
}
});
}
function createProductSpin()
{
const $quantityInput = $('#quantity_wanted');
$quantityInput.TouchSpin({
verticalbuttons: false,
verticalupclass: 'material-icons touchspin-up',
verticaldownclass: 'material-icons touchspin-down',
buttondown_class: 'btn btn-touchspin js-touchspin',
buttonup_class: 'btn btn-touchspin js-touchspin',
min: parseInt($quantityInput.attr('min'), 10),
max: 1000000
});
$('body').on('change keyup', '#quantity_wanted', (e) => {
$(e.currentTarget).trigger('touchspin.stopspin');
prestashop.emit('updateProduct', {
eventType: 'updatedProductQuantity',
event: e
});
});
}
// reviews click
$('.goreviews').click(function(e) {
e.preventDefault;
var reviewstab = $('#productCommentsBlock').parent();
var reviewstabid = reviewstab.attr('id');
var reviewstablink = $('a[href="#' + reviewstabid + '"]');
$("body,html").animate( {
scrollTop: $("#tabsection").offset().top - 170
}, 600 );
setTimeout( function() {
reviewstablink.click();
}, 200 );
});
// white color
function whiteborder()
{
$('.color').each(function() {
if( $(this).css('background-color') === 'rgb(255, 255, 255)') {
$(this).addClass('white');
}
});
}
// share
function shareclick() {
$('.share_text').click(function(e) {
e.preventDefault;
var share_dad = $('.share_text').parent('.social-sharing');
if (!share_dad.hasClass('click')) {
share_dad.addClass('click');
}
});
}
function updateCounters() {
$(".countcontainer").each(function(e) {
var $roycountdown = $(this).find(".roycountdown");
var $roycount = $roycountdown.find(".roycount");
var $dataspecificpriceto = $roycount.attr('data-specific-price-to');
if ($roycountdown.length) {
$roycountdown.county({
endDateTime: new Date($dataspecificpriceto.replace(/-/g, "/")) , reflection: false, animation: 'none', theme: 'black',
titleDays:$roycount.data('days'),titleHours:$roycount.data('hours'),titleMinutes:$roycount.data('minutes'),titleSeconds:$roycount.data('seconds')
});
}
});
}
});

View File

@@ -0,0 +1,89 @@
/**
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2017 PrestaShop SA
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import $ from 'jquery';
import prestashop from 'prestashop';
prestashop.responsive = prestashop.responsive || {};
prestashop.responsive.current_width = window.innerWidth;
prestashop.responsive.min_width = 992;
prestashop.responsive.mobile = prestashop.responsive.current_width < prestashop.responsive.min_width;
function swapChildren(obj1, obj2)
{
var temp = obj2.children().detach();
obj2.empty().append(obj1.children().detach());
obj1.append(temp);
}
function toggleMobileStyles()
{
if (prestashop.responsive.mobile) {
$("*[id^='_desktop_']").each(function(idx, el) {
var target = $('#' + el.id.replace('_desktop_', '_mobile_'));
if (target.length) {
swapChildren($(el), target);
}
});
} else {
$("*[id^='_mobile_']").each(function(idx, el) {
var target = $('#' + el.id.replace('_mobile_', '_desktop_'));
if (target.length) {
swapChildren($(el), target);
}
});
}
prestashop.emit('responsive update', {
mobile: prestashop.responsive.mobile
});
}
$(window).on('resize', function() {
var _cw = prestashop.responsive.current_width;
var _mw = prestashop.responsive.min_width;
var _w = window.innerWidth;
var _toggle = (_cw >= _mw && _w < _mw) || (_cw < _mw && _w >= _mw);
prestashop.responsive.current_width = _w;
prestashop.responsive.mobile = prestashop.responsive.current_width < prestashop.responsive.min_width;
if (_toggle) {
toggleMobileStyles();
}
});
$(document).ready(function() {
if (prestashop.responsive.mobile) {
toggleMobileStyles();
}
var headermobile = $('.header-mobile');
$(window).scroll(function(){
if ($(window).scrollTop() > 0) {
headermobile.addClass('scroll-down');
} else {
headermobile.removeClass('scroll-down');
}
});
});

View File

@@ -0,0 +1,146 @@
/* These SVG icons designed by RoyThemes. All rights reserved */
import $ from 'jquery';
import prestashop from 'prestashop';
function regenIcons() {
$('i.rts').each(function(i){
var rts_icon = $(this).html(),
rts_size = $(this).attr('data-size'),
rts_color = $(this).attr('data-color'),
rts_align = $(this).attr('data-align');
if (rts_icon == 'fav1')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28"><path d="M14.05,6.72C8.17.2,2.57,7.54,3.67,11.76,5.56,19,14.05,23.57,14.05,23.57s7.74-4.16,10.39-11.81C25.86,7.64,20.24.13,14.05,6.72Z" style="fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:2px"/></svg>'
if (rts_icon == 'fav2')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28"><path d="M14.63,4l3.53,5.67L24.32,11a.89.89,0,0,1,.49,1.33l-4.18,4.92.5,6.48a.89.89,0,0,1-1.16.78l-6-2.59-6,2.59a.89.89,0,0,1-1.16-.79l.57-6.58L3.06,12.33A.89.89,0,0,1,3.52,11L10.1,9.68,13.2,4A.89.89,0,0,1,14.63,4Z" style="fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:2px"/></svg>'
if (rts_icon == 'fav3')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28"><path d="M23,6.11C23,4.4,21.29,3,19.19,3H9.81C7.71,3,6,4.4,6,6.11V25.3c0,.77,1.22,1.08,1.75.43L14.5,17.5l6.71,8.18c.54.65,1.79.34,1.79-.44Z" style="fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:2px"/></svg>'
if (rts_icon == 'acc1')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28"><path d="M18.53,8.7c0,3.17-2.09,6.78-4.18,6.78s-4.18-3.61-4.18-6.78S12,4,14.35,4,18.53,5.53,18.53,8.7Z" style="fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8px"/><path d="M8.41,17.17A8.13,8.13,0,0,0,6,23a11.46,11.46,0,0,0,.17,2H22.53a11.46,11.46,0,0,0,.17-2,8.13,8.13,0,0,0-2.41-5.87" style="fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8px"/></svg>'
if (rts_icon == 'acc2')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28"><circle cx="14.5" cy="9.5" r="5.5" style="fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8px"/><path d="M8.46,17.78C6.88,19.66,7,20.07,7,22.92A12.19,12.19,0,0,0,7.18,25H22.36a12.19,12.19,0,0,0,.18-2.08c0-2.85.12-3.26-1.46-5.13" style="fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8px"/></svg>'
if (rts_icon == 'acc3')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28"><circle cx="14" cy="9" r="5" style="fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8px"/><path d="M14,18.07c-2.27.53-8.14,1.77-8.14,4.75,0,.75,0,1.48.08,2.18H22.37c0-.71.08-1.43.08-2.18,0-3-6.58-4.22-8.49-4.75" style="fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8px"/></svg>'
if (rts_icon == 'acc4')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28"><path d="M23.67,25V22.65A4.67,4.67,0,0,0,19,18H9.67A4.67,4.67,0,0,0,5,22.65V25" style="fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8px"/><circle cx="14.33" cy="8.65" r="4.67" style="fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8px"/></svg>'
if (rts_icon == 'acc5')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28"><circle cx="14.16" cy="9.14" r="2.43" style="fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8px"/><path d="M8.68,19.49a5.48,5.48,0,1,1,11,0" style="fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8px"/><circle cx="14" cy="14" r="11" style="fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8px"/></svg>'
if (rts_icon == 'acc6')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28"><path d="M13,25h9a1.83,1.83,0,0,0,1.84-1.79q0-.14,0-.28c0-2.83-7.46-4-9.62-4.51" style="fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8px"/><path d="M14.22,18.42C11.66,18.92,5,20.09,5,22.93q0,.13,0,.25A1.83,1.83,0,0,0,6.83,25H12" style="fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8px"/><path d="M10.53,13.95c.81,1,1.89,3.32,3.32,3.32,2.44,0,4.42-3.08,4.42-5.53" style="fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8px"/><path d="M9,17H6.11l1.11-4.42c0-4.88,3.23-8.84,7.22-8.84s7.22,4,7.22,8.84l1,4.42H19" style="fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8px"/><path d="M10.53,12.84A12.44,12.44,0,0,0,15,7.32s2.21,5.53,4.42,4.42" style="fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8px"/></svg>'
if (rts_icon == 'search1')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28"><circle cx="13.41" cy="12.91" r="9.41" style="fill:none;stroke:' + rts_color + ';stroke-miterlimit:10;stroke-width:2px"/><line x1="25.18" y1="23.5" x2="21.65" y2="19.97" style="fill:none;stroke:' + rts_color + ';stroke-miterlimit:10;stroke-width:2px"/></svg>'
if (rts_icon == 'search2')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28"><circle cx="14.76" cy="12.91" r="9.41" style="fill:none;stroke:' + rts_color + ';stroke-miterlimit:10;stroke-width:2px"/><line x1="3" y1="23.5" x2="6.53" y2="19.97" style="fill:none;stroke:' + rts_color + ';stroke-miterlimit:10;stroke-width:2px"/></svg>'
if (rts_icon == 'search3')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28"><circle cx="12.5" cy="12.25" r="8" style="fill:none;stroke:' + rts_color + ';stroke-miterlimit:10;stroke-width:2px"/><line x1="24.5" y1="24.25" x2="21.07" y2="20.82" style="fill:none;stroke:' + rts_color + ';stroke-miterlimit:10;stroke-width:2px"/></svg>'
if (rts_icon == 'search4')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28"><circle cx="16" cy="12.25" r="8" style="fill:none;stroke:' + rts_color + ';stroke-miterlimit:10;stroke-width:2px"/><line x1="4" y1="24.25" x2="7.43" y2="20.82" style="fill:none;stroke:' + rts_color + ';stroke-miterlimit:10;stroke-width:2px"/></svg>'
if (rts_icon == 'qv1')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-eye"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path><circle cx="12" cy="12" r="3"></circle></svg>'
if (rts_icon == 'qv2')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" class="feather feather-move"><polyline points="5 9 2 12 5 15"></polyline><polyline points="9 5 12 2 15 5"></polyline><polyline points="15 19 12 22 9 19"></polyline><polyline points="19 9 22 12 19 15"></polyline><line x1="2" y1="12" x2="22" y2="12"></line><line x1="12" y1="2" x2="12" y2="22"></line></svg>'
if (rts_icon == 'discover1')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect x="6" y="14" width="16" height="4" rx="1.6" ry="1.6" style="fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8px"/><rect x="2" y="6" width="20" height="4" rx="2" ry="2" style="fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8px"/></svg>'
if (rts_icon == 'discover2')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><circle cx="12.02" cy="12" r="10" style="fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8px"/><polyline points="10.55 8.94 14.51 11.98 10.55 15.06" style="fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8px"/></svg>'
if (rts_icon == 'discover3')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect x="2" y="2" width="8" height="8" rx="3" ry="3" style="fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8px"/><rect x="2" y="14" width="8" height="8" rx="3" ry="3" style="fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8px"/><rect x="14" y="2" width="8" height="8" rx="3" ry="3" style="fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8px"/><rect x="14" y="14" width="8" height="8" rx="3" ry="3" style="fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8px"/></svg>'
if (rts_icon == 'discover4')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11.85,20.76l8-8.69L12,4a1.7,1.7,0,0,0-2,0L7.91,6.07a1.19,1.19,0,0,0,0,1.58L13,12.06,8,17a1.81,1.81,0,0,0,0,2l2.39,1.74A1,1,0,0,0,11.85,20.76Z" style="fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:1.7999999523162842px"/></svg>'
if (rts_icon == 'discover5')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" class="feather feather-more-horizontal"><circle cx="12" cy="12" r="1"></circle><circle cx="19" cy="12" r="1"></circle><circle cx="5" cy="12" r="1"></circle></svg>'
if (rts_icon == 'discover6')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" class="feather feather-fast-forward"><polygon points="13 19 22 12 13 5 13 19"></polygon><polygon points="2 19 11 12 2 5 2 19"></polygon></svg>'
if (rts_icon == 'plus')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g id="Layer_4" data-name="Layer 4"><path d="M14.1,18.3V14.1h4.2a.7.7,0,0,0,.7-.7V10.6a.7.7,0,0,0-.7-.7H14.1V5.7a.7.7,0,0,0-.7-.7H10.6a.7.7,0,0,0-.7.7V9.9H5.7a.7.7,0,0,0-.7.7v2.8a.7.7,0,0,0,.7.7H9.9v4.2a.7.7,0,0,0,.7.7h2.8A.7.7,0,0,0,14.1,18.3Z" style="fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:2px"/></g></svg>'
if (rts_icon == 'cat_grid')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><defs><style>.a{fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:2.2px;}</style></defs><rect class="a" x="2" y="2" width="8" height="8" rx="3" ry="3"/><rect class="a" x="2" y="14" width="8" height="8" rx="3" ry="3"/><rect class="a" x="14" y="2" width="8" height="8" rx="3" ry="3"/><rect class="a" x="14" y="14" width="8" height="8" rx="3" ry="3"/></svg>'
if (rts_icon == 'cat_list')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><defs><style>.a{fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:2.2px;}</style></defs><rect class="a" x="2" y="2" width="20" height="4" rx="2" ry="2"/><rect class="a" x="2" y="10" width="20" height="4" rx="2" ry="2"/><rect class="a" x="2" y="18" width="20" height="4" rx="2" ry="2"/></svg>'
if (rts_icon == 'cat_filter')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><defs><style>.a,.b{fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;}.a{stroke-width:2px;}.b{stroke-width:2.3px;}</style></defs><circle class="a" cx="4" cy="8" r="3"/><circle class="a" cx="20" cy="9" r="3"/><circle class="a" cx="12" cy="16" r="3"/><line class="b" x1="20" y1="2" x2="20" y2="5"/><line class="b" x1="4" y1="2" x2="4" y2="4"/><line class="b" x1="4" y1="14.29" x2="4" y2="22.21"/><line class="b" x1="12" y1="20.29" x2="12" y2="22.21"/><line class="b" x1="20" y1="15.29" x2="20" y2="22.21"/><line class="b" x1="12" y1="2" x2="12" y2="12"/></svg>'
if (rts_icon == 'round_plus')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><defs><style>.a{fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:2.5px;}</style></defs><circle class="a" cx="12.02" cy="12" r="10"/><line class="a" x1="8.54" y1="12.08" x2="15.54" y2="12.08"/><line class="a" x1="12.04" y1="15.58" x2="12.04" y2="8.58"/></svg>'
if (rts_icon == 'cart1')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20,21H3a1,1,0,0,1-1-1L3,4A1,1,0,0,1,4,3H19a1,1,0,0,1,1,1l1,16A1,1,0,0,1,20,21Z" style="fill:none;stroke:' + rts_color + ';stroke-miterlimit:10;stroke-width:2px"/><path d="M15,6V9a3.28,3.28,0,0,1-3.5,3A3.28,3.28,0,0,1,8,9V6" style="fill:none;stroke:' + rts_color + ';stroke-miterlimit:10;stroke-width:2px"/></svg>'
if (rts_icon == 'cart2')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28"><path d="M21.46,26H6.54C4,26,4,23.86,4,22.46V2H24V22.46C24,23.86,24,26,21.46,26Z" style="fill:none;stroke:' + rts_color + ';stroke-miterlimit:10;stroke-width:2px"/><path d="M10,8v.78c0,2.68,1.8,4.88,4,4.88s4-2.19,4-4.88V8" style="fill:none;stroke:' + rts_color + ';stroke-miterlimit:10;stroke-width:2px"/></svg>'
if (rts_icon == 'cart3')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28"><path d="M23,7H19V6a4.57,4.57,0,0,0-6.08-4C10.74,2.61,9,4.1,9,6.36V12h2V9h4V7H11V5.94C11,4.41,12.48,4.22,14,4c1.91-.28,3,.08,3,2.21V12h2V9h2l2,16H5L7,8,5,9,3,27H25Z"/></svg>'
if (rts_icon == 'cart4')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28"><path d="M23.71,7H19V5.36C19,3.18,17.08,2,14,2S8,3.18,8,5.36V7H4.29A2.29,2.29,0,0,0,2,9.29V22.71A2.29,2.29,0,0,0,4.29,25H23.71A2.29,2.29,0,0,0,26,22.71V9.29A2.29,2.29,0,0,0,23.71,7ZM10,5.36c0-.64,1.4-1.6,3.5-1.6s3.5,1,3.5,1.6V7H10ZM24,23H4V9H8v5h2V9H24Z"/><rect x="16" y="12" width="3" height="2"/></svg>'
if (rts_icon == 'cart5')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28"><path d="M10,10V6.75c0-2.33,0-3.5,3.5-4.67A2.82,2.82,0,0,1,17,4.42V9" style="fill:none;stroke:' + rts_color + ';stroke-miterlimit:10;stroke-width:1.75px"/><polygon points="3.5 25.05 6.94 7.88 20.68 6.74 22.96 25.05 9.23 26.2 3.5 25.05" style="fill:none;stroke:' + rts_color + ';stroke-miterlimit:10;stroke-width:1.75px"/><line x1="6.94" y1="7.88" x2="9.23" y2="26.2" style="fill:none;stroke:' + rts_color + ';stroke-miterlimit:10;stroke-width:1.75px"/></svg>'
if (rts_icon == 'cart6')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28"><polygon points="6.78 7 6.17 18 21.45 18 25.12 7 6.78 7" style="fill:none;stroke:' + rts_color + ';stroke-miterlimit:10;stroke-width:1.8px"/><line x1="2" y1="3" x2="12" y2="3" style="fill:none;stroke:' + rts_color + ';stroke-miterlimit:10;stroke-width:2px"/><circle cx="9" cy="23" r="2"/><circle cx="16" cy="23" r="2"/></svg>'
if (rts_icon == 'cart7')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 28 28"><defs><linearGradient id="a" x1="11.69" y1="24.1" x2="14.19" y2="24.1" gradientTransform="matrix(-1, 0, 0, 1, 30, 0)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff"/><stop offset="1"/></linearGradient><linearGradient id="b" x1="19.18" y1="24.1" x2="21.68" y2="24.1" xlink:href="#a"/></defs><path d="M15.81,22.85c0,2.5.56,2.5,1.25,2.5a1.25,1.25,0,0,0,1.25-1.25" style="stroke:' + rts_color + ';stroke-miterlimit:10;stroke-width:2px;fill:url(#a)"/><path d="M8.32,22.85c0,2.5.56,2.5,1.25,2.5a1.25,1.25,0,0,0,1.25-1.25" style="stroke:' + rts_color + ';stroke-miterlimit:10;stroke-width:2px;fill:url(#b)"/><path d="M26.56,3.4,23,7l-4.8,12H8.56L3.76,9.4C2.56,7,5,7,5,7H17" style="fill:none;stroke:' + rts_color + ';stroke-miterlimit:10;stroke-width:2px"/></svg>'
if (rts_icon == 'cart8')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28"><path d="M6.67,2,3,6.8V23.6A2.4,2.4,0,0,0,5.4,26H22.6A2.4,2.4,0,0,0,25,23.6V6.8L21.33,2Z" style="fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8px"/><line x1="3" y1="7" x2="25" y2="7" style="fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8px"/><path d="M19,11.61a4.8,4.8,0,1,1-9.59,0" style="fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8px"/></svg>'
if (rts_icon == 'truck')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><defs><style>.a{fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:2px;}</style></defs><circle class="a" cx="7" cy="19" r="3"/><circle class="a" cx="18.06" cy="19" r="3"/><path class="a" d="M18.95,6H15c-1.1,0-1,3.9-1,5v5a2,2,0,0,0,1.29,1.86,3,3,0,0,1,5.59.14h.07a2,2,0,0,0,2-2V11C22.95,9.93,20.17,6.46,18.95,6Z"/><path class="a" d="M14,10H2c-1.1,0-1,1.9-1,3v3a2,2,0,0,0,2,2H4.18a3,3,0,0,1,5.63,0H12a2,2,0,0,0,2-2V10Z"/><rect class="a" x="3" y="6" width="5" height="4"/><rect class="a" x="8" y="7" width="3" height="3"/><line class="a" x1="16.76" y1="11" x2="21.06" y2="11"/></svg>'
if (rts_icon == 'security')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><defs><style>.a{fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:2px;}</style></defs><line class="a" x1="4" y1="7.13" x2="11" y2="2.83"/><path class="a" d="M4,9s.5,11,7,13"/><line class="a" x1="19" y1="7.13" x2="12" y2="2.83"/><path class="a" d="M19,9s-.5,11-7,13"/><line class="a" x1="8.97" y1="12.68" x2="11.35" y2="14.76"/><line class="a" x1="11.21" y1="14.44" x2="14.69" y2="9.72"/></svg>'
if (rts_icon == 'return')
var svg_current = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><defs><style>.a{fill:none;stroke:' + rts_color + ';stroke-linecap:round;stroke-linejoin:round;stroke-width:2px;}</style></defs><rect class="a" x="7" y="12" width="10" height="10" rx="1.87" ry="1.87"/><path class="a" d="M13,8h5.68A2.32,2.32,0,0,1,21,10.32V16"/><line class="a" x1="8.83" y1="11.43" x2="12.86" y2="8.5"/><line class="a" x1="21" y1="17.63" x2="18.17" y2="20.59"/><line class="a" x1="2.74" y1="3.13" x2="19.83" y2="3.13"/><line class="a" x1="18.25" y1="1" x2="22.16" y2="3.13"/><line class="a" x1="21.45" y1="3.13" x2="18.28" y2="5.04"/><line class="a" x1="10" y1="6" x2="4" y2="6"/><line class="a" x1="2.28" y1="6.1" x2="5.45" y2="8.02"/></svg>'
if (typeof rts_size !== typeof undefined && rts_size !== false) {
$(this).html(svg_current).css({
'width' : rts_size,
'height' : rts_size
});
$(this).find('svg').css({
'width' : rts_size,
'height' : rts_size
});
} else {
$(this).html(svg_current).css({
'width' : 24,
'height' : 24
});
$(this).find('svg').css({
'width' : 24,
'height' : 24
});
}
if (typeof rts_align !== typeof undefined && rts_align !== false) {
if (rts_align == 'left')
$(this).css({
'float' : 'left',
'margin-right' : '10px'
});
if (rts_align == 'right')
$(this).css({
'float' : 'right',
'margin-left' : '10px'
});
}
});
}
regenIcons();
$(document).ready(function () {
if(typeof prestashop !== 'undefined') {
prestashop.on(
'updatedProduct',
function (event) {
regenIcons();
}
);
prestashop.on(
'updateProductList',
function (event) {
regenIcons();
}
);
prestashop.on('updatedCart', () => {
regenIcons();
}
);
}
});

View File

@@ -0,0 +1,95 @@
import $ from 'jquery';
import { flickity } from "../node_modules/flickity/dist/flickity.pkgd.min";
$(document).on('ready', function(){
var $sliders = $('.slideme');
$sliders.on('dragStart.flickity', () => $sliders.find('.flickity-slider > *').css('pointer-events', 'none'));
$sliders.on('dragEnd.flickity', () => $sliders.find('.flickity-slider > *').css('pointer-events', 'all'));
function sliders_def() {
// HP sliders
$('.featured-products.slideme .products').each(function() {
var hasAuto = ($(this).parent('.featured-products').attr('data-auto') === 'true') ? 4400 :false;
$(this).flickity({
autoPlay: hasAuto,
contain: true,
draggable:1,
prevNextButtons: true,
pageDots: false,
cellAlign: 'left',
arrowShape: {
x0: 20,
x1: 60, y1: 50,
x2: 75, y2: 50,
x3: 35
}
})
});
// Specials column slider
$('#roy_specials_col .products').flickity({
autoPlay: 4400,
contain: true,
draggable:1,
prevNextButtons: true,
imagesLoaded: true,
pageDots: false,
arrowShape: {
x0: 20,
x1: 60, y1: 50,
x2: 75, y2: 50,
x3: 35
}
});
// Brands slider
$('.roy_brands_ul').flickity({
contain: true,
draggable:1,
prevNextButtons: true,
pageDots: false,
cellAlign: 'left',
arrowShape: {
x0: 20,
x1: 60, y1: 50,
x2: 75, y2: 50,
x3: 35
}
});
// Blog Latest posts slider
$('.blogslider').flickity({
contain: true,
draggable:1,
prevNextButtons: true,
pageDots: false,
arrowShape: {
x0: 20,
x1: 60, y1: 50,
x2: 75, y2: 50,
x3: 35
}
});
// Product page products sliders
$('#product .products').flickity({
draggable:1,
prevNextButtons: true,
pageDots: false,
cellAlign: 'center',
contain: true,
arrowShape: {
x0: 20,
x1: 60, y1: 50,
x2: 75, y2: 50,
x3: 35
}
});
}
$(window).load(function() {
sliders_def();
});
});

View File

@@ -0,0 +1,626 @@
/**
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2018 PrestaShop SA
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import 'expose-loader?Tether!tether';
import 'bootstrap/dist/js/bootstrap.min';
import 'flexibility';
import 'bootstrap-touchspin';
import './responsive';
import './checkout';
import './customer';
import './listing';
import './product';
import './cart';
import './rts_icons';
import './sliders';
import './county';
import DropDown from './components/drop-down';
import Form from './components/form';
import ProductMinitature from './components/product-miniature';
import ProductSelect from './components/product-select';
import TopMenu from './components/top-menu';
import prestashop from 'prestashop';
import EventEmitter from 'events';
import './lib/bootstrap-filestyle.min';
import './lib/jquery.scrollbox.min';
import './lib/jquery.sticky-kit.min.js';
import './lib/animsition.min';
import './components/block-cart';
// "inherit" EventEmitter
for (var i in EventEmitter.prototype) {
prestashop[i] = EventEmitter.prototype[i];
}
$(document).ready(() => {
let dropDownEl = $('.js-dropdown');
const form = new Form();
let topMenuEl = $('.js-top-menu ul[data-depth="0"]');
let dropDown = new DropDown(dropDownEl);
let topMenu = new TopMenu(topMenuEl);
let productMinitature = new ProductMinitature();
let productSelect = new ProductSelect();
dropDown.init();
form.init();
topMenu.init();
productMinitature.init();
productSelect.init();
$('.form-control-select').change(function(){
this.blur();
});
if ( $('.page-footer').children().length == 0 ) {
$('.page-footer').addClass('hidden');
}
// Sticky header
if ($('#header').attr('data-trans') == 'normal') {
var sticky_classes = 'sticky';
} else {
var sticky_classes = 'sticky normal';
}
var header_trans = function(){
if ($('#header').attr('data-trans') == 'normal') {
setTimeout(function() {
var header_height = $('#header').height();
$('main').css('padding-top', header_height);
}, 250);
} else {
var header_height = $('#header').height();
$('#top_column').css('min-height', header_height);
}
};
header_trans();
var sticky = function(){
$('#header').addClass(sticky_classes);
};
var stickyfrom = 0;
if ($(window).scrollTop() > stickyfrom) sticky();
if (window.matchMedia('(max-width: 991px)').matches) sticky();
$(window).scroll(function() {
if ($(this).scrollTop() > stickyfrom){
sticky();
} else {
if (window.matchMedia('(min-width: 992px)').matches) {
$('#header').removeClass(sticky_classes);
}
}
});
$(window).on('resize', function(){
if (window.matchMedia('(max-width: 991px)').matches) {
header_trans();
sticky();
} else {
header_trans();
if ($(this).scrollTop() == stickyfrom){
$('#header').removeClass(sticky_classes);
}
}
});
// Hide header on scroll
if ($('#header').attr('data-hide') == 'yes') {
var didScroll;
var lastScrollTop = 500;
var delta = 5;
$(window).scroll(function(event){
didScroll = true;
});
setInterval(function() {
if (didScroll) {
hasScrolled();
didScroll = false;
}
}, 250);
function hasScrolled() {
var st = $(window).scrollTop();
if(Math.abs(lastScrollTop - st) <= delta)
return;
if (st > lastScrollTop && st > 500){
// Scroll Down
$('#header').addClass('hide_up');
} else {
// Scroll Up
if(st + $(window).height() < $(document).height()) {
$('#header').removeClass('hide_up');
}
}
lastScrollTop = st;
}
}
// page reload
$(".animsition").animsition({
inClass: 'fade-in',
outClass: 'fade-out',
inDuration: 600,
outDuration: 600,
linkElement: 'a.noloader',
// e.g. linkElement: 'a:not([target="_blank"]):not([href^="#"])'
loading: false,
loadingParentElement: 'body', //animsition wrapper element
loadingClass: 'animsition-loading',
loadingInner: '', // e.g '<img src="loading.svg" />'
timeout: true,
timeoutCountdown: 300,
onLoadEvent: true,
browser: [ 'animation-duration', '-webkit-animation-duration'],
// "browser" option allows you to disable the "animsition" in case the css property in the array is not supported by your browser.
// The default setting is to disable the "animsition" in a browser that does not support "animation-duration".
overlay : false,
overlayClass : 'animsition-overlay-slide',
overlayParentElement : 'body',
transition: function(url){ window.location.href = url; }
});
$('.animsition').on('animsition.outStart', function(){
var exitDiv = $('.roy-loader');
exitDiv.fadeIn('slow');
});
$('.animsition').on('animsition.inStart', function(){
var exitDiv = $('.roy-loader');
exitDiv.fadeOut(400);
});
// 2020 filter mobile side
$('body').on('click', '#search_filter_toggler', function () {
$('body').addClass('filter_open');
});
$('.filter_close, .closefilters').click(function () {
$('body').removeClass('filter_open');
});
// side
// side: reopen function for mobile and open for desktop
var reopen = function() {
if($('body').hasClass('side_open')) {
$('body').removeClass('side_content');
$('.side_menu').removeClass('reopen_go').addClass('reopen_hide');
setTimeout(function(){
$('body').addClass('side_content');
}, 320);
setTimeout(function(){
$('.side_menu').removeClass('reopen_hide').addClass('reopen_go');
}, 600);
} else {
$('body').addClass('side_open side_content was_open')
}
}
var searchtoside = function() {
$('.action .search-widget').attr("id","");
$('.side_menu .search-widget').attr("id","search_widget");
}
searchtoside();
// side: close
$('.side_close, .close_cross, .return').click(function () {
$('body').removeClass('side_open side_content filter_open');
cartprodshide();
accsidehide();
setTimeout(function(){
$('body').removeClass('was_open');
}, 440);
});
var cartprodshide = function () {
$('.side_menu').find('.cart-prods > li').each(function(i){
$(this).removeClass('show');
});
}
var cartprodsshow = function () {
$('.side_menu').find('.cart-prods > li').each(function(i){
var row = $(this);
setTimeout(function(){
row.addClass('show');
}, 300 + i * 220);
});
}
var accsidehide = function () {
$('.side_menu').find('.acc_ul > *').each(function(i){
$(this).removeClass('show');
});
}
var accsideshow = function () {
$('.side_menu').find('.acc_ul > *').each(function(i){
var row = $(this);
setTimeout(function(){
row.addClass('show');
}, 300 + i * 120);
});
}
var scrollsidetop = function () {
setTimeout(function(){
$('html, body').animate({
scrollTop: $(".side_menu").offset().top
}, 1000);
}, 980);
}
// action on click
var sm = $('.side_menu');
var aoc_m = sm.attr('data-menu'),
aoc_s = sm.attr('data-search'),
aoc_c = sm.attr('data-cart'),
aoc_a = sm.attr('data-acc');
$(window).on('load resize', function(){
if (window.matchMedia('(min-width: 992px)').matches) {
$('body').removeClass('side_lay1 side_lay2 side_lay3').addClass('side_lay' + aoc_c);
$('.menu_top').hover(function(){
$('body').removeClass('side_lay1 side_lay2 side_lay3').addClass('side_lay' + aoc_m);
});
$('.search-widget').hover(function(){
$('body').removeClass('side_lay1 side_lay2 side_lay3').addClass('side_lay' + aoc_s);
});
$('.cart_widget, .add_wrap, .add-to-cart').hover(function(){
$('body').removeClass('side_lay1 side_lay2 side_lay3').addClass('side_lay' + aoc_c);
});
$('.acc_top').hover(function(){
$('body').removeClass('side_lay1 side_lay2 side_lay3').addClass('side_lay' + aoc_a);
});
} else {
$('body').removeClass('side_lay1 side_lay2 side_lay3').addClass('side_lay1');
}
});
// side: open, levibox clicks
var cart_click = function (e) {
e.preventDefault();
accsidehide();
reopen();
$('.side_menu .side_menu_rel > div').removeClass('show');
$('#side_cart_wrap').addClass('show');
$('.side_close').removeClass('search_close menu_close acc_close').addClass('cart_close');
$('.side_close i').toggleClass('rotateit');
if($('.side_menu').hasClass('reopen_hide')) {
setTimeout(function(){
cartprodsshow();
}, 320);
} else {
cartprodsshow();
}
}
var search_click = function (e) {
e.preventDefault();
accsidehide();
cartprodshide();
$('.side_menu').removeClass('side_lay1 side_lay2 side_lay3').addClass('side_lay' + aoc_s);
reopen();
searchtoside();
$('.side_menu .side_menu_rel > div').removeClass('show');
$('#side_search_wrap').addClass('show');
$('.side_close').removeClass('cart_close menu_close acc_close').addClass('search_close');
$('.side_close i').toggleClass('rotateit');
setTimeout(function(){
$('.side_menu .search-widget form input[type=text]').focus();
}, 1000);
}
var menu_click = function (e) {
e.preventDefault();
accsidehide();
cartprodshide();
$('.side_menu').removeClass('side_lay1 side_lay2 side_lay3').addClass('side_lay' + aoc_m);
reopen();
$('.side_menu .side_menu_rel > div').removeClass('show');
$('#side_menu_wrap').addClass('show');
$('.side_close').removeClass('cart_close search_close acc_close').addClass('menu_close');
$('.side_close i').toggleClass('rotateit');
}
var acc_click = function (e) {
e.preventDefault();
cartprodshide();
$('.side_menu').removeClass('side_lay1 side_lay2 side_lay3').addClass('side_lay' + aoc_a);
reopen();
$('.side_menu .side_menu_rel > div').removeClass('show');
$('#side_acc_wrap').addClass('show');
$('.side_close').removeClass('cart_close search_close menu_close').addClass('acc_close');
$('.side_close i').toggleClass('rotateit');
if($('.side_menu').hasClass('reopen_hide')) {
setTimeout(function(){
accsideshow();
}, 320);
} else {
accsideshow();
}
}
$('.box-cart').off("click", cart_click).on("click", cart_click);
$('.box-search').off("click", search_click).on("click", search_click);
$('.box-menu').off("click", menu_click).on("click", menu_click);
$('.box-acc').off("click", acc_click).on("click", acc_click);
$('#header .row.action .blockcart a.cart_nogo').off("click", cart_click).on("click", cart_click);
$('#header .row.action .search_nogo').off("click", search_click).on("click", search_click);
// mobile - desktop switch
if ($('#is_media').css('float') == 'left') {
$('body').addClass('mob_enabled');
} else {
$('body').removeClass('mob_enabled');
$('body').removeClass('side_open side_content');
}
$(window).on('resize', function(){
if ($('#is_media').css('float') == 'left') {
$('body').addClass('mob_enabled');
} else {
// $('body').removeClass('mob_enabled');
// $('body').removeClass('side_open side_content');
}
});
});
// special label height
$(window).load(function() {
setTimeout(function() {
$('#header').css('opacity','1');
}, 400);
setTimeout(function() {
$('#wrapper').css('opacity','1');
}, 700);
setTimeout(function() {
$('.breadcrumb').css({
'opacity':'1',
'transform':'matrix(1, 0, 0, 1, 0, 0)',
});
}, 750);
});
// 1.1 fix slash after home category
var breadlast = $('.breadcrumb > ol > li:last-child').find("span[itemprop*='name']");
if($.trim(breadlast.html())=='') {
breadlast.parent().prev().addClass('noafter');
}
// tooltip
function uitiprun() {
var $uiEl = $('.tip_inside');
$('body').append('<div id="ui_tip"><div class="ui_wrapper"><span class="ui_title"></span></div></div>');
var $uiTip = $('#ui_tip');
var $uiTipTitle = $uiTip.find('.ui_title');
$uiEl.on('mousemove', function(e) {
$uiTip.css({
top: e.clientY,
left: e.clientX
});
var winwidth = $(window).width(),
tipwidth = $('#ui_tip').width(),
tiprightdot = e.clientX + tipwidth + 14 + 40; // plus 40 padding compensation
if (tiprightdot > winwidth) {
$('#ui_tip').addClass('align-right');
} else {
$('#ui_tip').removeClass('align-right');
}
});
$uiEl.on('mouseover', function(e) {
$uiTipTitle.text($(this).find('.tip').text());
setTimeout(function() {
$uiTip.addClass('active')
}, 10);
}).on('mouseout', function(e) {
setTimeout(function() {
$uiTip.removeClass('active');
}, 10);
});
$(window).scroll(function() {
setTimeout(function() {
if($uiTip.hasClass('active')) {
$uiTip.removeClass('active');
}
}, 200);
});
}
$(document).ready(() => {
uitiprun();
});
// product 3rd lay
$('body').append('<div id="ui_prod"><div class="ui_wrapper"><span class="ui_name"><span></span></span><div><span class="ui_price"></span></div></div></div>');
var $uiProd = $('article.pl_lay3'),
$uiProdTip = $('#ui_prod'),
$uiProdName = $uiProdTip.find('.ui_name > span'),
$uiProdPrice = $uiProdTip.find('.ui_price');
$uiProd.on('mousemove', function(e) {
$uiProdTip.css({
top: e.clientY,
left: e.clientX
});
var winwidth = $(window).width(),
tipwidth = $('#ui_prod').width(),
tiprightdot = e.clientX + tipwidth + 54;
if (tiprightdot > winwidth) {
$('#ui_prod').addClass('align-right');
} else {
$('#ui_prod').removeClass('align-right');
}
});
$uiProd.find('.product-thumbnail').on('mouseover', function(e) {
$uiProdName.text($(this).closest('article').find('.product-title').text());
$uiProdPrice.html($(this).closest('article').find('.product-price-and-shipping').html());
setTimeout(function() {
$uiProdTip.addClass('active')
}, 10);
$(this).closest('article').find('.tip_inside').on('mouseover', function(e) {
console.log('inner');
$uiProdTip.removeClass('active');
}).on('mouseout', function(e) {
$uiProdTip.addClass('active')
});
}).on('mouseleave', function(e) {
$uiProdTip.removeClass('active');
});
// Sticky Right Column PP
var pp_stick = $('.pp_stick_it'),
pp_stick_ops = {
parent: '.pp_stick_parent',
offset_top: 90
};
$(window).on('load resize', function(){
setTimeout(function() {
if (window.matchMedia('(min-width: 992px)').matches) {
pp_stick.stick_in_parent(pp_stick_ops);
} else {
pp_stick.trigger("sticky_kit:detach");
}
},750);
});
// Roy Countdowns
$(document).ready(function($){
$( ".roycount" ).each(function(e) {
var $roycount = $(this);
var $dataspecificpriceto = $roycount.attr('data-specific-price-to');
$roycount.closest('.roycountdown').county({
endDateTime: new Date($dataspecificpriceto.replace(/-/g, "/")) , reflection: false, animation: 'none', theme: 'black',
titleDays:$roycount.data('days'),titleHours:$roycount.data('hours'),titleMinutes:$roycount.data('minutes'),titleSeconds:$roycount.data('seconds')
});
})
});
// Youtube responsive
$(function() {
var $allVideos = $(".page-cms iframe[src^='//player.vimeo.com'], .page-cms iframe[src^='https://player.vimeo.com'], .page-cms iframe[src^='//www.youtube.com'], .page-cms iframe[src^='https://www.youtube.com'], .page-cms iframe[src^='http://www.youtube.com'], .page-cms object, .page-cms embed"),
$allVideosPPS = $("#short_description_content iframe[src^='//player.vimeo.com'], #short_description_content iframe[src^='https://player.vimeo.com'], #short_description_content iframe[src^='//www.youtube.com'], #short_description_content iframe[src^='https://www.youtube.com'], #short_description_content iframe[src^='http://www.youtube.com'], #short_description_content object, #short_description_content embed"),
$fluidElPPS = $("#short_description_content"),
$allVideosPPF = $("#idTab1 iframe[src^='//player.vimeo.com'], #idTab1 iframe[src^='https://player.vimeo.com'], #idTab1 iframe[src^='//www.youtube.com'], #idTab1 iframe[src^='https://www.youtube.com'], #idTab1 iframe[src^='http://www.youtube.com'], #idTab1 object, #idTab1 embed"),
$fluidElPPF = $("#idTab1"),
$allVideosB = $("#module-smartblog-details iframe[src^='//player.vimeo.com'], #module-smartblog-details iframe[src^='https://player.vimeo.com'], #module-smartblog-details iframe[src^='//www.youtube.com'], #module-smartblog-details iframe[src^='https://www.youtube.com'], #module-smartblog-details iframe[src^='http://www.youtube.com'], #module-smartblog-details object, #module-smartblog-details embed"),
$fluidElB = $("#module-smartblog-details #content"),
$allVideosRC = $(".video_banner iframe[src^='//player.vimeo.com'], .video_banner iframe[src^='https://player.vimeo.com'], .video_banner iframe[src^='//www.youtube.com'], .video_banner iframe[src^='https://www.youtube.com'], .video_banner iframe[src^='http://www.youtube.com'], .video_banner object, .video_banner embed");
$allVideos.each(function() {
$(this)
// jQuery .data does not work on object/embed elements
.attr('data-aspectRatio', this.height / this.width)
.removeAttr('height')
.removeAttr('width');
});
$(window).resize(function() {
var newWidthPPS = $fluidElPPS.width();
var newWidthPPF = $fluidElPPF.width();
var newWidthB = $fluidElB.width();
$allVideos.each(function() {
var $el = $(this);
var $fluidEl = $el.parent();
var newWidth = $fluidEl.width();
$el
.width(newWidth)
.height(newWidth * $el.attr('data-aspectRatio'));
});
$allVideosB.each(function() {
var $el = $(this);
$el
.width(newWidthB)
.height(newWidthB * $el.attr('data-aspectRatio'));
});
$allVideosPPS.each(function() {
var $el = $(this);
$el
.width(newWidthPPS)
.height(newWidthPPS * $el.attr('data-aspectRatio'));
});
$allVideosPPF.each(function() {
var $el = $(this);
$el
.width(newWidthPPF)
.height(newWidthPPF * $el.attr('data-aspectRatio'));
});
$allVideosRC.each(function() {
var $el = $(this);
var $fluidElRC = $el.closest('.video_banner');
var newWidthRC = $fluidElRC.width();
$el
.width(newWidthRC)
.height(newWidthRC * $el.attr('data-aspectRatio'));
});
}).resize();
});