Skip to content

Instantly share code, notes, and snippets.

View JTorresConsulta's full-sized avatar
💭
....👻

JTorres JTorresConsulta

💭
....👻
View GitHub Profile
@BrendonKoz
BrendonKoz / leaflet-darkmode.md
Last active November 2, 2026 09:00
Automatic Dark Mode for Leaflet.js
// Leaflet JS - note the *className* attribute
// [...]

L.tileLayer('https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png', {
    attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
    className: 'map-tiles'
}).addTo(map);

// [...]
/**
* jQuery.alterClass
*
* For altering classes
*
* @param removals (wildcards are possible)
* [@param] additions
* @return jQuery object
*
* @author Axel Jack Fuchs (Cologne, Germany)
@peteboere
peteboere / jquery.alterclass.js
Created December 24, 2011 12:49
jQuery alterClass plugin: Remove element classes with wildcard matching. Optionally add classes.
/**
* jQuery alterClass plugin
*
* Remove element classes with wildcard matching. Optionally add classes:
* $( '#foo' ).alterClass( 'foo-* bar-*', 'foobar' )
*
* Copyright (c) 2011 Pete Boere (the-echoplex.net)
* Free under terms of the MIT license: http://www.opensource.org/licenses/mit-license.php
*
*/