From 621c58dac50628de4ede2e624679967d4eab80a0 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 4 Mar 2026 13:27:40 -0500 Subject: [PATCH 1/3] Added additional plugin support, patched additional fields previously left uncensored. --- plugins/SFWSwitch/README.md | 1 + plugins/SFWSwitch/additional_plugins.css | 65 ++++++++++++++++++++++++ plugins/SFWSwitch/sfw.css | 22 +++++++- plugins/SFWSwitch/sfwswitch.yml | 5 +- 4 files changed, 89 insertions(+), 4 deletions(-) create mode 100644 plugins/SFWSwitch/additional_plugins.css diff --git a/plugins/SFWSwitch/README.md b/plugins/SFWSwitch/README.md index 874e2f78..67e6c363 100644 --- a/plugins/SFWSwitch/README.md +++ b/plugins/SFWSwitch/README.md @@ -9,6 +9,7 @@ https://discourse.stashapp.cc/t/sfw-switch/4658 - Gray = Blur disabled - Toggling the button blurs cover images and other content. - Hovering over an image temporarily removes the blur. +- Public Additional Plugins support. Add your plugin to the additional_plugins.css file for additional compatibility. ## Screenshots diff --git a/plugins/SFWSwitch/additional_plugins.css b/plugins/SFWSwitch/additional_plugins.css new file mode 100644 index 00000000..6ce5d6fb --- /dev/null +++ b/plugins/SFWSwitch/additional_plugins.css @@ -0,0 +1,65 @@ +/* [Global changes] Blur NSFW images and unblur on mouse over */ + +/*Credit: fl0w#9497 */ + +/* === MORE BLUR === */ + +/* Stash Battle */ +.pwr-scene-image-container, +.pwr-scene-image-container, +.pwr-hover-preview, +.pwr-scene-image-container .pwr-scene-image, + +/* HotOrNot */ +.hon-performer-image, +.hon-scene-image, +.hon-image-image-container, +.hon-image-image, + +/* O Stats */ +.custom-stats-row .stats-element img, +#on-this-day-section [style*="position: relative; height: 400px"] +{ +filter: blur(30px); +} + +/* === LESS BLUR === */ + +/* StashBattle */ +.pwr-scene-info, + +/* HotOrNot */ +.hon-performer-info.hon-scene-info, + +/* O Stats */ +.custom-stats-row .stats-element, +#on-this-day-section [style*="display: flex"][style*="cursor: pointer"] img, +#on-this-day-section [style*="display: flex"][style*="cursor: pointer"] img + div, +#on-this-day-section > div:last-child +{ +filter: blur(2px); +} + +/* StashBattle */ +.pwr-scene-image-container:hover, +.pwr-scene-image-container:hover .pwr-hover-preview, +.pwr-scene-image-container:hover .pwr-scene-image, +.pwr-scene-info:hover, + +/* HotOrNot */ +.hon-performer-image:hover, +.hon-scene-image:hover, +.hon-image-image-container:hover, +.hon-image-image:hover, +.hon-performer-info.hon-scene-info:hover, + +/* O Stats */ +.custom-stats-row .stats-element:hover, +.custom-stats-row .stats-element:hover img, +#on-this-day-section [style*="display: flex"][style*="cursor: pointer"]:hover img, +#on-this-day-section [style*="display: flex"][style*="cursor: pointer"]:hover img + div, +#on-this-day-section > div:last-child:hover, +#on-this-day-section [style*="position: relative; height: 400px"]:hover +{ +filter: blur(0px); +} diff --git a/plugins/SFWSwitch/sfw.css b/plugins/SFWSwitch/sfw.css index a8cc23e3..bf4f0a8c 100644 --- a/plugins/SFWSwitch/sfw.css +++ b/plugins/SFWSwitch/sfw.css @@ -3,6 +3,7 @@ /*Credit: fl0w#9497 */ /* === MORE BLUR === */ + /* scene */ .scene-card-preview, .vjs-poster, @@ -34,11 +35,13 @@ img.performer, /* tag */ .tag-card-image + { filter: blur(30px); } /* === LESS BLUR === */ + /* common */ .card-section-title, @@ -48,6 +51,7 @@ filter: blur(30px); h3.scene-header, .studio-logo, .image-thumbnail, +.TruncatedText.scene-card__description, /* image */ h3.image-header, @@ -57,20 +61,26 @@ h3.image-header, /* gallery */ h3.gallery-header, +.TruncatedText.gallery-card__description, /* studio */ .studio-details .logo, .studio-details > div > h2, +.studio-card__details, +.studio-parent-studios, /* tag */ .logo-container > .logo, -.logo-container > h2 +.logo-container > h2, +.TruncatedText.tag-description, +.tag-parent-tags { filter: blur(2px); } /* === UNBLUR ON HOVER === */ + /* common */ .thumbnail-section:hover *, .card:hover .card-section-title, @@ -87,6 +97,7 @@ div:hover > .scene-header, .scene-card-preview:hover, .scrubber-item:hover, .scene-image:hover, +.TruncatedText.scene-card__description:hover, /* image */ .image-image:hover, @@ -100,6 +111,7 @@ div:hover > .image-header, /* gallery */ div:hover > .gallery-header, table > tbody > tr > td:hover > a > img.w-100, +.TruncatedText.gallery-card__description:hover, /* performer */ img.performer:hover, @@ -107,10 +119,16 @@ img.performer:hover, /* studio */ .studio-details .logo:hover, .studio-details:hover > div > h2, +.studio-card__details:hover, +.studio-parent-studios:hover, + /* tag */ .logo-container > .logo:hover, -.logo-container:hover > h2 +.logo-container:hover > h2, +.TruncatedText.tag-description:hover, +.tag-parent-tags:hover + { filter: blur(0px); } diff --git a/plugins/SFWSwitch/sfwswitch.yml b/plugins/SFWSwitch/sfwswitch.yml index 9c4b7171..f8d576b1 100644 --- a/plugins/SFWSwitch/sfwswitch.yml +++ b/plugins/SFWSwitch/sfwswitch.yml @@ -1,9 +1,10 @@ name: SFW Switch description: Add a button to blur covers and images. -version: 1.3 +version: 1.4 url: https://discourse.stashapp.cc/t/sfw-switch/4658 ui: javascript: - sfw.js css: - - sfw.css \ No newline at end of file + - sfw.css + - additional_plugins.css \ No newline at end of file From 3b11e912df643c63f9dd88ab7b79c903354847ef Mon Sep 17 00:00:00 2001 From: DogmaDragon <103123951+DogmaDragon@users.noreply.github.com> Date: Thu, 5 Mar 2026 14:13:02 +0200 Subject: [PATCH 2/3] Update README Clarified instructions for adding custom selectors to additional_plugins.css. --- plugins/SFWSwitch/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/SFWSwitch/README.md b/plugins/SFWSwitch/README.md index 67e6c363..02cb3507 100644 --- a/plugins/SFWSwitch/README.md +++ b/plugins/SFWSwitch/README.md @@ -9,7 +9,8 @@ https://discourse.stashapp.cc/t/sfw-switch/4658 - Gray = Blur disabled - Toggling the button blurs cover images and other content. - Hovering over an image temporarily removes the blur. -- Public Additional Plugins support. Add your plugin to the additional_plugins.css file for additional compatibility. +- Extends the blurring functionality to some community plugins. + - Custom selectors should should be added to `additional_plugins.css` file. ## Screenshots @@ -18,4 +19,4 @@ https://discourse.stashapp.cc/t/sfw-switch/4658 ## Credit Original plugin by Belleyy [here](https://github.com/Belleyy/CommunityScripts/tree/pluginUI_SFWSwitch/plugins/SFW%20Switch). -The CSS code used is provided by fl0w#9497 [here](https://discourse.stashapp.cc/t/custom-css-snippets/4043#p-8143-blur-nsfw-images-and-unblur-on-mouse-over-41). \ No newline at end of file +The CSS code used is provided by fl0w#9497 [here](https://discourse.stashapp.cc/t/custom-css-snippets/4043#p-8143-blur-nsfw-images-and-unblur-on-mouse-over-41). From 31dda12139c2756ac2fc27fe4fd70420b99936d0 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 7 Mar 2026 08:58:48 -0500 Subject: [PATCH 3/3] SFW Switch now mutes all sound when enabled by default. --- plugins/SFWSwitch/additional_plugins.css | 8 +- plugins/SFWSwitch/sfw.js | 94 ++++++++++++++++++++++-- plugins/SFWSwitch/sfwswitch.yml | 2 +- 3 files changed, 95 insertions(+), 9 deletions(-) diff --git a/plugins/SFWSwitch/additional_plugins.css b/plugins/SFWSwitch/additional_plugins.css index 6ce5d6fb..de8c494f 100644 --- a/plugins/SFWSwitch/additional_plugins.css +++ b/plugins/SFWSwitch/additional_plugins.css @@ -18,7 +18,10 @@ /* O Stats */ .custom-stats-row .stats-element img, -#on-this-day-section [style*="position: relative; height: 400px"] +#on-this-day-section [style*="position: relative; height: 400px"], + +/* Sprite Tab */ +.sprite-cell { filter: blur(30px); } @@ -53,6 +56,9 @@ filter: blur(2px); .hon-image-image:hover, .hon-performer-info.hon-scene-info:hover, +/* Sprite Tab */ +.sprite-cell:hover, + /* O Stats */ .custom-stats-row .stats-element:hover, .custom-stats-row .stats-element:hover img, diff --git a/plugins/SFWSwitch/sfw.js b/plugins/SFWSwitch/sfw.js index 2410ade2..cc2637fa 100644 --- a/plugins/SFWSwitch/sfw.js +++ b/plugins/SFWSwitch/sfw.js @@ -1,3 +1,6 @@ +let sfw_mediaObserver = null; +let sfw_playListener = null; + function sfw_mode() { const stash_css = sfwswitch_findstashcss(); const button = document.getElementById("plugin_sfw"); @@ -6,10 +9,14 @@ function sfw_mode() { const sfwState = localStorage.getItem("sfw_mode") === "true"; - // Apply saved state to the stylesheet stash_css.disabled = !sfwState; - // Update button color + if (sfwState) { + sfw_mute_all_media(); + } else { + sfw_unmute_all_media(); + } + button.style.color = sfwState ? "#5cff00" : "#f5f8fa"; } @@ -45,6 +52,72 @@ function sfwswitch_createbutton() { setTimeout(() => clearInterval(intervalId), 10000); } +function sfw_forceMute(media) { + media.muted = true; + media.defaultMuted = true; + media.volume = 0; +} + +function sfw_mute_all_media() { + + // Mute existing media + document.querySelectorAll("audio, video").forEach(sfw_forceMute); + + // Mute media when it starts playing + if (!sfw_playListener) { + sfw_playListener = function(e) { + if (e.target.tagName === "VIDEO" || e.target.tagName === "AUDIO") { + sfw_forceMute(e.target); + } + }; + + document.addEventListener("play", sfw_playListener, true); + } + + // Watch for new media nodes + if (!sfw_mediaObserver) { + + sfw_mediaObserver = new MutationObserver(mutations => { + mutations.forEach(mutation => { + mutation.addedNodes.forEach(node => { + + if (node.tagName === "VIDEO" || node.tagName === "AUDIO") { + sfw_forceMute(node); + } + + if (node.querySelectorAll) { + node.querySelectorAll("video, audio").forEach(sfw_forceMute); + } + + }); + }); + }); + + sfw_mediaObserver.observe(document.body, { + childList: true, + subtree: true + }); + } +} + +function sfw_unmute_all_media() { + + document.querySelectorAll("audio, video").forEach(media => { + media.muted = false; + media.volume = 1; + }); + + if (sfw_mediaObserver) { + sfw_mediaObserver.disconnect(); + sfw_mediaObserver = null; + } + + if (sfw_playListener) { + document.removeEventListener("play", sfw_playListener, true); + sfw_playListener = null; + } +} + function sfwswitch_switcher() { const stash_css = sfwswitch_findstashcss(); if (!stash_css) { @@ -52,15 +125,22 @@ function sfwswitch_switcher() { return; } - // Toggle stylesheet stash_css.disabled = !stash_css.disabled; - // Save new state to localStorage - localStorage.setItem("sfw_mode", !stash_css.disabled); + const enabled = !stash_css.disabled; + + localStorage.setItem("sfw_mode", enabled); + + if (enabled) { + sfw_mute_all_media(); + } else { + sfw_unmute_all_media(); + } const button = document.getElementById("plugin_sfw"); - button.style.color = stash_css.disabled ? "#f5f8fa" : "#5cff00"; - console.log(`SFW mode ${stash_css.disabled ? "disabled" : "enabled"}`); + button.style.color = enabled ? "#5cff00" : "#f5f8fa"; + + console.log(`SFW mode ${enabled ? "enabled" : "disabled"}`); } function sfwswitch_findstashcss() { diff --git a/plugins/SFWSwitch/sfwswitch.yml b/plugins/SFWSwitch/sfwswitch.yml index f8d576b1..10e94b4d 100644 --- a/plugins/SFWSwitch/sfwswitch.yml +++ b/plugins/SFWSwitch/sfwswitch.yml @@ -1,6 +1,6 @@ name: SFW Switch description: Add a button to blur covers and images. -version: 1.4 +version: 1.5 url: https://discourse.stashapp.cc/t/sfw-switch/4658 ui: javascript: