=== MarketUp Snowfall ===
Contributors: fotibout
Tags: snow, snowfall, christmas, holiday, music
Requires at least: 5.8
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.5.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Festive snowfall, a Christmas music-box button and Christmas-only content (like a festive hero). Switches itself on and off by date.

== Description ==

MarketUp Snowfall adds gentle falling snow to your site for the holidays, plus an optional button that plays Christmas music. Set the dates once and it switches itself on and off every year.

**Snow**

* Lightweight canvas animation drawn above the page. Clicks, links and forms keep working underneath it.
* Soft dots, crystals, or a mix. Choose the amount (separately for phones), size, speed, wind, colour and opacity.
* Optional soft shadow so white snow is visible on white pages.
* Fewer flakes on phones, pauses in background tabs, and no snow for visitors who ask their device to reduce motion.
* A "stop the snow" button for visitors, as recommended by WCAG 2.2.2 (Pause, Stop, Hide). Their choice is remembered.

**Music**

* A small button plays a music box version of five public-domain carols: Jingle Bells, We Wish You a Merry Christmas, Deck the Halls, Silent Night and Good King Wenceslas.
* The music is generated by the visitor's browser (Web Audio), so there are no audio files to load and nothing to license.
* Play one song, or all of them one after another.
* Or use your own MP3 files from the Media Library, played in order.
* The music plays when the visitor presses the button. Optionally ("Start automatically") it tries to start when the page opens; most browsers block that until the visitor has interacted with the site, and then only the button starts it. Visitors who stop the music are remembered.

**Schedule and caching**

* Runs between two dates every year (default 1 December to 7 January, in the site timezone), or all the time.
* When the season starts or ends, the page cache is cleared automatically for WP Rocket, LiteSpeed Cache, W3 Total Cache, WP Super Cache, SiteGround Optimizer, FlyingPress, Breeze and Nginx Helper.
* The script is kept out of "delay JavaScript", minify/combine and Cloudflare Rocket Loader, so the snow starts straight away.
* Administrators can preview the effect at any time of year by adding `?mksnow_preview=1` to any page address. Visitors do not see the preview.

**Christmas-only content**

* Add the CSS class `snowfall-christmas` to anything that should appear only during the season (for example a Christmas hero banner), and `snowfall-normal` to what should appear the rest of the year.
* Works with Elementor containers, sections, columns and widgets (Advanced → CSS Classes): hidden elements are not sent to the browser, so their images do not load. Other content with these classes is hidden with CSS.
* Follows the same dates as the snow, so the festive content and the snow switch together, and the preview link shows both.
* The Elementor editor always shows both versions, so you can change photos and text any time.

**Where it shows**

* Hidden on WooCommerce cart, checkout and account pages by default.
* Exclude any page or post by ID.

The plugin does not connect to any external service, does not set cookies and does not collect data. It stores two small preferences in the visitor's browser (localStorage): whether they stopped the snow and which song plays next.

== Installation ==

1. Upload the plugin through Plugins → Add New → Upload Plugin, or install it from the plugin directory.
2. Activate it.
3. Go to Settings → MarketUp Snowfall to choose dates, snow style and music.
4. Click "Preview on the site" to see it before the season starts.

== Frequently Asked Questions ==

= Why doesn't the music start automatically? =

Most browsers block sound until the visitor has interacted with the site. By default the music starts when the visitor presses the music button. With "Start automatically" enabled the plugin tries to start it when the page opens; if the browser blocks it, nothing plays and the button still works.

= Can I use any Christmas song as my own MP3? =

Only recordings you have the rights to. Most recordings of carols are copyrighted even when the tune itself is public domain. The built-in songs are generated from public-domain melodies, so they are safe to use.

= The season started but I don't see snow. =

The plugin clears the common page caches automatically. If you use a CDN that caches whole pages (for example Cloudflare with "Cache Everything" or APO), purge it once at the start and end of the season. Developers can hook into `mksnow_purge_cache` to clear any other cache.

= Will it slow my site down? =

The script is about 20 KB, has no dependencies, loads deferred, and is only added to pages during the season. Flakes are pre-drawn once and the animation stops when the tab is not visible.

= How do I show a Christmas hero only during the season? =

Duplicate your hero. On the Christmas copy add the CSS class `snowfall-christmas`, on the normal one `snowfall-normal`. In Elementor this is under Advanced → CSS Classes. Use the preview link in the settings to check it before the season.

= Does it work with page builders and themes? =

Yes. The snow is a separate layer above the page that does not change your theme's markup. The buttons are added by the script with their own styles.

== Screenshots ==

1. Snow falling on a page, with the music and snow buttons in the corner.
2. The settings page.

== Developer hooks ==

* `mksnow_should_load` (filter, bool) – show or hide the effect on the current request.
* `mksnow_config` (filter, array) – change the front-end configuration.
* `mksnow_purge_cache` (action) – runs when the season starts or ends; clear custom caches here.

== Changelog ==

= 1.5.0 =
* Renamed to MarketUp Snowfall; slug and text domain are now marketup-snowfall.
* Translations are no longer bundled; they come from translate.wordpress.org.

= 1.4.0 =
* New option: try to start the music when the page opens (when the browser allows it; otherwise only the music button starts it). Visitors who stop the music are remembered.
* Christmas-only content explained with a step-by-step example on the settings page.

= 1.3.0 =
* Christmas-only content: CSS classes snowfall-christmas and snowfall-normal show or hide any element by season (Elementor elements are removed on the server).

= 1.2.0 =
* Plugin slug and text domain changed to snowfall-marketup for the WordPress.org directory.
* Readme prepared for the plugin directory.

= 1.1.1 =
* Renamed to Snowfall MarketUp.
* Plugin Check fixes.

= 1.1.0 =
* Four more built-in songs and an "all songs in turn" mode.
* Several of your own MP3 files, played in order.

= 1.0.0 =
* First release.

== Upgrade Notice ==

= 1.5.0 =
The plugin folder changed to marketup-snowfall. If you installed an earlier version from a ZIP, deactivate and delete the old copy first. Your settings are kept.

= 1.2.0 =
The plugin folder changed to snowfall-marketup. If you installed an earlier version from a ZIP, deactivate and delete the old copy first. Your settings are kept.
