Only split out html/md files;Fix page load problem
This commit is contained in:
parent
c0909343f6
commit
57ca675f7a
|
@ -372,30 +372,25 @@
|
||||||
<script src="//cdnjs.cloudflare.com/ajax/libs/UpUp/1.1.0/upup.min.js"></script>
|
<script src="//cdnjs.cloudflare.com/ajax/libs/UpUp/1.1.0/upup.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
window.onload = (function (oldLoad) {
|
window.onload = (function (oldLoad) {
|
||||||
return function () {
|
|
||||||
oldLoad && oldLoad();
|
oldLoad && oldLoad();
|
||||||
if (UpUp) {
|
if (UpUp) {
|
||||||
UpUp.start({
|
UpUp.start({
|
||||||
'cache-version': '2.0.0',
|
'cache-version': '2.0.0',
|
||||||
'content-url': 'offline.html',
|
'content-url': 'offline.html',
|
||||||
'assets': [
|
'assets': [
|
||||||
'src.8d47de22.js',
|
'src.c95c2dcd.js',
|
||||||
'main.3381ca43.css',
|
'main.3381ca43.css',
|
||||||
'help.ecc721dc.html',
|
'help.ecc721dc.html',
|
||||||
'privacy.5cbf7ea0.html',
|
'privacy.5cbf7ea0.html',
|
||||||
'terms.bcb4cecc.html',
|
'terms.bcb4cecc.html',
|
||||||
'usage.4a51122f.html',
|
'usage.4a51122f.html',
|
||||||
'ads.f4e0c99c.js',
|
|
||||||
'favicon.5d013634.png',
|
|
||||||
'ipa-table.6c5cf939.html',
|
'ipa-table.6c5cf939.html',
|
||||||
'papaparse.min.dab93fe4.js',
|
'favicon.5d013634.png',
|
||||||
],
|
],
|
||||||
'service-worker-url': 'upup.sw.min.js',
|
'service-worker-url': 'upup.sw.min.js',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
})(window.onload);
|
})(window.onload);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -20,12 +20,11 @@ function initialize() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
setupAds().then(() => renderAll());
|
setupAds();
|
||||||
|
renderAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
window.onload = (function (oldLoad) {
|
window.onload = (function (oldLoad) {
|
||||||
return function () {
|
|
||||||
oldLoad && oldLoad();
|
oldLoad && oldLoad();
|
||||||
initialize();
|
initialize();
|
||||||
}
|
|
||||||
})(window.onload);
|
})(window.onload);
|
|
@ -1,4 +1,3 @@
|
||||||
import { setupInfoModal } from "../setupListeners";
|
|
||||||
import { request } from "./helpers";
|
import { request } from "./helpers";
|
||||||
|
|
||||||
export function renderForgotPasswordForm() {
|
export function renderForgotPasswordForm() {
|
||||||
|
@ -24,6 +23,15 @@ export function renderForgotPasswordForm() {
|
||||||
setupInfoModal(modal);
|
setupInfoModal(modal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setupInfoModal(modal) {
|
||||||
|
const closeElements = modal.querySelectorAll('.modal-background, .close-button');
|
||||||
|
Array.from(closeElements).forEach(close => {
|
||||||
|
close.addEventListener('click', () => {
|
||||||
|
modal.parentElement.removeChild(modal);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function setupStartResetForm() {
|
function setupStartResetForm() {
|
||||||
document.getElementById('forgotPasswordSubmit').addEventListener('click', startPasswordReset);
|
document.getElementById('forgotPasswordSubmit').addEventListener('click', startPasswordReset);
|
||||||
}
|
}
|
||||||
|
@ -59,7 +67,10 @@ function startPasswordReset() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupPasswordResetForm() {
|
function setupPasswordResetForm() {
|
||||||
document.getElementById('newPasswordSubmit').addEventListener('click', submitPasswordReset);
|
const submitButton = document.getElementById('newPasswordSubmit');
|
||||||
|
if (submitButton) {
|
||||||
|
submitButton.addEventListener('click', submitPasswordReset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function submitPasswordReset() {
|
function submitPasswordReset() {
|
||||||
|
@ -97,8 +108,6 @@ function submitPasswordReset() {
|
||||||
}
|
}
|
||||||
|
|
||||||
window.onload = (function (oldLoad) {
|
window.onload = (function (oldLoad) {
|
||||||
return function () {
|
|
||||||
oldLoad && oldLoad();
|
oldLoad && oldLoad();
|
||||||
setupPasswordResetForm();
|
setupPasswordResetForm();
|
||||||
}
|
|
||||||
})(window.onload);
|
})(window.onload);
|
|
@ -1,12 +1,11 @@
|
||||||
import { DISPLAY_AD_EVERY } from '../constants.js';
|
import { DISPLAY_AD_EVERY } from '../constants.js';
|
||||||
|
import ads from '../../ads.json';
|
||||||
|
|
||||||
export function setupAds() {
|
export function setupAds() {
|
||||||
return import('../../ads.json').then(ads => {
|
|
||||||
const shuffle = (a, b) => Math.random() > 0.5 ? 1 : -1;
|
const shuffle = (a, b) => Math.random() > 0.5 ? 1 : -1;
|
||||||
const priority = ads.filter(ad => isActive(ad) && ad.isPriority).sort(shuffle);
|
const priority = ads.filter(ad => isActive(ad) && ad.isPriority).sort(shuffle);
|
||||||
const regular = ads.filter(ad => isActive(ad) && !ad.isPriority).sort(shuffle);
|
const regular = ads.filter(ad => isActive(ad) && !ad.isPriority).sort(shuffle);
|
||||||
window.ads = [...priority, ...regular];
|
window.ads = [...priority, ...regular];
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function isActive(ad) {
|
function isActive(ad) {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import papa from 'papaparse';
|
||||||
import { renderDictionaryDetails, renderPartsOfSpeech, renderAll, renderTheme } from "./render";
|
import { renderDictionaryDetails, renderPartsOfSpeech, renderAll, renderTheme } from "./render";
|
||||||
import { removeTags, cloneObject, getTimestampInSeconds, download, slugify } from "../helpers";
|
import { removeTags, cloneObject, getTimestampInSeconds, download, slugify } from "../helpers";
|
||||||
import { LOCAL_STORAGE_KEY, DEFAULT_DICTIONARY, MIGRATE_VERSION } from "../constants";
|
import { LOCAL_STORAGE_KEY, DEFAULT_DICTIONARY, MIGRATE_VERSION } from "../constants";
|
||||||
|
@ -203,7 +204,6 @@ export function importWords() {
|
||||||
if (importWordsField.files.length === 1) {
|
if (importWordsField.files.length === 1) {
|
||||||
if (confirm('Importing a CSV file with words will add all of the words in the file to your dictionary regardless of duplication!\nDo you want to continue?')) {
|
if (confirm('Importing a CSV file with words will add all of the words in the file to your dictionary regardless of duplication!\nDo you want to continue?')) {
|
||||||
addMessage('Importing words...');
|
addMessage('Importing words...');
|
||||||
import('papaparse').then(papa => {
|
|
||||||
const importedWords = [];
|
const importedWords = [];
|
||||||
papa.parse(importWordsField.files[0], {
|
papa.parse(importWordsField.files[0], {
|
||||||
header: true,
|
header: true,
|
||||||
|
@ -247,7 +247,6 @@ export function importWords() {
|
||||||
},
|
},
|
||||||
skipEmptyLines: true,
|
skipEmptyLines: true,
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -269,7 +268,6 @@ export function exportWords() {
|
||||||
addMessage('Exporting Words...');
|
addMessage('Exporting Words...');
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
import('papaparse').then(papa => {
|
|
||||||
const { name, specification } = window.currentDictionary;
|
const { name, specification } = window.currentDictionary;
|
||||||
|
|
||||||
const fileName = slugify(name + '_' + specification) + '_words.csv';
|
const fileName = slugify(name + '_' + specification) + '_words.csv';
|
||||||
|
@ -285,7 +283,6 @@ export function exportWords() {
|
||||||
});
|
});
|
||||||
const csv = papa.unparse(words, { quotes: true });
|
const csv = papa.unparse(words, { quotes: true });
|
||||||
download(csv, fileName, 'text/csv;charset=utf-8');
|
download(csv, fileName, 'text/csv;charset=utf-8');
|
||||||
});
|
|
||||||
}, 1);
|
}, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { showSearchModal, clearSearchText } from "./search";
|
||||||
import { saveAndCloseSettingsModal, openSettingsModal, saveSettings } from "./settings";
|
import { saveAndCloseSettingsModal, openSettingsModal, saveSettings } from "./settings";
|
||||||
import { saveAndCloseEditModal, openEditModal } from "./dictionaryManagement";
|
import { saveAndCloseEditModal, openEditModal } from "./dictionaryManagement";
|
||||||
import { addMessage, hideAllModals } from "./utilities";
|
import { addMessage, hideAllModals } from "./utilities";
|
||||||
|
import helpFile from '../markdown/help.md';
|
||||||
|
|
||||||
export function enableHotKeys() {
|
export function enableHotKeys() {
|
||||||
document.addEventListener('keydown', hotKeyActions);
|
document.addEventListener('keydown', hotKeyActions);
|
||||||
|
@ -102,9 +103,7 @@ function submitWord() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function showHelpModal() {
|
function showHelpModal() {
|
||||||
import('../markdown/help.md').then(html => {
|
renderInfoModal(helpFile);
|
||||||
renderInfoModal(html);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function maximizeTextarea() {
|
function maximizeTextarea() {
|
||||||
|
|
|
@ -17,6 +17,7 @@ import {
|
||||||
import { getPaginationData } from './pagination';
|
import { getPaginationData } from './pagination';
|
||||||
import { getOpenEditForms, parseReferences } from './wordManagement';
|
import { getOpenEditForms, parseReferences } from './wordManagement';
|
||||||
import { renderAd } from './ads';
|
import { renderAd } from './ads';
|
||||||
|
import ipaTableFile from './KeyboardFire/phondue/ipa-table.html';
|
||||||
|
|
||||||
export function renderAll() {
|
export function renderAll() {
|
||||||
renderTheme();
|
renderTheme();
|
||||||
|
@ -311,7 +312,6 @@ export function renderIPATable(ipaTableButton) {
|
||||||
ipaTableButton = typeof ipaTableButton.target === 'undefined' || ipaTableButton.target === '' ? ipaTableButton : ipaTableButton.target;
|
ipaTableButton = typeof ipaTableButton.target === 'undefined' || ipaTableButton.target === '' ? ipaTableButton : ipaTableButton.target;
|
||||||
const label = ipaTableButton.parentElement.innerText.replace(/(Field Help|IPA Chart)/g, '').trim();
|
const label = ipaTableButton.parentElement.innerText.replace(/(Field Help|IPA Chart)/g, '').trim();
|
||||||
const textBox = ipaTableButton.parentElement.querySelector('input');
|
const textBox = ipaTableButton.parentElement.querySelector('input');
|
||||||
import('./KeyboardFire/phondue/ipa-table.html').then(html => {
|
|
||||||
const modalElement = document.createElement('section');
|
const modalElement = document.createElement('section');
|
||||||
modalElement.classList.add('modal', 'ipa-table-modal');
|
modalElement.classList.add('modal', 'ipa-table-modal');
|
||||||
modalElement.innerHTML = `<div class="modal-background"></div>
|
modalElement.innerHTML = `<div class="modal-background"></div>
|
||||||
|
@ -319,7 +319,7 @@ export function renderIPATable(ipaTableButton) {
|
||||||
<a class="close-button">×︎</a>
|
<a class="close-button">×︎</a>
|
||||||
<header><label>${label} <input value="${textBox.value}" class="ipa-field"></label></header>
|
<header><label>${label} <input value="${textBox.value}" class="ipa-field"></label></header>
|
||||||
<section>
|
<section>
|
||||||
${html}
|
${ipaTableFile}
|
||||||
</section>
|
</section>
|
||||||
<footer><a class="button done-button">Done</a></footer>
|
<footer><a class="button done-button">Done</a></footer>
|
||||||
</div>`;
|
</div>`;
|
||||||
|
@ -328,7 +328,6 @@ export function renderIPATable(ipaTableButton) {
|
||||||
|
|
||||||
setupIPAFields();
|
setupIPAFields();
|
||||||
setupIPATable(modalElement, textBox);
|
setupIPATable(modalElement, textBox);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function renderMaximizedTextbox(maximizeButton) {
|
export function renderMaximizedTextbox(maximizeButton) {
|
||||||
|
|
|
@ -8,6 +8,9 @@ import { usePhondueDigraphs } from './KeyboardFire/phondue/ipaField';
|
||||||
import { openSettingsModal, saveSettingsModal, saveAndCloseSettingsModal } from './settings';
|
import { openSettingsModal, saveSettingsModal, saveAndCloseSettingsModal } from './settings';
|
||||||
import { enableHotKeys } from './hotkeys';
|
import { enableHotKeys } from './hotkeys';
|
||||||
import { showSearchModal, clearSearchText, checkAllPartsOfSpeechFilters, uncheckAllPartsOfSpeechFilters } from './search';
|
import { showSearchModal, clearSearchText, checkAllPartsOfSpeechFilters, uncheckAllPartsOfSpeechFilters } from './search';
|
||||||
|
import helpFile from '../markdown/help.md';
|
||||||
|
import termsFile from '../markdown/terms.md';
|
||||||
|
import privacyFile from '../markdown/privacy.md';
|
||||||
|
|
||||||
export default function setupListeners() {
|
export default function setupListeners() {
|
||||||
setupDetailsTabs();
|
setupDetailsTabs();
|
||||||
|
@ -357,19 +360,13 @@ export function setupMaximizeModal(modal, textBox) {
|
||||||
|
|
||||||
export function setupInfoButtons() {
|
export function setupInfoButtons() {
|
||||||
document.getElementById('helpInfoButton').addEventListener('click', () => {
|
document.getElementById('helpInfoButton').addEventListener('click', () => {
|
||||||
import('../markdown/help.md').then(html => {
|
renderInfoModal(helpFile);
|
||||||
renderInfoModal(html);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
document.getElementById('termsInfoButton').addEventListener('click', () => {
|
document.getElementById('termsInfoButton').addEventListener('click', () => {
|
||||||
import('../markdown/terms.md').then(html => {
|
renderInfoModal(termsFile);
|
||||||
renderInfoModal(html);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
document.getElementById('privacyInfoButton').addEventListener('click', () => {
|
document.getElementById('privacyInfoButton').addEventListener('click', () => {
|
||||||
import('../markdown/privacy.md').then(html => {
|
renderInfoModal(privacyFile);
|
||||||
renderInfoModal(html);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,8 @@ import setupListeners from './setupListeners';
|
||||||
import { setupAds } from '../ads';
|
import { setupAds } from '../ads';
|
||||||
|
|
||||||
function initialize() {
|
function initialize() {
|
||||||
setupAds().then(() => renderAll());
|
setupAds();
|
||||||
|
renderAll();
|
||||||
setupListeners();
|
setupListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
import {showSection, hideDetailsPanel} from './displayToggles';
|
import {showSection, hideDetailsPanel} from './displayToggles';
|
||||||
import { showSearchModal, clearSearchText, checkAllPartsOfSpeechFilters, uncheckAllPartsOfSpeechFilters } from './search';
|
import { showSearchModal, clearSearchText, checkAllPartsOfSpeechFilters, uncheckAllPartsOfSpeechFilters } from './search';
|
||||||
import { renderWords, renderInfoModal } from './render';
|
import { renderWords, renderInfoModal } from './render';
|
||||||
|
import helpFile from '../../markdown/help.md';
|
||||||
|
import termsFile from '../../markdown/terms.md';
|
||||||
|
import privacyFile from '../../markdown/privacy.md';
|
||||||
|
|
||||||
export default function setupListeners() {
|
export default function setupListeners() {
|
||||||
setupDetailsTabs();
|
setupDetailsTabs();
|
||||||
|
@ -79,19 +82,13 @@ export function setupSearchFilters() {
|
||||||
|
|
||||||
export function setupInfoButtons() {
|
export function setupInfoButtons() {
|
||||||
document.getElementById('helpInfoButton').addEventListener('click', () => {
|
document.getElementById('helpInfoButton').addEventListener('click', () => {
|
||||||
import('../../markdown/help.md').then(html => {
|
renderInfoModal(helpFile);
|
||||||
renderInfoModal(html);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
document.getElementById('termsInfoButton').addEventListener('click', () => {
|
document.getElementById('termsInfoButton').addEventListener('click', () => {
|
||||||
import('../../markdown/terms.md').then(html => {
|
renderInfoModal(termsFile);
|
||||||
renderInfoModal(html);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
document.getElementById('privacyInfoButton').addEventListener('click', () => {
|
document.getElementById('privacyInfoButton').addEventListener('click', () => {
|
||||||
import('../../markdown/privacy.md').then(html => {
|
renderInfoModal(privacyFile);
|
||||||
renderInfoModal(html);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue