Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

🔥 INCLUDES TONS OF NEW FEATURES V1.2.8 #203

Merged
merged 45 commits into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
1753dc3
Merge pull request #182 from addonify/stable
h1dd3nsn1p3r Jul 19, 2023
734ac83
🌈 NEW: ANIMATION, OPTIONS, COLORS.
h1dd3nsn1p3r Jul 20, 2023
a2ecf27
Merge pull request #183 from addonify/sniper
h1dd3nsn1p3r Jul 20, 2023
6e54430
🌈 REFACTOR: PUBLIC FACING JAVASCRIPT.
h1dd3nsn1p3r Jul 21, 2023
b613cf0
Added: modalContentLoaded API.
h1dd3nsn1p3r Jul 21, 2023
78dc0eb
Updated: Readme.txt.
h1dd3nsn1p3r Jul 21, 2023
bf7fc4c
Added: Close events (Esc, Outside)
h1dd3nsn1p3r Jul 21, 2023
7321b47
Merge pull request #184 from addonify/sniper
h1dd3nsn1p3r Jul 21, 2023
6a7e81c
🔥 NEW: FEATURES
h1dd3nsn1p3r Jul 21, 2023
d8d2d86
🎆 NEW: Z-INDEX, SPINNER ICONS, MORE.
h1dd3nsn1p3r Jul 21, 2023
1741eff
Merge pull request #185 from addonify/sniper
h1dd3nsn1p3r Jul 21, 2023
1a9ffb7
UPDATED: README.
h1dd3nsn1p3r Jul 21, 2023
2a718a1
Merge pull request #186 from addonify/sniper
h1dd3nsn1p3r Jul 21, 2023
2032409
HOUSEKEEPING
h1dd3nsn1p3r Jul 21, 2023
5eeb725
Merge pull request #187 from addonify/sniper
h1dd3nsn1p3r Jul 21, 2023
563ec2c
🦄 Better WC var product.
h1dd3nsn1p3r Jul 24, 2023
6d01eb3
Merge pull request #188 from addonify/sniper
h1dd3nsn1p3r Jul 24, 2023
bbcb1ed
☕ NEW: Option to define content row layout inside modal.
h1dd3nsn1p3r Jul 24, 2023
a49d23d
Merge pull request #189 from addonify/sniper
h1dd3nsn1p3r Jul 24, 2023
daa3ac3
🌈 Added: Option to control content column gap.
h1dd3nsn1p3r Jul 24, 2023
c545e41
Merge pull request #190 from addonify/sniper
h1dd3nsn1p3r Jul 24, 2023
ffdbb43
WC: Better grouped products.
h1dd3nsn1p3r Jul 25, 2023
d21256c
Merge pull request #191 from addonify/sniper
h1dd3nsn1p3r Jul 25, 2023
3078cfb
Fix: dependent.
h1dd3nsn1p3r Jul 25, 2023
a1cdf43
Merge pull request #192 from addonify/sniper
h1dd3nsn1p3r Jul 25, 2023
36b8cd3
🦄 ADDED: OPTION, ICON IN QV BUTTON.
h1dd3nsn1p3r Jul 26, 2023
b1e6956
Merge pull request #193 from addonify/sniper
h1dd3nsn1p3r Jul 26, 2023
9bd3e64
📦 FIX: BUTTONS INSIDE MODAL.
h1dd3nsn1p3r Aug 1, 2023
269bc9f
Merge pull request #194 from addonify/sniper
h1dd3nsn1p3r Aug 1, 2023
dea37fc
🔥 NEW: FEATURES 11+.
h1dd3nsn1p3r Aug 1, 2023
fa69431
Merge pull request #195 from addonify/sniper
h1dd3nsn1p3r Aug 1, 2023
95ac598
📦 NEW: FEATURES 8+.
h1dd3nsn1p3r Aug 1, 2023
25ff23a
Merge pull request #196 from addonify/sniper
h1dd3nsn1p3r Aug 1, 2023
6d30f7a
🐛FIX: OPTIONS!
h1dd3nsn1p3r Aug 2, 2023
955647f
Merge pull request #197 from addonify/sniper
h1dd3nsn1p3r Aug 2, 2023
de6310b
📦 NEW: BUTTON FEATURES 9+.
h1dd3nsn1p3r Aug 2, 2023
55057a3
Merge pull request #198 from addonify/sniper
h1dd3nsn1p3r Aug 2, 2023
ed26ecb
📝 UPDATED: README.
h1dd3nsn1p3r Aug 2, 2023
e797110
Merge pull request #199 from addonify/sniper
h1dd3nsn1p3r Aug 2, 2023
3a2fe38
📢 TWEAK: NOTICE IS NOW NON-DISMISSABLE.
h1dd3nsn1p3r Aug 3, 2023
e943af9
Merge pull request #200 from addonify/sniper
h1dd3nsn1p3r Aug 3, 2023
425d955
Fix dynamic value of gallery trigger border radius
Asok17 Aug 4, 2023
808d00d
Merge pull request #201 from addonify/ashok
Asok17 Aug 4, 2023
0fd0462
🗓️ UPDATED: RELEASE DATE.
h1dd3nsn1p3r Aug 4, 2023
a9f4f89
Merge pull request #202 from addonify/sniper
h1dd3nsn1p3r Aug 4, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
🌈 REFACTOR: PUBLIC FACING JAVASCRIPT.
- 🌈 REFACTOR: PUBLIC FACING JAVASCRIPT.
  • Loading branch information
h1dd3nsn1p3r committed Jul 21, 2023
commit 6e54430ae88cbc676a4c119fc5489e86d81b81cd
2 changes: 1 addition & 1 deletion public/assets/build/css/addonify-quick-view-rtl.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/assets/build/css/addonify-quick-view.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/assets/build/css/addonify-quick-view.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/assets/build/js/addonify-quick-view.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

288 changes: 250 additions & 38 deletions public/assets/src/js/custom/custom-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,66 +2,89 @@

'use strict';

$(document).ready(function () {
const animateModelOnClose = true;

function AddonifyQuickViewModel() {
/**
* Main object for addonify quick view modal.
* Define all necessary actions/methods here.
* Below defined methods can be called on document ready, scroll and resize.
*
* @since 1.2.8
*/
const addonifyQuickView = {

// add class to body when quick view button is clicked
loadOnReady: function () {

$('body').on('click', '.addonify-qvm-button', function (e) {
// Fire all these methods on document ready.
this.handleOpenCloseActions();
this.prepareOverlayButtons();
this.initPerfectScrollbar();
},

e.preventDefault(); // prevent empty links clicks
loadOnScroll: function () {

$('body').addClass('addonify-qvm-is-active');
});
// Fire all these methods on document scroll.
},

// remove class from body when quick view close button is clicked
$('body').on('click', '#addonify-qvm-close-button', function (e) {
loadOnResize: function () {

e.preventDefault(); // prevent empty links clicks
// Fire all these methods on document resize.
},

let animationOpeningTask = null;
let animationClosingTask = null;
let quickViewModelWrapperEle = $('#addonify-quick-view-modal-wrapper');
/**
* Method: handleOpenCloseActions
* Handles all open and close actions.
*
* @return void
*/
handleOpenCloseActions: function () {

// open quick view modal when quick view button is clicked.
$('body').on('click', '.addonify-qvm-button', function (e) {

e.preventDefault();
dispatchAddonifyQuickViewEvent.open();
});

// If closing animation is enabled.
quickViewModelWrapperEle.removeClass('play-opening-animation');
quickViewModelWrapperEle.addClass('play-closing-animation');
// close quick view modal when close button is clicked.
$('body').on('click', '#addonify-qvm-close-button', function (e) {

clearTimeout(animationOpeningTask);
animationOpeningTask = setTimeout(() => {
e.preventDefault();

$('body').removeClass('addonify-qvm-is-active');
quickViewModelWrapperEle.removeClass('play-closing-animation');
if (animateModelOnClose) {

clearTimeout(animationOpeningTask);
}, 800);
// close quick view modal with animation.
dispatchAddonifyQuickViewEvent.animate();
} else {

clearTimeout(animationClosingTask);
animationClosingTask = setTimeout(() => {
// close quick view modal without animation.
dispatchAddonifyQuickViewEvent.close();
}

quickViewModelWrapperEle.addClass('play-opening-animation');
clearTimeout(animationClosingTask);
}, 1000);
});
}
},

// buttons overlay in image
function prepare_overlay_buttons() {
/**
* Method: prepareOverlayButtons
* Prepare overlay buttons.
*
* @return void
*/
prepareOverlayButtons: function () {

var overlay_btn_wrapper_class = 'addonify-overlay-btn-wrapper';
var overlay_btn_class = 'addonify-overlay-btn';
let overlay_btn_wrapper_class = 'addonify-overlay-btn-wrapper';
let overlay_btn_class = 'addonify-overlay-btn';

var $overlay_btn_wrapper_sel = $('.' + overlay_btn_wrapper_class);
var $overlay_parent_container = $('.addonify-overlay-buttons');
let $overlay_btn_wrapper_sel = $('.' + overlay_btn_wrapper_class);
let $overlay_parent_container = $('.addonify-overlay-buttons');

if ($overlay_btn_wrapper_sel.length) {

// wrapper div already exists
$overlay_parent_container.each(function () {

// clone original button
var btn_clone = $('button.' + overlay_btn_class, this).clone();
let btn_clone = $('button.' + overlay_btn_class, this).clone();

// delete oroginal buttons
$('button.' + overlay_btn_class, this).remove();
Expand All @@ -76,7 +99,7 @@
$('button.' + overlay_btn_class, this).wrapAll('<div class=" ' + overlay_btn_wrapper_class + ' " />');
});

var img_height = $('img.attachment-woocommerce_thumbnail').height();
let img_height = $('img.attachment-woocommerce_thumbnail').height();

// set height of the button wrapper div
$('.' + overlay_btn_wrapper_class).css('height', img_height + 'px');
Expand All @@ -88,11 +111,200 @@
$(this).css('opacity', 0);
})
}
},

/**
* Method: setSpinner
* Show or hide spinner.
*
* @param {string} action. show | hide
* @return void
*/
setSpinner: function (action) {

let spinner = $('#adfy-qvm-spinner');

if (action === 'show') {

spinner.removeClass('hide');
} else {

spinner.addClass('hide');
}
},

/**
* Method: hydrateModalContent
* Fn hat does Ajax call to get modal content.
*
* @param {int} productID. ID of the product.
* @return void
* @since 1.2.8
*/
hydrateModalContent: function (productID) {

let modalContentContainer = $('#addonify-quick-view-modal #adfy-quick-view-modal-content');

// show loading state.
addonifyQuickView.setSpinner('show');

// clear old contents
$(modalContentContainer).html(" ");

// check if we have product id before doing call.
if (productID) {

$.ajax({
type: 'GET',
url: addonifyQuickViewPublicScriptObject.ajaxURL,
contentType: "application/json; charset=utf-8",
data: {
'action': addonifyQuickViewPublicScriptObject.quickViewAction,
'product_id': productID,
'nonce': addonifyQuickViewPublicScriptObject.nonce,
},
'success': function (response) {

response.success ? $(modalContentEle).html(response.data) : console.log(response.message);
},
'error': function (event) {

console.error('Addonify Quick View - error loading modal content!');
console.log(event);
},
'complete': function () {

// hide loading state.
addonifyQuickView.setSpinner('hide');
}
});

} else {

throw new Error('Addonify Quick View: Product id is not supplied!');
}
},

/**
* Method: intPerfectScrollbar
* Initialize perfect scrollbar.
*
* @param {null} null
* @return void
* @since 1.2.8
*/
initPerfectScrollbar: function () {

if (typeof PerfectScrollbar === 'function') {

let scrollEle = $('#addonify-quick-view-modal');

if (scrollEle.length > 0) {

new PerfectScrollbar(modalEle, {

wheelSpeed: 1,
wheelPropagation: true,
minScrollbarLength: 20
});
}
} else {

console.warn("Addonify Quick View: PerfectScrollbar is not defined. Perfect scroll bar won't be initialized.");
}
}
}


/**
* Define events.
* Also acts as API for dispatching DOM events.
*
* @since 1.2.8
*/
const dispatchAddonifyQuickViewEvent = {

/**
* Dispatch event when quick view modal is opened.
*
* @since 1.2.8
*/
open: function () {

$('body').addClass('addonify-qvm-is-active');

// dispatch event when quick view modal is opened in DOM.
document.trigger('addonifyQuickViewModalOpened');
document.dispatchEvent(new CustomEvent('addonifyQuickViewModalOpened'));
},

/**
* Dispatch event when quick view modal is closed.
*
* @since 1.2.8
*/
close: function () {

$('body').removeClass('addonify-qvm-is-active');

// dispatch event when quick view modal is closed in DOM.
document.trigger('addonifyQuickViewModalClosed');
document.dispatchEvent(new CustomEvent('addonifyQuickViewModalClosed'));
},

/**
* Handles quick view modal animation task.
*
* @since 1.2.8
*/
animate: function () {

let openingTask = null;
let closingTask = null;
let quickViewModelWrapperEle = $('#addonify-quick-view-modal-wrapper');

quickViewModelWrapperEle.removeClass('play-opening-animation');
quickViewModelWrapperEle.addClass('play-closing-animation');

// Remove closing animation class after 800ms
clearTimeout(closingTask);
closingTask = setTimeout(() => {

this.close();
quickViewModelWrapperEle.removeClass('play-closing-animation');
clearTimeout(closingTask);
}, 800);

// Reset opening animation class after 1000ms
clearTimeout(openingTask);
openingTask = setTimeout(() => {

quickViewModelWrapperEle.addClass('play-opening-animation');
clearTimeout(openingTask);
}, 1200);
}
}


AddonifyQuickViewModel();
prepare_overlay_buttons();
/**
* Mount the methods on jQuery events.
* Types: ready, scroll, resize
*
* @since 1.2.8
*/

$(document).ready(function () {

addonifyQuickView.loadOnReady();
});

$(window).on('scroll', function () {

addonifyQuickView.loadOnScroll();
});

$(window).on('resize', function () {

addonifyQuickView.loadOnResize();
});
})(jQuery);
17 changes: 2 additions & 15 deletions public/assets/src/scss/abstracts/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,14 @@
@if $visibility == hidden {
opacity: 0;
visibility: hidden;
backface-visibility: hidden;
} @else {
opacity: 1;
visibility: visible;
backface-visibility: visible;
}
}


@mixin scale () {

transform: scale(1.1);
Expand All @@ -80,20 +81,6 @@
transform: translateX(-50%) translateY(-50%);
}

@mixin overlay () {

top: 0;
bottom: 0;
left: 0;
right: 0;
@include transation_delay();
}

@mixin border_radius ( $radius ) {

border-radius: $radius;
}

@mixin box_shadow () {

box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
Expand Down
2 changes: 1 addition & 1 deletion public/assets/src/scss/abstracts/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
--adonify_qv_product_title_font_weight: normal; // NEW
--adonify_qv_product_title_line_height: 1.2; // NEW
--adonify_qv_product_price_font_size: 22px; // NEW
--adonify_qv_product_price_font_weight: bold; // NEW
--adonify_qv_product_price_font_weight: normal; // NEW

// Image gallery
--addonify_qv_modal_images_border: rgba(238, 238, 238, 1);
Expand Down
Loading