Actualiser custom.js
This commit is contained in:
parent
fa5ff3c4e9
commit
c4f2236b12
1 changed files with 1 additions and 4 deletions
|
@ -2,7 +2,7 @@ const loopIter = 3;
|
||||||
const timeoutStartDuration = 200;
|
const timeoutStartDuration = 200;
|
||||||
|
|
||||||
window.addEventListener("load", () => {
|
window.addEventListener("load", () => {
|
||||||
/* ocamlhljs(); */
|
ocamlhljs();
|
||||||
setTimeout(() => checker(loopIter), timeoutStartDuration);
|
setTimeout(() => checker(loopIter), timeoutStartDuration);
|
||||||
|
|
||||||
// When clicking on a link, we recheck images
|
// When clicking on a link, we recheck images
|
||||||
|
@ -44,12 +44,10 @@ relevance:0},{begin:/->/}]})})();hljs.registerLanguage("ocaml",e)};
|
||||||
|
|
||||||
const svgObsidianFix = () => {
|
const svgObsidianFix = () => {
|
||||||
for (const item of document.getElementsByTagName("img")) {
|
for (const item of document.getElementsByTagName("img")) {
|
||||||
console.log(item);
|
|
||||||
if (!item.src.startsWith("data:image/svg+xml;base64,")) {
|
if (!item.src.startsWith("data:image/svg+xml;base64,")) {
|
||||||
// Exclude image who aren't SVG and base64 encoded
|
// Exclude image who aren't SVG and base64 encoded
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
console.log("aaaa");
|
|
||||||
|
|
||||||
/** Convert to grayscale */
|
/** Convert to grayscale */
|
||||||
const colorToGrayscale = (color) => {
|
const colorToGrayscale = (color) => {
|
||||||
|
@ -93,7 +91,6 @@ const svgObsidianFix = () => {
|
||||||
const totalGrayscale = grayscaleValues.reduce((acc, val) => acc + val, 0);
|
const totalGrayscale = grayscaleValues.reduce((acc, val) => acc + val, 0);
|
||||||
const averageGrayscale = totalGrayscale / grayscaleValues.length;
|
const averageGrayscale = totalGrayscale / grayscaleValues.length;
|
||||||
|
|
||||||
console.log(averageGrayscale);
|
|
||||||
if (averageGrayscale < 128) {
|
if (averageGrayscale < 128) {
|
||||||
item.style = "filter: invert(1);";
|
item.style = "filter: invert(1);";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue