From 88ec0afccca3076812725d3f5ee6ceec9d8b1e44 Mon Sep 17 00:00:00 2001 From: evolite Date: Sat, 23 May 2026 08:39:35 +0200 Subject: [PATCH 1/2] feat(SFWSwitch): add Never Unblur on Hover setting Adds a new boolean plugin setting that keeps all blurred content blurred even when hovered. --- plugins/SFWSwitch/sfw.js | 41 +++++++++++++++++++++++++++++---- plugins/SFWSwitch/sfwswitch.yml | 6 ++++- 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/plugins/SFWSwitch/sfw.js b/plugins/SFWSwitch/sfw.js index fc18e571..4565070e 100644 --- a/plugins/SFWSwitch/sfw.js +++ b/plugins/SFWSwitch/sfw.js @@ -17,10 +17,10 @@ async function getSfwConfig() { }); const result = await response.json(); const pluginSettings = result.data.configuration.plugins.sfwswitch; - return pluginSettings?.audio_setting === true; + return { audioMute: pluginSettings?.audio_setting === true, neverUnblur: pluginSettings?.never_unblur === true }; } catch (e) { console.error("SFW Switch: Could not fetch config", e); - return false; + return { audioMute: false, neverUnblur: false }; } } @@ -30,9 +30,10 @@ async function sfw_mode() { if (!stash_css) return; const rawState = localStorage.getItem("sfw_mode"); const sfwState = rawState === "true"; - const audioMuteEnabled = await getSfwConfig(); + const { audioMute: audioMuteEnabled, neverUnblur } = await getSfwConfig(); stash_css.disabled = !sfwState; + sfw_apply_never_unblur(sfwState && neverUnblur); if (sfwState && audioMuteEnabled) { sfw_mute_all_media(); @@ -141,7 +142,8 @@ async function sfwswitch_switcher() { localStorage.setItem("sfw_mode", enabled); - const audioMuteEnabled = await getSfwConfig(); + const { audioMute: audioMuteEnabled, neverUnblur } = await getSfwConfig(); + sfw_apply_never_unblur(enabled && neverUnblur); if (enabled && audioMuteEnabled) { sfw_mute_all_media(); @@ -161,6 +163,37 @@ async function sfwswitch_switcher() { } } +const SFW_NEVER_UNBLUR_CSS = [ + ".thumbnail-container img,.detail-header-image,.wall-item-gallery,", + ".scene-player-container,.scene-cover,.scene-card-preview,.scrubber-item,", + ".scene-image,.scene-card img,.wall-item-media,.wall-item.show-title,", + ".image-card img,.image-thumbnail,.Lightbox-carousel,.image-image,", + ".react-photo-gallery--gallery img,.group-card-image,.gallery-image,", + ".gallery-card-image,.gallery-card img,.gallery-cover img,", + ".GalleryWallCard.GalleryWallCard-portrait,.GalleryWallCard.GalleryWallCard-landscape,", + ".performer-card img,.studio-card-image,.studio-card img,.tag-card img", + "{filter:blur(30px)!important}", + ".card-section-title,.detail-item-value,.TruncatedText,.scene-studio-overlay,", + ".scene-header>h3,h3.scene-header,.queue-scene-details,.marker-wall,", + ".performer-name,.card-section,.name-data,.aliases-data,.gallery-header.no-studio,", + ".studio-name,.studio-overlay a,.studio-logo,.studio-parent-studios,", + ".group-details>div>h2,h3.image-header,.TruncatedText.image-card__description,", + ".TruncatedText.tag-description,.tag-item.tag-link.badge.badge-secondary,.tag-name", + "{filter:blur(2px)!important}", +].join(""); + +function sfw_apply_never_unblur(enabled) { + const existing = document.getElementById("sfw-never-unblur"); + if (enabled && !existing) { + const style = document.createElement("style"); + style.id = "sfw-never-unblur"; + style.textContent = SFW_NEVER_UNBLUR_CSS; + document.head.appendChild(style); + } else if (!enabled && existing) { + existing.remove(); + } +} + function sfwswitch_findstashcss() { for (let i = 0; i < document.styleSheets.length; i++) { const sheet = document.styleSheets[i]; diff --git a/plugins/SFWSwitch/sfwswitch.yml b/plugins/SFWSwitch/sfwswitch.yml index 59b8dc61..7cce20c8 100644 --- a/plugins/SFWSwitch/sfwswitch.yml +++ b/plugins/SFWSwitch/sfwswitch.yml @@ -12,4 +12,8 @@ settings: audio_setting: displayName: Enable Sound Mute description: By default the plugin does not mute sound. Enabling this feature will have sound sources included when the SFW button is enabled. - type: BOOLEAN \ No newline at end of file + type: BOOLEAN + never_unblur: + displayName: Never Unblur on Hover + description: Keep images blurred even when hovered. + type: BOOLEAN From 159f2171c02304d577ef37b687d79507e7dc5603 Mon Sep 17 00:00:00 2001 From: evolite Date: Sat, 23 May 2026 08:54:18 +0200 Subject: [PATCH 2/2] updated to only not unblur images, not text --- plugins/SFWSwitch/sfw.js | 44 ++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/plugins/SFWSwitch/sfw.js b/plugins/SFWSwitch/sfw.js index 4565070e..e7332b84 100644 --- a/plugins/SFWSwitch/sfw.js +++ b/plugins/SFWSwitch/sfw.js @@ -1,6 +1,6 @@ let sfw_mediaObserver = null; let sfw_playListener = null; -let sfw_extraListeners = null; +let sfw_extraListeners = null; async function getSfwConfig() { try { @@ -163,32 +163,28 @@ async function sfwswitch_switcher() { } } -const SFW_NEVER_UNBLUR_CSS = [ - ".thumbnail-container img,.detail-header-image,.wall-item-gallery,", - ".scene-player-container,.scene-cover,.scene-card-preview,.scrubber-item,", - ".scene-image,.scene-card img,.wall-item-media,.wall-item.show-title,", - ".image-card img,.image-thumbnail,.Lightbox-carousel,.image-image,", - ".react-photo-gallery--gallery img,.group-card-image,.gallery-image,", - ".gallery-card-image,.gallery-card img,.gallery-cover img,", - ".GalleryWallCard.GalleryWallCard-portrait,.GalleryWallCard.GalleryWallCard-landscape,", - ".performer-card img,.studio-card-image,.studio-card img,.tag-card img", - "{filter:blur(30px)!important}", - ".card-section-title,.detail-item-value,.TruncatedText,.scene-studio-overlay,", - ".scene-header>h3,h3.scene-header,.queue-scene-details,.marker-wall,", - ".performer-name,.card-section,.name-data,.aliases-data,.gallery-header.no-studio,", - ".studio-name,.studio-overlay a,.studio-logo,.studio-parent-studios,", - ".group-details>div>h2,h3.image-header,.TruncatedText.image-card__description,", - ".TruncatedText.tag-description,.tag-item.tag-link.badge.badge-secondary,.tag-name", - "{filter:blur(2px)!important}", -].join(""); - function sfw_apply_never_unblur(enabled) { const existing = document.getElementById("sfw-never-unblur"); if (enabled && !existing) { - const style = document.createElement("style"); - style.id = "sfw-never-unblur"; - style.textContent = SFW_NEVER_UNBLUR_CSS; - document.head.appendChild(style); + let css = ""; + for (let s = 0; s < document.styleSheets.length; s++) { + const sheet = document.styleSheets[s]; + try { + if (!sheet.href || !sheet.href.includes("/plugin/sfwswitch/css")) continue; + for (let i = 0; i < sheet.cssRules.length; i++) { + const rule = sheet.cssRules[i]; + if (rule instanceof CSSStyleRule && !rule.selectorText.includes(":hover")) { + css += `${rule.selectorText}{filter:${rule.style.filter}!important}`; + } + } + } catch (e) {} + } + if (css) { + const style = document.createElement("style"); + style.id = "sfw-never-unblur"; + style.textContent = css; + document.head.appendChild(style); + } } else if (!enabled && existing) { existing.remove(); }