mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 07:56:16 -04:00
Use 'transparent' as reference to validate css
Use 'transparent' instead of 'white' as a reference color for validating CSS color values. Presumably, a user setting a userColor wants some color other than 'transparent' if they are setting it (they could always duplicate the background's color if not).
This commit is contained in:
parent
afc90604bf
commit
bc6e495e8c
1 changed files with 4 additions and 4 deletions
|
@ -164,7 +164,7 @@ function getParams()
|
||||||
settings.globalUserName = decodeURIComponent(userName);
|
settings.globalUserName = decodeURIComponent(userName);
|
||||||
}
|
}
|
||||||
if(userColor)
|
if(userColor)
|
||||||
// If the userColor is set as a parameter, set a global value to use once we have initiated hte pad.
|
// If the userColor is set as a parameter, set a global value to use once we have initiated the pad.
|
||||||
{
|
{
|
||||||
settings.globalUserColor = decodeURIComponent(userColor);
|
settings.globalUserColor = decodeURIComponent(userColor);
|
||||||
}
|
}
|
||||||
|
@ -372,12 +372,12 @@ function handshake()
|
||||||
if (settings.globalUserColor !== false)
|
if (settings.globalUserColor !== false)
|
||||||
{
|
{
|
||||||
// First, check the color to ensure it's a valid css color value.
|
// First, check the color to ensure it's a valid css color value.
|
||||||
var check = $("<span/>").css("background-color", "white");
|
var check = $("<span/>").css("background-color", "transparent");
|
||||||
$("body").append(check);
|
$("body").append(check);
|
||||||
var white = check.css("background-color");
|
var transparent = check.css("background-color");
|
||||||
check.css("background-color", settings.globalUserColor);
|
check.css("background-color", settings.globalUserColor);
|
||||||
// Ensure that setting the element changed the color.
|
// Ensure that setting the element changed the color.
|
||||||
if (check.css("background-color") === white) {
|
if (check.css("background-color") === transparent) {
|
||||||
settings.globalUserColor = "#ff0000";
|
settings.globalUserColor = "#ff0000";
|
||||||
}
|
}
|
||||||
check.remove();
|
check.remove();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue