|
|
| (9 intermediate revisions by the same user not shown) |
| Line 1: |
Line 1: |
| | | {{Seitenkopf|Bibliography Backbone}} |
| | |
| {{#dpl: | |
| |category = Media Pages | |
| |include = {MediaInfo}:publication:year:illustrator:chapter:illustration:title:tags:[[%TITLE%]]
| |
| |table = class="wikitable datatable hover" id="DPL"
| |
| data-layout='{"top1Start":"searchBuilder"}'
| |
| data-language='<nowiki>{"searchPlaceholder":" Quick Search", "search":"", "searchBuilder":{"add":"Add Search Condition"}}</nowiki>'
| |
| data-page-length="50",-,Publication, Year, Illustrator, Chapter, Illustration, Title, Tags,ID
| |
| |tablerow=style="width:5%;"¦%%, %%, style="width:5%;"¦%%, %%, style="width:5%;"¦%%, style="width:5%;"¦%%, class="type" style="width:5%;"¦%%,
| |
| style="width:5%;"¦%%, style="width:5%;"¦%%
| |
| |ordermethod = title
| |
| |order=ascending
| |
| }} | |
| <html> | | <html> |
| <hr> | | <p> |
| | | <button id="generateCatalogHTML">Create Raw HTML</button> |
| <button id="generateCatalogHTML"> | | </p> |
| Generate static Catalog HTML from DPL
| |
| </button> | |
| | |
| <pre id="catalogOutput"
| |
| style="white-space:pre-wrap; max-height:600px; overflow:auto; background:#f8f8f8; padding:1em;">
| |
| </pre>
| |
| <script>
| |
| (function () {
| |
| | |
| function extractFileIdFromHref(href) {
| |
| if (!href) return null;
| |
| | |
| // title=Hf_1885_kmb_ch001_ill1.jpg
| |
| const match = href.match(/title=([^&]+)/i);
| |
| if (!match) return null;
| |
| | |
| return decodeURIComponent(match[1])
| |
| .replace(/\.jpg$/i, '')
| |
| .toLowerCase();
| |
| }
| |
| | |
| function buildRow(d) {
| |
| return `
| |
| <tr>
| |
| <td align="left"><font face="Liberation Serif">${d.book}</font></td>
| |
| <td align="right" sdnum="1031;" sdval="${d.year}">
| |
| <font face="Liberation Serif">${d.year}</font>
| |
| </td>
| |
| <td align="left"><font face="Liberation Serif">${d.illustrator}</font></td>
| |
| <td align="center" sdval="${d.chapter}">
| |
| <font face="Liberation Serif">${d.chapter}</font>
| |
| </td>
| |
| <td align="center" sdval="${d.chapter}">
| |
| <font face="Liberation Serif">${d.chapter}</font>
| |
| </td>
| |
| <td align="center" sdval="${d.illustration}">
| |
| <font face="Liberation Serif">${d.illustration}</font>
| |
| </td>
| |
| <td align="left"><font face="Liberation Serif">${d.title}</font></td>
| |
| <td align="left"><font face="Liberation Serif">-${d.tags.replace(/,\s*/g, ' -')}</font></td>
| |
| <td align="left">
| |
| <a href="/index.php/Special:Redirect/file/${d.file}.jpg">${d.file}</a>
| |
| </td>
| |
| </tr>`;
| |
| }
| |
| | |
| document.getElementById('generateCatalogHTML')
| |
| .addEventListener('click', function () {
| |
| | |
| const table = document.getElementById('DPL');
| |
| if (!table) {
| |
| alert('DPL table not found');
| |
| return;
| |
| }
| |
| | |
| const rows = table.querySelectorAll('tr');
| |
| if (rows.length < 2) {
| |
| alert('No data rows found in DPL table');
| |
| return;
| |
| }
| |
| | |
| let out = [];
| |
| | |
| rows.forEach((row, i) => {
| |
| if (i === 0) return; // Skip header row
| |
| | |
| const cells = row.querySelectorAll('td');
| |
| if (cells.length < 8) return;
| |
| | |
| const link = cells[0].querySelector('a');
| |
| const fileId = extractFileIdFromHref(link?.href);
| |
| if (!fileId) return;
| |
| | |
| out.push(buildRow({
| |
| file: fileId,
| |
| book: cells[1].innerText.trim(),
| |
| year: cells[2].innerText.trim(),
| |
| illustrator: cells[3].innerText.trim(),
| |
| chapter: cells[4].innerText.trim(),
| |
| illustration: cells[5].innerText.trim(),
| |
| title: cells[6].innerText.trim(),
| |
| tags: cells[7].innerText.trim()
| |
| }));
| |
| });
| |
| | |
| const html = `
| |
| <table id="catalog" class="wikitable" style="width:100%">
| |
| <thead>
| |
| <tr>
| |
| <th>Book</th>
| |
| <th>Year</th>
| |
| <th>Illustrator</th>
| |
| <th>Og.Chpt.</th>
| |
| <th>Chpt.</th>
| |
| <th>Ill. in Chpt.</th>
| |
| <th>Illustration Title</th>
| |
| <th>Tags</th>
| |
| <th>ID</th>
| |
| </tr>
| |
| </thead>
| |
| <tbody>
| |
| ${out.join('\n')}
| |
| </tbody>
| |
| </table>`.trim();
| |
| | |
| document.getElementById('catalogOutput').textContent = html;
| |
| });
| |
|
| |
|
| })();
| | <textarea id="outputHTML" style="width:100%; height:600px; font-family:monospace;"></textarea> |
| </script> | |
|
| |
|
| | <div id="status" style="margin-top:10px;"></div> |
| </html> | | </html> |