Compare commits

...

3 Commits

4 changed files with 17 additions and 12 deletions

View File

@ -245,13 +245,18 @@ export function importWords() {
definition: removeTags(row.definition).trim(), definition: removeTags(row.definition).trim(),
details: removeTags(row.explanation).trim(), details: removeTags(row.explanation).trim(),
wordId: getNextId(), wordId: getNextId(),
}, false, false, false); }, false);
importedWords.push(importedWord); importedWords.push(importedWord);
// Sort and save every 500 words, just in case something goes wrong on large imports
if (importedWords.length % 500 == 499) {
sortWords(false);
}
} }
}, },
complete: () => { complete: () => {
saveDictionary(false); sortWords(false);
renderAll(); renderAll();
importWordsField.value = ''; importWordsField.value = '';
document.getElementById('editModal').style.display = 'none'; document.getElementById('editModal').style.display = 'none';

View File

@ -1,4 +1,3 @@
import { addWord } from './wordManagement';
import { getCookie } from './StackOverflow/cookie'; import { getCookie } from './StackOverflow/cookie';
export function getNextId() { export function getNextId() {

View File

@ -173,6 +173,14 @@ export function submitWordForm() {
if (validateWord(word)) { if (validateWord(word)) {
addWord(word); addWord(word);
sortWords(true);
if (upload && hasToken()) {
import('./account/index.js').then(account => {
account.uploadWord(word);
});
}
clearWordForm(); clearWordForm();
} }
} }
@ -187,7 +195,7 @@ export function clearWordForm() {
document.getElementById('wordName').focus(); document.getElementById('wordName').focus();
} }
export function addWord(word, render = true, message = true, upload = true) { export function addWord(word, message = true) {
const timestamp = getTimestampInSeconds(); const timestamp = getTimestampInSeconds();
word.lastUpdated = timestamp; word.lastUpdated = timestamp;
word.createdOn = timestamp; word.createdOn = timestamp;
@ -195,13 +203,6 @@ export function addWord(word, render = true, message = true, upload = true) {
if (message) { if (message) {
addMessage(`<a href="#${word.wordId}">${word.name}</a> Created Successfully`, 30000); addMessage(`<a href="#${word.wordId}">${word.name}</a> Created Successfully`, 30000);
} }
sortWords(render);
if (upload && hasToken()) {
import('./account/index.js').then(account => {
account.uploadWord(word);
});
}
return word; return word;
} }

View File

@ -130,7 +130,7 @@ switch ($view) {
oldLoad && oldLoad(); oldLoad && oldLoad();
if (UpUp) { if (UpUp) {
UpUp.start({ UpUp.start({
'cache-version': '2.1.1', 'cache-version': '2.1.2',
'content-url': 'offline.html', 'content-url': 'offline.html',
'assets': [ 'assets': [
\"" . implode('","', $files) . "\" \"" . implode('","', $files) . "\"