Mod now supports triplets that are missing a #
so FF0000 will become #FF0000 and be used
This commit is contained in:
parent
3c2bee69ed
commit
b3176a8c0c
|
|
@ -13,4 +13,23 @@ if(urlParams.get('pageColor') != null) { //null check
|
|||
};
|
||||
};
|
||||
|
||||
document.body.style.backgroundColor = color;
|
||||
color_Would_Be_A_Triplet_If_It_Started_With_An_Octothorpe = null;
|
||||
color_Is_Supported_As_A_Background_By_The_Browser = null;
|
||||
|
||||
if( /^#([0-9A-F]{3}){1,2}$/i.test("#" + color) ) {
|
||||
color_Would_Be_A_Triplet_If_It_Started_With_An_Octothorpe = true
|
||||
} else {
|
||||
color_Would_Be_A_Triplet_If_It_Started_With_An_Octothorpe = false
|
||||
}
|
||||
|
||||
if( CSS.supports('background',color) ) {
|
||||
color_Is_Supported_As_A_Background_By_The_Browser = true
|
||||
} else {
|
||||
color_Is_Supported_As_A_Background_By_The_Browser = false
|
||||
}
|
||||
|
||||
if(color_Is_Supported_As_A_Background_By_The_Browser == false && color_Would_Be_A_Triplet_If_It_Started_With_An_Octothorpe == true) {
|
||||
color = "#" + color
|
||||
}
|
||||
|
||||
document.body.style.background = color;
|
||||
|
|
|
|||
Loading…
Reference in New Issue