Browse Source

version 1.2.1

changed it to add a class to the document root element
instead of a style tag to the head
some sites like youtube would remove the style tag or csp could block it
master
Rei 1 year ago
parent
commit
0354d802fa
4 changed files with 11 additions and 9 deletions
  1. 1
    0
      createXPI.sh
  2. 5
    0
      main.css
  3. 3
    8
      main.js
  4. 2
    1
      manifest.json

+ 1
- 0
createXPI.sh View File

@@ -3,6 +3,7 @@
3 3
 zip -r -FS ../my-extension.xpi \
4 4
     icons/logo-*.png \
5 5
     main.js \
6
+    main.css \
6 7
     manifest.json \
7 8
     settings.html \
8 9
     settings.js \

+ 5
- 0
main.css View File

@@ -0,0 +1,5 @@
1
+.no-caps-addon-activated,
2
+.no-caps-addon-activated * {
3
+  text-transform: lowercase !important;
4
+  font-variant: inherit !important;
5
+}

+ 3
- 8
main.js View File

@@ -1,3 +1,5 @@
1
+const classname = "no-caps-addon-activated";
2
+
1 3
 function onError(error) {
2 4
   console.log(`Error: ${error}`);
3 5
 }
@@ -16,14 +18,7 @@ function initialize(item) {
16 18
     }
17 19
   }
18 20
 
19
-  // Create a new style element
20
-  let css = document.createElement("style");
21
-  css.type = "text/css";
22
-  // Add our CSS
23
-  css.innerHTML = `* {
24
-    text-transform: lowercase !important;
25
-  }`;
26
-  document.head.appendChild(css);
21
+  document.documentElement.classList.add(classname);
27 22
 
28 23
   // Set the title to lowercase
29 24
   document.title = document.title.toLowerCase();

+ 2
- 1
manifest.json View File

@@ -1,7 +1,7 @@
1 1
 {
2 2
   "manifest_version": 2,
3 3
   "name": "no-caps",
4
-  "version": "1.2",
4
+  "version": "1.2.1",
5 5
 
6 6
   "icons": {
7 7
     "48": "icons/logo-48.png",
@@ -15,6 +15,7 @@
15 15
     {
16 16
       "matches": ["<all_urls>"],
17 17
       "js": ["main.js"],
18
+      "css": ["main.css"],
18 19
       "run_at": "document_start"
19 20
     }
20 21
   ],

Loading…
Cancel
Save