Skip to content

Commit 159f217

Browse files
author
evolite
committed
updated to only not unblur images, not text
1 parent 88ec0af commit 159f217

1 file changed

Lines changed: 20 additions & 24 deletions

File tree

plugins/SFWSwitch/sfw.js

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
let sfw_mediaObserver = null;
22
let sfw_playListener = null;
3-
let sfw_extraListeners = null;
3+
let sfw_extraListeners = null;
44

55
async function getSfwConfig() {
66
try {
@@ -163,32 +163,28 @@ async function sfwswitch_switcher() {
163163
}
164164
}
165165

166-
const SFW_NEVER_UNBLUR_CSS = [
167-
".thumbnail-container img,.detail-header-image,.wall-item-gallery,",
168-
".scene-player-container,.scene-cover,.scene-card-preview,.scrubber-item,",
169-
".scene-image,.scene-card img,.wall-item-media,.wall-item.show-title,",
170-
".image-card img,.image-thumbnail,.Lightbox-carousel,.image-image,",
171-
".react-photo-gallery--gallery img,.group-card-image,.gallery-image,",
172-
".gallery-card-image,.gallery-card img,.gallery-cover img,",
173-
".GalleryWallCard.GalleryWallCard-portrait,.GalleryWallCard.GalleryWallCard-landscape,",
174-
".performer-card img,.studio-card-image,.studio-card img,.tag-card img",
175-
"{filter:blur(30px)!important}",
176-
".card-section-title,.detail-item-value,.TruncatedText,.scene-studio-overlay,",
177-
".scene-header>h3,h3.scene-header,.queue-scene-details,.marker-wall,",
178-
".performer-name,.card-section,.name-data,.aliases-data,.gallery-header.no-studio,",
179-
".studio-name,.studio-overlay a,.studio-logo,.studio-parent-studios,",
180-
".group-details>div>h2,h3.image-header,.TruncatedText.image-card__description,",
181-
".TruncatedText.tag-description,.tag-item.tag-link.badge.badge-secondary,.tag-name",
182-
"{filter:blur(2px)!important}",
183-
].join("");
184-
185166
function sfw_apply_never_unblur(enabled) {
186167
const existing = document.getElementById("sfw-never-unblur");
187168
if (enabled && !existing) {
188-
const style = document.createElement("style");
189-
style.id = "sfw-never-unblur";
190-
style.textContent = SFW_NEVER_UNBLUR_CSS;
191-
document.head.appendChild(style);
169+
let css = "";
170+
for (let s = 0; s < document.styleSheets.length; s++) {
171+
const sheet = document.styleSheets[s];
172+
try {
173+
if (!sheet.href || !sheet.href.includes("/plugin/sfwswitch/css")) continue;
174+
for (let i = 0; i < sheet.cssRules.length; i++) {
175+
const rule = sheet.cssRules[i];
176+
if (rule instanceof CSSStyleRule && !rule.selectorText.includes(":hover")) {
177+
css += `${rule.selectorText}{filter:${rule.style.filter}!important}`;
178+
}
179+
}
180+
} catch (e) {}
181+
}
182+
if (css) {
183+
const style = document.createElement("style");
184+
style.id = "sfw-never-unblur";
185+
style.textContent = css;
186+
document.head.appendChild(style);
187+
}
192188
} else if (!enabled && existing) {
193189
existing.remove();
194190
}

0 commit comments

Comments
 (0)