Ver código fonte

ref: style ids

Sv443 1 ano atrás
pai
commit
d321a3e44d
2 arquivos alterados com 6 adições e 4 exclusões
  1. 5 3
      src/features/layout.ts
  2. 1 1
      src/index.ts

+ 5 - 3
src/features/layout.ts

@@ -279,7 +279,7 @@ function setVolSliderSize() {
   addGlobalStyle(`\
   addGlobalStyle(`\
 #bytm-vol-slider-cont tp-yt-paper-slider#volume-slider {
 #bytm-vol-slider-cont tp-yt-paper-slider#volume-slider {
   width: ${size}px !important;
   width: ${size}px !important;
-}`);
+}`).id = "bytm-style-vol-slider-size";
 }
 }
 
 
 /** Sets the `step` attribute of the volume slider */
 /** Sets the `step` attribute of the volume slider */
@@ -293,7 +293,8 @@ function setVolSliderStep(sliderElem: HTMLInputElement) {
 export async function addAnchorImprovements() {
 export async function addAnchorImprovements() {
   try {
   try {
     const css = await (await fetchAdvanced(await getResourceUrl("css-anchor_improvements"))).text();
     const css = await (await fetchAdvanced(await getResourceUrl("css-anchor_improvements"))).text();
-    css && addGlobalStyle(css);
+    if(css)
+      addGlobalStyle(css).id = "bytm-style-anchor-improvements";
   }
   }
   catch(err) {
   catch(err) {
     error("Couldn't add anchor improvements CSS due to an error:", err);
     error("Couldn't add anchor improvements CSS due to an error:", err);
@@ -467,7 +468,8 @@ export async function removeShareTrackingParam() {
 export async function fixSpacing() {
 export async function fixSpacing() {
   try {
   try {
     const css = await (await fetchAdvanced(await getResourceUrl("css-fix_spacing"))).text();
     const css = await (await fetchAdvanced(await getResourceUrl("css-fix_spacing"))).text();
-    css && addGlobalStyle(css);
+    if(css)
+      addGlobalStyle(css).id = "bytm-style-fix-spacing";
   }
   }
   catch(err) {
   catch(err) {
     error("Couldn't fix spacing due to an error:", err);
     error("Couldn't fix spacing due to an error:", err);

+ 1 - 1
src/index.ts

@@ -129,7 +129,7 @@ async function init() {
 /** Called when the DOM has finished loading and can be queried and altered by the userscript */
 /** Called when the DOM has finished loading and can be queried and altered by the userscript */
 async function onDomLoad() {
 async function onDomLoad() {
   // post-build these double quotes are replaced by backticks (because if backticks are used here, the bundler converts them to double quotes)
   // post-build these double quotes are replaced by backticks (because if backticks are used here, the bundler converts them to double quotes)
-  addGlobalStyle("#{{GLOBAL_STYLE}}");
+  addGlobalStyle("#{{GLOBAL_STYLE}}").id = "bytm-style-global";
 
 
   initObservers();
   initObservers();
   initOnSelector();
   initOnSelector();