### Initialize Website Modules and Prefetching Source: https://mech-masz.com.pl/oferta Configures the global RS_MODULES object for module tracking and defines a JSON-based prefetching strategy for site navigation. This setup ensures optimized resource loading by excluding administrative paths and no-follow links. ```javascript window.RS_MODULES = window.RS_MODULES || {}; window.RS_MODULES.modules = window.RS_MODULES.modules || {}; window.RS_MODULES.waiting = window.RS_MODULES.waiting || []; window.RS_MODULES.defered = true; window.RS_MODULES.moduleWaiting = window.RS_MODULES.moduleWaiting || {}; window.RS_MODULES.type = 'compiled'; const prefetchConfig = {"prefetch":[{"source":"document","where":{"and":[{"href_matches":"/*"},{"not":{"href_matches":["/wp-*.php","/wp-admin/*","/wp-content/uploads/*","/wp-content/*","/wp-content/plugins/*","/wp-content/themes/porto-child/*","/wp-content/themes/porto/*","/*\\?(.+)"]}},{"not":{"selector_matches":"a[rel~=\"nofollow\"]"}},{"not":{"selector_matches":".no-prefetch, .no-prefetch a"}}]},"eagerness":"conservative"}]}; ``` -------------------------------- ### Get Cookie Value (JavaScript) Source: https://mech-masz.com.pl/oferty-pracy The `getCookie` function retrieves the value of a specified cookie. It also includes logic to generate a version string based on the current date if the cookie is not found. This is used by the CallPage widget script. ```javascript var getCookie = function(cname) {var objToday = new Date();var version = objToday.toISOString().split('T')[0].split('-').join('');var name = cname + '=';var decodedCookie = decodeURIComponent(document.cookie);var cookieArray = decodedCookie.split(';');for (var i = 0; i < cookieArray.length; i++) {var cookie = cookieArray[i];cookie = cookie.trim();if (cookie.indexOf(name) == 0) {return cookie.substring(name.length, cookie.length);}}return version;}; ``` -------------------------------- ### Initialize Responsive Product Tabs Source: https://mech-masz.com.pl/produkt/przesiewacz-do-maki-nierdzewny Initializes the responsive tab interface for product descriptions using the easyResponsiveTabs library. It dynamically loads the dependency script if not already present and handles accordion behavior for mobile views. ```JavaScript ( function() { var porto_init_desc_tab = function() { ( function( $ ) { var $tabs = $('.woocommerce-tabs-8m7arhcs'); function init_tabs($tabs) { $tabs.easyResponsiveTabs({ type: 'default', width: 'auto', fit: true, activate: function(event) {}, closed: false }); } if (!$.fn.easyResponsiveTabs) { var js_src = "https://mech-masz.com.pl/wp-content/themes/porto/js/libs/easy-responsive-tabs.min.js"; if (!$('script[src="' + js_src + '"]').length) { var js = document.createElement('script'); $(js).appendTo('body').on('load', function() { init_tabs($tabs); }).attr('src', js_src); } } else { init_tabs($tabs); } function goAccordionTab(target) { setTimeout(function() { var label = target.attr('data-target'); var $tab_content = $tabs.find('.resp-tab-content[aria-labelledby="' + label + '"]'); if ($tab_content.length && $tab_content.css('display') != 'none') { var offset = target.offset().top - theme.StickyHeader.sticky_height - theme.adminBarHeight() - 14; if (offset < $(window).scrollTop()) $('html, body').stop().animate({ scrollTop: offset }, 600, 'easeOutQuad'); } }, 500); } $tabs.find('h2.resp-accordion').on('click', function(e) { goAccordionTab($(this)); }); } )( window.jQuery ); }; if ( window.theme && theme.isLoaded ) { porto_init_desc_tab(); } else { window.addEventListener( 'load', porto_init_desc_tab ); } } )(); ``` -------------------------------- ### Initialize Website Modules (JavaScript) Source: https://mech-masz.com.pl/oferty-pracy This script initializes the global `RS_MODULES` object, which is used to manage website modules. It sets up properties for modules, waiting lists, deferred loading, and module waiting states. It also configures prefetching behavior for links on the page, excluding specific patterns. ```javascript window.RS_MODULES = window.RS_MODULES || {}; window.RS_MODULES.modules = window.RS_MODULES.modules || {}; window.RS_MODULES.waiting = window.RS_MODULES.waiting || []; window.RS_MODULES.defered = true; window.RS_MODULES.moduleWaiting = window.RS_MODULES.moduleWaiting || {}; window.RS_MODULES.type = 'compiled'; {"prefetch":[{"source":"document","where":{"and":[{"href_matches":"/*"},{"not":{"href_matches":["/wp-*.php","/wp-admin/*","/wp-content/uploads/*","/wp-content/*","/wp-content/plugins/*","/wp-content/themes/porto-child/*","/wp-content/themes/porto/*","/*\?(.+)"]}},{"not":{"selector_matches":"a[rel~=\"nofollow\"]"}},{"not":{"selector_matches=".no-prefetch, .no-prefetch a"}}]},"eagerness":"conservative"}]} ``` -------------------------------- ### PixelYourSite Event Tracking Configuration (JavaScript) Source: https://mech-masz.com.pl/aktualnosci Configuration for PixelYourSite, a plugin for managing marketing pixels. It defines static and dynamic events for Facebook and Google Analytics, including PageView, Form submissions, and Download tracking. This setup allows for detailed user behavior tracking and targeted advertising. ```javascript var pysOptions = {"staticEvents":{"facebook":{"init_event":[{"delay":0,"type":"static","ajaxFire":false,"name":"PageView","pixelIds":["2762408817146974"],"eventID":"2fd21690-af86-476c-92e3-fdb3c07da2c0","params":{"post_category":"Aktualno\u015bci","page_title":"Mech-Masz Szczeci\u0144ski","post_type":"page","plugin":"PixelYourSite","user_role":"guest","event_url":"mech-masz.com.pl/news/"},"e_id":"init_event","ids":[],"hasTimeWindow":false,"timeWindow":0,"woo_order":"","edd_order":""}]},"dynamicEvents":{"automatic_event_form":{"facebook":{"delay":0,"type":"dyn","name":"Form","pixelIds":["2762408817146974"],"eventID":"ce2d32fc-b64c-49d1-a29a-b1d748d186fa","params":{"page_title":"Mech-Masz Szczeci\u0144ski","post_type":"page","plugin":"PixelYourSite","user_role":"guest","event_url":"mech-masz.com.pl/news/"},"e_id":"automatic_event_form","ids":[],"hasTimeWindow":false,"timeWindow":0,"woo_order":"","edd_order":""},"ga":{"delay":0,"type":"dyn","name":"Form","trackingIds":["G-WVQVSXY7YW"],"eventID":"ce2d32fc-b64c-49d1-a29a-b1d748d186fa","params":{"page_title":"Mech-Masz Szczeci\u0144ski","post_type":"page","plugin":"PixelYourSite","user_role":"guest","event_url":"mech-masz.com.pl/news/"},"e_id":"automatic_event_form","ids":[],"hasTimeWindow":false,"timeWindow":0,"pixelIds":[],"woo_order":"","edd_order":""}},"automatic_event_download":{"facebook":{"delay":0,"type":"dyn","name":"Download","extensions":["","doc","exe","js","pdf","ppt","tgz","zip","xls"],"pixelIds":["2762408817146974"],"eventID":"191ed917-352a-4bc6-a019-6531d96b75f2","params":{"page_title":"Mech-Masz Szczeci\u0144ski","post_type":"page","plugin":"PixelYourSite","user_role":"guest","event_url":"mech-masz.com.pl/news/"},"e_id":"automatic_event_download","ids":[],"hasTimeWindow":false,"timeWindow":0,"woo_order":"","edd_order":""},"ga":{"delay":0,"type":"dyn","name":"Download","extensions":["","doc","exe","js","pdf","ppt","tgz","zip","xls"],"trackingIds":["G-WVQVSXY7YW"],"eventID":"191ed917-352a-4bc6-a019-6531d96b75f2","params":{"page_title":"Mech-Masz Szczeci\u0144ski","post_type":"page","plugin":"PixelYourSite","user_role":"guest","event_url":"mech-masz.com.pl/news/"},"e_id":"automatic_event_download","ids":[],"hasTimeWindow":false,"timeWindow":0,"pixelIds":[],"woo_order":"","edd_order":""}}} ``` -------------------------------- ### Initialize Modules and Load Babel Polyfill for Widget Source: https://mech-masz.com.pl/aktualnosci This script initializes module loading configurations and asynchronously loads the Babel polyfill. After the polyfill is loaded, it calls a function to load the CallPage widget. It also includes a check for existing CallPage instances to prevent duplicates. ```javascript window.RS_MODULES = window.RS_MODULES || {}; window.RS_MODULES.modules = window.RS_MODULES.modules || {}; window.RS_MODULES.waiting = window.RS_MODULES.waiting || []; window.RS_MODULES.defered = true; window.RS_MODULES.moduleWaiting = window.RS_MODULES.moduleWaiting || {}; window.RS_MODULES.type = 'compiled'; var loadBabel = function(url, callback) { var script = document.createElement('script'); script.async = true; if (script.readyState) { script.onreadystatechange = function() { if (script.readyState == 'loaded' || script.readyState == 'complete') { script.onreadystatechange = null; callback(window, document); } }; } else { script.onload = function() { callback(window, document); }; } script.src = url; document.head.appendChild(script); }; var getCookie = function(cname) { var objToday = new Date(); var version = objToday.toISOString().split('T')[0].split('-').join(''); var name = cname + '='; var decodedCookie = decodeURIComponent(document.cookie); var cookieArray = decodedCookie.split(';'); for (var i = 0; i < cookieArray.length; i++) { var cookie = cookieArray[i]; cookie = cookie.trim(); if (cookie.indexOf(name) == 0) { return cookie.substring(name.length, cookie.length); } } return version; }; var loadWidget = function(window, document) { var __cp = {"id":"rt9c2LeFBM8fOP4X6YNGS5RYGDuVzePsMbhejgSVgq8","version":"1.1"}; var cp = document.createElement('script'); cp.type = 'text/javascript'; cp.async = true; cp.src = "++cdn-widget.callpage.io+build+js+callpage.js".replace(/[+]/g, '/').replace(/[=]/g, '.') + '?v=' + getCookie('callpage-widget-version'); var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(cp, s); if (window.callpage) { alert('You could have only 1 CallPage code on your website!'); } else { window.callpage = function(method) { if (method == '__getQueue') { return this.methods; } else if (method) { if (typeof window.callpage.execute === 'function') { return window.callpage.execute.apply(this, arguments); } else { (this.methods = this.methods || []).push({ arguments: arguments }); } } }; window.callpage.__cp = __cp; window.callpage('api.button.autoshow'); } }; loadBabel('https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.26.0/polyfill.min.js', function() { return loadWidget(window, document); }); window.wpbCustomElement = 1; ``` -------------------------------- ### Configure Resource Prefetching (JavaScript) Source: https://mech-masz.com.pl/piekarnia-start Configures resource prefetching to improve page load performance. It specifies conditions for prefetching, excluding specific file types and elements like 'nofollow' links or elements with the 'no-prefetch' class. ```javascript {"prefetch":[{"source":"document","where":{"and":[{"href_matches":"/"},{"not":{"href_matches":["/wp-*.php","/wp-admin/*","/wp-content/uploads/*","/wp-content/*","/wp-content/plugins/*","/wp-content/themes/porto-child/*","/wp-content/themes/porto/*","/*.\?(.+)"]}},{"not":{"selector_matches":"a[rel~=\"nofollow\"]"}},{"not":{"selector_matches":".no-prefetch, .no-prefetch a"}}]},"eagerness":"conservative"}]} ``` -------------------------------- ### JavaScript for Product Data Handling Source: https://mech-masz.com.pl/piekarnia-start This JavaScript code snippet initializes and manages product data, likely for e-commerce tracking and analytics. It stores information about products, including their IDs, names, categories, and pricing, associated with events like 'add_to_cart'. ```javascript window.pysWooProductData = window.pysWooProductData || []; window.pysWooProductData[ 5261 ] = { "facebook": { "delay": 0, "type": "static", "name": "AddToCart", "pixelIds": ["2762408817146974"], "eventID": "e8d5df75-d168-4c7b-a275-edd5907d63e3", "params": { "content_type": "product", "content_ids": ["5261"], "contents": [{"id": "5261", "quantity": 1}], "content_name": "Piec cukierniczy modu\u0142owy MODULO 2", "category_name": "Piece cukiernicze modu\u0142owe MODULO", "value": "0", "currency": "PLN" }, "e_id": "woo_add_to_cart_on_button_click", "ids": [], "hasTimeWindow": false, "timeWindow": 0, "woo_order": "", "edd_order": "" }, "ga": { "delay": 0, "type": "static", "name": "add_to_cart", "pixelIds": ["2762408817146974"], "eventID": "e8d5df75-d168-4c7b-a275-edd5907d63e3", "trackingIds": ["G-WVQVSXY7YW"], "params": { "content_type": "product", "content_ids": ["5261"], "contents": [{"id": "5261", "quantity": 1}], "content_name": "Piec cukierniczy modu\u0142owy MODULO 2", "category_name": "Piece cukiernicze modu\u0142owe MODULO", "value": "0", "currency": "PLN", "event_category": "ecommerce", "items": [{ "item_id": "5261", "item_name": "Piec cukierniczy modu\u0142owy MODULO 2", "quantity": 1, "price": "0", "item_category": "Piece cukiernicze modu\u0142owe MODULO" }] }, "e_id": "woo_add_to_cart_on_button_click", "ids": [], "hasTimeWindow": false, "timeWindow": 0, "woo_order": "", "edd_order": "" } }; ``` -------------------------------- ### WooCommerce Product Gallery and Options Configuration (JavaScript) Source: https://mech-masz.com.pl/produkt/przesiewacz-do-maki-nierdzewny This JavaScript object, wc_single_product_params, configures options for a single product page in WooCommerce. It includes internationalization strings, gallery settings (like flexslider), and zoom/photoswipe configurations. ```javascript var wc_single_product_params = {"i18n_required_rating_text":"Prosz\u0119 wybra\u0107 ocen\u0119","i18n_rating_options":["1 z 5 gwiazdek","2 z 5 gwiazdek","3 z 5 gwiazdek","4 z 5 gwiazdek","5 z 5 gwiazdek"],"i18n_product_gallery_trigger_text":"Wy\u015bwietl pe\u0142noekranow\u0105 galeri\u0119 obrazk\u00f3w","review_rating_required":"yes","flexslider":{"rtl":false,"animation":"slide","smoothHeight":true,"directionNav":false,"controlNav":"thumbnails","slideshow":false,"animationSpeed":500,"animationLoop":false,"allowOneSlide":false},"zoom_enabled":"","zoom_options":[],"photoswipe_enabled":"1","photoswipe_options":{"shareEl":false,"closeOnScroll":false,"history":false,"hideAnimationDuration":0,"showAnimationDuration":0},"flexslider_enabled":""}; //# sourceURL=wc-single-product-js-extra ``` -------------------------------- ### Initialize WooCommerce Product Tracking Data Source: https://mech-masz.com.pl/oferta/krojenie-i-pakowanie-chleba This JavaScript snippet initializes the global `pysWooProductData` object. It maps product-specific metadata, including IDs, names, and categories, to tracking events for Facebook and Google Analytics. ```javascript window.pysWooProductData = window.pysWooProductData || []; window.pysWooProductData[ 5346 ] = { "facebook": { "name": "AddToCart", "params": { "content_type": "product", "content_ids": ["5346"], "content_name": "Przemysłowa krajalnica z nożem tarczowym ROTEC 2000", "currency": "PLN" } }, "ga": { "name": "add_to_cart", "params": { "items": [{ "item_id": "5346", "item_name": "Przemysłowa krajalnica z nożem tarczowym ROTEC 2000", "price": "0" }] } } }; ``` -------------------------------- ### Initialize WooCommerce Product Tracking Data Source: https://mech-masz.com.pl/piekarnia-start This JavaScript snippet initializes the global 'pysWooProductData' array and populates it with product-specific metadata. It includes event parameters for Facebook Pixel and Google Analytics, such as product IDs, names, categories, and currency, triggered upon user interaction. ```javascript window.pysWooProductData = window.pysWooProductData || []; window.pysWooProductData[ 5354 ] = { "facebook": { "name": "AddToCart", "pixelIds": ["2762408817146974"], "params": { "content_name": "Aparaty załadowcze do pieców piekarskich", "value": "0", "currency": "PLN" } }, "ga": { "name": "add_to_cart", "trackingIds": ["G-WVQVSXY7YW"] } }; window.pysWooProductData[ 5377 ] = { "facebook": { "name": "AddToCart", "pixelIds": ["2762408817146974"], "params": { "content_name": "Małe miesiarki spiralne od 5 do 70 litrów", "value": "0", "currency": "PLN" } }, "ga": { "name": "add_to_cart", "trackingIds": ["G-WVQVSXY7YW"] } }; ``` -------------------------------- ### Initialize PixelYourSite Tracking Configuration Source: https://mech-masz.com.pl/ktory-piec-sprawdzi-sie-w-twojej-piekarni This JavaScript variable initializes the tracking options for the PixelYourSite plugin. It contains static and dynamic event definitions, including pixel IDs and event parameters required for tracking user engagement across the site. ```javascript var pysOptions = { "staticEvents": { "facebook": { "init_event": [{ "delay": 0, "type": "static", "name": "PageView", "pixelIds": ["2762408817146974"], "params": { "page_title": "Który piec do piekarni wybrać? MODULO vs PPCR", "plugin": "PixelYourSite" } }] } }, "dynamicEvents": { "automatic_event_form": { "facebook": { "name": "Form", "pixelIds": ["2762408817146974"] }, "ga": { "name": "Form", "trackingIds": ["G-WVQVSXY7YW"] } } } }; ``` -------------------------------- ### JavaScript Product Add to Cart Event Tracking Source: https://mech-masz.com.pl/piekarnia-start This JavaScript code initializes and populates product data for tracking 'add_to_cart' events. It supports both Facebook Pixel and Google Analytics, including parameters like product ID, name, category, quantity, and value. This snippet is designed to be integrated into e-commerce platforms. ```javascript window.pysWooProductData = window.pysWooProductData || []; window.pysWooProductData[ 5614 ] = { "facebook": { "delay": 0, "type": "static", "name": "AddToCart", "pixelIds": ["2762408817146974"], "eventID": "578cf789-0bde-4a52-8dd3-4ea1de61fa64", "params": { "content_type": "product", "content_ids": ["5614"], "contents": [{"id": "5614", "quantity": 1}], "content_name": "Mobilna komora garownicza 20 blach PROF-1", "category_name": "Komory garownicze i agregaty", "value": "0", "currency": "PLN" }, "e_id": "woo_add_to_cart_on_button_click", "ids": [], "hasTimeWindow": false, "timeWindow": 0, "woo_order": "", "edd_order": "" }, "ga": { "delay": 0, "type": "static", "name": "add_to_cart", "pixelIds": ["2762408817146974"], "eventID": "578cf789-0bde-4a52-8dd3-4ea1de61fa64", "trackingIds": ["G-WVQVSXY7YW"], "params": { "content_type": "product", "content_ids": ["5614"], "contents": [{"id": "5614", "quantity": 1}], "content_name": "Mobilna komora garownicza 20 blach PROF-1", "category_name": "Komory garownicze i agregaty", "value": "0", "currency": "PLN", "event_category": "ecommerce", "items": [{ "item_id": "5614", "item_name": "Mobilna komora garownicza 20 blach PROF-1", "quantity": 1, "price": "0", "item_category": "Komory garownicze i agregaty" }] }, "e_id": "woo_add_to_cart_on_button_click", "ids": [], "hasTimeWindow": false, "timeWindow": 0, "woo_order": "", "edd_order": "" } }; ``` ```javascript window.pysWooProductData = window.pysWooProductData || []; window.pysWooProductData[ 7501 ] = { "facebook": { "delay": 0, "type": "static", "name": "AddToCart", "pixelIds": ["2762408817146974"], "eventID": "39a57156-139b-42a8-a184-24bc8d1f011b", "params": { "content_type": "product", "content_ids": ["7501"], "contents": [{"id": "7501", "quantity": 1}], "content_name": "Miesiarka spiralna z kot\u0142em sta\u0142ym UNIMIX", "category_name": "Miesiarki do ciasta", "value": "0", "currency": "PLN" }, "e_id": "woo_add_to_cart_on_button_click", "ids": [], "hasTimeWindow": false, "timeWindow": 0, "woo_order": "", "edd_order": "" }, "ga": { "delay": 0, "type": "static", "name": "add_to_cart", "pixelIds": ["2762408817146974"], "eventID": "39a57156-139b-42a8-a184-24bc8d1f011b", "trackingIds": ["G-WVQVSXY7YW"], "params": { "content_type": "product", "content_ids": ["7501"], "contents": [{"id": "7501", "quantity": 1}], "content_name": "Miesiarka spiralna z kot\u0142em sta\u0142ym UNIMIX", "category_name": "Miesiarki do ciasta", "value": "0", "currency": "PLN", "event_category": "ecommerce", "items": [{ "item_id": "7501", "item_name": "Miesiarka spiralna z kot\u0142em sta\u0142ym UNIMIX", "quantity": 1, "price": "0", "item_category": "Miesiarki do ciasta" }] }, "e_id": "woo_add_to_cart_on_button_click", "ids": [], "hasTimeWindow": false, "timeWindow": 0, "woo_order": "", "edd_order": "" } }; ``` ```javascript window.pysWooProductData = window.pysWooProductData || []; window.pysWooProductData[ 7501 ] = { "facebook": { "delay": 0, "type": "static", "name": "AddToCart", "pixelIds": ["2762408817146974"], "eventID": "39a57156-139b-42a8-a184-24bc8d1f011b", "params": { "content_type": "product", "content_ids": ["7501"], "contents": [{"id": "7501", "quantity": 1}], "content_name": "Miesiarka spiralna z kot\u0142em sta\u0142ym UNIMIX", "category_name": "Miesiarki do ciasta", "value": "0", "currency": "PLN" }, "e_id": "woo_add_to_cart_on_button_click", "ids": [], "hasTimeWindow": false, "timeWindow": 0, "woo_order": "", "edd_order": "" }, "ga": { "delay": 0, "type": "static", "name": "add_to_cart", "pixelIds": ["2762408817146974"], "eventID": "39a57156-139b-42a8-a184-24bc8d1f011b", "trackingIds": ["G-WVQVSXY7YW"], "params": { "content_type": "product", "content_ids": ["7501"], "contents": [{"id": "7501", "quantity": 1}], "content_name": "Miesiarka spiralna z kot\u0142em sta\u0142ym UNIMIX", "category_name": "Miesiarki do ciasta", "value": "0", "currency": "PLN", "event_category": "ecommerce", "items": [{ "item_id": "7501", "item_name": "Miesiarka spiralna z kot\u0142em sta\u0142ym UNIMIX", "quantity": 1, "price": "0", "item_category": "Miesiarki do ciasta" }] }, "e_id": "woo_add_to_cart_on_button_click", "ids": [], "hasTimeWindow": false, "timeWindow": 0, "woo_order": "", "edd_order": "" } }; ``` -------------------------------- ### Definicje zmiennych CSS dla WordPressa Source: https://mech-masz.com.pl/piekarnia-start Ten kod CSS definiuje zmienne CSS dla różnych elementów i kolorów używanych w motywie WordPress. Obejmuje to kolory bloków, kolory motywu administracyjnego, szerokość obramowania i rozmiary czcionek. Umożliwia łatwą personalizację wyglądu strony. ```css :root{ --wp-block-synced-color:#7a00df; --wp-block-synced-color--rgb:122 , 0 , 223; --wp-bound-block-color:var(--wp-block-synced-color); --wp-editor-canvas-background:#ddd; --wp-admin-theme-color:#007cba; --wp-admin-theme-color--rgb:0 , 124 , 186; --wp-admin-theme-color-darker-10:#006ba1; --wp-admin-theme-color-darker-10--rgb:0 , 107 , 160.5; --wp-admin-theme-color-darker-20:#005a87; --wp-admin-theme-color-darker-20--rgb:0 , 90 , 135; --wp-admin-border-width-focus:2px } @media (min-resolution:192dpi){ :root{ --wp-admin-border-width-focus:1.5px } } .wp-element-button{cursor:pointer} :root .has-very-light-gray-background-color{background-color:#eee} :root .has-very-dark-gray-background-color{background-color:#313131} :root .has-very-light-gray-color{color:#eee} :root .has-very-dark-gray-color{color:#313131} :root .has-vivid-green-cyan-to-vivid-cyan-blue-gradient-background{background:linear-gradient(135deg,#00d084,#0693e3)} :root .has-purple-crush-gradient-background{background:linear-gradient(135deg,#34e2e4,#4721fb 50%,#ab1dfe)} :root .has-hazy-dawn-gradient-gradient-background{background:linear-gradient(135deg,#fafaca8,#dad0ec)} :root .has-subdued-olive-gradient-background{background:linear-gradient(135deg,#fafae1,#67a671)} :root .has-atomic-cream-gradient-background{background:linear-gradient(135deg,#fdd79a,#004a59)} :root .has-nightshade-gradient-background{background:linear-gradient(135deg,#330968,#31cdcf)} :root .has-midnight-gradient-background{background:linear-gradient(135deg,#020381,#2874fc)} :root{ --wp--preset--font-size--normal:16px; --wp--preset--font-size--huge:42px } .has-regular-font-size{font-size:1em} .has-larger-font-size{font-size:2.625em} .has-normal-font-size{font-size:var(--wp--preset--font-size--normal)} .has-huge-font-size{font-size:var(--wp--preset--font-size--huge)} .has-text-align-center{text-align:center} .has-text-align-left{text-align:left} .has-text-align-right{text-align:right} .has-fit-text{white-space:nowrap!important} #end-resizable-editor-section{display:none} .aligncenter{clear:both} .items-justified-left{justify-content:flex-start} .items-justified-center{justify-content:center} .items-justified-right{justify-content:flex-end} .items-justified-space-between{justify-content:space-between} .screen-reader-text{border:0;clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-wrap ``` -------------------------------- ### Initialize E-commerce Tracking Data Source: https://mech-masz.com.pl/ktory-piec-sprawdzi-sie-w-twojej-piekarni Initializes the global product data object for tracking user interactions such as adding products to the cart. This script populates metadata for both Facebook Pixel and Google Analytics. ```javascript window.pysWooProductData = window.pysWooProductData || []; window.pysWooProductData[ 7181 ] = { "facebook": { "delay": 0, "type": "static", "name": "AddToCart", "pixelIds": ["2762408817146974"], "eventID": "0e87cd53-9636-483c-aaa1-a6eae4c48602", "params": { "content_type": "product", "content_ids": ["7181"], "contents": [{"id": "7181", "quantity": 1}], "content_name": "Piec piekarniczy ceramiczno-rurowy 16 m\u00b2", "category_name": "Piece ceramiczno-rurowe", "value": "0", "currency": "PLN" } }, "ga": { "delay": 0, "type": "static", "name": "add_to_cart", "pixelIds": ["2762408817146974"], "eventID": "0e87cd53-9636-483c-aaa1-a6eae4c48602", "trackingIds": ["G-WVQVSXY7YW"], "params": { "content_type": "product", "content_ids": ["7181"], "contents": [{"id": "7181", "quantity": 1}], "content_name": "Piec piekarniczy ceramiczno-rurowy 16 m\u00b2", "category_name": "Piece ceramiczno-rurowe", "value": "0", "currency": "PLN", "event_category": "ecommerce", "items": [{"item_id": "7181", "item_name": "Piec piekarniczy ceramiczno-rurowy 16 m\u00b2", "quantity": 1, "price": "0", "item_category": "Piece ceramiczno-rurowe"}] } } }; ``` -------------------------------- ### Stylizacja obrazów z atrybutem 'sizes' Source: https://mech-masz.com.pl/piekarnia-start Ten kod CSS definiuje właściwość 'contain-intrinsic-size' dla elementów obrazów, które mają atrybut 'sizes' ustawiony na 'auto' lub zaczynający się od 'auto,'. Pomaga to w lepszym zarządzaniu układem strony podczas ładowania obrazów. ```css img:is([sizes=auto i],[sizes^="auto," i]){contain-intrinsic-size:3000px 1500px} ``` -------------------------------- ### WooCommerce Product Tracking Data Initialization Source: https://mech-masz.com.pl/oferta/mlynki-do-bulki-tartej This JavaScript snippet initializes the 'pysWooProductData' object, which stores product metadata for tracking events. It captures details like product IDs, names, categories, and pricing, which are then passed to Facebook Pixel and Google Analytics. ```javascript window.pysWooProductData = window.pysWooProductData || []; window.pysWooProductData[ 5361 ] = { "facebook": { "name": "AddToCart", "params": { "content_ids": ["5361"], "content_name": "Młynki do cukru pudru", "currency": "PLN" } }, "ga": { "name": "add_to_cart", "params": { "items": [{ "item_id": "5361", "item_name": "Młynki do cukru pudru", "price": "0" }] } } }; ``` -------------------------------- ### Configure Resource Prefetching (JavaScript) Source: https://mech-masz.com.pl/produkt/mlynki-do-cukru-pudru This configuration object defines prefetching rules for resources. It aims to optimize loading by speculatively fetching documents, excluding specific paths like admin or upload directories, and avoiding links with 'nofollow' attributes or specific classes. ```javascript {"prefetch":[{"source":"document","where":{"and":[{"href_matches":"/*"},{"not":{"href_matches":["/wp-*.php","/wp-admin/*","/wp-content/uploads/*","/wp-content/*","/wp-content/plugins/*","/wp-content/themes/porto-child/*","/wp-content/themes/porto/*","/*\?(.+)"]}},{"not":{"selector_matches":"a[rel~=\"nofollow\"]"}},{"not":{"selector_matches":".no-prefetch, .no-prefetch a"}}]},"eagerness":"conservative"}]} ``` -------------------------------- ### Critical Image Detection and Beacon Data (JavaScript) Source: https://mech-masz.com.pl/piekarnia-start This JavaScript code snippet is designed to detect critical images on a webpage for performance optimization. It identifies images that are likely to be visible to the user and sends beacon data to a specified URL. Dependencies include the browser's DOM API and potentially a Google PageSpeed module. ```javascript //b||1342177279>>=1)c+=c;return a};q!=p&&null!=q&&g(h,n,{configurable:!0,writable:!0,value:q});var t=this; function u(b,c){var a=b.split("."),d=t;a[0]in d||!d.execScript||d.execScript("var "+a[0]);for(var e;a.length&&(e=a.shift());)a.length||void 0===c?d[e]?d=d[e]:d=d[e]={}:d[e]=c};function v(b){var c=b.length;if(0=c.offsetWidth&&0>=c.offsetHeight)a=!1;else{d=c.getBoundingClientRect();var f=document.body;a=d.top+("pageYOffset"in window?window.pageYOffset:(document.documentElement||f.parentNode||f).scrollTop);d=d.left+("pageXOffset"in window?window.pageXOffset:(document.documentElement||f.parentNode||f).scrollLeft);f=a.toString()+","+d;b.b.hasOwnProperty(f)?a=!1:(b.b[f]=!0,a=a<=b.g.height&&d<=b.g.width)}a&&(b.a.push(e), b.c[e]=!0)}y.prototype.checkImageForCriticality=function(b){b.getBoundingClientRect&&z(this,b)};u("pagespeed.CriticalImages.checkImageForCriticality",function(b){x.checkImageForCriticality(b)});u("pagespeed.CriticalImages.checkCriticalImages",function(){A(x)}); function A(b){b.b={};for(var c=["IMG","INPUT"],a=[],d=0;d=a.length+e.length&&(a+=e)}b.i&&(e="&rd="+encodeURIComponent(JSON.stringify(B())),131072>=a.length+e.length&&(a+=e),c=!0);C=a;if(c){d=b.h;b=b.j;var f;if(window.XMLHttpRequest)f= new XMLHttpRequest;else if(window.ActiveXObject)try{f=new ActiveXObject("Msxml2.XMLHTTP")}catch(r){try{f=new ActiveXObject("Microsoft.XMLHTTP")}catch(D){}}f&&(f.open("POST",d+(-1==d.indexOf("?")?"?":"&")+"url="+encodeURIComponent(b)),f.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),f.send(a))}}} function B(){var b={},c;c=document.getElementsByTagName("IMG");if(!c.length)return{};var a=c[0];if(!("naturalWidth"in a&&"naturalHeight"in a))return{};for(var d=0;a=c[d];++d){var e=a.getAttribute("data-pagespeed-url-hash");e&&(!(e in b)&&0=b[e].o&&a.height>=b[e].m)&&(b[e]={rw:a.width,rh:a.height,ow:a.naturalWidth,oh:a.naturalHeight})}return b}var C="";u("pagespeed.CriticalImages.getBeaconData",function(){return C}); u("pagespeed.CriticalImages.Run",function(b,c,a,d,e,f){var r=new y(b,c,a,e,f);x=r;d&&w(function(){window.setTimeout(function(){A(r)},0)})});})(); pagespeed.CriticalImages.Run('/mod_pagespeed_beacon','https://mech-masz.com.pl/piekarnia-start/','Tt5XTryosv',true,false,'M6OOL3roNm0'); //]]> ``` -------------------------------- ### Initialize Revolution Slider and Prefetching Configuration Source: https://mech-masz.com.pl/oferta/komory-garownicze-i-agregaty Initializes the global RS_MODULES object for slider functionality and defines a JSON-based configuration for browser resource prefetching. This ensures optimized asset loading based on URL patterns and selector exclusions. ```javascript window.RS_MODULES = window.RS_MODULES || {}; window.RS_MODULES.modules = window.RS_MODULES.modules || {}; window.RS_MODULES.waiting = window.RS_MODULES.waiting || []; window.RS_MODULES.defered = true; window.RS_MODULES.moduleWaiting = window.RS_MODULES.moduleWaiting || {}; window.RS_MODULES.type = 'compiled'; {"prefetch":[{"source":"document","where":{"and":[{"href_matches":"/*"},{"not":{"href_matches":["/wp-*.php","/wp-admin/*","/wp-content/uploads/*","/wp-content/*","/wp-content/plugins/*","/wp-content/themes/porto-child/*","/wp-content/themes/porto/*","/*\\?(.+)"]}},{"not":{"selector_matches":"a[rel~=\"nofollow\"]"}},{"not":{"selector_matches":".no-prefetch, .no-prefetch a"}}]},"eagerness":"conservative"}]} ```