Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 6246fde

Browse files
committed
Fix room tinting
Looks like the cachebuster stuff in element-hq/element-web#2515 broke room tinting. Add a fix, along with some ranting.
1 parent f56aff7 commit 6246fde

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/Tinter.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ var keyRgb = [
3535
// x * 118 + 255 - 255 * x = 234
3636
// x * 118 - x * 255 = 234 - 255
3737
// (255 - 118) x = 255 - 234
38-
// x = (255 - 234) / (255 - 118) = 0.16
38+
// x = (255 - 234) / (255 - 118) = 0.16
3939

4040
// The colour keys to be replaced as referred to in SVGs
4141
var keyHex = [
@@ -90,7 +90,20 @@ function calcCssFixups() {
9090
// See also #vector:matrix.org/$145357669685386ebCfr:matrix.org
9191
// ...except some browsers apparently return stylesheets without
9292
// hrefs, which we have no choice but ignore right now
93-
if (ss.href && !ss.href.endsWith("/bundle.css")) continue;
93+
94+
// XXX seriously? we are hardcoding the name of vector's CSS file in
95+
// here?
96+
//
97+
// Why do we need to limit it to vector's CSS file anyway - if there
98+
// are other CSS files affecting the doc don't we want to apply the
99+
// same transformations to them?
100+
//
101+
// Iterating through the CSS looking for matches to hack on feels
102+
// pretty horrible anyway. And what if the application skin doesn't use
103+
// Vector Green as its primary color?
104+
105+
if (ss.href && !ss.href.match(/\/bundle.*\.css$/)) continue;
106+
94107
if (!ss.cssRules) continue;
95108
for (var j = 0; j < ss.cssRules.length; j++) {
96109
var rule = ss.cssRules[j];

0 commit comments

Comments
 (0)