Comment out unused pagination code
- The unused code kept getting bundled, so this should prevent that.
This commit is contained in:
parent
4318f90263
commit
34459b40a4
|
@ -4,11 +4,11 @@ import { getHomonymnNumber, hasToken } from '../utilities';
|
|||
import { getMatchingSearchWords, highlightSearchTerm, getSearchFilters, getSearchTerm } from '../search';
|
||||
import {
|
||||
setupWordOptionButtons,
|
||||
setupPagination,
|
||||
// setupPagination,
|
||||
setupWordOptionSelections,
|
||||
setupWordEditFormButtons,
|
||||
} from '../setupListeners/words';
|
||||
import { getPaginationData } from '../pagination';
|
||||
// import { getPaginationData } from '../pagination';
|
||||
import { getOpenEditForms, translateOrthography, parseReferences, getWordReferenceMarkdown } from '../wordManagement';
|
||||
import { renderAd } from '../ads';
|
||||
import { getPublicLink } from '../account/utilities';
|
||||
|
@ -136,25 +136,25 @@ export function renderWords() {
|
|||
// renderPagination(words);
|
||||
}
|
||||
|
||||
export function renderPagination(filteredWords) {
|
||||
const paginationData = getPaginationData(filteredWords);
|
||||
// export function renderPagination(filteredWords) {
|
||||
// const paginationData = getPaginationData(filteredWords);
|
||||
|
||||
if (paginationData.pages > 0) {
|
||||
let paginationHTML = (paginationData.currentPage > 0 ? '<span class="button prev-button">« Previous</span>' : '')
|
||||
+ '<select class="page-selector">';
|
||||
for (let i = 0; i < paginationData.pages; i++) {
|
||||
paginationHTML += `<option value="${i}"${paginationData.currentPage === i ? ' selected' : ''}>Page ${i + 1}</option>`;
|
||||
}
|
||||
paginationHTML += '</select>'
|
||||
+ (paginationData.currentPage < paginationData.pages - 1 ? '<span class="button next-button">Next »</span>' : '');
|
||||
// if (paginationData.pages > 0) {
|
||||
// let paginationHTML = (paginationData.currentPage > 0 ? '<span class="button prev-button">« Previous</span>' : '')
|
||||
// + '<select class="page-selector">';
|
||||
// for (let i = 0; i < paginationData.pages; i++) {
|
||||
// paginationHTML += `<option value="${i}"${paginationData.currentPage === i ? ' selected' : ''}>Page ${i + 1}</option>`;
|
||||
// }
|
||||
// paginationHTML += '</select>'
|
||||
// + (paginationData.currentPage < paginationData.pages - 1 ? '<span class="button next-button">Next »</span>' : '');
|
||||
|
||||
Array.from(document.getElementsByClassName('pagination')).forEach(pagination => {
|
||||
pagination.innerHTML = paginationHTML;
|
||||
});
|
||||
// Array.from(document.getElementsByClassName('pagination')).forEach(pagination => {
|
||||
// pagination.innerHTML = paginationHTML;
|
||||
// });
|
||||
|
||||
setupPagination();
|
||||
}
|
||||
}
|
||||
// setupPagination();
|
||||
// }
|
||||
// }
|
||||
|
||||
export function renderEditForm(wordId = false) {
|
||||
wordId = typeof wordId.target === 'undefined' ? wordId : parseInt(this.id.replace('edit_', ''));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { renderEditForm } from '../render/words';
|
||||
import { confirmEditWord, cancelEditWord, confirmDeleteWord, expandAdvancedForm, submitWordForm } from '../wordManagement';
|
||||
import { goToNextPage, goToPreviousPage, goToPage } from '../pagination';
|
||||
// import { goToNextPage, goToPreviousPage, goToPage } from '../pagination';
|
||||
import { setupMaximizeButtons } from './buttons';
|
||||
import { setupIPAFields } from '.';
|
||||
|
||||
|
@ -98,22 +98,22 @@ export function setupMobileWordFormButton() {
|
|||
});
|
||||
}
|
||||
|
||||
export function setupPagination() {
|
||||
const nextButtons = document.getElementsByClassName('next-button'),
|
||||
prevButtons = document.getElementsByClassName('prev-button'),
|
||||
pageSelectors = document.getElementsByClassName('page-selector');
|
||||
// export function setupPagination() {
|
||||
// const nextButtons = document.getElementsByClassName('next-button'),
|
||||
// prevButtons = document.getElementsByClassName('prev-button'),
|
||||
// pageSelectors = document.getElementsByClassName('page-selector');
|
||||
|
||||
Array.from(nextButtons).forEach(nextButton => {
|
||||
nextButton.removeEventListener('click', goToNextPage);
|
||||
nextButton.addEventListener('click', goToNextPage);
|
||||
});
|
||||
Array.from(prevButtons).forEach(prevButton => {
|
||||
prevButton.removeEventListener('click', goToPreviousPage);
|
||||
prevButton.addEventListener('click', goToPreviousPage);
|
||||
});
|
||||
// Array.from(nextButtons).forEach(nextButton => {
|
||||
// nextButton.removeEventListener('click', goToNextPage);
|
||||
// nextButton.addEventListener('click', goToNextPage);
|
||||
// });
|
||||
// Array.from(prevButtons).forEach(prevButton => {
|
||||
// prevButton.removeEventListener('click', goToPreviousPage);
|
||||
// prevButton.addEventListener('click', goToPreviousPage);
|
||||
// });
|
||||
|
||||
Array.from(pageSelectors).forEach(pageSelector => {
|
||||
pageSelector.removeEventListener('change', goToPage);
|
||||
pageSelector.addEventListener('change', goToPage);
|
||||
});
|
||||
}
|
||||
// Array.from(pageSelectors).forEach(pageSelector => {
|
||||
// pageSelector.removeEventListener('change', goToPage);
|
||||
// pageSelector.addEventListener('change', goToPage);
|
||||
// });
|
||||
// }
|
Loading…
Reference in New Issue