Comment out unused pagination code

- The unused code kept getting bundled, so this should prevent that.
This commit is contained in:
Robbie Antenesse 2020-08-03 22:58:29 -06:00
parent 4318f90263
commit 34459b40a4
2 changed files with 36 additions and 36 deletions

View File

@ -4,11 +4,11 @@ import { getHomonymnNumber, hasToken } from '../utilities';
import { getMatchingSearchWords, highlightSearchTerm, getSearchFilters, getSearchTerm } from '../search'; import { getMatchingSearchWords, highlightSearchTerm, getSearchFilters, getSearchTerm } from '../search';
import { import {
setupWordOptionButtons, setupWordOptionButtons,
setupPagination, // setupPagination,
setupWordOptionSelections, setupWordOptionSelections,
setupWordEditFormButtons, setupWordEditFormButtons,
} from '../setupListeners/words'; } from '../setupListeners/words';
import { getPaginationData } from '../pagination'; // import { getPaginationData } from '../pagination';
import { getOpenEditForms, translateOrthography, parseReferences, getWordReferenceMarkdown } from '../wordManagement'; import { getOpenEditForms, translateOrthography, parseReferences, getWordReferenceMarkdown } from '../wordManagement';
import { renderAd } from '../ads'; import { renderAd } from '../ads';
import { getPublicLink } from '../account/utilities'; import { getPublicLink } from '../account/utilities';
@ -136,25 +136,25 @@ export function renderWords() {
// renderPagination(words); // renderPagination(words);
} }
export function renderPagination(filteredWords) { // export function renderPagination(filteredWords) {
const paginationData = getPaginationData(filteredWords); // const paginationData = getPaginationData(filteredWords);
if (paginationData.pages > 0) { // if (paginationData.pages > 0) {
let paginationHTML = (paginationData.currentPage > 0 ? '<span class="button prev-button">&laquo; Previous</span>' : '') // let paginationHTML = (paginationData.currentPage > 0 ? '<span class="button prev-button">&laquo; Previous</span>' : '')
+ '<select class="page-selector">'; // + '<select class="page-selector">';
for (let i = 0; i < paginationData.pages; i++) { // for (let i = 0; i < paginationData.pages; i++) {
paginationHTML += `<option value="${i}"${paginationData.currentPage === i ? ' selected' : ''}>Page ${i + 1}</option>`; // paginationHTML += `<option value="${i}"${paginationData.currentPage === i ? ' selected' : ''}>Page ${i + 1}</option>`;
} // }
paginationHTML += '</select>' // paginationHTML += '</select>'
+ (paginationData.currentPage < paginationData.pages - 1 ? '<span class="button next-button">Next &raquo;</span>' : ''); // + (paginationData.currentPage < paginationData.pages - 1 ? '<span class="button next-button">Next &raquo;</span>' : '');
Array.from(document.getElementsByClassName('pagination')).forEach(pagination => { // Array.from(document.getElementsByClassName('pagination')).forEach(pagination => {
pagination.innerHTML = paginationHTML; // pagination.innerHTML = paginationHTML;
}); // });
setupPagination(); // setupPagination();
} // }
} // }
export function renderEditForm(wordId = false) { export function renderEditForm(wordId = false) {
wordId = typeof wordId.target === 'undefined' ? wordId : parseInt(this.id.replace('edit_', '')); wordId = typeof wordId.target === 'undefined' ? wordId : parseInt(this.id.replace('edit_', ''));

View File

@ -1,6 +1,6 @@
import { renderEditForm } from '../render/words'; import { renderEditForm } from '../render/words';
import { confirmEditWord, cancelEditWord, confirmDeleteWord, expandAdvancedForm, submitWordForm } from '../wordManagement'; 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 { setupMaximizeButtons } from './buttons';
import { setupIPAFields } from '.'; import { setupIPAFields } from '.';
@ -98,22 +98,22 @@ export function setupMobileWordFormButton() {
}); });
} }
export function setupPagination() { // export function setupPagination() {
const nextButtons = document.getElementsByClassName('next-button'), // const nextButtons = document.getElementsByClassName('next-button'),
prevButtons = document.getElementsByClassName('prev-button'), // prevButtons = document.getElementsByClassName('prev-button'),
pageSelectors = document.getElementsByClassName('page-selector'); // pageSelectors = document.getElementsByClassName('page-selector');
Array.from(nextButtons).forEach(nextButton => { // Array.from(nextButtons).forEach(nextButton => {
nextButton.removeEventListener('click', goToNextPage); // nextButton.removeEventListener('click', goToNextPage);
nextButton.addEventListener('click', goToNextPage); // nextButton.addEventListener('click', goToNextPage);
}); // });
Array.from(prevButtons).forEach(prevButton => { // Array.from(prevButtons).forEach(prevButton => {
prevButton.removeEventListener('click', goToPreviousPage); // prevButton.removeEventListener('click', goToPreviousPage);
prevButton.addEventListener('click', goToPreviousPage); // prevButton.addEventListener('click', goToPreviousPage);
}); // });
Array.from(pageSelectors).forEach(pageSelector => { // Array.from(pageSelectors).forEach(pageSelector => {
pageSelector.removeEventListener('change', goToPage); // pageSelector.removeEventListener('change', goToPage);
pageSelector.addEventListener('change', goToPage); // pageSelector.addEventListener('change', goToPage);
}); // });
} // }