PluginProbe
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant / 1.8
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant v1.8
2.3.2 2.3.1 2.3.0 2.2.8 2.2.7 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.11.0 1.11.1 1.11.2 1.6 1.7 1.8 1.8.1 1.8.2 1.8.3 1.9.0 1.9.1 1.9.10 1.9.11 All 60 releases
merchant / assets / js / modules / inactive-tab-message / inactive-tab-message.js

inactive-tab-message.js in Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant 1.8, at assets/js/modules/inactive-tab-message/inactive-tab-message.js

32 lines 997 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * Merchant Inactive Tab Message.
3 *
4 */
5
6 'use strict';
7
8 var merchant = merchant || {};
9 merchant.modules = merchant.modules || {};
10 (function ($) {
11 merchant.modules.inactiveTabMessage = {
12 init: function init() {
13 var count = window.merchant.setting.inactive_tab_cart_count;
14 $(document.body).on('added_to_cart removed_from_cart', function (event, data) {
15 if (data && data['.merchant_cart_count'] !== undefined) {
16 count = data['.merchant_cart_count'];
17 }
18 });
19 var initial = document.title;
20 var message;
21 document.addEventListener('visibilitychange', function () {
22 if (document.hidden) {
23 var message = count ? window.merchant.setting.inactive_tab_abandoned_message : window.merchant.setting.inactive_tab_messsage;
24 document.title = message.replace("'", "'");
25 } else {
26 document.title = initial;
27 }
28 });
29 }
30 };
31 merchant.modules.inactiveTabMessage.init();
32 })(jQuery);