Browse Source

facet hide

master
rdrew 2 months ago
parent
commit
50d0ea25fa
  1. 4
      js/mobile_facets.js

4
js/mobile_facets.js

@ -1,6 +1,5 @@
(function (Drupal) { // Select the parent container (function (Drupal) { // Select the parent container
const sidebar = document.querySelector('.region--sidebar'); // Check if the element exists const sidebar = document.querySelector('.region--sidebar'); // Check if the element exists
const buttonText = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Free v7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M480 272C480 317.9 465.1 360.3 440 394.7L566.6 521.4C579.1 533.9 579.1 554.2 566.6 566.7C554.1 579.2 533.8 579.2 521.3 566.7L394.7 440C360.3 465.1 317.9 480 272 480C157.1 480 64 386.9 64 272C64 157.1 157.1 64 272 64C386.9 64 480 157.1 480 272zM272 416C351.5 416 416 351.5 416 272C416 192.5 351.5 128 272 128C192.5 128 128 192.5 128 272C128 351.5 192.5 416 272 416z"/></svg> Search the Collection'
if (sidebar) { if (sidebar) {
// Get all direct children // Get all direct children
const children = Array.from(sidebar.children);// Create the wrapper div const children = Array.from(sidebar.children);// Create the wrapper div
@ -23,8 +22,7 @@
// Create the button element // Create the button element
const button = document.createElement('button'); const button = document.createElement('button');
button.id = 'toggle-facets'; button.id = 'toggle-facets';
//button.textContent = 'Search the Collection'; button.textContent = 'Search the Collection';
button.innerHtml = buttonText;
// Insert the button before the wrapper // Insert the button before the wrapper
sidebar.insertBefore(button, wrapper); sidebar.insertBefore(button, wrapper);

Loading…
Cancel
Save