Re-lock word form if dictionary is completed.

Broke out Lock and Unlock word form functions for use elsewhere.
This commit is contained in:
Robbie Antenesse 2016-02-24 13:07:32 -07:00
parent 7cf5eeb252
commit cb9041c7ca
1 changed files with 37 additions and 16 deletions

View File

@ -209,11 +209,21 @@ function ToggleWordFormLock() {
var wordForm = document.getElementById("wordEntryForm"); var wordForm = document.getElementById("wordEntryForm");
if (wordFormIsLocked()) { //If it is already locked, change it to Unlocked and get everything working as it needs to. if (wordFormIsLocked()) { //If it is already locked, change it to Unlocked and get everything working as it needs to.
UnlockWordForm();
} else {
LockWordForm();
}
}
function UnlockWordForm() {
var lockButton = document.getElementById("formLockButton");
var leftColumn = document.getElementById("leftColumn");
var wordForm = document.getElementById("wordEntryForm");
var wordFormWidth = wordForm.offsetWidth - 20; var wordFormWidth = wordForm.offsetWidth - 20;
var leftColumnWidth = leftColumn.offsetWidth; var leftColumnWidth = leftColumn.offsetWidth;
var leftColumnHeight = leftColumn.offsetHeight; var leftColumnHeight = leftColumn.offsetHeight;
lockButton.innerHTML = "🔓"; lockButton.innerHTML = "🔓"; // Change to the "Unlocked lock" icon.
wordForm.style.position = "fixed"; wordForm.style.position = "fixed";
wordForm.style.top = document.getElementsByTagName("header")[0].offsetHeight.toString() + "px"; wordForm.style.top = document.getElementsByTagName("header")[0].offsetHeight.toString() + "px";
@ -221,11 +231,16 @@ function ToggleWordFormLock() {
leftColumn.style.width = leftColumnWidth.toString() + "px"; leftColumn.style.width = leftColumnWidth.toString() + "px";
leftColumn.style.height = leftColumnHeight.toString() + "px"; leftColumn.style.height = leftColumnHeight.toString() + "px";
} else { }
lockButton.innerHTML = "🔒";
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'); leftColumn.removeAttribute('style');
wordForm.removeAttribute('style'); wordForm.removeAttribute('style');
}
} }
function CloseUpdateConflictArea(displayId) { function CloseUpdateConflictArea(displayId) {
@ -422,7 +437,13 @@ function ShowFilterWordCount(numberOfWords) {
function HideSettings() { function HideSettings() {
document.getElementById("settingsScreen").style.display = "none"; 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) { function NewWordNotification(word) {