import _ from './anime-client.js'; // Click on hidden MAL checkbox so // that MAL id is passed _.on('main', 'change', '.big-check', (e) => { const id = e.target.id; document.getElementById(`mal_${id}`).checked = true; }); /** * On search results with an existing library entry, this shows that fact, with an edit link for the existing * library entry * * @param {'anime'|'manga'} type * @param {Object} item * @param isCollection * @returns {String} */ function renderEditLink (type, item, isCollection = false) { if (isCollection || item.libraryEntry === null) { return ''; } return `
[ Already in List ]
Edit
 
` } /** * Show the search results for a media item * * @param {'anime'|'manga'} type * @param {Object} data * @param {boolean} isCollection * @returns {String} */ export function renderSearchResults (type, data, isCollection = false) { return data.map(item => { const titles = item.titles.join('
'); let disabled = item.libraryEntry !== null ? 'disabled' : ''; const editLink = renderEditLink(type, item, isCollection); if (isCollection) { disabled = ''; } return ` `; }).join(''); }