Skip to content

Instantly share code, notes, and snippets.

@leoossa
Last active December 8, 2022 12:13
Show Gist options
  • Select an option

  • Save leoossa/deeb8e6fd948ff99fbe6f42a25141d6c to your computer and use it in GitHub Desktop.

Select an option

Save leoossa/deeb8e6fd948ff99fbe6f42a25141d6c to your computer and use it in GitHub Desktop.

Revisions

  1. leoossa revised this gist Jul 26, 2021. 1 changed file with 21 additions and 19 deletions.
    40 changes: 21 additions & 19 deletions AlternativeTo.OP.js
    Original file line number Diff line number Diff line change
    @@ -1,21 +1,23 @@
    javascript: (function() {
    let currBuildId = window.__NEXT_DATA__.buildId;
    let alternativesCount = window.__NEXT_DATA__.props.pageProps.appsTotal;
    let pageNavigation = document.querySelector('nav[aria-label="Pagination Navigation"]');
    pageNavigation.remove();
    let appListParent = document.querySelector('li[data-testid]').parentElement;
    let pageCount = window.__NEXT_DATA__.props.pageProps.pagingMeta.totalPages;
    let alternativesApps = [];
    let container = document.createElement("div");
    for (i = 2; i <= pageCount; i++) {
    fetch(window.location.href + "?p=" + i).then(res => {
    return res.text();
    }).then(data => {
    container.innerHTML = data;
    alternativesApps = container.querySelectorAll("li[data-testid]");
    alternativesApps.forEach(item => {
    appListParent.appendChild(item);
    })
    const appListParent = document.querySelector('li[data-testid]').parentElement;
    let alternativesApps = [];
    document.querySelector('nav[aria-label="Pagination Navigation"]').remove(); // Remove navigation links
    const container = document.createElement("div");
    for (i = 2; i <= window.__NEXT_DATA__.props.pageProps.pagingMeta.totalPages; i++)
    {
    fetch(window.location.href + "?p=" + i).then(res =>
    {
    return res.text();
    }).then(data =>
    {
    container.innerHTML = data;
    alternativesApps = container.querySelectorAll("li[data-testid]");
    alternativesApps.forEach(item =>
    {
    appListParent.appendChild(item);
    });
    }
    })();
    });
    }
    const metaspansCount = document.querySelectorAll('span.meta').length;
    document.querySelectorAll('span.meta')[metaspansCount - 1].parentNode.remove(); // remove last span that contains 'navigation progress'
    })();
  2. leoossa created this gist Mar 13, 2021.
    21 changes: 21 additions & 0 deletions AlternativeTo.OP.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    javascript: (function() {
    let currBuildId = window.__NEXT_DATA__.buildId;
    let alternativesCount = window.__NEXT_DATA__.props.pageProps.appsTotal;
    let pageNavigation = document.querySelector('nav[aria-label="Pagination Navigation"]');
    pageNavigation.remove();
    let appListParent = document.querySelector('li[data-testid]').parentElement;
    let pageCount = window.__NEXT_DATA__.props.pageProps.pagingMeta.totalPages;
    let alternativesApps = [];
    let container = document.createElement("div");
    for (i = 2; i <= pageCount; i++) {
    fetch(window.location.href + "?p=" + i).then(res => {
    return res.text();
    }).then(data => {
    container.innerHTML = data;
    alternativesApps = container.querySelectorAll("li[data-testid]");
    alternativesApps.forEach(item => {
    appListParent.appendChild(item);
    })
    });
    }
    })();