···11-module.exports = function (grunt) {
11+/**
22+ * This is the Grunt configuration file for the project. It defines tasks for linting JavaScript and CSS files, as well as generating SVG sprites. The default task runs ESLint and SVG store tasks, it combines individual SVG files into a single SVG sprite sheet. Webpack doesn't do this natively, so Grunt handles it. Grunt is typically run as a pre-build step or during development when you need to regenerate the SVG sprite. The Stencil CLI internally invokes it at certain points, and it may also be wired into the watch process.
33+ */
44+55+module.exports = function gruntfile(grunt) {
26 require('time-grunt')(grunt);
37 require('load-grunt-config')(grunt);
48
···11-import { forEach } from "lodash";
22-31export default function () {
44- jQuery(document).ready(function () {
55- const descriptionOld = document.getElementsByClassName("description-v1");
66- if ($("#_product-description").length > 0) {
77- //If text is detected within the id _product-description element
88- if (
99- ~document
1010- .getElementById("_product-description")
1111- .innerHTML.toString()
1212- .indexOf("<!-- pagebreak -->")
1313- ) {
1414- const breaks = $("#_product-description")
1515- .html()
1616- .trim()
1717- .split("<!-- pagebreak -->");
1818- console.log("description-v2");
1919- document.getElementById("tab-description").innerHTML = breaks[0];
2020- document.getElementById("tab-composition").innerHTML = breaks[1];
2121- if (document.getElementById("tab-instructions")) {
2222- document.getElementById("tab-instructions").innerHTML = breaks[1];
2323- }
2424- if (document.getElementById("tab-supplements-composition")) {
2525- document.getElementById("tab-supplements-composition").innerHTML =
2626- breaks[1];
2727- }
2828- document.getElementById("tab-constituents").innerHTML = breaks[2];
2929- if (document.getElementById("tab-health-safety")) {
3030- document.getElementById("tab-health-safety").innerHTML = breaks[2];
3131- }
3232- if (document.getElementById("tab-supplements-constituents")) {
3333- document.getElementById("tab-supplements-constituents").innerHTML =
3434- breaks[2];
3535- }
3636- if (document.getElementById("tab-supplements-instructions")) {
3737- document.getElementById("tab-supplements-instructions").innerHTML =
3838- breaks[3];
3939- }
4040- /*Mobile tabs content allocation*/
4141- document.getElementById("tab-mobile-description").innerHTML = breaks[0];
4242- document.getElementById("tab-mobile-composition").innerHTML = breaks[1];
4343- if (document.getElementById("tab-mobile-instructions")) {
4444- document.getElementById("tab-mobile-instructions").innerHTML =
4545- breaks[1];
4646- }
4747- if (document.getElementById("tab-mobile-supplements-composition")) {
4848- document.getElementById(
4949- "tab-mobile-supplements-composition"
5050- ).innerHTML = breaks[1];
5151- }
5252- if (document.getElementById("tab-mobile-constituents")) {
5353- document.getElementById("tab-mobile-constituents").innerHTML =
5454- breaks[2];
5555- }
5656- if (document.getElementById("tab-mobile-health-safety")) {
5757- document.getElementById("tab-mobile-health-safety").innerHTML =
5858- breaks[2];
5959- }
6060- if (document.getElementById("tab-mobile-supplements-constituents")) {
6161- document.getElementById(
6262- "tab-mobile-supplements-constituents"
6363- ).innerHTML = breaks[2];
6464- }
6565- if (document.getElementById("tab-mobile-supplements-instructions")) {
6666- document.getElementById(
6767- "tab-mobile-supplements-instructions"
6868- ).innerHTML = breaks[3];
6969- }
7070- } else {
7171- console.log("description-v1");
7272- /*If no pagebreak is detected, the description-v1 elements are made visible and the old system is used to display description tab content.*/
7373- for (var i = 0; i < descriptionOld.length; i++) {
7474- // descriptionOld[i].style.display = "block";
7575- console.log("test")
22+ $(() => {
33+ const descriptionOld =
44+ document.getElementsByClassName('description-v1');
55+ if ($('#_product-description').length > 0) {
66+ // If text is detected within the id _product-description element
77+ if (
88+ document
99+ .getElementById('_product-description')
1010+ .innerHTML.toString()
1111+ .indexOf('<!-- pagebreak -->') !== -1
1212+ ) {
1313+ const breaks = $('#_product-description')
1414+ .html()
1515+ .trim()
1616+ .split('<!-- pagebreak -->');
1717+ console.log('description-v2');
1818+ document.getElementById('tab-description').innerHTML =
1919+ breaks[0];
2020+ document.getElementById('tab-composition').innerHTML =
2121+ breaks[1];
2222+ if (document.getElementById('tab-instructions')) {
2323+ document.getElementById('tab-instructions').innerHTML =
2424+ breaks[1];
2525+ }
2626+ if (document.getElementById('tab-supplements-composition')) {
2727+ document.getElementById(
2828+ 'tab-supplements-composition',
2929+ ).innerHTML = breaks[1];
3030+ }
3131+ document.getElementById('tab-constituents').innerHTML =
3232+ breaks[2];
3333+ if (document.getElementById('tab-health-safety')) {
3434+ document.getElementById('tab-health-safety').innerHTML =
3535+ breaks[2];
3636+ }
3737+ if (document.getElementById('tab-supplements-constituents')) {
3838+ document.getElementById(
3939+ 'tab-supplements-constituents',
4040+ ).innerHTML = breaks[2];
4141+ }
4242+ if (document.getElementById('tab-supplements-instructions')) {
4343+ document.getElementById(
4444+ 'tab-supplements-instructions',
4545+ ).innerHTML = breaks[3];
4646+ }
4747+ /* Mobile tabs content allocation */
4848+ document.getElementById('tab-mobile-description').innerHTML =
4949+ breaks[0];
5050+ document.getElementById('tab-mobile-composition').innerHTML =
5151+ breaks[1];
5252+ if (document.getElementById('tab-mobile-instructions')) {
5353+ document.getElementById(
5454+ 'tab-mobile-instructions',
5555+ ).innerHTML = breaks[1];
5656+ }
5757+ if (
5858+ document.getElementById(
5959+ 'tab-mobile-supplements-composition',
6060+ )
6161+ ) {
6262+ document.getElementById(
6363+ 'tab-mobile-supplements-composition',
6464+ ).innerHTML = breaks[1];
6565+ }
6666+ if (document.getElementById('tab-mobile-constituents')) {
6767+ document.getElementById(
6868+ 'tab-mobile-constituents',
6969+ ).innerHTML = breaks[2];
7070+ }
7171+ if (document.getElementById('tab-mobile-health-safety')) {
7272+ document.getElementById(
7373+ 'tab-mobile-health-safety',
7474+ ).innerHTML = breaks[2];
7575+ }
7676+ if (
7777+ document.getElementById(
7878+ 'tab-mobile-supplements-constituents',
7979+ )
8080+ ) {
8181+ document.getElementById(
8282+ 'tab-mobile-supplements-constituents',
8383+ ).innerHTML = breaks[2];
8484+ }
8585+ if (
8686+ document.getElementById(
8787+ 'tab-mobile-supplements-instructions',
8888+ )
8989+ ) {
9090+ document.getElementById(
9191+ 'tab-mobile-supplements-instructions',
9292+ ).innerHTML = breaks[3];
9393+ }
9494+ } else {
9595+ console.log('description-v1');
9696+ /* If no pagebreak is detected, the description-v1 elements are made visible and the old system is used to display description tab content. */
9797+ for (let i = 0; i < descriptionOld.length; i++) {
9898+ // descriptionOld[i].style.display = "block";
9999+ console.log('test');
100100+ }
101101+ }
76102 }
7777- }
7878-7979- forEach
8080- }
8181- });
103103+ });
82104}
+1-3
assets/js/theme/global.js
···3344import carousel from './common/carousel';
55import './common/select-option-plugin';
66-import calculatorDropdown from './custom/calculatorDropdown';
76import descriptionTabs from './custom/descriptionTabs';
87import cartPreview from './global/cart-preview';
98import privacyCookieNotification from './global/cookieNotification';
···3130 privacyCookieNotification();
3231 svgInjector();
3332 descriptionTabs();
3434- calculatorDropdown();
35333634 $(() => {
3735 function handleImageVisibility() {
···9694 // Find the related input with class "form-input--incrementTotal"
9795 const incrementTotalInput = card.find(
9896 // eslint-disable-next-line comma-dangle
9999- '.form-input--incrementTotal'
9797+ '.form-input--incrementTotal',
10098 );
10199102100 // Update the value of the input with the HTML content of the span