Skip to content

Commit

Permalink
Exolve v1.15
Browse files Browse the repository at this point in the history
  • Loading branch information
viresh-ratnakar authored May 21, 2021
1 parent 08d1809 commit f345440
Show file tree
Hide file tree
Showing 55 changed files with 275 additions and 121 deletions.
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.14 April 19 2021
Version: Exolve v1.15 May 20 2021
*/

/**
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.14 April 19 2021
Version: Exolve v1.15 May 20 2021
*/

function exolveFromPuzNextNull(buffer, offset) {
Expand Down
6 changes: 3 additions & 3 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.14 April 19 2021
Version: Exolve v1.15 May 20 2021
-->

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

<title>Exolve</title>

Expand Down
2 changes: 1 addition & 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.13 April 10 2021
Version: Exolve v1.15 May 20 2021
*/

@media (max-width: 500px) {
Expand Down
6 changes: 3 additions & 3 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.14 April 19 2021
Version: Exolve v1.15 May 20 2021
-->
<link rel="stylesheet" type="text/css" href="exolve-m.css?v1.14"/>
<script src="exolve-m.js?v1.14"></script>
<link rel="stylesheet" type="text/css" href="exolve-m.css?v1.15"/>
<script src="exolve-m.js?v1.15"></script>

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

Expand Down
57 changes: 48 additions & 9 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.14 April 19 2021'
this.VERSION = 'Exolve v1.15 May 20 2021'

this.puzzleText = puzzleSpec
this.containerId = containerId
Expand Down Expand Up @@ -236,18 +236,20 @@ function Exolve(puzzleSpec,
'from full clues with a second click. Shortcut: Ctrl-q',
'clear-all': 'Clear all!',
'clear-all.hover': 'Clear everything! A second click clears all ' +
'placeholder entries in clues without known squares. Shortcut: Ctrl-Q',
'placeholder entries in clues without known cells. Shortcut: Ctrl-Q',
'check': 'Check this',
'checkcell': 'Check cell',
'check.hover': 'Erase mistakes in highlighted squares. Long-click to ' +
'check.hover': 'Erase mistakes in highlighted cells. Long-click to ' +
'check just the current cell',
'check-all': 'Check all',
'checkcell': 'Check cell',
'checkcell.hover': 'Erase the current cell if it\'s incorrect',
'check-all': 'Check all!',
'check-all.hover': 'Erase all mistakes. Reveal any available annos if ' +
'no mistakes',
'reveal': 'Reveal this',
'revealcell': 'Reveal cell',
'reveal.hover': 'Reveal highlighted clue/squares. Long-click to reveal ' +
'reveal.hover': 'Reveal highlighted clue/cells. Long-click to reveal ' +
'just the current cell',
'revealcell': 'Reveal cell',
'revealcell.hover': 'Reveal the solution letter in the current cell',
'show-ninas': 'Show ninas',
'show-ninas.hover': 'Show ninas hidden in the grid/clues',
'hide-ninas': 'Hide ninas',
Expand Down Expand Up @@ -346,6 +348,7 @@ function Exolve(puzzleSpec,
this.cluesToRight = false
this.ignoreUnclued = false
this.ignoreEnumMismatch = false
this.showCellLevelButtons = false

this.createPuzzle()
}
Expand Down Expand Up @@ -412,6 +415,13 @@ Exolve.prototype.init = function() {
<button id="${this.prefix}-check-all" class="xlv-button"
style="display:none">${this.textLabels['check-all']}</button>
</div> <!-- xlv-button-row-1 -->
<div id="${this.prefix}-buttons-extra-row" class="xlv-controls-row"
style="display:none">
<button id="${this.prefix}-checkcell" class="xlv-button"
style="display:none">${this.textLabels['checkcell']}</button>
<button id="${this.prefix}-revealcell" class="xlv-button"
style="display:none">${this.textLabels['revealcell']}</button>
</div>
<div id="${this.prefix}-button-row-2" class="xlv-controls-row">
<button id="${this.prefix}-reveal" class="xlv-button"
style="display:none">${this.textLabels['reveal']}</button>
Expand Down Expand Up @@ -637,6 +647,8 @@ Exolve.prototype.init = function() {
this.checkButton.addEventListener('mousedown', this.cellLightToggler.bind(
this, this.checkButton, this.textLabels['checkcell']));
this.checkButton.addEventListener('mouseup', this.checkCurr.bind(this));
this.checkcellButton = document.getElementById(this.prefix + '-checkcell')
this.checkcellButton.addEventListener('click', this.checkCell.bind(this));

this.checkAllButton = document.getElementById(this.prefix + '-check-all')
this.checkAllButton.addEventListener('click', this.checkAll.bind(this));
Expand All @@ -648,6 +660,8 @@ Exolve.prototype.init = function() {
this.revealButton.addEventListener('mousedown', this.cellLightToggler.bind(
this, this.revealButton, this.textLabels['revealcell']));
this.revealButton.addEventListener('mouseup', this.revealCurr.bind(this));
this.revealcellButton = document.getElementById(this.prefix + '-revealcell')
this.revealcellButton.addEventListener('click', this.revealCell.bind(this));

this.revealAllButton = document.getElementById(this.prefix + '-reveal-all')
this.revealAllButton.addEventListener('click', this.revealAll.bind(this));
Expand Down Expand Up @@ -1021,6 +1035,10 @@ Exolve.prototype.parseOption = function(s) {
let sparts = s.split(' ')
for (let spart of sparts) {
spart = spart.trim().toLowerCase()
if (spart == "show-cell-level-buttons") {
this.showCellLevelButtons = true
continue
}
if (spart == "hide-inferred-numbers") {
this.hideInferredNumbers = true
continue
Expand Down Expand Up @@ -3378,6 +3396,7 @@ Exolve.prototype.updateDisplayAndGetState = function() {
let ci = this.clueOrParentIndex(this.currClueIndex)
let revOrphan = this.isOrphanWithReveals(ci)
this.checkButton.disabled = (this.activeCells.length == 0) && !revOrphan
this.checkcellButton.disabled = this.checkButton.disabled
let theClue = this.clues[ci]
let haveReveals = (this.activeCells.length > 0 && !this.hasUnsolvedCells) ||
(theClue && (theClue.anno || theClue.solution ||
Expand All @@ -3391,6 +3410,7 @@ Exolve.prototype.updateDisplayAndGetState = function() {
}
}
this.revealButton.disabled = !haveReveals;
this.revealcellButton.disabled = this.revealButton.disabled
this.clearButton.disabled = this.revealButton.disabled &&
this.activeCells.length == 0;
return state
Expand Down Expand Up @@ -5287,6 +5307,11 @@ Exolve.prototype.cellLightToggler = function(button, text) {
this.cellLightTogglerDone.bind(this, button, text), 500);
}

Exolve.prototype.checkCell = function() {
this.cellNotLight = true;
this.checkCurr();
}

Exolve.prototype.checkCurr = function() {
if (this.cellLightToggleTimer) {
clearTimeout(this.cellLightToggleTimer)
Expand Down Expand Up @@ -5423,6 +5448,11 @@ Exolve.prototype.revealClueAnno = function(ci) {
}
}

Exolve.prototype.revealCell = function() {
this.cellNotLight = true;
this.revealCurr();
}

Exolve.prototype.revealCurr = function() {
if (this.cellLightToggleTimer) {
clearTimeout(this.cellLightToggleTimer)
Expand Down Expand Up @@ -5629,12 +5659,21 @@ Exolve.prototype.displayButtons = function() {
if (!this.hasUnsolvedCells) {
this.checkButton.style.display = ''
this.checkButton.title = this.textLabels['check.hover']
this.checkButton.disabled = true
this.checkAllButton.style.display = ''
this.checkAllButton.title = this.textLabels['check-all.hover']
this.revealAllButton.style.display = ''
this.revealAllButton.title = this.textLabels['reveal-all.hover']

this.checkButton.disabled = true
if (this.showCellLevelButtons) {
document.getElementById(
this.prefix + '-buttons-extra-row').style.display = '';
this.checkcellButton.style.display = ''
this.checkcellButton.title = this.textLabels['checkcell.hover']
this.checkcellButton.disabled = true
this.revealcellButton.style.display = ''
this.revealcellButton.title = this.textLabels['revealcell.hover']
this.revealcellButton.disabled = true
}
}
if (!this.hasUnsolvedCells || this.hasReveals) {
this.revealButton.style.display = ''
Expand Down
8 changes: 4 additions & 4 deletions exolve-player.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" type="text/css" href="exolve-m.css?v1.14"/>
<script src="exolve-m.js?v1.14"></script>
<script src="exolve-from-ipuz.js?v1.14"></script>
<script src="exolve-from-puz.js?v1.14"></script>
<link rel="stylesheet" type="text/css" href="exolve-m.css?v1.15"/>
<script src="exolve-m.js?v1.15"></script>
<script src="exolve-from-ipuz.js?v1.15"></script>
<script src="exolve-from-puz.js?v1.15"></script>

<style>
#exolve-player {
Expand Down
53 changes: 46 additions & 7 deletions exolve.html
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
visTop=0,
maxDim=0,
saveState=true) {
this.VERSION = 'Exolve v1.14 April 19 2021'
this.VERSION = 'Exolve v1.15 May 20 2021'

this.puzzleText = puzzleSpec
this.containerId = containerId
Expand Down Expand Up @@ -269,18 +269,20 @@
'from full clues with a second click. Shortcut: Ctrl-q',
'clear-all': 'Clear all!',
'clear-all.hover': 'Clear everything! A second click clears all ' +
'placeholder entries in clues without known squares. Shortcut: Ctrl-Q',
'placeholder entries in clues without known cells. Shortcut: Ctrl-Q',
'check': 'Check this',
'checkcell': 'Check cell',
'check.hover': 'Erase mistakes in highlighted squares. Long-click to ' +
'check.hover': 'Erase mistakes in highlighted cells. Long-click to ' +
'check just the current cell',
'check-all': 'Check all',
'checkcell.hover': 'Erase the current cell if it\'s incorrect',
'check-all': 'Check all!',
'check-all.hover': 'Erase all mistakes. Reveal any available annos if ' +
'no mistakes',
'reveal': 'Reveal this',
'revealcell': 'Reveal cell',
'reveal.hover': 'Reveal highlighted clue/squares. Long-click to reveal ' +
'reveal.hover': 'Reveal highlighted clue/cells. Long-click to reveal ' +
'just the current cell',
'revealcell.hover': 'Reveal the solution letter in the current cell',
'show-ninas': 'Show ninas',
'show-ninas.hover': 'Show ninas hidden in the grid/clues',
'hide-ninas': 'Hide ninas',
Expand Down Expand Up @@ -379,6 +381,7 @@
this.cluesToRight = false
this.ignoreUnclued = false
this.ignoreEnumMismatch = false
this.showCellLevelButtons = false

this.createPuzzle()
}
Expand Down Expand Up @@ -453,6 +456,13 @@ <h2 id="${this.prefix}-title" class="xlv-title"></h2>
<button id="${this.prefix}-reveal-all" class="xlv-button"
style="display:none">${this.textLabels['reveal-all']}</button>
</div> <!-- xlv-button-row-2 -->
<div id="${this.prefix}-buttons-extra-row" class="xlv-controls-row"
style="display:none">
<button id="${this.prefix}-checkcell" class="xlv-button"
style="display:none">${this.textLabels['checkcell']}</button>
<button id="${this.prefix}-revealcell" class="xlv-button"
style="display:none">${this.textLabels['revealcell']}</button>
</div>
</div> <!-- xlv-controls -->
<div id="${this.prefix}-errors" class="xlv-errors"></div>
<div id="${this.prefix}-status" class="xlv-status">
Expand Down Expand Up @@ -670,6 +680,8 @@ <h2 id="${this.prefix}-title" class="xlv-title"></h2>
this.checkButton.addEventListener('mousedown', this.cellLightToggler.bind(
this, this.checkButton, this.textLabels['checkcell']));
this.checkButton.addEventListener('mouseup', this.checkCurr.bind(this));
this.checkcellButton = document.getElementById(this.prefix + '-checkcell')
this.checkcellButton.addEventListener('click', this.checkCell.bind(this));

this.checkAllButton = document.getElementById(this.prefix + '-check-all')
this.checkAllButton.addEventListener('click', this.checkAll.bind(this));
Expand All @@ -681,6 +693,8 @@ <h2 id="${this.prefix}-title" class="xlv-title"></h2>
this.revealButton.addEventListener('mousedown', this.cellLightToggler.bind(
this, this.revealButton, this.textLabels['revealcell']));
this.revealButton.addEventListener('mouseup', this.revealCurr.bind(this));
this.revealcellButton = document.getElementById(this.prefix + '-revealcell')
this.revealcellButton.addEventListener('click', this.revealCell.bind(this));

this.revealAllButton = document.getElementById(this.prefix + '-reveal-all')
this.revealAllButton.addEventListener('click', this.revealAll.bind(this));
Expand Down Expand Up @@ -1054,6 +1068,10 @@ <h2 id="${this.prefix}-title" class="xlv-title"></h2>
let sparts = s.split(' ')
for (let spart of sparts) {
spart = spart.trim().toLowerCase()
if (spart == "show-cell-level-buttons") {
this.showCellLevelButtons = true
continue
}
if (spart == "hide-inferred-numbers") {
this.hideInferredNumbers = true
continue
Expand Down Expand Up @@ -3411,6 +3429,7 @@ <h2 id="${this.prefix}-title" class="xlv-title"></h2>
let ci = this.clueOrParentIndex(this.currClueIndex)
let revOrphan = this.isOrphanWithReveals(ci)
this.checkButton.disabled = (this.activeCells.length == 0) && !revOrphan
this.checkcellButton.disabled = this.checkButton.disabled
let theClue = this.clues[ci]
let haveReveals = (this.activeCells.length > 0 && !this.hasUnsolvedCells) ||
(theClue && (theClue.anno || theClue.solution ||
Expand All @@ -3424,6 +3443,7 @@ <h2 id="${this.prefix}-title" class="xlv-title"></h2>
}
}
this.revealButton.disabled = !haveReveals;
this.revealcellButton.disabled = this.revealButton.disabled
this.clearButton.disabled = this.revealButton.disabled &&
this.activeCells.length == 0;
return state
Expand Down Expand Up @@ -5320,6 +5340,11 @@ <h2 id="${this.prefix}-title" class="xlv-title"></h2>
this.cellLightTogglerDone.bind(this, button, text), 500);
}

Exolve.prototype.checkCell = function() {
this.cellNotLight = true;
this.checkCurr();
}

Exolve.prototype.checkCurr = function() {
if (this.cellLightToggleTimer) {
clearTimeout(this.cellLightToggleTimer)
Expand Down Expand Up @@ -5456,6 +5481,11 @@ <h2 id="${this.prefix}-title" class="xlv-title"></h2>
}
}

Exolve.prototype.revealCell = function() {
this.cellNotLight = true;
this.revealCurr();
}

Exolve.prototype.revealCurr = function() {
if (this.cellLightToggleTimer) {
clearTimeout(this.cellLightToggleTimer)
Expand Down Expand Up @@ -5662,12 +5692,21 @@ <h2 id="${this.prefix}-title" class="xlv-title"></h2>
if (!this.hasUnsolvedCells) {
this.checkButton.style.display = ''
this.checkButton.title = this.textLabels['check.hover']
this.checkButton.disabled = true
this.checkAllButton.style.display = ''
this.checkAllButton.title = this.textLabels['check-all.hover']
this.revealAllButton.style.display = ''
this.revealAllButton.title = this.textLabels['reveal-all.hover']

this.checkButton.disabled = true
if (this.showCellLevelButtons) {
document.getElementById(
this.prefix + '-buttons-extra-row').style.display = '';
this.checkcellButton.style.display = ''
this.checkcellButton.title = this.textLabels['checkcell.hover']
this.checkcellButton.disabled = true
this.revealcellButton.style.display = ''
this.revealcellButton.title = this.textLabels['revealcell.hover']
this.revealcellButton.disabled = true
}
}
if (!this.hasUnsolvedCells || this.hasReveals) {
this.revealButton.style.display = ''
Expand Down
4 changes: 2 additions & 2 deletions gussalufz-1-solved.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" type="text/css" href="exolve-m.css?v1.14"/>
<script src="exolve-m.js?v1.14"></script>
<link rel="stylesheet" type="text/css" href="exolve-m.css?v1.15"/>
<script src="exolve-m.js?v1.15"></script>
<title>Gussalufz</title>
</head>

Expand Down
4 changes: 2 additions & 2 deletions gussalufz-1-unsolved.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" type="text/css" href="exolve-m.css?v1.14"/>
<script src="exolve-m.js?v1.14"></script>
<link rel="stylesheet" type="text/css" href="exolve-m.css?v1.15"/>
<script src="exolve-m.js?v1.15"></script>
<title>Gussalufz</title>
</head>

Expand Down
Loading

0 comments on commit f345440

Please sign in to comment.