YouTube Iframe API code

const netflixLogo=’ttttttt‘,shudderLogo=’tttt‘,muteButton=document.getElementById(“trailerMute”),nextTrailerButton=document.querySelector(“.elementor-swiper-button-next”);let player,playButtons=document.querySelectorAll(“.trailerSelect”),playKey=0;playButtons.length>0&&playButtons[0].classList.add(“active”);let startGetvideoId=playButtons[0].querySelector(“.youtubeVideoCode span”),startVideoId=startGetvideoId.innerHTML;function onYouTubeIframeAPIReady(){player=new YT.Player(“trailerVideo”,{videoId:startVideoId,host:”https://www.youtube-nocookie.com”,playerVars:{origin:window.location.host,controls:”0″,mute:”1″,autoplay:”1″,loop:”1″,playlist:startVideoId,rel:0,showinfo:0,ecver:2},events:{onReady:onPlayerReady,onStateChange:onPlayerStateChange,onError:onPlayerError}})}function onPlayerReady(c){console.log(“hey Im ready”),updateTrailer(playKey),setTimeout(document.getElementById(“trailerButton”).classList.remove(“hiddenForLoad”),3e3),setTimeout(document.getElementById(“trailerContainer”).classList.remove(“hiddenForLoad”),3e3),setTimeout(document.getElementById(“trailerLogoImg”).classList.remove(“hiddenForLoad”),3e3),setTimeout(document.getElementById(“trailerCatText”).classList.remove(“hiddenForLoad”),3e3),setTimeout(document.getElementById(“trailerSummaryText”).classList.remove(“hiddenForLoad”),3e3),setTimeout(document.getElementById(“rtLink”).classList.remove(“hiddenForLoad”),3e3)}function onPlayerStateChange(c){c.data===YT.PlayerState.ENDED&&(console.log(“trailer just ended”),playKey+1==playButtons.length?(playKey=0,console.log(“the first trailer is playing again”)):(playKey++,console.log(“the next trailer is playing”)),updateTrailer(playKey),updateTrailerSelect(playKey))}function onPlayerError(){location.reload()}function updateTrailerSelect(c){playButtons.forEach((c=>{c.classList.remove(“active”)})),playButtons[c].classList.add(“active”)}function updateTrailer(c){let l=playButtons[c].querySelector(“.youtubeVideoCode span”).innerHTML,e=playButtons[c].querySelector(“.youtubeVideoSummary span”).innerHTML,t=playButtons[c].querySelector(“.youtubeVideoLogo img”).src,o=playButtons[c].querySelector(“.youtubeVideoCategory span”).innerHTML,r=playButtons[c].querySelector(“.youtubeVideoStreamLink a”).getAttribute(“href”),a=playButtons[c].querySelector(“.youtubeStreamLogo span”).innerHTML,h=playButtons[c].querySelector(“.youtubeVideoReviewLink a”).getAttribute(“href”),n=document.querySelector(“#trailerLogoImg img”),i=document.querySelector(“#trailerSummaryText p”),v=document.querySelector(“#trailerCatText p”),s=document.querySelector(“#trailerButton a”),u=document.querySelector(“#trailerButton .elementor-button-icon “),d=document.querySelector(“#rtLink a”);switch(n.src=t,n.srcset=t+”…Continue reading

dynamic sku display on variable products ( Mihai )

jQuery(document).ready(function($) { // Listen for clicks on the variation items $(‘.variable-items-wrapper’).on(‘click’, ‘li’, function() { // Get the data-value attribute of the selected item var selectedValue = $(this).data(‘value’); // Check if the skuData object is defined and contains the selected SKU…Continue reading

SaleIQ chat bug fix (Mihai)

(function() { let originalTitle = document.title; Object.defineProperty(document, ‘title’, { get: function() { // Remove ‘>’ from the title when accessed return originalTitle.replace(/>/g, ”); } }); })();Continue reading

Silent Print Javascript Lib ( Mihai )

// following function is copy/paste from here: https://github.com/imTigger/webapp-hardware-bridge/blob/master/demo/websocket-printer.js function WebSocketPrinter(options) { let urlSilentPrintServer; if (LOCAL_SILENT_PRINT_SERVER) { urlSilentPrintServer = “wss://127.0.0.1:12212/printer”; } else { urlSilentPrintServer = “wss://192.168.1.46:12212/printer”; } var defaults = { url: urlSilentPrintServer, onConnect: function () { console.log(‘PrintingRouter connected to ‘+urlSilentPrintServer);…Continue reading

Divi Blurb Accessibility Fix (Single Link, ARIA Labels)

(function ($) { $(document).ready(function () { const processBlurbs = () => { const $blurbs = $(“.et_pb_blurb.et_clickable”); const total = $blurbs.length; // Add role=”list” to container row $(“.dle-services-12-row”).attr(“role”, “list”); $blurbs.each(function (index) { const $blurb = $(this); const $h3 = $blurb.find(“h3”).first(); //…Continue reading

Woocommecre Category Fix

jQuery(document).ready(function( $ ){ var checkCategory = jQuery(“body.archive.tax-product_cat .product-category”); if(checkCategory.length > 0){ jQuery(“body”).addClass(“only-products-cat”); } });Continue reading