MFP > Yootheme JS

“use strict” jQuery(document).on(‘ready’, function () { jQuery(‘.uk-nav.uk-nav-primary’).removeClass(‘uk-nav-‘).addClass(‘uk-child-width-1-1 uk-child-width-1-2@s uk-grid uk-grid-row-large uk-grid-column-collapse’); // UIkit.sticky(‘#tm-dialog .uk-grid .uk-grid-margin:last-child > div ‘, {‘position’ : ‘bottom’}); // jQuery(‘input[type=text]’).addClass(‘uk-input’); // jQuery(‘input[type=password]’).addClass(‘uk-input’); // jQuery(‘input[type=number]’).addClass(‘uk-input’); // jQuery(‘input[type=email]’).addClass(‘uk-input’); // jQuery(‘select’).addClass(‘uk-select’); // jQuery(‘input[type=radio]’).addClass(‘uk-radio’); // jQuery(‘input[type=checkbox]’).addClass(‘uk-checkbox’); // jQuery(‘input[type=range]’).addClass(‘uk-range’); // jQuery(‘input[type=tel]’).addClass(‘uk-input’); //…Continue reading

Scroll Reveal JS (reference)

function scrollFunction() { if (document.body.scrollTop > 160 || document.documentElement.scrollTop > 160) { document.getElementById(“profile-bubble”).style.display = “inline-block”; } else { document.getElementById(“profile-bubble”).style.display = “none”; } } window.onscroll = function() {scrollFunction()};Continue reading

Tasty Pins – Remove the Pin button for an image by URL

(function(callback) { if (document.readyState !== “loading”) { callback(); } else { document.addEventListener(“DOMContentLoaded”, callback); } })(() => { let tp_exclusions = document.querySelectorAll(‘img[src=”https://example.com/wp-content/uploads/2023/12/logo.png”]’); if ( tp_exclusions.length === 0 ) { return; } for( const tp_exclusion of tp_exclusions ) { tp_exclusion.dataset.pinNopin = ‘nopin’;…Continue reading

WP Simple Pay: Require Terms of Service Link Click

jQuery( function() { var fieldId = ‘simpay-form-771-field-5’; var $checkbox = jQuery(‘#’ + fieldId); $checkbox.prop( ‘disabled’, true ); jQuery(‘label[for=”‘ + fieldId + ‘”] a’).on( ‘click’, function() { $checkbox.prop( ‘disabled’, false ); } ); });Continue reading

Product Count Javascript

// Update values in post counter if ( jQuery( ‘.cwf-products-count’ ) && jQuery( ‘.cwf-products-count’ ).length ) { // TODO maybe found more suitable event in imagesLoaded? $us.$canvas.on( ‘resize’, function(){ // Make sure HTML was appended setTimeout(() => { jQuery( ‘.cwf-products-count’…Continue reading

Observe the Target Node Mutations (DOM)

// Options for the observer (which mutations to observe) const config = { attributes: true, childList: true, characterData: true, subtree: true, }; // Callback function to execute when mutations are observed const callback = (mutationList, observer) => { for (const…Continue reading

Goal Tracking Pixel

var peGoal = { name : “Enter goal name”, count: 1, value: 1, // Enter goal value in numbers }; window.PushEngage = window.PushEngage || []; PushEngage.push(function() { PushEngage.sendGoal(peGoal).then(function(data) { console.log(data) }).catch(function error(error) { console.log(error.message) }); });Continue reading

Add Profile ID to Subscriber

var peProfileId = “Enter Profile Id”; window.PushEngage = window.PushEngage || []; PushEngage.push(function () { PushEngage.setProfileId(peProfileId) .then(function (response) { console.log(response); }) .catch(function (error) { console.log(error.message, error.details); }); });Continue reading

Remove Subscriber from Segment

var peRemoveSegmentNames = []; // Array of segment ids e.g, [“segment1”, “segment2”] window.PushEngage = window.PushEngage || []; PushEngage.push(function () { PushEngage.removeSegment(peRemoveSegmentNames) .then(function (response) { console.log(response); }) .catch(function (error) { console.log(error.message, error.details); }); });Continue reading

Add Subscriber to Segment with Duration

var peSegmentNameWithDuration = []; // e.g, [{“name”:”segmentName”,”duration”: 5}] window.PushEngage = window.PushEngage || []; PushEngage.push(function() { PushEngage.addSegmentWithDuration(peSegmentNameWithDuration).then(function(data) { console.log(data) }).catch(function error(error) { console.log(error.message) }); });Continue reading