1/** 2 * Register the Article Categories variation for the Post Terms block. 3 */ 4wp.domReady( () => { 5 6 console.log('Registering block variation'); 7 wp.blocks.registerBlockVariation( 8 'core/post-terms', 9 { 10 name: 'jetpack-portfolio-type', 11 title: 'Project Types', 12 icon: 'category', 13 isDefault: false, 14 attributes: { taxonomy: 'jetpack-portfolio-type' }, 15 }, 16 ); 17 18} );; 19(function ($) { 20 'use strict' 21 22 function generalFunctions() { 23 // Start Marquee 24 $('.marquee').each(function () { 25 var $this = $(this); // Store the current .marquee 26 for(var i = 0; i < 1; i++) { 27 var $cloneOfGroup = $this.find('.marquee__group:first').clone(); // Clone the first .marquee__group 28 // Add aria-hidden to all elements in the clone 29 $cloneOfGroup.find('*').attr('aria-hidden', 'true'); 30 // Append the clone to the current .marquee 31 $this.append($cloneOfGroup); 32 } 33 }); 34 $('.marquee .marquee__group').each(function () { 35 var $this = $(this); // Store the current .marquee__group 36 for(var i = 0; i < 1; i++) { 37 var $cloneOfText = $this.contents().clone().attr('aria-hidden', 'true'); // Clone the text and add aria-hidden 38 // Append the cloned text to the current .marquee__group 39 $this.append($cloneOfText); 40 } 41 }); 42 43 // Filters Panel 44 // Initially hide the filters-panel 45 $(".filters-panel").css({ 46 'right': '-100%', 47 'position': 'fixed' 48 }); 49 // Open the filters-panel 50 $(".product-filter-button").click(function() { 51 $(".filters-panel").animate({ 52 right: '0' 53 }); 54 }); 55 // Close the filters-panel 56 $(".product-filter-close").click(function() { 57 $(".filters-panel").animate({ 58 right: '-100%' 59 }); 60 }); 61 62 // Tiled gallery captions 63 $('.tiled-gallery__gallery a:has(img[data-image-caption])').each(function() { 64 // Extract the caption from the data attribute 65 var caption = $(this).find('img').attr('data-image-caption'); 66 67 // Check if the caption exists and is not empty 68 if (caption && caption.trim() !== '') { 69 // Create a new <div> element to hold the caption text 70 // You can replace <div> with <p> or any other tag as needed 71 var captionEl = $('<div>', { 72 class: 'image-caption', // Add a class for possible styling 73 html: caption // Set the inner HTML to the caption text 74 }); 75 76 // Insert the caption element directly after the <a> tag 77 $(this).after(captionEl); 78 } 79 }); 80 81 // Portfolio list pattern image reveal 82 $('.wp-block-post').hover(function(e) { 83 // Find the hidden image within this list item 84 var $hiddenImage = $(this).find('.wp-block-post-featured-image.hidden'); 85 var offset = 24; // Offset from the cursor 86 var imageWidth = 480; // Define the image width 87 var imageHeight; // Variable to store the image height, to be calculated 88 89 // Show the hidden image and apply initial styling 90 $hiddenImage.css({ 91 'display': 'block', // Show the image 92 'position': 'absolute', 93 'z-index': '99', // Ensure it appears above other content 94 'pointer-events': 'none', // Allows mouse events to pass through it 95 'min-width': imageWidth + 'px', // Set min width to control image size 96 'max-width': imageWidth + 'px', // Set max width to control image size 97 'height': 'auto' // Maintain aspect ratio 98 }); 99 100 // Calculate the image height dynamically after it is displayed 101 imageHeight = $hiddenImage.outerHeight(); 102 103 // Move the image with the cursor 104 $(document).mousemove(function(e) { 105 var xPosition = e.pageX + offset; 106 var yPosition = e.pageY + offset; 107 108 // Adjust the x position if the image goes beyond the right edge of the window 109 if (xPosition + imageWidth > $(window).width()) { 110 xPosition = e.pageX - imageWidth - offset; 111 } 112 113 // Adjust the y position if the image goes beyond the bottom edge of the window 114 if (yPosition + imageHeight > $(window).height()) { 115 yPosition = e.pageY - imageHeight - offset; 116 } 117 118 // Apply the adjusted position 119 $hiddenImage.offset({ 120 top: yPosition, 121 left: xPosition 122 }); 123 }); 124 }, function() { 125 // On hover out, hide the image 126 $(this).find('.wp-block-post-featured-image.hidden').css('display', 'none'); 127 $(document).off('mousemove'); // Remove mousemove event listener to prevent multiple bindings 128 }); 129 } 130 131 /* Mobile Submenu Dropdowns --------------------- */ 132 function subMenuSetup() { 133 $('.wp-block-navigation__responsive-container-open').click(function() { 134 if ($(".wp-block-navigation__container .dropdown-arrow").length === 0) { 135 $(".wp-block-navigation__container .wp-block-navigation-submenu").append("<span class='dropdown-arrow'><i class='fas fa-chevron-down'></i></span>"); 136 } 137 138 var subMenuToggle = $('.wp-block-navigation__container .wp-block-navigation-submenu > .dropdown-arrow').unbind(); 139 subMenuToggle.on('click touchstart', function(e) { 140 e.preventDefault(); 141 142 var submenu = $(this).parent().children('.wp-block-navigation__submenu-container'); 143 if ($(submenu).is(':hidden')) { 144 $(submenu).slideDown(200); 145 } else { 146 $(submenu).slideUp(200); 147 } 148 }); 149 }); 150 151 $('.wp-block-navigation__responsive-container-close').click(function() { 152 $(".wp-block-navigation__container .dropdown-arrow").remove(); 153 }); 154 } 155 156 $(document) 157 .ready(generalFunctions) 158 159 $(window) 160 .on('load', subMenuSetup) 161})(jQuery) 162;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.