Show link to word after adding it and focus on Word field.
Only for newly added words.
This commit is contained in:
parent
7fb4dfbb70
commit
6e9d11ec0c
|
@ -26,12 +26,10 @@ if ($_GET['adminoverride'] == 'dictionarytotext') {
|
|||
</div>
|
||||
</header>
|
||||
<contents>
|
||||
<?php if ($notificationMessage) { ?>
|
||||
<div id="notificationArea">
|
||||
<div id="notificationArea" style="display:<?php echo (($notificationMessage) ? "block" : "none"); ?>;">
|
||||
<span id="notificationCloseButton" class="clickable" onclick="document.getElementById('notificationArea').style.display='none';">Close</span>
|
||||
<?php echo $notificationMessage; ?>
|
||||
<div id="notificationMessage"><?php echo $notificationMessage; ?></div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div id="leftColumn">
|
||||
<form id="wordEntryForm">
|
||||
<label><span>Word</span>
|
||||
|
|
|
@ -103,10 +103,11 @@ function AddWord() {
|
|||
}
|
||||
} else {
|
||||
currentDictionary.words.push({name: word, pronunciation: pronunciation, partOfSpeech: partOfSpeech, simpleDefinition: simpleDefinition, longDefinition: longDefinition, wordId: currentDictionary.nextWordId++});
|
||||
FocusAfterAddingNewWord();
|
||||
NewWordNotification(word);
|
||||
SaveAndUpdateDictionary(false);
|
||||
}
|
||||
|
||||
|
||||
errorMessageArea.innerHTML = "";
|
||||
} else {
|
||||
if (word == "") {
|
||||
|
|
12
js/ui.js
12
js/ui.js
|
@ -99,4 +99,16 @@ function SetPartsOfSpeech () {
|
|||
function HideSettings() {
|
||||
document.getElementById("settingsScreen").style.display = "none";
|
||||
document.getElementById("wordEntryForm").style.display = (currentDictionary.settings.isComplete) ? "none" : "block";
|
||||
}
|
||||
|
||||
function NewWordNotification(word) {
|
||||
var notificationArea = document.getElementById("notificationArea");
|
||||
var notificationMessage = document.getElementById("notificationMessage");
|
||||
var wordId = currentDictionary.nextWordId - 1;
|
||||
notificationArea.style.display = "block";
|
||||
notificationMessage.innerHTML = "New Word Added: <a href='#" + wordId.toString() + "'>" + word + "</a>";
|
||||
}
|
||||
|
||||
function FocusAfterAddingNewWord() {
|
||||
document.getElementById("word").focus();
|
||||
}
|
Loading…
Reference in New Issue