Consolidate HG WordPress plugins
This commit is contained in:
commit
dccb8ed9bd
18 files changed
+1701
No files matched your search
@@ -0,0 +1,22 @@
|
||||
(() => {
|
||||
for (const feed of document.querySelectorAll('.hgsf-feed')) {
|
||||
const button = feed.querySelector('.hgsf-more');
|
||||
if (!button) continue;
|
||||
|
||||
const tiles = [...feed.querySelectorAll('.hgsf-grid > li')];
|
||||
const batchSize = Number(feed.dataset.hgsfLimit);
|
||||
let visible = batchSize;
|
||||
|
||||
for (const tile of tiles.slice(visible)) tile.hidden = true;
|
||||
button.hidden = false;
|
||||
|
||||
button.addEventListener('click', () => {
|
||||
const nextBatch = tiles.slice(visible, visible + batchSize);
|
||||
for (const tile of nextBatch) tile.hidden = false;
|
||||
visible += nextBatch.length;
|
||||
button.hidden = visible === tiles.length;
|
||||
const firstTile = nextBatch[0];
|
||||
(firstTile.querySelector('a') || firstTile).focus();
|
||||
});
|
||||
}
|
||||
})();
|
||||
Reference in new issue
Block a user