Re-lock word form if dictionary is completed.
Broke out Lock and Unlock word form functions for use elsewhere.
This commit is contained in:
parent
7cf5eeb252
commit
cb9041c7ca
53
js/ui.js
53
js/ui.js
|
@ -209,25 +209,40 @@ function ToggleWordFormLock() {
|
|||
var wordForm = document.getElementById("wordEntryForm");
|
||||
|
||||
if (wordFormIsLocked()) { //If it is already locked, change it to Unlocked and get everything working as it needs to.
|
||||
var wordFormWidth = wordForm.offsetWidth - 20;
|
||||
var leftColumnWidth = leftColumn.offsetWidth;
|
||||
var leftColumnHeight = leftColumn.offsetHeight;
|
||||
|
||||
lockButton.innerHTML = "🔓";
|
||||
|
||||
wordForm.style.position = "fixed";
|
||||
wordForm.style.top = document.getElementsByTagName("header")[0].offsetHeight.toString() + "px";
|
||||
wordForm.style.width = wordFormWidth.toString() + "px";
|
||||
|
||||
leftColumn.style.width = leftColumnWidth.toString() + "px";
|
||||
leftColumn.style.height = leftColumnHeight.toString() + "px";
|
||||
UnlockWordForm();
|
||||
} else {
|
||||
lockButton.innerHTML = "🔒";
|
||||
leftColumn.removeAttribute('style');
|
||||
wordForm.removeAttribute('style');
|
||||
LockWordForm();
|
||||
}
|
||||
}
|
||||
|
||||
function UnlockWordForm() {
|
||||
var lockButton = document.getElementById("formLockButton");
|
||||
var leftColumn = document.getElementById("leftColumn");
|
||||
var wordForm = document.getElementById("wordEntryForm");
|
||||
var wordFormWidth = wordForm.offsetWidth - 20;
|
||||
var leftColumnWidth = leftColumn.offsetWidth;
|
||||
var leftColumnHeight = leftColumn.offsetHeight;
|
||||
|
||||
lockButton.innerHTML = "🔓"; // Change to the "Unlocked lock" icon.
|
||||
|
||||
wordForm.style.position = "fixed";
|
||||
wordForm.style.top = document.getElementsByTagName("header")[0].offsetHeight.toString() + "px";
|
||||
wordForm.style.width = wordFormWidth.toString() + "px";
|
||||
|
||||
leftColumn.style.width = leftColumnWidth.toString() + "px";
|
||||
leftColumn.style.height = leftColumnHeight.toString() + "px";
|
||||
}
|
||||
|
||||
function LockWordForm() {
|
||||
var lockButton = document.getElementById("formLockButton");
|
||||
var leftColumn = document.getElementById("leftColumn");
|
||||
var wordForm = document.getElementById("wordEntryForm");
|
||||
|
||||
lockButton.innerHTML = "🔒"; // Change to the "locked" icon.
|
||||
leftColumn.removeAttribute('style');
|
||||
wordForm.removeAttribute('style');
|
||||
}
|
||||
|
||||
function CloseUpdateConflictArea(displayId) {
|
||||
displayId = (typeof displayId !== 'undefined' && displayId != null) ? displayId : false;
|
||||
if (displayId != false) {
|
||||
|
@ -422,7 +437,13 @@ function ShowFilterWordCount(numberOfWords) {
|
|||
|
||||
function HideSettings() {
|
||||
document.getElementById("settingsScreen").style.display = "none";
|
||||
document.getElementById("wordEntryForm").style.display = (currentDictionary.settings.isComplete) ? "none" : "block";
|
||||
if (currentDictionary.settings.isComplete) {
|
||||
LockWordForm();
|
||||
document.getElementById("wordEntryForm").style.display = "none";
|
||||
} else {
|
||||
document.getElementById("wordEntryForm").style.display = "block";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function NewWordNotification(word) {
|
||||
|
|
Loading…
Reference in New Issue