From e502b60a871c893e33ed7e9cd7fd26086f2cb618 Mon Sep 17 00:00:00 2001 From: tomasvana10 Date: Thu, 23 May 2024 19:24:28 +1000 Subject: [PATCH] Tab-related fixes and popup improvements The 'toggleAllTabIndices' method was added to prevent the user from tabbing to anything else except for the continue/close buttons on popups. All popup-related functionality was merged into 'togglePopup'. --- .../cword_webapp/static/interaction.js | 59 ++++++++++--------- .../cword_webapp/static/interaction.min.js | 2 +- .../cword_webapp/templates/index.html | 7 +-- 3 files changed, 36 insertions(+), 32 deletions(-) diff --git a/crossword_puzzle/cword_webapp/static/interaction.js b/crossword_puzzle/cword_webapp/static/interaction.js index 85743fa12..4c0c2b96c 100644 --- a/crossword_puzzle/cword_webapp/static/interaction.js +++ b/crossword_puzzle/cword_webapp/static/interaction.js @@ -20,6 +20,10 @@ const opMagnitude = { // The scale to which a grid operation is performed GRID: "grid", } const toggleIds = ["ts", "tw", "tc", "tz"]; +const popupData = { + ONLOAD: ["onload_popup", "continue_button"], + COMPLETION: ["completion_popup", "close_button"], +} class Interaction { /* Class to handle all forms of interaction with the web app, as well as to @@ -103,7 +107,7 @@ class Interaction { this.doNotSaveGridState = false; this.applyCookieData(); // Update grid and toggles - this.displayOnloadPopup(); + this.togglePopup("onload_popup"); // This flag was initially toggled to true, as by default, the toggles are // automatically turned off, thus overriding the toggle's cookies. It should @@ -785,7 +789,7 @@ class Interaction { Interaction.sleep(1).then(() => { // Allow the input the user just made to be shown by the DOM this.handleEscapePress(null); - this.displayCompletionPopup(); + this.togglePopup("completion_popup"); this.jazz.play(); }); } @@ -1256,41 +1260,36 @@ class Interaction { this.currentDropdown = id; } - displayOnloadPopup() { - this.onloadPopupToggled = true; - - Interaction.sleep(200).then(() => { - document.getElementById("blur").classList.toggle("active"); - document.getElementById("onload_popup").classList.toggle("active"); - Interaction.sleep(301).then(() => { - document - .getElementsByClassName("continue_button")[0] - .focus({ focusVisible: true }); - }); - }); - } + togglePopup(popupClass) { + let state; + let buttonClass = + popupClass === popupData.COMPLETION[0] + ? popupData.COMPLETION[1] + : popupData.ONLOAD[1]; + if (popupClass === popupData.COMPLETION[0]) { + this.completionPopupToggled = !this.completionPopupToggled; + state = this.completionPopupToggled; + } else if (popupClass === popupData.ONLOAD[0]) { + this.onloadPopupToggled = !this.onloadPopupToggled; + state = this.onloadPopupToggled; + } - displayCompletionPopup() { - this.completionPopupToggled = !this.completionPopupToggled; document.getElementById("blur").classList.toggle("active"); - document.getElementById("completion_popup").classList.toggle("active"); - if (this.completionPopupToggled) { - // Focus the close button + document.getElementById(popupClass).classList.toggle("active"); + if (state) { + Interaction.toggleAllTabIndices(false); + Interaction.sleep(501).then( () => document - .getElementsByClassName("close_button")[0] + .getElementsByClassName(buttonClass)[0] .focus({ focusVisible: true }) // Ensure the user can see the focus ); + } else { + Interaction.toggleAllTabIndices(true); } } - closeOnloadPopup() { - this.onloadPopupToggled = false; - document.getElementById("blur").classList.toggle("active"); - document.getElementById("onload_popup").classList.toggle("active"); - } - preventZoomIfRequired(event) { /* Prevent the user from zooming if they do not have the "click to zoom" button toggled on. This must be handled as the zoom functions from zoomooz.js @@ -1321,6 +1320,12 @@ class Interaction { } } + static toggleAllTabIndices(mode) { + document.querySelectorAll(`[tabindex="${mode ? "-1": "0"}"]:not(.non_empty_cell):not(.right_side)`).forEach(element => { + element.tabIndex = mode ? "0" : "-1"; + }); + } + static getDefByNumber(num, andClick = false) { let def = document.querySelector(`[data-num="${num}"`); if (andClick) { diff --git a/crossword_puzzle/cword_webapp/static/interaction.min.js b/crossword_puzzle/cword_webapp/static/interaction.min.js index e445465cc..57b73d087 100644 --- a/crossword_puzzle/cword_webapp/static/interaction.min.js +++ b/crossword_puzzle/cword_webapp/static/interaction.min.js @@ -1 +1 @@ -"use strict";function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}function _regeneratorRuntime(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function(){return e};var t,e={},u=Object.prototype,o=u.hasOwnProperty,n=Object.defineProperty||function(t,e,u){t[e]=u.value},r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",s=r.asyncIterator||"@@asyncIterator",l=r.toStringTag||"@@toStringTag";function a(t,e,u){return Object.defineProperty(t,e,{value:u,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{a({},"")}catch(t){a=function(t,e,u){return t[e]=u}}function c(t,e,u,o){var r=e&&e.prototype instanceof p?e:p,i=Object.create(r.prototype),s=new L(o||[]);return n(i,"_invoke",{value:b(t,u,s)}),i}function D(t,e,u){try{return{type:"normal",arg:t.call(e,u)}}catch(t){return{type:"throw",arg:t}}}e.wrap=c;var d="suspendedStart",h="suspendedYield",C="executing",E="completed",f={};function p(){}function F(){}function A(){}var m={};a(m,i,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(S([])));g&&g!==u&&o.call(g,i)&&(m=g);var v=A.prototype=p.prototype=Object.create(m);function B(t){["next","throw","return"].forEach((function(e){a(t,e,(function(t){return this._invoke(e,t)}))}))}function k(t,e){function u(n,r,i,s){var l=D(t[n],t,r);if("throw"!==l.type){var a=l.arg,c=a.value;return c&&"object"==_typeof(c)&&o.call(c,"__await")?e.resolve(c.__await).then((function(t){u("next",t,i,s)}),(function(t){u("throw",t,i,s)})):e.resolve(c).then((function(t){a.value=t,i(a)}),(function(t){return u("throw",t,i,s)}))}s(l.arg)}var r;n(this,"_invoke",{value:function(t,o){function n(){return new e((function(e,n){u(t,o,e,n)}))}return r=r?r.then(n,n):n()}})}function b(e,u,o){var n=d;return function(r,i){if(n===C)throw Error("Generator is already running");if(n===E){if("throw"===r)throw i;return{value:t,done:!0}}for(o.method=r,o.arg=i;;){var s=o.delegate;if(s){var l=I(s,o);if(l){if(l===f)continue;return l}}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if(n===d)throw n=E,o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);n=C;var a=D(e,u,o);if("normal"===a.type){if(n=o.done?E:h,a.arg===f)continue;return{value:a.arg,done:o.done}}"throw"===a.type&&(n=E,o.method="throw",o.arg=a.arg)}}}function I(e,u){var o=u.method,n=e.iterator[o];if(n===t)return u.delegate=null,"throw"===o&&e.iterator.return&&(u.method="return",u.arg=t,I(e,u),"throw"===u.method)||"return"!==o&&(u.method="throw",u.arg=new TypeError("The iterator does not provide a '"+o+"' method")),f;var r=D(n,e.iterator,u.arg);if("throw"===r.type)return u.method="throw",u.arg=r.arg,u.delegate=null,f;var i=r.arg;return i?i.done?(u[e.resultName]=i.value,u.next=e.nextLoc,"return"!==u.method&&(u.method="next",u.arg=t),u.delegate=null,f):i:(u.method="throw",u.arg=new TypeError("iterator result is not an object"),u.delegate=null,f)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function S(e){if(e||""===e){var u=e[i];if(u)return u.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function u(){for(;++n=0;--r){var i=this.tryEntries[r],s=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var l=o.call(i,"catchLoc"),a=o.call(i,"finallyLoc");if(l&&a){if(this.prev=0;--u){var n=this.tryEntries[u];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev=0;--e){var u=this.tryEntries[e];if(u.finallyLoc===t)return this.complete(u.completion,u.afterLoc),_(u),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var u=this.tryEntries[e];if(u.tryLoc===t){var o=u.completion;if("throw"===o.type){var n=o.arg;_(u)}return n}}throw Error("illegal catch attempt")},delegateYield:function(e,u,o){return this.delegate={iterator:S(e),resultName:u,nextLoc:o},"next"===this.method&&(this.arg=t),f}},e}function _createForOfIteratorHelper(t,e){var u="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!u){if(Array.isArray(t)||(u=_unsupportedIterableToArray(t))||e&&t&&"number"==typeof t.length){u&&(t=u);var o=0,n=function(){};return{s:n,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,i=!0,s=!1;return{s:function(){u=u.call(t)},n:function(){var t=u.next();return i=t.done,t},e:function(t){s=!0,r=t},f:function(){try{i||null==u.return||u.return()}finally{if(s)throw r}}}}function _slicedToArray(t,e){return _arrayWithHoles(t)||_iterableToArrayLimit(t,e)||_unsupportedIterableToArray(t,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArrayLimit(t,e){var u=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=u){var o,n,r,i,s=[],l=!0,a=!1;try{if(r=(u=u.call(t)).next,0===e){if(Object(u)!==u)return;l=!1}else for(;!(l=(o=r.call(u)).done)&&(s.push(o.value),s.length!==e);l=!0);}catch(t){a=!0,n=t}finally{try{if(!l&&null!=u.return&&(i=u.return(),Object(i)!==i))return}finally{if(a)throw n}}return s}}function _arrayWithHoles(t){if(Array.isArray(t))return t}function _toConsumableArray(t){return _arrayWithoutHoles(t)||_iterableToArray(t)||_unsupportedIterableToArray(t)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var u=Object.prototype.toString.call(t).slice(8,-1);return"Object"===u&&t.constructor&&(u=t.constructor.name),"Map"===u||"Set"===u?Array.from(t):"Arguments"===u||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u)?_arrayLikeToArray(t,e):void 0}}function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var u=0,o=new Array(e);u0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1?arguments[1]:void 0,u=arguments.length>2&&void 0!==arguments[2]&&arguments[2];null==t||t.preventDefault();var o=e===arrowKeys[2]?-1:1,n=this.getDefinitionsListItemFromWord(),r=Number(n.getAttribute("data-num"))+o,i=Interaction.getDefByNumber(r);if(!i){var s=1===o?"1":this.wordCount;i=Interaction.getDefByNumber(s)}var l=this.cellCoords;-1===o&&u&&(this.setCoordsToEndOfWord=!0),i.focus(),i.click(),i.blur(),this.followCellZoom(l)}},{key:"skipCellCoords",value:function(t,e){var u=this.shiftCellCoords(t,e,modes.ENTER);if(u.isEqualTo(t))return u;if(!this.wasEmpty)return u;for(this.wasEmpty=!1;!Interaction.isEmpty(Interaction.getCellElement(u));){var o=u;if(u=this.shiftCellCoords(u,e,modes.ENTER),o.isEqualTo(u))break}return Interaction.isEmpty(Interaction.getCellElement(u))?u:this.wordToggle.checked?(this.shiftWordSelection(null,"ArrowDown"),this.bypassPostCellShiftActions=!0,this.cellCoords):this.shiftCellCoords(t,e,modes.ENTER)}},{key:"shiftCellCoords",value:function(t,e,u){var o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=u==modes.ENTER?1:-1,r=e===this.directions[1]?[t[0]+n,t[1]]:[t[0],t[1]+n],i=Interaction.getCellElement(r);return null!==i&&i.classList.contains("non_empty_cell")||o?r:t}},{key:"onDefinitionsListItemClick",value:function(t,e,u){var o=document.querySelector('[data-num_label="'.concat(e,'"]')).parentElement;this.preventZoomIfRequired(t),this.removeCompoundInputIfRequired(o),this.setFocusMode(!1),document.activeElement.blur(),this.compoundInputActive&&document.getElementsByClassName("compound_input")[0].focus(),this.direction=u,this.cellCoords=Interaction.updateCellCoords(o),this.setCoordsToEndOfWord&&(this.cellCoords=Interaction.updateCellCoords(_toConsumableArray(this.getWordElements()).slice(-1)[0]),this.setCoordsToEndOfWord=!1),this.currentWord=this.updateCurrentWord(),this.setFocusMode(!0)}},{key:"onCellClick",value:function(t,e){if(this.doNotHandleStandardCellClick)return this.doNotHandleStandardCellClick=!1;this.preventZoomIfRequired(t),this.removeCompoundInputIfRequired(e),this.setFocusMode(!1);var u=Interaction.updateCellCoords(e);(this.intersections.includes(JSON.stringify(u))&&u.isEqualTo(this.cellCoords)||this.shouldDirectionBeAlternated(u))&&this.alternateDirection(),this.cellCoords=u,this.currentWord=this.updateCurrentWord(),this.setFocusMode(!0),this.updateDefinitionsListPos()}},{key:"handleArrowPress",value:function(t,e){e.preventDefault();var u=t===arrowKeys[3]||t===arrowKeys[1]?modes.ENTER:modes.DEL,o=t===arrowKeys[3]||t===arrowKeys[2]?this.directions[1]:this.directions[0],n=Interaction.getCellElement(this.cellCoords),r=this.shiftCellCoords(this.cellCoords,o,u,!0),i=!1;try{for(;Interaction.getCellElement(r).classList.contains("empty_cell");)r=this.shiftCellCoords(r,o,u,!0),i=!0}catch(t){r=this.cellCoords}this.setFocusMode(!1),this.shouldDirectionBeAlternated(r)?(this.alternateDirection(),i&&(this.cellCoords=r),i=!1):this.cellCoords=r,this.followCellZoom(n),this.currentWord=this.updateCurrentWord(),this.setFocusMode(!0),this.updateDefinitionsListPos()}},{key:"handleEnterPress",value:function(t){var e=t.target.classList;e.contains("def")?(t.target.click(),t.target.blur(),this.zoomToggle.checked&&(this.doNotHandleStandardCellClick=!0,Interaction.getCellElement(this.cellCoords).click())):e.contains("toggle")?(t.target.click(),t.target.blur()):e.contains("grid")?Interaction.toggleCellTabIndices(!0):e.contains("non_empty_cell")&&t.target.click()}},{key:"handleEnterKeybindPress",value:function(t){Interaction.unfocusActiveElement(),this.hideDropdowns();var e=t.shiftKey?gridOp.REVEAL:"check";this.doSpecialButtonAction(opMagnitude.WORD,e,!1)}},{key:"handleSpacebarPress",value:function(t){t.preventDefault(),this.setFocusMode(!1),this.alternateDirection(),this.currentWord=this.updateCurrentWord(),this.setFocusMode(!0),this.updateDefinitionsListPos()}},{key:"handleEscapePress",value:function(t){null==t||t.preventDefault(),Interaction.unfocusActiveElement(),this.hideDropdowns(),this.setFocusMode(!1),this.zoomOut(),this.cellCoords=null,this.currentWord=null}},{key:"crosswordCompletionHandler",value:function(){var t=this;this.isCrosswordComplete()&&Interaction.sleep(1).then((function(){t.handleEscapePress(null),t.displayCompletionPopup(),t.jazz.play()}))}},{key:"doSpecialButtonAction",value:function(t,e){var u=this,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if((!(arguments.length>2&&void 0!==arguments[2])||arguments[2])&&this.onDropdownClick(e+"_dropdown"),null===this.cellCoords&&t!==opMagnitude.GRID)return alert(this.errMsgs[0]);switch(t){case opMagnitude.CELL:var n=Interaction.getCellElement(this.cellCoords);this.doGridOperation(n,e),e===gridOp.REVEAL&&this.handleCellShift(modes.ENTER,n);break;case opMagnitude.WORD:var r,i=this.isWordEmpty(),s=_createForOfIteratorHelper(this.getWordElements());try{for(s.s();!(r=s.n()).done;){var l=r.value;this.doGridOperation(l,e)}}catch(t){s.e(t)}finally{s.f()}this.wordToggle.checked&&(e===gridOp.REVEAL?this.shiftWordSelection(null,arrowKeys[3]):e===gridOp.CLEAR&&i&&this.shiftWordSelection(null,arrowKeys[2]));break;case opMagnitude.GRID:document.querySelectorAll(".non_empty_cell").forEach((function(t){return u.doGridOperation(t,e,o)}))}e!==gridOp.CLEAR&&(e===gridOp.REVEAL&&this.crosswordCompletionHandler(),this.saveGridState())}},{key:"doGridOperation",value:function(t,e){var u=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e===gridOp.REVEAL?(t.classList.remove("wrong"),this.setValue(t,t.getAttribute("data-value")),t.classList.add("lock_in")):e===gridOp.CHECK?Interaction.isEmpty(t)||(t.hasCorrectValue()?t.classList.add("lock_in"):t.classList.add("wrong")):e===gridOp.CLEAR&&(u&&!t.classList.contains("lock_in")||!u)&&(t.classList.remove("lock_in"),t.classList.remove("wrong"),this.setValue(t,"",this.doNotSaveGridState))}},{key:"shouldDirectionBeAlternated",value:function(t){return this.shiftCellCoords(t,this.direction,modes.ENTER).isEqualTo(t)&&this.shiftCellCoords(t,this.direction,modes.DEL).isEqualTo(t)}},{key:"setFocusMode",value:function(t){null!==this.cellCoords&&(this.changeWordFocus(t),this.changeCellFocus(t),this.changeDefinitionsListItemFocus(t))}},{key:"changeWordFocus",value:function(t){var e,u=_createForOfIteratorHelper(this.getWordElements());try{for(u.s();!(e=u.n()).done;){e.value.style.backgroundColor=t?this.colourPalette.WORD_FOCUS:this.colourPalette.SUB}}catch(t){u.e(t)}finally{u.f()}}},{key:"changeCellFocus",value:function(t){return this.saveGridState(),Interaction.getCellElement(this.cellCoords).style.backgroundColor=t?this.colourPalette.CELL_FOCUS:this.colourPalette.SUB}},{key:"changeDefinitionsListItemFocus",value:function(t){return this.getDefinitionsListItemFromWord().style.backgroundColor=t?this.colourPalette.WORD_FOCUS:""}},{key:"updateCurrentWord",value:function(){var t,e="",u=_createForOfIteratorHelper(this.getWordElements());try{for(u.s();!(t=u.n()).done;){e+=t.value.getAttribute("data-value")}}catch(t){u.e(t)}finally{u.f()}return e.toUpperCase()}},{key:"getWordElements",value:_regeneratorRuntime().mark((function t(){var e,u,o,n,r,i;return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=this.getWordIndices(),u=_slicedToArray(e,2),o=u[0],n=u[1],r=o;case 2:if(!(r<=n)){t.next=9;break}return i=this.isDown?[r,this.staticIndex]:[this.staticIndex,r],t.next=6,Interaction.getCellElement(i);case 6:r++,t.next=2;break;case 9:case"end":return t.stop()}}),t,this)}))},{key:"getWordIndices",value:function(){var t=_slicedToArray(this.cellCoords,2),e=t[0],u=t[1];this.isDown=this.direction===this.directions[1],this.staticIndex=this.isDown?u:e;for(var o=_slicedToArray(this.isDown?[e,e]:[u,u],2),n=o[0],r=o[1];n>0&&this.grid[this.isDown?n-1:e][this.isDown?u:n-1]!=this.empty;)n--;for(;r0&&void 0!==arguments[0]&&arguments[0],u=Array.from({length:this.dimensions},(function(){return Array(t.dimensions).fill(t.empty)})),o=structuredClone(u);return document.querySelectorAll(".non_empty_cell").forEach((function(t){var n=parseInt(t.getAttribute("data-row")),r=parseInt(t.getAttribute("data-column")),i=t.childNodes[0].nodeValue.toUpperCase();if(u[n][r]=i,e){var s="";t.classList.contains("wrong")?s="wrong":t.classList.contains("lock_in")&&(s="lock_in"),o[n][r]=s}})),e?[u,o]:u}},{key:"setCompoundInput",value:function(t){this.compoundInputActive=!0,t||(this.wasEmpty=!0);var e=Interaction.getCellElement(this.cellCoords);e.onclick=function(t){return Interaction.dummyCellClick(t)},this.setValue(e,"");var u=document.createElement("input");u.value=t,u.type="text",u.classList.add("compound_input"),e.appendChild(u),u.focus()}},{key:"handleSetCompoundInput",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(null===this.cellCoords)return alert(this.errMsgs[0]);if(document.getElementsByClassName("compound_input")[0])return this.removeCompoundInput(t);var e=Interaction.getCellElement(this.cellCoords).childNodes,u=e[0].nodeValue;e.length>1&&(e[1].style.display="none"),this.setCompoundInput(u)}},{key:"removeCompoundInput",value:function(){var t=this,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.compoundInputActive){var u=document.getElementsByClassName("compound_input")[0],o=u.parentElement,n=u.value;0!==n.length&&n[0].match(onlyLangRegex)||(n=""),u.remove(),this.setValue(o,n[0]);var r=o.childNodes;r.length>1&&(r[1].style.display="inline"),o.onclick=function(e){return t.onCellClick(e,o)},o.classList.remove("lock_in","wrong"),this.compoundInputActive=!1,this.currentPlaceholder=0,this.checkToggle.checked&&this.doGridOperation(o,gridOp.CHECK),e&&this.handleCellShift(modes.ENTER,o)}}},{key:"cycleCompoundInputPlaceholderText",value:function(){var t=document.getElementsByClassName("compound_input")[0];void 0!==t&&(t.placeholder=compoundInputPlaceholders[this.currentPlaceholder],this.currentPlaceholder===compoundInputPlaceholders.length-1?this.currentPlaceholder=0:this.currentPlaceholder+=1)}},{key:"removeCompoundInputIfRequired",value:function(t){this.compoundInputActive&&t!==Interaction.getCellElement(this.cellCoords)&&this.removeCompoundInput()}},{key:"followCellZoom",value:function(t){if(1===document.querySelectorAll(".non_empty_cell.selectedZoomTarget").length){var e=Interaction.getCellElement(this.cellCoords);if(e!==t)return this.doNotHandleStandardCellClick=!0,e.click()}}},{key:"handleClick",value:function(t){t.target.closest(".special_button, .dropdown, .dropdown_button")||(this.hideDropdowns(),this.removeCompoundInput(!1))}},{key:"handleFocusOut",value:function(t){var e,u,o,n,r,i,s,l,a,c,D,d;(null!==(e=t.relatedTarget)&&void 0!==e&&e.classList.contains("grid")||null!==(u=t.target)&&void 0!==u&&u.classList.contains("non_empty_cell")&&(null===(o=t.relatedTarget)||void 0===o||!o.classList.contains("non_empty_cell")))&&Interaction.toggleCellTabIndices(!1),(null===(n=t.relatedTarget)||void 0===n||!n.classList.contains("dropdown_button")||null!==(r=t.target)&&void 0!==r&&r.classList.contains("dropdown_button")&&null!==(i=t.relatedTarget)&&void 0!==i&&i.classList.contains("special_button")&&(null===(s=t.relatedTarget)||void 0===s||!s.id.startsWith(null===(l=this.currentDropdown)||void 0===l?void 0:l.substring(0,null===(a=this.currentDropdown)||void 0===a?void 0:a.indexOf("_"))))||null!==(c=t.target.id)&&void 0!==c&&c.endsWith("button")&&(null!==(D=t.relatedTarget)&&void 0!==D&&null!==(D=D.id)&&void 0!==D&&D.endsWith("button")||null===(d=t.relatedTarget)||void 0===d||null===(d=d.classList)||void 0===d||!d.contains("dropdown_button")))&&this.hideDropdowns()}},{key:"hideDropdowns",value:function(){document.querySelectorAll(".dropdown").forEach((function(t){return t.classList.remove("show_dropdown")})),document.querySelectorAll(".special_button").forEach((function(t){return t.innerHTML=t.innerHTML.replace("▲","▼")})),this.currentDropdown=null}},{key:"onDropdownClick",value:function(t){this.removeCompoundInput(!1);var e=document.getElementById(t);if(t===this.currentDropdown)return this.hideDropdowns(),void(this.currentDropdown=null);this.hideDropdowns();var u=document.getElementById(t.replace("_dropdown","_button"));u.innerHTML=u.innerHTML.replace("▼","▲"),e.classList.add("show_dropdown"),this.currentDropdown=t}},{key:"displayOnloadPopup",value:function(){this.onloadPopupToggled=!0,Interaction.sleep(200).then((function(){document.getElementById("blur").classList.toggle("active"),document.getElementById("onload_popup").classList.toggle("active"),Interaction.sleep(301).then((function(){document.getElementsByClassName("continue_button")[0].focus({focusVisible:!0})}))}))}},{key:"displayCompletionPopup",value:function(){this.completionPopupToggled=!this.completionPopupToggled,document.getElementById("blur").classList.toggle("active"),document.getElementById("completion_popup").classList.toggle("active"),this.completionPopupToggled&&Interaction.sleep(501).then((function(){return document.getElementsByClassName("close_button")[0].focus({focusVisible:!0})}))}},{key:"closeOnloadPopup",value:function(){this.onloadPopupToggled=!1,document.getElementById("blur").classList.toggle("active"),document.getElementById("onload_popup").classList.toggle("active")}},{key:"preventZoomIfRequired",value:function(t){document.getElementById("tz").checked&&!this.preventInitialLIZoom||(this.preventInitialLIZoom=!1,t.stopImmediatePropagation())}},{key:"setValue",value:function(t,e){var u=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t.childNodes[0].nodeValue=e,u||this.saveGridState()}}],[{key:"toggleCellTabIndices",value:function(t){var e;document.querySelectorAll(".non_empty_cell").forEach((function(u,o){u.tabIndex=t?"0":"-1",0===o&&(e=u)})),t&&e.focus({focusVisible:!0})}},{key:"getDefByNumber",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],u=document.querySelector('[data-num="'.concat(t,'"'));return e&&u.click(),u}},{key:"dummyCellClick",value:function(t){return t.stopImmediatePropagation()}},{key:"unfocusActiveElement",value:function(){document.activeElement.blur()}},{key:"sleep",value:function(t){return new Promise((function(e){return setTimeout(e,t)}))}},{key:"isEmpty",value:function(t){var e;return!(null!=t&&null!==(e=t.childNodes[0])&&void 0!==e&&e.nodeValue)}},{key:"getCellElement",value:function(t){return document.querySelector('[data-row="'.concat(t[0],'"][data-column="').concat(t[1],'"]'))}},{key:"updateCellCoords",value:function(t){return[parseInt(t.getAttribute("data-row")),parseInt(t.getAttribute("data-column"))]}},{key:"configureScrollHeights",value:function(){var t=document.querySelector(".definitions_a"),e=document.querySelector(".definitions_d");document.getElementById("return_def_zoom").style.height=Math.max(t.scrollHeight,e.scrollHeight)+"px";var u=document.getElementById("no_scroll");u.scrollHeight-1>u.clientHeight&&(u.style.overflowY="auto")}}])}(),Cookies=function(){return _createClass((function t(){_classCallCheck(this,t)}),null,[{key:"setCookie",value:function(t,e,u){var o=new Date;o.setTime(o.getTime()+24*u*60*60*1e3);var n="expires="+o.toUTCString();document.cookie="".concat(t,"=").concat(e,";").concat(n,";path=/;SameSite=Lax")}},{key:"getCookie",value:function(t){for(var e=t+"=",u=document.cookie.split(";"),o=0;o=0;--r){var i=this.tryEntries[r],s=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var l=o.call(i,"catchLoc"),a=o.call(i,"finallyLoc");if(l&&a){if(this.prev=0;--u){var n=this.tryEntries[u];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev=0;--e){var u=this.tryEntries[e];if(u.finallyLoc===t)return this.complete(u.completion,u.afterLoc),_(u),E}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var u=this.tryEntries[e];if(u.tryLoc===t){var o=u.completion;if("throw"===o.type){var n=o.arg;_(u)}return n}}throw Error("illegal catch attempt")},delegateYield:function(e,u,o){return this.delegate={iterator:S(e),resultName:u,nextLoc:o},"next"===this.method&&(this.arg=t),E}},e}function _createForOfIteratorHelper(t,e){var u="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!u){if(Array.isArray(t)||(u=_unsupportedIterableToArray(t))||e&&t&&"number"==typeof t.length){u&&(t=u);var o=0,n=function(){};return{s:n,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,i=!0,s=!1;return{s:function(){u=u.call(t)},n:function(){var t=u.next();return i=t.done,t},e:function(t){s=!0,r=t},f:function(){try{i||null==u.return||u.return()}finally{if(s)throw r}}}}function _slicedToArray(t,e){return _arrayWithHoles(t)||_iterableToArrayLimit(t,e)||_unsupportedIterableToArray(t,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArrayLimit(t,e){var u=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=u){var o,n,r,i,s=[],l=!0,a=!1;try{if(r=(u=u.call(t)).next,0===e){if(Object(u)!==u)return;l=!1}else for(;!(l=(o=r.call(u)).done)&&(s.push(o.value),s.length!==e);l=!0);}catch(t){a=!0,n=t}finally{try{if(!l&&null!=u.return&&(i=u.return(),Object(i)!==i))return}finally{if(a)throw n}}return s}}function _arrayWithHoles(t){if(Array.isArray(t))return t}function _toConsumableArray(t){return _arrayWithoutHoles(t)||_iterableToArray(t)||_unsupportedIterableToArray(t)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var u=Object.prototype.toString.call(t).slice(8,-1);return"Object"===u&&t.constructor&&(u=t.constructor.name),"Map"===u||"Set"===u?Array.from(t):"Arguments"===u||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u)?_arrayLikeToArray(t,e):void 0}}function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var u=0,o=new Array(e);u0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1?arguments[1]:void 0,u=arguments.length>2&&void 0!==arguments[2]&&arguments[2];null==t||t.preventDefault();var o=e===arrowKeys[2]?-1:1,n=this.getDefinitionsListItemFromWord(),r=Number(n.getAttribute("data-num"))+o,i=Interaction.getDefByNumber(r);if(!i){var s=1===o?"1":this.wordCount;i=Interaction.getDefByNumber(s)}var l=this.cellCoords;-1===o&&u&&(this.setCoordsToEndOfWord=!0),i.focus(),i.click(),i.blur(),this.followCellZoom(l)}},{key:"skipCellCoords",value:function(t,e){var u=this.shiftCellCoords(t,e,modes.ENTER);if(u.isEqualTo(t))return u;if(!this.wasEmpty)return u;for(this.wasEmpty=!1;!Interaction.isEmpty(Interaction.getCellElement(u));){var o=u;if(u=this.shiftCellCoords(u,e,modes.ENTER),o.isEqualTo(u))break}return Interaction.isEmpty(Interaction.getCellElement(u))?u:this.wordToggle.checked?(this.shiftWordSelection(null,"ArrowDown"),this.bypassPostCellShiftActions=!0,this.cellCoords):this.shiftCellCoords(t,e,modes.ENTER)}},{key:"shiftCellCoords",value:function(t,e,u){var o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=u==modes.ENTER?1:-1,r=e===this.directions[1]?[t[0]+n,t[1]]:[t[0],t[1]+n],i=Interaction.getCellElement(r);return null!==i&&i.classList.contains("non_empty_cell")||o?r:t}},{key:"onDefinitionsListItemClick",value:function(t,e,u){var o=document.querySelector('[data-num_label="'.concat(e,'"]')).parentElement;this.preventZoomIfRequired(t),this.removeCompoundInputIfRequired(o),this.setFocusMode(!1),document.activeElement.blur(),this.compoundInputActive&&document.getElementsByClassName("compound_input")[0].focus(),this.direction=u,this.cellCoords=Interaction.updateCellCoords(o),this.setCoordsToEndOfWord&&(this.cellCoords=Interaction.updateCellCoords(_toConsumableArray(this.getWordElements()).slice(-1)[0]),this.setCoordsToEndOfWord=!1),this.currentWord=this.updateCurrentWord(),this.setFocusMode(!0)}},{key:"onCellClick",value:function(t,e){if(this.doNotHandleStandardCellClick)return this.doNotHandleStandardCellClick=!1;this.preventZoomIfRequired(t),this.removeCompoundInputIfRequired(e),this.setFocusMode(!1);var u=Interaction.updateCellCoords(e);(this.intersections.includes(JSON.stringify(u))&&u.isEqualTo(this.cellCoords)||this.shouldDirectionBeAlternated(u))&&this.alternateDirection(),this.cellCoords=u,this.currentWord=this.updateCurrentWord(),this.setFocusMode(!0),this.updateDefinitionsListPos()}},{key:"handleArrowPress",value:function(t,e){e.preventDefault();var u=t===arrowKeys[3]||t===arrowKeys[1]?modes.ENTER:modes.DEL,o=t===arrowKeys[3]||t===arrowKeys[2]?this.directions[1]:this.directions[0],n=Interaction.getCellElement(this.cellCoords),r=this.shiftCellCoords(this.cellCoords,o,u,!0),i=!1;try{for(;Interaction.getCellElement(r).classList.contains("empty_cell");)r=this.shiftCellCoords(r,o,u,!0),i=!0}catch(t){r=this.cellCoords}this.setFocusMode(!1),this.shouldDirectionBeAlternated(r)?(this.alternateDirection(),i&&(this.cellCoords=r),i=!1):this.cellCoords=r,this.followCellZoom(n),this.currentWord=this.updateCurrentWord(),this.setFocusMode(!0),this.updateDefinitionsListPos()}},{key:"handleEnterPress",value:function(t){var e=t.target.classList;e.contains("def")?(t.target.click(),t.target.blur(),this.zoomToggle.checked&&(this.doNotHandleStandardCellClick=!0,Interaction.getCellElement(this.cellCoords).click())):e.contains("toggle")?(t.target.click(),t.target.blur()):e.contains("grid")?Interaction.toggleCellTabIndices(!0):e.contains("non_empty_cell")&&t.target.click()}},{key:"handleEnterKeybindPress",value:function(t){Interaction.unfocusActiveElement(),this.hideDropdowns();var e=t.shiftKey?gridOp.REVEAL:"check";this.doSpecialButtonAction(opMagnitude.WORD,e,!1)}},{key:"handleSpacebarPress",value:function(t){t.preventDefault(),this.setFocusMode(!1),this.alternateDirection(),this.currentWord=this.updateCurrentWord(),this.setFocusMode(!0),this.updateDefinitionsListPos()}},{key:"handleEscapePress",value:function(t){null==t||t.preventDefault(),Interaction.unfocusActiveElement(),this.hideDropdowns(),this.setFocusMode(!1),this.zoomOut(),this.cellCoords=null,this.currentWord=null}},{key:"crosswordCompletionHandler",value:function(){var t=this;this.isCrosswordComplete()&&Interaction.sleep(1).then((function(){t.handleEscapePress(null),t.togglePopup("completion_popup"),t.jazz.play()}))}},{key:"doSpecialButtonAction",value:function(t,e){var u=this,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if((!(arguments.length>2&&void 0!==arguments[2])||arguments[2])&&this.onDropdownClick(e+"_dropdown"),null===this.cellCoords&&t!==opMagnitude.GRID)return alert(this.errMsgs[0]);switch(t){case opMagnitude.CELL:var n=Interaction.getCellElement(this.cellCoords);this.doGridOperation(n,e),e===gridOp.REVEAL&&this.handleCellShift(modes.ENTER,n);break;case opMagnitude.WORD:var r,i=this.isWordEmpty(),s=_createForOfIteratorHelper(this.getWordElements());try{for(s.s();!(r=s.n()).done;){var l=r.value;this.doGridOperation(l,e)}}catch(t){s.e(t)}finally{s.f()}this.wordToggle.checked&&(e===gridOp.REVEAL?this.shiftWordSelection(null,arrowKeys[3]):e===gridOp.CLEAR&&i&&this.shiftWordSelection(null,arrowKeys[2]));break;case opMagnitude.GRID:document.querySelectorAll(".non_empty_cell").forEach((function(t){return u.doGridOperation(t,e,o)}))}e!==gridOp.CLEAR&&(e===gridOp.REVEAL&&this.crosswordCompletionHandler(),this.saveGridState())}},{key:"doGridOperation",value:function(t,e){var u=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e===gridOp.REVEAL?(t.classList.remove("wrong"),this.setValue(t,t.getAttribute("data-value")),t.classList.add("lock_in")):e===gridOp.CHECK?Interaction.isEmpty(t)||(t.hasCorrectValue()?t.classList.add("lock_in"):t.classList.add("wrong")):e===gridOp.CLEAR&&(u&&!t.classList.contains("lock_in")||!u)&&(t.classList.remove("lock_in"),t.classList.remove("wrong"),this.setValue(t,"",this.doNotSaveGridState))}},{key:"shouldDirectionBeAlternated",value:function(t){return this.shiftCellCoords(t,this.direction,modes.ENTER).isEqualTo(t)&&this.shiftCellCoords(t,this.direction,modes.DEL).isEqualTo(t)}},{key:"setFocusMode",value:function(t){null!==this.cellCoords&&(this.changeWordFocus(t),this.changeCellFocus(t),this.changeDefinitionsListItemFocus(t))}},{key:"changeWordFocus",value:function(t){var e,u=_createForOfIteratorHelper(this.getWordElements());try{for(u.s();!(e=u.n()).done;){e.value.style.backgroundColor=t?this.colourPalette.WORD_FOCUS:this.colourPalette.SUB}}catch(t){u.e(t)}finally{u.f()}}},{key:"changeCellFocus",value:function(t){return this.saveGridState(),Interaction.getCellElement(this.cellCoords).style.backgroundColor=t?this.colourPalette.CELL_FOCUS:this.colourPalette.SUB}},{key:"changeDefinitionsListItemFocus",value:function(t){return this.getDefinitionsListItemFromWord().style.backgroundColor=t?this.colourPalette.WORD_FOCUS:""}},{key:"updateCurrentWord",value:function(){var t,e="",u=_createForOfIteratorHelper(this.getWordElements());try{for(u.s();!(t=u.n()).done;){e+=t.value.getAttribute("data-value")}}catch(t){u.e(t)}finally{u.f()}return e.toUpperCase()}},{key:"getWordElements",value:_regeneratorRuntime().mark((function t(){var e,u,o,n,r,i;return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=this.getWordIndices(),u=_slicedToArray(e,2),o=u[0],n=u[1],r=o;case 2:if(!(r<=n)){t.next=9;break}return i=this.isDown?[r,this.staticIndex]:[this.staticIndex,r],t.next=6,Interaction.getCellElement(i);case 6:r++,t.next=2;break;case 9:case"end":return t.stop()}}),t,this)}))},{key:"getWordIndices",value:function(){var t=_slicedToArray(this.cellCoords,2),e=t[0],u=t[1];this.isDown=this.direction===this.directions[1],this.staticIndex=this.isDown?u:e;for(var o=_slicedToArray(this.isDown?[e,e]:[u,u],2),n=o[0],r=o[1];n>0&&this.grid[this.isDown?n-1:e][this.isDown?u:n-1]!=this.empty;)n--;for(;r0&&void 0!==arguments[0]&&arguments[0],u=Array.from({length:this.dimensions},(function(){return Array(t.dimensions).fill(t.empty)})),o=structuredClone(u);return document.querySelectorAll(".non_empty_cell").forEach((function(t){var n=parseInt(t.getAttribute("data-row")),r=parseInt(t.getAttribute("data-column")),i=t.childNodes[0].nodeValue.toUpperCase();if(u[n][r]=i,e){var s="";t.classList.contains("wrong")?s="wrong":t.classList.contains("lock_in")&&(s="lock_in"),o[n][r]=s}})),e?[u,o]:u}},{key:"setCompoundInput",value:function(t){this.compoundInputActive=!0,t||(this.wasEmpty=!0);var e=Interaction.getCellElement(this.cellCoords);e.onclick=function(t){return Interaction.dummyCellClick(t)},this.setValue(e,"");var u=document.createElement("input");u.value=t,u.type="text",u.classList.add("compound_input"),e.appendChild(u),u.focus()}},{key:"handleSetCompoundInput",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(null===this.cellCoords)return alert(this.errMsgs[0]);if(document.getElementsByClassName("compound_input")[0])return this.removeCompoundInput(t);var e=Interaction.getCellElement(this.cellCoords).childNodes,u=e[0].nodeValue;e.length>1&&(e[1].style.display="none"),this.setCompoundInput(u)}},{key:"removeCompoundInput",value:function(){var t=this,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.compoundInputActive){var u=document.getElementsByClassName("compound_input")[0],o=u.parentElement,n=u.value;0!==n.length&&n[0].match(onlyLangRegex)||(n=""),u.remove(),this.setValue(o,n[0]);var r=o.childNodes;r.length>1&&(r[1].style.display="inline"),o.onclick=function(e){return t.onCellClick(e,o)},o.classList.remove("lock_in","wrong"),this.compoundInputActive=!1,this.currentPlaceholder=0,this.checkToggle.checked&&this.doGridOperation(o,gridOp.CHECK),e&&this.handleCellShift(modes.ENTER,o)}}},{key:"cycleCompoundInputPlaceholderText",value:function(){var t=document.getElementsByClassName("compound_input")[0];void 0!==t&&(t.placeholder=compoundInputPlaceholders[this.currentPlaceholder],this.currentPlaceholder===compoundInputPlaceholders.length-1?this.currentPlaceholder=0:this.currentPlaceholder+=1)}},{key:"removeCompoundInputIfRequired",value:function(t){this.compoundInputActive&&t!==Interaction.getCellElement(this.cellCoords)&&this.removeCompoundInput()}},{key:"followCellZoom",value:function(t){if(1===document.querySelectorAll(".non_empty_cell.selectedZoomTarget").length){var e=Interaction.getCellElement(this.cellCoords);if(e!==t)return this.doNotHandleStandardCellClick=!0,e.click()}}},{key:"handleClick",value:function(t){t.target.closest(".special_button, .dropdown, .dropdown_button")||(this.hideDropdowns(),this.removeCompoundInput(!1))}},{key:"handleFocusOut",value:function(t){var e,u,o,n,r,i,s,l,a,c,D,d;(null!==(e=t.relatedTarget)&&void 0!==e&&e.classList.contains("grid")||null!==(u=t.target)&&void 0!==u&&u.classList.contains("non_empty_cell")&&(null===(o=t.relatedTarget)||void 0===o||!o.classList.contains("non_empty_cell")))&&Interaction.toggleCellTabIndices(!1),(null===(n=t.relatedTarget)||void 0===n||!n.classList.contains("dropdown_button")||null!==(r=t.target)&&void 0!==r&&r.classList.contains("dropdown_button")&&null!==(i=t.relatedTarget)&&void 0!==i&&i.classList.contains("special_button")&&(null===(s=t.relatedTarget)||void 0===s||!s.id.startsWith(null===(l=this.currentDropdown)||void 0===l?void 0:l.substring(0,null===(a=this.currentDropdown)||void 0===a?void 0:a.indexOf("_"))))||null!==(c=t.target.id)&&void 0!==c&&c.endsWith("button")&&(null!==(D=t.relatedTarget)&&void 0!==D&&null!==(D=D.id)&&void 0!==D&&D.endsWith("button")||null===(d=t.relatedTarget)||void 0===d||null===(d=d.classList)||void 0===d||!d.contains("dropdown_button")))&&this.hideDropdowns()}},{key:"hideDropdowns",value:function(){document.querySelectorAll(".dropdown").forEach((function(t){return t.classList.remove("show_dropdown")})),document.querySelectorAll(".special_button").forEach((function(t){return t.innerHTML=t.innerHTML.replace("▲","▼")})),this.currentDropdown=null}},{key:"onDropdownClick",value:function(t){this.removeCompoundInput(!1);var e=document.getElementById(t);if(t===this.currentDropdown)return this.hideDropdowns(),void(this.currentDropdown=null);this.hideDropdowns();var u=document.getElementById(t.replace("_dropdown","_button"));u.innerHTML=u.innerHTML.replace("▼","▲"),e.classList.add("show_dropdown"),this.currentDropdown=t}},{key:"togglePopup",value:function(t){var e,u=t===popupData.COMPLETION[0]?popupData.COMPLETION[1]:popupData.ONLOAD[1];t===popupData.COMPLETION[0]?(this.completionPopupToggled=!this.completionPopupToggled,e=this.completionPopupToggled):t===popupData.ONLOAD[0]&&(this.onloadPopupToggled=!this.onloadPopupToggled,e=this.onloadPopupToggled),document.getElementById("blur").classList.toggle("active"),document.getElementById(t).classList.toggle("active"),e?(Interaction.toggleAllTabIndices(!1),Interaction.sleep(501).then((function(){return document.getElementsByClassName(u)[0].focus({focusVisible:!0})}))):Interaction.toggleAllTabIndices(!0)}},{key:"preventZoomIfRequired",value:function(t){document.getElementById("tz").checked&&!this.preventInitialLIZoom||(this.preventInitialLIZoom=!1,t.stopImmediatePropagation())}},{key:"setValue",value:function(t,e){var u=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t.childNodes[0].nodeValue=e,u||this.saveGridState()}}],[{key:"toggleCellTabIndices",value:function(t){var e;document.querySelectorAll(".non_empty_cell").forEach((function(u,o){u.tabIndex=t?"0":"-1",0===o&&(e=u)})),t&&e.focus({focusVisible:!0})}},{key:"toggleAllTabIndices",value:function(t){document.querySelectorAll('[tabindex="'.concat(t?"-1":"0",'"]:not(.non_empty_cell):not(.right_side)')).forEach((function(e){e.tabIndex=t?"0":"-1"}))}},{key:"getDefByNumber",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],u=document.querySelector('[data-num="'.concat(t,'"'));return e&&u.click(),u}},{key:"dummyCellClick",value:function(t){return t.stopImmediatePropagation()}},{key:"unfocusActiveElement",value:function(){document.activeElement.blur()}},{key:"sleep",value:function(t){return new Promise((function(e){return setTimeout(e,t)}))}},{key:"isEmpty",value:function(t){var e;return!(null!=t&&null!==(e=t.childNodes[0])&&void 0!==e&&e.nodeValue)}},{key:"getCellElement",value:function(t){return document.querySelector('[data-row="'.concat(t[0],'"][data-column="').concat(t[1],'"]'))}},{key:"updateCellCoords",value:function(t){return[parseInt(t.getAttribute("data-row")),parseInt(t.getAttribute("data-column"))]}},{key:"configureScrollHeights",value:function(){var t=document.querySelector(".definitions_a"),e=document.querySelector(".definitions_d");document.getElementById("return_def_zoom").style.height=Math.max(t.scrollHeight,e.scrollHeight)+"px";var u=document.getElementById("no_scroll");u.scrollHeight-1>u.clientHeight&&(u.style.overflowY="auto")}}])}(),Cookies=function(){return _createClass((function t(){_classCallCheck(this,t)}),null,[{key:"setCookie",value:function(t,e,u){var o=new Date;o.setTime(o.getTime()+24*u*60*60*1e3);var n="expires="+o.toUTCString();document.cookie="".concat(t,"=").concat(e,";").concat(n,";path=/;SameSite=Lax")}},{key:"getCookie",value:function(t){for(var e=t+"=",u=document.cookie.split(";"),o=0;o @@ -129,7 +128,7 @@ -
+
{# Compound button #}
@@ -354,7 +353,7 @@

{{ _('Crossword Puzzle - Game') }}

@@ -365,7 +364,7 @@

{{ _('You completed the crossword!') }}