How to disable dark mode in TailwindCSS 4

TailwindCSS recently released a major updated to version 4. One of the main changes is that it no longer uses a tailwind.config.js file, and instead all the configuration is managed through a single CSS file: TailwindCSS upgrade guide. Most of the time, the new configuration method is pretty straight forward. However, there’s something I’ve been unable to do so far.

I usually want to completely disable dark mode. For this reason, I used to do this in the past in my configuration file:

module.exports = {
  darkMode: false, // Disable dark mode
  theme: {
    extend: {},
  },
  plugins: [],
}

These would completely ignore any dark: classes when compiling. According to the official documentation, dark mode now works using the CSS prefers-color-scheme media feature but there’s no specific guidance in how to disable it.

I did find a sample to override the default functionality using this line in the new CSS configuration file: @custom-variant dark (&:where(.dark, .dark *));. Then, if I don’t add the class dark up in the DOM tree, dark mode disabled but this feels like a clunky solution. When compiling the CSS file, all classes and styles for dark mode are still there, whereas my previous solution with the JavaScript configuration file omitted those.

What’s the proper way to set up the new CSS configuration file to completely disable dark mode? I know that the logical solution would be to just remove any dark: classes, but I choose to work like this because I use some third part components and plugins that always force dark mode based on system preferences. Hence, my main website has no dark mode but the specific components do render in dark mode making it less visually pleasing. I appreciate any guidance.

Tailwind CSS’ official playground could be used for testing. I’ve trying to use the following code for something simple:

<div class="bg-red-400 dark:bg-green-400 h-screen w-screen">
</div>

It’s possible to review the generated CSS in the bottom left tab. Any code like this shouldn’t be compiled with the appropriate configuration file:

.dark:bg-green-400 {
  @media (prefers-color-scheme: dark) {
    background-color: var(--color-green-400);
  }
}

Google sheets Apps Script Main Sheet formula

Formulae’s I have tried to make a Main Sheet in a google sheets workbook are not working. I want a main sheet which adds the data of all the other sheets onto one sheet. I want to include the AddColumns function I have on the sheets to work on the Main sheet as well.

Is it safe / secure to render raw HTML from `history.state` or `sessionStorage`?

I’m making a fetch request for additional HTML content and rendering it on the page.

I need to store this HTML client-side so that on back / forward navigation, the page appears as the user left it – that is, with the additional content.

In this particular case, the standard bfcache does not work.

My solution is to utilize history.state or sessionStorage to store the additional HTML content and render it on back / forward navigation using innerHTML or similar.

My understanding is that sessionStorage and history.pushState / history.replaceState are same origin APIs, and therefore my solution is as secure as the website itself – that is, I can trust the HTML passed to innerHTML.

However, I’m not a web security expert, and don’t know whether this is correct.

“Panel” is not exported by @base-ui-components/react/tabs

I am new to React. I have started to work in an existing project! Therefore have more challenges to fix the existing deprecations.

Since https://www.npmjs.com/package/@mui/base is deprecated. I tried to change it to @base-ui-components/react as recommended by npmjs.
However, there are few components that I am unable to import.

  1. import { TabPanel as MuiTabPanel } from ‘@mui/base/TabPanel’;
  2. import { TabsList as MuiTabsList } from ‘@mui/base/TabsList’;

I am using Tabs, Tab, TabPanel & TabsList from @mui/base. I am trying to add these now via @base-ui-components/react/tabs

When I looked into node_modules/@base-ui-components/react/tabs, I see that these modules are available. However, they are not public! I think so!

Can someone help me how to import these modules in my project?

How to send Conversation to Form Submitter?

I am trying to get my custom form to add submitted data to a Google Sheet as well as send a confirmation to the submitter and a notification to myself.

I’ve got it working so that it adds the data to the sheet and I am using FormSubmit.co to get notified of the submissions myself, but the submitter doesn’t get a confirmation. I understand FormSubmit has the ability to do so but I have _CAPTCHA disabled for my form because that type of verification is very inaccessible and my users are disabled visually impaired or blind people. So because I have that security disabled, I cannot use their service to send a confirmation back to the submitter.

Below is the Google App Script connect to the Google Sheet where the data is collected.

function doPost(e) {
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Services");
  var data = e.parameter;

  var emailAddress = data["Email Address"];
  var subject = "Confirmation: Your Request has been Received";
  var message = "Hello " + firstName + ",nnThank you for submitting a service request. We have received your request and will get back to you shortly.nnBest regards,niAccessAbility";
  
  // Send confirmation email to the user
  if (emailAddress) {
    try {
      MailApp.sendEmail(emailAddress, subject, message);
      Logger.log("Email sent to: " + emailAddress);
    } catch (error) {
      Logger.log("Email sending error: " + error.message);
    }
  } else {
    Logger.log("No email address provided.");
  }

  // Append form data to submissions sheet
  sheet.appendRow([data.Date, data["First Name"], data["Last Name"], data["Phone Number"], data["Email Address"], data.Communication, data.Service]);
  // Return success message
  return ContentService.createTextOutput("Success").setMimeType(ContentService.MimeType.TEXT);
}

Below is the HTML custom form page

<!DOCTYPE html>
<html lang="en-US">
    <head>
        <meta charset="UTF-8">
        <meta name="author" content="Leah Dykema">
        <meta name="description" content="Learn, receive help, and connect with iAccessAbility">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta property="og:image" name="image" content="img/favicon.png">
        <meta property="og:title" content="iAccessAbility Services">
        <meta property="og:description" content="Learn, connect, and receive help with your Apple products from iAccessAbility services.">
        <link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico">
        <link rel="apple-touch-icon" type="image/x-icon" href="img/favicon.png">
        <title>iAccessAbility</title>
        <link rel="stylesheet" href="stylesheets/style.css">
        <link rel="stylesheet" href="stylesheets/main.css">
        <link rel="stylesheet" href="navbar/navbar.css">
    </head>
    <body>
        <!-- Menu Nav Bar -->
        <div data-role="header" data-position="fixed" class="nav-container">
            <nav>
                <!-- Desktop Menu -->
                <ul class="desktop-nav">
                    <!-- logo -->
                    <li><a href="index.html" class="link-logo"><img src="img/logo-colored.svg" class="link-logo" alt="I access ability"></a></li>
                    <!-- Support -->
                    <li><a href="html/support.html">Support</a></li>
                    <!-- Connect -->
                    <li><a href="html/connect.html">Connect</a></li>
                    <!-- About -->
                    <li><a href="html/about.html">About</a></li>
                </ul>
            </nav>
        </div>
        <!-- Home Page -->
        <div class="site">
            <!-- Channel Banner -->
            <div>
                <img src="img/YT-banner-desktop.svg" alt="Beyond Sight, independence with technology" class="desktop">
                <img src="img/YT-banner-mobile.svg" alt="Beyond Sight, independence with technology" class="mobile">
            </div>
            <div>
                <!-- Get to know the Site -->
                <section>
                    <h2>Get to Know the Site&#33;</h2>
                    <p>Checkout some of the iAccessAbility&#39;s other pages&#58;</p>
                    <p><b>News and Events</b>
                    <br>
                    Stay up to date with what iAccessAbility is doing&#33; <a class="links" href="html/news.html">Events and News Updates &gt;</a></p>
                    <p><b>Recommendations</b>
                    <br>
                    Get links to apps&#44; services &#44; and products I use&#58; <a class="links" href="html/recommendations.html">Recommendations &#45; iAccessAbility &gt;</a></p>
                    <p><b>Behind the Vision</b>
                    <br>
                    Get to know Leah Dykema&#44; the owner behind iAccessAbility&#58; <a class="links" href="html/about.html">About Leah Dykema &gt;</a></p>
                </section>
                <!-- Frequently Asked Questions -->
                <section>
                    <h2>Frequently Asked Questions</h2>
                    <p>
                        <b>What services do you provide&#63;</b>
                        <br>
                        iAccessAbility offers tech support&#44; one-on-one training&#44; and a personalized consultant service keeping in mind your budget and needs&#46;
                        <a href="html/service.html">Learn more &gt;</a>
                    </p>
                    <p>
                        <b>When are you open?</b>
                        <br>
                        You can contact us at any time and I will get back to you as soon as we can&#59; however&#44; calls are accepted and returned between 10&#58;00 AM and 6&#58;00 PM on weekdays and Saturdays&#46;
                    </p>
                    <p>
                        <b>How much do you charge for services&#63;</b>
                        <br>
                        At this time, iAccessAbility services are free since I am a student still learning; however, a set fee will be eventually calculated and posted on the services page&#46;
                    </p>
                </section>
            </div>
        </div>
    </body>
</html>

Any help would be appreciated!

Sincerely,

Leah – iAccessAbility

YouTube API – get video transcript

I have this script:

// content.js - Extracts YouTube Transcript and Sends it to an API

async function getTranscript() {
    console.log("getTranscript() function started!"); // Debugging

    const videoId = new URLSearchParams(window.location.search).get("v");
    if (!videoId) {
        console.log("No video ID found.");
        return;
    }

    console.log("Found video ID:", videoId);

    const response = await fetch(`https://www.youtube.com/api/timedtext?lang=en&v=${videoId}`);
    if (!response.ok) {
        console.log("Could not fetch transcript.");
        return;
    }

    const transcriptText = await response.text();
    if (!transcriptText) {
        console.log("No transcript found.");
        return;
    }

    console.log("Transcript extracted successfully:", transcriptText.substring(0, 100), "..."); // Log first 100 chars

    // Store locally
    chrome.storage.local.set({ transcript: transcriptText }, () => {
        console.log("Transcript saved.");
    });

    // Send transcript to the server
    sendTranscriptToServer(transcriptText);
}

// Run on page load
window.onload = getTranscript;


async function sendTranscriptToServer(transcript) {
    console.log("sendTranscriptToServer() called!"); // Check if function runs

    const endpoint = "http://139.169.160.58:8081/api/transcript";
    try {
        console.log("Sending transcript to server:", transcript); // Log transcript data

        const response = await fetch(endpoint, {
            method: "POST",
            headers: {
                "Content-Type": "application/json"
            },
            body: JSON.stringify({ text: transcript })
        });

        console.log("Request sent, waiting for response...");

        if (response.ok) {
            const responseData = await response.text();
            console.log("Server Response:", responseData);
            alert("Server Response: " + responseData);
        } else {
            console.error("Failed to send transcript.", response.statusText);
        }
    } catch (error) {
        console.error("Error sending transcript:", error);
    }
}


// Run the script when the video page loads
window.onload = getTranscript;

I see this messages , but I don’t receive any call in the server and no errors in the console

enter image description here

Custom TinyMCE Buttons Not Showing in Publii Editor

I’m developing a custom Publii theme and trying to add three custom buttons (Margin Note, Sidenote, and Epigraph) to the TinyMCE editor toolbar. However, while the script logs indicate the buttons are added successfully, they do not appear in the editor UI.

What I’ve Done So Far:

  1. Created a custom TinyMCE script (tinymce.script.js) in the theme root directory:

    (function () {
    console.log(“Custom TinyMCE script loaded.”);

     function addCustomButtons(editor) {
         console.log("Adding custom TinyMCE buttons.");
    
         // Margin Note Button
         editor.ui.registry.addButton('margin_note', {
             text: 'Margin Note',
             icon: 'comment',
             tooltip: 'Insert a margin note',
             onAction: function () {
                 let note = prompt("Enter margin note text:");
                 if (note) {
                     editor.insertContent(`<span class="marginnote">${note}</span>`);
                 }
             }
         });
    
         // Sidenote Button
         editor.ui.registry.addButton('sidenote', {
             text: 'Sidenote',
             icon: 'comment',
             tooltip: 'Insert a sidenote with automatic numbering',
             onAction: function () {
                 let note = prompt("Enter sidenote text:");
                 if (note) {
                     editor.insertContent(`<label for="sn-1" class="margin-toggle sidenote-number"></label><input type="checkbox" id="sn-1" class="margin-toggle"/><span class="sidenote">${note}</span>`);
                 }
             }
         });
    
         // Epigraph Button
         editor.ui.registry.addButton('epigraph', {
             text: 'Epigraph',
             icon: 'quote',
             tooltip: 'Format as an epigraph',
             onAction: function () {
                 let selectedText = editor.selection.getContent();
                 if (selectedText) {
                     editor.insertContent(`<blockquote class="epigraph">${selectedText}</blockquote>`);
                 } else {
                     alert("Please select text for the epigraph.");
                 }
             }
         });
    
         console.log("Buttons added: Margin Note, Sidenote, Epigraph.");
     }
    
     tinymce.init({
         selector: 'textarea',
         toolbar: 'undo redo | bold italic | margin_note sidenote epigraph', // Add custom buttons
         setup: function (editor) {
             editor.on('init', function () {
                 console.log("TinyMCE editor initialized.");
                 addCustomButtons(editor);
             });
         }
     });
    
     console.log("TinyMCE initialization script executed.");
    

    })();

  2. Updated config.json to enable custom TinyMCE configuration:

    “extensions”: {
    “postEditorConfigOverride”: true,
    “postEditorCustomScript”: true
    }

  3. Updated tinymce.override.json to define the toolbar layout:

    {
    “toolbar”: “undo redo | bold italic | margin_note sidenote epigraph”,
    “plugins”: “lists link image table code”
    }

  4. Checked the Console Logs:
    The script executes correctly.
    Logs confirm buttons are added:

Custom TinyMCE script loaded.
TinyMCE initialization script executed.
TinyMCE editor initialized.
Adding custom TinyMCE buttons.
Buttons added: Margin Note, Sidenote, Epigraph.

Even though the logs indicate the buttons are added, they do not appear in the TinyMCE editor UI in Publii.

What I’ve Tried:
Restarted Publii and cleared cache.
Verified the script is loading using console logs.
Checked if editor.ui.registry.getAll().buttons contains margin_note, sidenote, and epigraph.
Manually called addCustomButtons(editor); inside setup().

uestion:
Why are my custom TinyMCE buttons not appearing in the Publii editor?
Am I missing any additional TinyMCE or Publii configuration settings?
Any help or insights would be appreciated!

Infinite carousel gets stuck when scrolling too fast

I’ve been working on this draggable/scrollable infinite carousel for a few hours but I ran into an issue. It seems like whenever my if statements hits within infiniteScroll, and the user scrolls ‘too fast’, the if statement triggers again before carousel.scrollLeft() has updated, causing the carousel.scrollLeft() to be called multiple times.

How could I prevent this from happening?

I’ve been testing in dev tools, but scrolling within the carousel should work while holding shift and scrolling.

const carousel = $('.carousel');
const carouselCards = carousel.children('.card');

let cardAmount = 3; // The amount of cards visible within the carousel

carouselCards.slice(-cardAmount).get().reverse().forEach((e) => {
  let card = $(e);
  carousel.prepend(card.prop('outerHTML')); // Puts the last three cards in front of the first card in reverse order
})

carouselCards.slice(0, cardAmount).get().forEach((e) => {
  let card = $(e);
  carousel.append(card.prop('outerHTML')); // Puts the first three cards after the last card
})

let scrollTriggerStart = carouselCards.outerWidth() + carouselCards.outerWidth() / 2 - carousel.outerWidth() / 2; // The exact scrollLeft value where the second card is in the center of the carousel
let scrollTriggerEnd = carousel[0].scrollWidth - carouselCards.outerWidth() - carouselCards.outerWidth() / 2 - carousel.outerWidth() / 2; // The exact scrollLeft value where the second to last card is in the center of the carousel
let seamlessPosStart = carouselCards.length * carouselCards.outerWidth() - carouselCards.outerWidth() / 2 - carousel.outerWidth() / 2; // The exact scrollLeft value of the corresponding card of the second to last card
let seamlessPosEnd = carousel[0].scrollWidth - carouselCards.length * carouselCards.outerWidth() + carouselCards.outerWidth() / 2 - carousel.outerWidth() / 2; // The exact scrollLeft value of the corresponding card of the second card

infiniteScroll = () => {
  if (carousel.scrollLeft() <= scrollTriggerStart) {
    // This gets triggered multiple times
    carousel.addClass('no-transition');
    carousel.scrollLeft(seamlessPosEnd);
    carousel.removeClass('no-transition');
  } else if (carousel.scrollLeft() >= scrollTriggerEnd) {
    carousel.addClass('no-transition');
    carousel.scrollLeft(seamlessPosStart);
    carousel.removeClass('no-transition');
  }
}

carousel.on('scroll', infiniteScroll);
*,
::before,
::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

* {
  font: inherit;
}

html,
body {
  min-height: 100vh;
}

ul:has([class]) {
  list-style: none;
}

body {
  font-family: sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5em;
  width: 100%;
  padding-inline: 10em;
}

.carousel {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc(100% / 2);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  border-radius: .5em;
  scroll-behavior: smooth;
  scrollbar-width: none;
  width: 100%;
}

.carousel::-webkit-scrollbar {
  display: none;
}

.carousel .card {
  aspect-ratio: 1;
  scroll-snap-align: center;
  background: rgba(255, 0, 0, 0.25);
  border-radius: .5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  scale: 0.95;
  border: 2px solid transparent;
  transition: 250ms ease;
}

.card.selected {
  border: 2px solid red;
  scale: 1;
}

.no-transition {
  scroll-behavior: auto;
}

.no-transition .card {
  scroll-snap-align: unset;
}

/* .slider-interactive {
    display: flex;
    gap: 4em;
}

.slider-interactive > * {
    background: rgba(255,0,0,0.25);
    aspect-ratio: 1;
    border-radius: 50%;
    cursor: pointer;
    transition: 250ms ease;
    width: 1.5rem;
}

.slider-interactive > *.selected {
    background: red;
} */
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" href="style.css">
  <title>Infinite carousel</title>
</head>

<body>
  <div class="wrapper">
    <ul class="carousel">
      <li class="card">
        <h2>Card 1</h2>
      </li>
      <li class="card">
        <h2>Card 2</h2>
      </li>
      <li class="card">
        <h2>Card 3</h2>
      </li>
      <li class="card">
        <h2>Card 4</h2>
      </li>
      <li class="card">
        <h2>Card 5</h2>
      </li>
    </ul>
  </div>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js" integrity="sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
  <script src="main.js"></script>
</body>

</html>

The end of the files is cut off by web server [closed]

After uploading a js file via ftp in IDE (phpstorm or phped) to a web server (tried different hosting servers with apache) sometimes within a few minutes the file opens through http without last symbols, which causes an error. In a few minutes the file starts to load normally. When viewing the file via ftp client – the file is full. Different servers, different ftp clients, different projects, and the situation is the same. Sometimes apache shows js file without last 5-10 symbols.

JS file size is 150Kb. File ending:

function elsewhere(){}

With error file ending is:

function elsewhere(

Script loading tag: <script type="text/javascript" src="/myscript.js?t=1740843480994"></script>

Adventure game for legend [closed]

gangster,adventure game**

Let’s play a simple text-based adventure game. I’ll be the game master and provide the setting, challenges, and rules.

The Cursed Temple
You are an adventurer seeking fortune and glory in the ancient Cursed Temple. Legend has it that the temple holds treasures beyond your wildest dreams, but it’s also said to be cursed, and many adventurers before you have never returned.

Your Goal
Your goal is to navigate through the temple, collect treasures, and make it out alive.

Game Mechanics

  1. I’ll describe the situation you’re in, and then give you a choice of actions to take.
  2. You’ll tell me the action you’d like to take, and I’ll describe the consequences of that action.
  3. You’ll keep exploring the temple until you’ve collected all the treasures or run out of health.

Let’s Start
You stand in front of the temple entrance, a grand stone structure with intricate carvings depicting strange creatures and mystical symbols. The doors are old and creaky, but they slowly open with a gentle push.

As you step inside, the doors close behind you, and you hear a faint whispering in your ear. “Welcome, adventurer… you’ll never leave.”

You find yourself in a dimly lit chamber with two passageways leading out of the room. The air is musty, and the smell of decay fills your nostrils.

Your Current Status

  • Health: 100
  • Treasures: 0

Choose Your Action
A) Head left through the narrow passageway
B) Head right through the wider passageway
C) Search the chamber for hidden objects or clues
D) Try to open the entrance doors again

What would you like to do?

The end of the files is cut off by web server

After uploading a js file via ftp in IDE (phpstorm or phped) to a web server (tried different hosting servers with apache) sometimes within a few minutes the file opens through http without last symbols, which causes an error. In a few minutes the file starts to load normally. When viewing the file via ftp client – the file is full. Different servers, different ftp clients, different projects, and the situation is the same. Sometimes apache shows js file without last 5-10 symbols.

JS file size is 150Kb. File ending:

function elsewhere(){}

With error file ending is:

function elsewhere(

Script loading tag: <script type="text/javascript" src="/myscript.js?t=1740843480994"></script>

Calling navigator.perrmissions.query from a generator

I am working with Redux Saga to perform actions like setting authorization and permissions once a user has logged in or has resumed a session. However, it appears that calling navigator.permissions.query from within the saga generator function causes an “illegal invocation” error to occur:

function* getUserLocation(){
  const result = yield call(navigator.permissions.query, { name: "geolocation" });
  switch (result.state) {
    // ...
  }
}

From what I’ve found on the web, this appears to be due to the context no longer being what is expected when the generator runs. I’ve considered binding the query function, however I am unsure what to bind it to. Is there possibly a solution to this other than simply calling the query function outside of a generator?

Thanks in advance.

Using htmx HX-Trigger with JSON in body of response

I want my htmx response to trigger an event using the HX-Trigger, but the ‘details’ of the event are too large to put in the response header. Is there a way to access the JSON content of the response in the event handler?

For example, given this (Python, FastHTML) server-side code producing a response:

return Response(
    headers={"HX-Trigger": "replaceGraph"},
    media_type="application/json",
    content=json.dumps(content),
)

I want this client-side code:

document.body.addEventListener('replaceGraph', evt => {
   // Get access to JSON content of the response.
});

How to add an element containing the number of elements for the number of files in the [blog] folder

How to add an < md-list> element below the “Celebrate” button, containing the same number of < md-list-item> elements as the number of files in the ./blog folder, with the title of each < md-list-item> being the file name, and clicking on the file can open the file in a new tab?


The element marked with “Github” is the md-list element

Its code:code

Project Structure:

.
├── blog
│   └── 1.txt
├── index.html

Documentation about this md3 component:md-list