Skip to content

Commit

Permalink
v1.30
Browse files Browse the repository at this point in the history
### Version: Exolve v1.30 February 12, 2022

- Allow & to be used as the separator between clue numbers in a linked
  clue. Remember the separator used, and use it when displaying too.
- Add `exolve-option: no-nina-button` that will suppress the display of
  the "Show ninas" button even if there are ninas. "Reveal all" will
  display the ninas and will also bring up the "Hide ninas" button. Hiding
  ninas will again hide the nina button when the option is true.
- Vertically top-align the next/prev button in the current clue.
- When a cell gets the same colour twice from ninas (for example, a cell
  at the intersection of two lights that are marked as ninas), create only
  one coloured overlay, so as to avoid double-colouring. Do the same for
  ninas (but not across ninas and colours).
  • Loading branch information
viresh-ratnakar authored Feb 13, 2022
1 parent 14d604f commit 38f60db
Show file tree
Hide file tree
Showing 47 changed files with 228 additions and 146 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

### Version: Exolve v1.30 February 12, 2022

- Allow & to be used as the separator between clue numbers in a linked
clue. Remember the separator used, and use it when displaying too.
- Add `exolve-option: no-nina-button` that will suppress the display of
the "Show ninas" button even if there are ninas. "Reveal all" will
display the ninas and will also bring up the "Hide ninas" button. Hiding
ninas will again hide the nina button when the option is true.
- Vertically top-align the next/prev button in the current clue.
- When a cell gets the same colour twice from ninas (for example, a cell
at the intersection of two lights that are marked as ninas), create only
one coloured overlay, so as to avoid double-colouring. Do the same for
ninas (but not across ninas and colours).

### Version: Exolve v1.29 November 29, 2021

- Allow adding placeholder blanks next to any clue by appending one (or more)
Expand Down
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## An Easily Configurable Interactive Crossword Solver

### Version: Exolve v1.29 November 29 2021
### Version: Exolve v1.30 February 12, 2022

Exolve can help you create online interactively solvable crosswords (simple
ones with blocks and/or bars as well as those that are jumbles or are
Expand Down Expand Up @@ -620,17 +620,19 @@ own custom CSS rules.

### Linked lights and clues
If a linked clue includes other "children clues," this can be indicated by
appending a comma-separated list of children clue numbers to the parent clue
number. Example:
appending a comma-separated (or &-separated) list of children clue numbers
to the parent clue number. Example:
```
exolve-across:
1, 5, 2d In spite of adverse circumstances (7,3,4)
5 See 1 Across
...
exolve-down:
2 See 1 Across
3 & 7 See neck (4,3)
7 See 3 Down
```
As shown in the above example, if a child clue (2d in the example) has a
As shown in the above examples, if a child clue (2d in the first example) has a
different direction from the parent, the direction can be specified with a
one-letter suffix ("a" or "d" or "b" or "u"), or, in 3-D crosswords, with
a two-letter suffix ("ac" or "aw" or "dn" or "ba" or "to" or "up").
Expand Down Expand Up @@ -1272,7 +1274,7 @@ The list of currently supported options is as follows:
if the window is resized. The number of columns can only be one of
the following: 1 (which is the same as what we get without the
columnar-layout option, when the available width is too small), 2, or 3.
As of February 2021, columnar layout is quirky: Chrome supports it best,
As of February 2022, columnar layout is quirky: Chrome supports it best,
but all browsers seem to have some peculiarities.
- **`clues-at-right-in-two-columns`** If this option is specified, it affects
the column layout when the available width is wide enough for exactly two
Expand Down Expand Up @@ -1319,6 +1321,9 @@ The list of currently supported options is as follows:
used. Set this option to disable that. Useful if you want to control
how the solution appears in the anno. Also see the note on "anno" in the
section on clues.
**`no-nina-button`** In a grid with ninas, a nina-toggline button gets
shown normally. You can suppress the creation of this button by using this
option.
- **`colour-<name>:<c>` or `color-<name>:<c>`** Set the
colour of the element named &lt;name&gt; to &lt;c&gt;, which should be a
valid HTML colour name/code (do not include spaces within it though). See the
Expand Down Expand Up @@ -1900,7 +1905,7 @@ that has the class `xlv-dont-print`.
Clicking on the "Print" link (that's shown under the grid) toggles a panel
with the title "Settings for printing/PDFs". This lets you specify:
- Page size (such as 'Letter' or 'A4'). As of September 2021, you still need to
- Page size (such as 'Letter' or 'A4'). As of February 2022, you still need to
pick the same page size in the printer's settings that open up when you
print, if you use a paper size that's not the current choice in the printer's
settings.
Expand Down Expand Up @@ -1962,7 +1967,7 @@ algorithm, then you can turn it off by setting a field, like this:
Brwosers have their own printing layout algorithms that sometimes do not behave
as expected by Exolve's printing layout algorithm. Here are some known issues as
of September, 2021.
of February, 2022.
- Printing settings in Firefox seem especially complex, and Exolve turns off
the pagination attempts described above if it detects the browser to be
Expand Down
2 changes: 1 addition & 1 deletion exolve-from-ipuz.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ SOFTWARE.
The latest code and documentation for Exolve can be found at:
https://github.com/viresh-ratnakar/exolve
Version: Exolve v1.29 November 3 2021
Version: Exolve v1.30 February 12, 2022
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion exolve-from-puz.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ SOFTWARE.
The latest code and documentation for Exolve can be found at:
https://github.com/viresh-ratnakar/exolve
Version: Exolve v1.29 November 3 2021
Version: Exolve v1.30 February 12, 2022
*/

function exolveFromPuzNextNull(buffer, offset) {
Expand Down
8 changes: 4 additions & 4 deletions exolve-m-simple.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
See the full Exolve license notice in exolve-m.js.
Version: Exolve v1.29 November 29 2021
Version: Exolve v1.30 February 12, 2022
-->

<link rel="stylesheet" type="text/css" href="https://viresh-ratnakar.github.io/exolve-m.css?v1.29"/>
<script src="https://viresh-ratnakar.github.io/exolve-m.js?v1.29"></script>
<link rel="stylesheet" type="text/css" href="https://viresh-ratnakar.github.io/exolve-m.css?v1.30"/>
<script src="https://viresh-ratnakar.github.io/exolve-m.js?v1.30"></script>

<title>Exolve</title>

Expand All @@ -35,7 +35,7 @@
# Uncomment and edit the next two lines if you want to show the setter's name
# and/or show a copyright notice.
# exolve-setter: Your-Setter-Name-Or-Pseudonym
# exolve-copyright: 2021 Comma-separated-copyright-holders
# exolve-copyright: 2022 Comma-separated-copyright-holders
exolve-width: 3
exolve-height: 3
Expand Down
5 changes: 4 additions & 1 deletion exolve-m.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Copyright (c) 2019 Viresh Ratnakar
See the full license notice in exolve-m.js.
Version: Exolve v1.29 November 29 2021
Version: Exolve v1.30 February 12, 2022
*/

@media (max-width: 500px) {
Expand Down Expand Up @@ -335,6 +335,9 @@ Version: Exolve v1.29 November 29 2021
break-inside: avoid;
break-after: avoid;
}
.xlv-nextprev {
vertical-align: top;
}
.xlv-frame hr {
margin: 0 0 4px 0;
}
Expand Down
8 changes: 4 additions & 4 deletions exolve-m.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
See the full Exolve license notice in exolve-m.js.
Version: Exolve v1.29 November 29 2021
Version: Exolve v1.30 February 12, 2022
-->
<link rel="stylesheet" type="text/css" href="exolve-m.css?v1.29"/>
<script src="exolve-m.js?v1.29"></script>
<link rel="stylesheet" type="text/css" href="exolve-m.css?v1.30"/>
<script src="exolve-m.js?v1.30"></script>

<title>Exolve (replace with puzzle title)</title>

Expand All @@ -29,7 +29,7 @@
exolve-title: Quick 3x3 (replace with puzzle title)
exolve-setter: Your-Setter-Name-Or-Pseudonym (replace with setter's pseudonym)
exolve-copyright: 2021 Comma-separated-copyright-holders (delete or replace)
exolve-copyright: 2022 Comma-separated-copyright-holders (delete or replace)
exolve-width: 3
exolve-height: 3
Expand Down
68 changes: 48 additions & 20 deletions exolve-m.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function Exolve(puzzleSpec,
visTop=0,
maxDim=0,
saveState=true) {
this.VERSION = 'Exolve v1.29 November 29 2021';
this.VERSION = 'Exolve v1.30 February 12, 2022';

this.puzzleText = puzzleSpec;
this.containerId = containerId;
Expand Down Expand Up @@ -397,6 +397,7 @@ function Exolve(puzzleSpec,
this.showCellLevelButtons = false;
this.printCompleted3Cols = false;
this.printIncomplete2Cols = false;
this.noNinaButton = false;

this.createPuzzle();
}
Expand Down Expand Up @@ -1260,6 +1261,10 @@ Exolve.prototype.parseOption = function(s) {
this.ignoreEnumMismatch = true
continue
}
if (spart == "no-nina-button" || spart == "no-ninas-button") {
this.noNinaButton = true
continue
}
if (spart == "allow-digits") {
spart = 'allow-chars:0123456789'
// Fall through to the allow-chars code.
Expand Down Expand Up @@ -2280,12 +2285,13 @@ Exolve.prototype.parseDir = function(s) {
// dirStr
// dirIsPrefix
// reversed (for b/d and ba/to/up).
// hasChildren
// hasChildren, linkSep
// skip
// leadSpace
Exolve.prototype.parseClueLabel = function(clueLine, consumeTrailing=true) {
let parse = {dir: '', label: '', notLabel: true};
parse.hasChilden = false;
parse.linkSep = '';
parse.skip = 0;
parse.leadSpace = '';
const space = clueLine.match(/^\s*/);
Expand Down Expand Up @@ -2342,9 +2348,11 @@ Exolve.prototype.parseClueLabel = function(clueLine, consumeTrailing=true) {
}
parse.notLabel = false;
if (consumeTrailing) {
commaParts = clueLine.match(/^\s*,/)
commaParts = clueLine.match(/^\s*[,&]/)
if (commaParts && commaParts.length == 1) {
parse.hasChildren = true
parse.hasChildren = true;
// Store the separator char in linkSep
parse.linkSep = commaParts[0][commaParts[0].length - 1]
parse.skip += commaParts[0].length
clueLine = clueLine.substr(commaParts[0].length)
}
Expand Down Expand Up @@ -2597,6 +2605,7 @@ Exolve.prototype.parseClue = function(dir, clueLine) {
clue.index = clueIndex

clueLine = clueLine.substr(clueLabelParse.skip)
clue.linkSep = clueLabelParse.linkSep || '';
clue.children = []
while (clueLabelParse.hasChildren) {
clueLabelParse = this.parseClueLabel(clueLine)
Expand Down Expand Up @@ -3045,6 +3054,7 @@ Exolve.prototype.processClueChildren = function() {
let lastRowColDir = clue.dir
dupes = {}
const allDirections = ['A', 'D', 'Z', 'X']
let linkSep = (clue.linkSep != ',') ? (' ' + clue.linkSep + ' ') : ', ';
for (let chi = 0; chi < clue.children.length; chi++) {
const child = clue.children[chi];
// Direction could be the same as the direction of the parent. Or,
Expand Down Expand Up @@ -3089,12 +3099,13 @@ Exolve.prototype.processClueChildren = function() {
if (!childClue.fullDisplayLabel) {
childClue.fullDisplayLabel = this.clueLabelDisp(childClue);
}
clue.displayLabel = clue.displayLabel + ', ' +
clue.displayLabel = clue.displayLabel + linkSep +
((childClue.dir == clue.dir) && !childClue.reversed ?
childClue.label : childClue.fullDisplayLabel);
clue.fullDisplayLabel = clue.fullDisplayLabel + ', ' +
clue.fullDisplayLabel = clue.fullDisplayLabel + linkSep +
childClue.fullDisplayLabel;
}
linkSep = (child.linkSep != ',') ? (' ' + child.linkSep + ' ') : ', ';
clue.childrenClueIndices.push(childIndex)
childClue.parentClueIndex = clueIndex

Expand Down Expand Up @@ -3661,7 +3672,8 @@ Exolve.prototype.displayClues = function() {

let col1Chars = theClue.displayLabel.replace(/&[^;]*;/g, '#')
let col1NumChars = [...col1Chars].length
if (col1Chars.substr(1, 1) == ',' ||
const linkSep = col1Chars.substr(1, 2);
if (linkSep == ', ' || linkSep == ' &' ||
(revSuff && col1Chars.substr(1, revSuff.length) == revSuff)) {
// Linked clue that begins with a single-letter/digit clue number.
// Or, reversed single-letter/digit clue.
Expand All @@ -3685,16 +3697,16 @@ Exolve.prototype.displayClues = function() {
if (col1NumChars > 2) {
// More than two unicode chars in col1. Need to indent col2.
col1Chars = col1Chars.substr(2)
// spaces and equal number of commas use 0.6
let col1Spaces = col1Chars.split(' ').length - 1
let indent = col1Spaces * 2 * 0.6
// spaces and commas use 0.6
const col1Spammas = col1Chars.replace(/[^, ]*/g, '').length
let indent = col1Spammas * 0.6
// digits, lowercase letters use 1
let col1Digits = col1Chars.replace(/[^0-9a-z]*/g, '').length
const col1Digits = col1Chars.replace(/[^0-9a-z]*/g, '').length
indent = indent + (col1Digits * 1)
// uppercase letters use 1.1
let col1Letters = col1Chars.replace(/[^A-Z]*/g, '').length
indent = indent + (col1Letters * 1.1)
let rem = col1Chars.length - col1Letters - col1Digits - (2 * col1Spaces);
// uppercase letters and & use 1.3
const col1Letters = col1Chars.replace(/[^A-Z&]*/g, '').length
indent = indent + (col1Letters * 1.3)
const rem = col1Chars.length - col1Letters - col1Digits - col1Spammas;
if (rem > 0) {
indent = indent + (rem * 2.8)
}
Expand Down Expand Up @@ -4535,11 +4547,13 @@ Exolve.prototype.getLinkedClues = function(clueIndex) {
// Get HTML for back/forth buttons in current clue.
Exolve.prototype.getCurrClueButtons = function() {
return `<span>
<button id="${this.prefix}-curr-clue-prev" class="xlv-small-button"
title="${this.textLabels['curr-clue-prev.hover']}"
<button id="${this.prefix}-curr-clue-prev"
class="xlv-small-button xlv-nextprev"
title="${this.textLabels['curr-clue-prev.hover']}"
>${this.textLabels['curr-clue-prev']}</button>
<button id="${this.prefix}-curr-clue-next" class="xlv-small-button"
title="${this.textLabels['curr-clue-next.hover']}"
<button id="${this.prefix}-curr-clue-next"
class="xlv-small-button xlv-nextprev"
title="${this.textLabels['curr-clue-next.hover']}"
>${this.textLabels['curr-clue-next']}</button></span>`;
}

Expand Down Expand Up @@ -5360,13 +5374,16 @@ Exolve.prototype.createListeners = function() {
Exolve.prototype.recolourCells = function(scale=1) {
// Set colours specified through exolve-colour.
this.colourGroup.innerHTML = '';
const dupes = {};
for (let colourSpec of this.colourfuls) {
for (let cccc of colourSpec.list) {
for (let cell of cccc.cells) {
const row = cell[0]
const col = cell[1]
if (dupes[[row, col, colourSpec.colour]]) continue;
this.colourGroup.appendChild(
this.makeCellDiv(row, col, colourSpec.colour, scale));
dupes[[row, col, colourSpec.colour]] = true;
}
}
}
Expand Down Expand Up @@ -5659,6 +5676,7 @@ Exolve.prototype.redisplayNinas = function(scale=1) {
this.ninaGroup.innerHTML = '';
this.ninaClassElements = [];
let ninaColorIndex = 0;
const dupes = {};
for (let nina of this.ninas) {
console.assert(nina.colour, nina);
for (let cccc of nina.list) {
Expand All @@ -5680,7 +5698,9 @@ Exolve.prototype.redisplayNinas = function(scale=1) {
for (let cell of cccc.cells) {
const row = cell[0]
const col = cell[1]
if (dupes[[row, col, nina.colour]]) continue;
this.ninaGroup.appendChild(this.makeCellDiv(row, col, nina.colour, scale));
dupes[[row, col, nina.colour]] = true;
}
}
}
Expand All @@ -5695,6 +5715,10 @@ Exolve.prototype.showNinas = function() {
this.ninasButton.innerHTML = this.textLabels['hide-ninas']
this.ninasButton.title = this.textLabels['hide-ninas.hover']
this.showingNinas = true
if (this.ninas.length > 0 && this.noNinaButton) {
// Show the "hide-ninas" button
this.ninasButton.style.display = ''
}
}

Exolve.prototype.hideNinas = function() {
Expand All @@ -5705,6 +5729,10 @@ Exolve.prototype.hideNinas = function() {
this.ninasButton.innerHTML = this.textLabels['show-ninas']
this.ninasButton.title = this.textLabels['show-ninas.hover']
this.showingNinas = false
if (this.ninas.length > 0 && this.noNinaButton) {
// Hide the "show-ninas" button
this.ninasButton.style.display = 'none'
}
}

Exolve.prototype.toggleNinas = function() {
Expand Down Expand Up @@ -6314,7 +6342,7 @@ Exolve.prototype.displayButtons = function() {
this.revealButton.title = this.textLabels['reveal.hover']
this.revealButton.disabled = true
}
if (this.ninas.length > 0) {
if (this.ninas.length > 0 && !this.noNinaButton) {
this.ninasButton.style.display = ''
this.ninasButton.title = this.textLabels['show-ninas.hover']
}
Expand Down
Loading

0 comments on commit 38f60db

Please sign in to comment.