first commit
This commit is contained in:
49
themes/ayon__/_dev/js/components/block-cart.js
Normal file
49
themes/ayon__/_dev/js/components/block-cart.js
Normal 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
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
54
themes/ayon__/_dev/js/components/drop-down.js
Normal file
54
themes/ayon__/_dev/js/components/drop-down.js
Normal 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();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
55
themes/ayon__/_dev/js/components/form.js
Normal file
55
themes/ayon__/_dev/js/components/form.js
Normal 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>');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
49
themes/ayon__/_dev/js/components/product-miniature.js
Normal file
49
themes/ayon__/_dev/js/components/product-miniature.js
Normal 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}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
84
themes/ayon__/_dev/js/components/product-select.js
Normal file
84
themes/ayon__/_dev/js/components/product-select.js
Normal 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');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
92
themes/ayon__/_dev/js/components/top-menu.js
Normal file
92
themes/ayon__/_dev/js/components/top-menu.js
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user