Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
crossword
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Silas Dohm
crossword
Commits
93cc7f33
Commit
93cc7f33
authored
Feb 21, 2022
by
Silas Dohm
Browse files
Options
Downloads
Patches
Plain Diff
new color scheme
parent
d39fc835
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
index.html
+21
-1
21 additions, 1 deletion
index.html
sketch.js
+40
-27
40 additions, 27 deletions
sketch.js
style.css
+22
-3
22 additions, 3 deletions
style.css
with
83 additions
and
31 deletions
index.html
+
21
−
1
View file @
93cc7f33
...
...
@@ -37,9 +37,29 @@
<span
class=
"close"
>
×
</span>
<p>
keybindings:
</p>
<table>
<tr>
<th>
key
</th>
<th>
action
</th>
<th>
key
</th>
<th>
action
</th>
</tr>
<tr>
<td>
h
</td>
<td>
left
</td>
<td>
move left
</td>
<td>
l
</td>
<td>
move righ
</td>
</tr>
<tr>
<td>
j
</td>
<td>
move down
</td>
<td>
k
</td>
<td>
move up
</td>
</tr>
<tr>
<td>
x
</td>
<td>
delete char
</td>
<td>
k
</td>
<td>
up
</td>
</tr>
</table>
</div>
...
...
This diff is collapsed.
Click to expand it.
sketch.js
+
40
−
27
View file @
93cc7f33
...
...
@@ -8,24 +8,24 @@ class Cell {
this
.
word
=
new
Array
(
2
)
this
.
neighbour
=
new
Array
(
4
);
//0=left, 1=top, 2=right, 3=bot
}
drawChar
=
function
(
color
,
fontcolor
=
"
black
"
)
{
this
.
drawCell
(
color
);
drawChar
=
function
(
color
,
fontcolor
=
"
black
"
,
strokeColor
=
"
black
"
)
{
//drawCell
ctx
.
fillStyle
=
color
;
ctx
.
strokeStyle
=
strokeColor
;
ctx
.
lineWidth
=
2
;
ctx
.
fillRect
(
this
.
x
*
size
,
this
.
y
*
size
,
size
,
size
);
ctx
.
strokeRect
(
this
.
x
*
size
,
this
.
y
*
size
,
size
,
size
);
//draw text
ctx
.
fillStyle
=
fontcolor
;
ctx
.
font
=
size
/
2
+
"
px monospace
"
;
ctx
.
fillText
(
this
.
currentChar
.
toUpperCase
(),
this
.
x
*
size
+
size
/
3
,
this
.
y
*
size
+
size
/
1.5
);
//draw hintNr
if
(
this
.
hintNr
)
{
ctx
.
fillStyle
=
"
black
"
;
ctx
.
font
=
"
14px Consolas
"
;
ctx
.
fillText
(
this
.
hintNr
,
this
.
x
*
size
+
4
,
(
this
.
y
)
*
size
+
15
);
}
}
drawCell
=
function
(
fillstyle
)
{
//draw field
ctx
.
fillStyle
=
fillstyle
;
ctx
.
strokeStyle
=
"
#4717f6
"
;
ctx
.
fillRect
(
this
.
x
*
size
,
this
.
y
*
size
,
size
,
size
);
ctx
.
strokeRect
(
this
.
x
*
size
,
this
.
y
*
size
,
size
,
size
);
}
}
class
Word
{
static
number
=
0
;
...
...
@@ -34,7 +34,8 @@ class Word {
constructor
(
clue
,
word
,
x
,
y
,
direction
)
{
this
.
chars
=
new
Array
();
this
.
direction
=
direction
;
this
.
highlightColor
=
direction
?
'
#c8b9fc
'
:
"
#CFE9F5
"
;
// this.highlightColor = direction ? '#c8b9fc' : '#CFE9F5';
this
.
highlightColor
=
direction
?
'
#fff5bc
'
:
'
#ffddbd
'
;
if
(
!
mycell
[
x
][
y
].
hintNr
)
{
mycell
[
x
][
y
].
hintNr
=
++
Word
.
number
;
}
...
...
@@ -68,35 +69,43 @@ class Word {
highlight
=
function
()
{
let
filled
=
true
;
this
.
li
.
scrollIntoView
({
behavior
:
'
smooth
'
});
// this.li.style.color = m_orientation==this.direction?"red":"black";
this
.
li
.
style
.
color
=
"
black
"
;
this
.
li
.
style
.
background
=
this
.
highlightColor
;
this
.
chars
.
forEach
(
element
=>
{
if
(
element
==
activeCell
)
element
.
drawChar
(
m_orientation
?
'
#
7e5df9
'
:
'
#80C4E4
'
);
element
.
drawChar
(
m_orientation
?
'
#
ffe553
'
:
'
#ffab58
'
);
else
{
element
.
drawChar
(
this
.
highlightColor
);
}
if
(
element
.
currentChar
==
""
)
filled
=
false
;
});
//TODO: !!
if
(
filled
)
{
this
.
chars
.
forEach
(
element
=>
{
let
color
=
this
.
highlightColor
;
if
(
element
==
activeCell
)
color
=
m_orientation
?
'
#
7e5df9
'
:
'
#80C4E4
'
;
color
=
m_orientation
?
'
#
ffe553
'
:
'
#ffab58
'
;
if
(
element
.
currentChar
.
toUpperCase
()
==
element
.
actualChar
.
toUpperCase
())
{
element
.
drawChar
(
color
,
"
green
"
);
}
else
element
.
drawChar
(
color
,
"
red
"
);
element
.
drawChar
(
color
,
"
#bf060b
"
);
});
}
//highlight
ctx
.
strokeStyle
=
"
#bf060b
"
;
if
(
this
.
direction
==
m_orientation
)
{
this
.
li
.
style
.
borderColor
=
"
#bf060b
"
;
if
(
this
.
direction
)
ctx
.
strokeRect
(
this
.
chars
[
0
].
x
*
size
,
this
.
chars
[
0
].
y
*
size
,
size
,
this
.
chars
.
length
*
size
);
else
ctx
.
strokeRect
(
this
.
chars
[
0
].
x
*
size
,
this
.
chars
[
0
].
y
*
size
,
this
.
chars
.
length
*
size
,
size
);
}
}
clearHighlight
=
function
()
{
this
.
li
.
style
.
color
=
"
white
"
;
this
.
li
.
style
.
background
=
'
none
'
;
this
.
li
.
style
.
borderColor
=
"
transparent
"
;
this
.
chars
.
forEach
(
element
=>
{
element
.
drawChar
(
'
white
'
);
});
...
...
@@ -206,6 +215,7 @@ function logKey(e) {
case
"
I
"
:
//start of horizontal word
if
(
activeCell
.
word
[
0
])
activeCell
=
activeCell
.
word
[
0
].
chars
[
0
];
case
"
R
"
:
case
"
i
"
:
activeMode
=
mode
.
insert
;
m_orientation
=
0
;
...
...
@@ -228,6 +238,9 @@ function logKey(e) {
case
"
r
"
:
activeMode
=
mode
.
replace
;
break
;
case
"
`
"
:
activeCell
.
currentChar
=
activeCell
.
actualChar
;
break
;
default
:
break
;
}
...
...
This diff is collapsed.
Click to expand it.
style.css
+
22
−
3
View file @
93cc7f33
:root
{
/* --bg-color: #074079; */
--bg-color
:
#2b2a33
;
}
body
{
background-color
:
#4717f6
;
background-color
:
var
(
--bg-color
)
;
color
:
white
;
font-family
:
Courier
;
font-size
:
2em
;
...
...
@@ -29,6 +33,7 @@ ol{
}
li
{
cursor
:
pointer
;
border
:
2px
solid
transparent
;
}
#canvasWrapper
{
...
...
@@ -60,8 +65,8 @@ canvas{
/* Modal Content */
.modal-content
{
/*
background-color:
#fefefe; */
background-color
:
#4717f6
;
background-color
:
var
(
--bg-color
);
color
:
white
;
margin
:
auto
;
padding
:
20px
;
box-shadow
:
0
24px
38px
3px
rgba
(
0
,
0
,
0
,
0.14
),
0
9px
46px
8px
rgba
(
0
,
0
,
0
,
0.12
),
0
11px
15px
-7px
rgba
(
0
,
0
,
0
,
0.2
);
...
...
@@ -89,6 +94,20 @@ canvas{
font-size
:
1.2em
;
width
:
1.2em
;
}
.modal-content
table
{
margin
:
0
auto
;
}
.modal-content
tr
{
/* margin: 5px; */
}
.modal-content
th
{
border
:
1px
white
solid
;
padding
:
0px
1em
;
}
.modal-content
td
{
border
:
1px
white
solid
;
text-align
:
center
;
}
/* ===============statusBar div=============== */
#status
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment