parent
13d74faf01
commit
e5f1598cd0
|
@ -7,39 +7,36 @@ import (
|
||||||
"github.com/lucasb-eyer/go-colorful"
|
"github.com/lucasb-eyer/go-colorful"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Colors holds all the valid html color names for MovieNight
|
||||||
// the values in colors must be lowercase so it matches with the color input
|
// the values in colors must be lowercase so it matches with the color input
|
||||||
// this saves from having to call strings.ToLower(color) every time to check
|
// this saves from having to call strings.ToLower(color) every time to check
|
||||||
var colors = []string{
|
var Colors = []string{
|
||||||
"aliceblue", "antiquewhite", "aqua", "aquamarine", "azure",
|
"aliceblue", "antiquewhite", "aqua", "aquamarine", "azure",
|
||||||
"beige", "bisque", "black", "blanchedalmond", "blue",
|
"beige", "bisque", "blanchedalmond", "blueviolet", "brown",
|
||||||
"blueviolet", "brown", "burlywood", "cadetblue", "chartreuse",
|
"burlywood", "cadetblue", "chartreuse", "chocolate", "coral",
|
||||||
"chocolate", "coral", "cornflowerblue", "cornsilk", "crimson",
|
"cornflowerblue", "cornsilk", "crimson", "cyan", "darkcyan",
|
||||||
"cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray",
|
"darkgoldenrod", "darkgray", "darkkhaki", "darkmagenta", "darkolivegreen",
|
||||||
"darkgrey", "darkgreen", "darkkhaki", "darkmagenta", "darkolivegreen",
|
"darkorange", "darkorchid", "darksalmon", "darkseagreen", "darkslateblue",
|
||||||
"darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen",
|
"darkslategray", "darkturquoise", "darkviolet", "deeppink", "deepskyblue",
|
||||||
"darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet",
|
"dimgray", "dodgerblue", "firebrick", "floralwhite", "forestgreen",
|
||||||
"deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue",
|
"fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod",
|
||||||
"firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro",
|
"gray", "greenyellow", "honeydew", "hotpink", "indigo",
|
||||||
"ghostwhite", "gold", "goldenrod", "gray", "grey",
|
"ivory", "khaki", "lavender", "lavenderblush", "lawngreen",
|
||||||
"green", "greenyellow", "honeydew", "hotpink", "indianred",
|
"lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow",
|
||||||
"indigo", "ivory", "khaki", "lavender", "lavenderblush",
|
"lightgrey", "lightgreen", "lightpink", "lightsalmon", "lightseagreen",
|
||||||
"lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan",
|
"lightskyblue", "lightslategray", "lightsteelblue", "lightyellow", "lime",
|
||||||
"lightgoldenrodyellow", "lightgray", "lightgrey", "lightgreen", "lightpink",
|
"limegreen", "linen", "magenta", "mediumaquamarine", "mediumorchid",
|
||||||
"lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey",
|
|
||||||
"lightsteelblue", "lightyellow", "lime", "limegreen", "linen",
|
|
||||||
"magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid",
|
|
||||||
"mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise",
|
"mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise",
|
||||||
"mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin",
|
"mediumvioletred", "mintcream", "mistyrose", "moccasin", "navajowhite",
|
||||||
"navajowhite", "navy", "oldlace", "olive", "olivedrab",
|
"oldlace", "olive", "olivedrab", "orange", "orangered",
|
||||||
"orange", "orangered", "orchid", "palegoldenrod", "palegreen",
|
"orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred",
|
||||||
"paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru",
|
"papayawhip", "peachpuff", "peru", "pink", "plum",
|
||||||
"pink", "plum", "powderblue", "purple", "rebeccapurple",
|
"powderblue", "purple", "rebeccapurple", "red", "rosybrown",
|
||||||
"red", "rosybrown", "royalblue", "saddlebrown", "salmon",
|
"royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen",
|
||||||
"sandybrown", "seagreen", "seashell", "sienna", "silver",
|
"seashell", "sienna", "silver", "skyblue", "slateblue",
|
||||||
"skyblue", "slateblue", "slategray", "slategrey", "snow",
|
"slategray", "snow", "springgreen", "steelblue", "tan",
|
||||||
"springgreen", "steelblue", "tan", "teal", "thistle",
|
"teal", "thistle", "tomato", "turquoise", "violet",
|
||||||
"tomato", "turquoise", "violet", "wheat", "white",
|
"wheat", "white", "whitesmoke", "yellow", "yellowgreen",
|
||||||
"whitesmoke", "yellow", "yellowgreen",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -50,7 +47,7 @@ var (
|
||||||
// It also accepts hex codes in the form of #RGB and #RRGGBB
|
// It also accepts hex codes in the form of #RGB and #RRGGBB
|
||||||
func IsValidColor(s string) bool {
|
func IsValidColor(s string) bool {
|
||||||
s = strings.ToLower(s)
|
s = strings.ToLower(s)
|
||||||
for _, c := range colors {
|
for _, c := range Colors {
|
||||||
if s == c {
|
if s == c {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,11 +192,22 @@ function updateColor() {
|
||||||
|
|
||||||
function changeColor() {
|
function changeColor() {
|
||||||
if (isValidColor(colorAsHex())) {
|
if (isValidColor(colorAsHex())) {
|
||||||
sendMessage("/color " + colorAsHex());
|
sendColor(colorAsHex());
|
||||||
showColors(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function colorSelectChange() {
|
||||||
|
let val = $("#colorSelect").val()
|
||||||
|
if (val !== "") {
|
||||||
|
sendColor(val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function sendColor(color) {
|
||||||
|
sendMessage("/color " + color);
|
||||||
|
showColors(false);
|
||||||
|
}
|
||||||
|
|
||||||
function setTimestamp(v) {
|
function setTimestamp(v) {
|
||||||
showTimestamp(v)
|
showTimestamp(v)
|
||||||
document.cookie = "timestamp=" + v
|
document.cookie = "timestamp=" + v
|
||||||
|
@ -272,37 +283,3 @@ window.addEventListener("load", () => {
|
||||||
// Make sure name is focused on start
|
// Make sure name is focused on start
|
||||||
$("#name").focus();
|
$("#name").focus();
|
||||||
});
|
});
|
||||||
|
|
||||||
function pleaseremovethis() {
|
|
||||||
colors = ["aliceblue", "antiquewhite", "aqua", "aquamarine", "azure",
|
|
||||||
"beige", "bisque", "black", "blanchedalmond", "blue",
|
|
||||||
"blueviolet", "brown", "burlywood", "cadetblue", "chartreuse",
|
|
||||||
"chocolate", "coral", "cornflowerblue", "cornsilk", "crimson",
|
|
||||||
"cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray",
|
|
||||||
"darkgrey", "darkgreen", "darkkhaki", "darkmagenta", "darkolivegreen",
|
|
||||||
"darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen",
|
|
||||||
"darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet",
|
|
||||||
"deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue",
|
|
||||||
"firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro",
|
|
||||||
"ghostwhite", "gold", "goldenrod", "gray", "grey",
|
|
||||||
"green", "greenyellow", "honeydew", "hotpink", "indianred",
|
|
||||||
"indigo", "ivory", "khaki", "lavender", "lavenderblush",
|
|
||||||
"lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan",
|
|
||||||
"lightgoldenrodyellow", "lightgray", "lightgrey", "lightgreen", "lightpink",
|
|
||||||
"lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey",
|
|
||||||
"lightsteelblue", "lightyellow", "lime", "limegreen", "linen",
|
|
||||||
"magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid",
|
|
||||||
"mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise",
|
|
||||||
"mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin",
|
|
||||||
"navajowhite", "navy", "oldlace", "olive", "olivedrab",
|
|
||||||
"orange", "orangered", "orchid", "palegoldenrod", "palegreen",
|
|
||||||
"paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru",
|
|
||||||
"pink", "plum", "powderblue", "purple", "rebeccapurple",
|
|
||||||
"red", "rosybrown", "royalblue", "saddlebrown", "salmon",
|
|
||||||
"sandybrown", "seagreen", "seashell", "sienna", "silver",
|
|
||||||
"skyblue", "slateblue", "slategray", "slategrey", "snow",
|
|
||||||
"springgreen", "steelblue", "tan", "teal", "thistle",
|
|
||||||
"tomato", "turquoise", "violet", "wheat", "white",
|
|
||||||
"whitesmoke", "yellow", "yellowgreen",]
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -75,8 +75,8 @@
|
||||||
<input id="colorBlue" type="range" min="0" max="255" value="0" oninput="updateColor();" />
|
<input id="colorBlue" type="range" min="0" max="255" value="0" oninput="updateColor();" />
|
||||||
<span id="colorBlueLabel"></span>
|
<span id="colorBlueLabel"></span>
|
||||||
</div>
|
</div>
|
||||||
<div id="colorInputDiv" class="range-div">
|
<div class="range-div">
|
||||||
#<input id="colorInput" type="text" maxlength="6" onchange="changeColorInput();" />
|
<select id="colorSelect" onchange="colorSelectChange();"></select>
|
||||||
</div>
|
</div>
|
||||||
<div id="colorName" class="range-div">
|
<div id="colorName" class="range-div">
|
||||||
NAME
|
NAME
|
||||||
|
|
10
wasm/main.go
10
wasm/main.go
|
@ -189,6 +189,16 @@ func main() {
|
||||||
js.Set("debugValues", js.CallbackOf(debugValues))
|
js.Set("debugValues", js.CallbackOf(debugValues))
|
||||||
js.Set("showTimestamp", js.CallbackOf(showTimestamp))
|
js.Set("showTimestamp", js.CallbackOf(showTimestamp))
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
time.Sleep(time.Second * 1)
|
||||||
|
inner := `<option value=""></option>`
|
||||||
|
for _, c := range common.Colors {
|
||||||
|
inner += fmt.Sprintf(`<option value="%s">%s</option>\n`, c, c)
|
||||||
|
}
|
||||||
|
|
||||||
|
js.Get("colorSelect").Set("innerHTML", inner)
|
||||||
|
}()
|
||||||
|
|
||||||
// This is needed so the goroutine does not end
|
// This is needed so the goroutine does not end
|
||||||
for {
|
for {
|
||||||
// heatbeat to keep connection alive to deal with nginx
|
// heatbeat to keep connection alive to deal with nginx
|
||||||
|
|
Loading…
Reference in New Issue