first commit
This commit is contained in:
49
themes/at_movic/_dev/js/components/block-cart.js
Normal file
49
themes/at_movic/_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 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/at_movic/_dev/js/components/drop-down.js
Normal file
54
themes/at_movic/_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 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/at_movic/_dev/js/components/form.js
Normal file
55
themes/at_movic/_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 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 () {
|
||||
var elm = $(this).closest('.input-group').children('input.js-visible-password');
|
||||
if (elm.attr('type') === 'password') {
|
||||
elm.attr('type', 'text');
|
||||
$(this).text($(this).data('textHide'));
|
||||
} else {
|
||||
elm.attr('type', 'password');
|
||||
$(this).text($(this).data('textShow'));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
35
themes/at_movic/_dev/js/components/index.php
Normal file
35
themes/at_movic/_dev/js/components/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* 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 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
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../');
|
||||
exit;
|
||||
56
themes/at_movic/_dev/js/components/product-miniature.js
Normal file
56
themes/at_movic/_dev/js/components/product-miniature.js
Normal file
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* 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 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 $percent = $(element).find('.discount-percentage');
|
||||
let $onsale = $(element).find('.on-sale');
|
||||
let $new = $(element).find('.new');
|
||||
if($percent.length){
|
||||
$new.css('top', $percent.height() * 2 + FLAG_MARGIN);
|
||||
$percent.css('top',-$(element).find('.thumbnail-container').height() + $(element).find('.product-description').height() + FLAG_MARGIN);
|
||||
}
|
||||
if($onsale.length){
|
||||
$percent.css('top', parseFloat($percent.css('top')) + $onsale.height() + FLAG_MARGIN);
|
||||
$new.css('top', ($percent.height() * 2 + $onsale.height()) + FLAG_MARGIN * 2);
|
||||
}
|
||||
*/
|
||||
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}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
87
themes/at_movic/_dev/js/components/product-select.js
Normal file
87
themes/at_movic/_dev/js/components/product-select.js
Normal file
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* 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 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');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
82
themes/at_movic/_dev/js/components/top-menu.js
Normal file
82
themes/at_movic/_dev/js/components/top-menu.js
Normal file
@@ -0,0 +1,82 @@
|
||||
/**
|
||||
* 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 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`).hide();
|
||||
}
|
||||
elmId = $(e.currentTarget).attr('id');
|
||||
}
|
||||
if (elmId && $(e.target).data('depth') === 0) {
|
||||
$(`#${elmId} .js-sub-menu`).show().css({
|
||||
top: $(`#${elmId}`).height() + $(`#${elmId}`).position().top
|
||||
});
|
||||
}
|
||||
});
|
||||
$('#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`).hide();
|
||||
});
|
||||
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