// ==UserScript== // @name F-Droid.org: F-Droid Supplemental! // @namespace a-pav // @description Adds links to Google Play, F-Droid Archive (by IzzySoft) and Izzy Repo for the packages. // @description Adds required android version and last update date of app to top of page. // @description Press '/' to trigger search and more.. // @match *://f-droid.org/* // @version 1.0 // @run-at document-end // @author a-pav // @grant none // @icon https://f-droid.org/assets/favicon-32x32.png // @downloadURL none // ==/UserScript== // Set search input shortcut key function setSearchShortcut() { var searchInput = document.querySelector("div.search-input-wrp>input"); if (!searchInput) { return } searchInput.setAttribute("title", " press key / to search "); searchInput.setAttribute("placeholder", " / "); window.addEventListener('keyup', function(e) { if (e.key === "/") { // or e.which: 191 searchInput.focus(); } else if (e.key === "Escape") { // or e.which: 27 searchInput.blur(); } }); } // Set Info-Title (i.e. Required OS version, last pakckage update date) function setInfoTitle() { const infoTitleID = "info-title-summary"; var requiredOS = document.getElementsByClassName("package-version-requirement")[0].innerText.replace(/.*requires /, ""); var lastUpdated = document.getElementsByClassName("package-version-header")[0].innerText.replace(/.*Added on /, ""); var style = ` padding: 10px 0 0px 7px; border-left-style: groove; font-family: 'Roboto'; font-weight: bolder; cursor: pointer; `; document.querySelector("div.package-title").innerHTML += `
// ${requiredOS}
// Update: ${lastUpdated}
`; document.getElementById(infoTitleID).addEventListener('click', function() { document.getElementById("latest").scrollIntoView({behavior: "smooth"}); }); } // Set additional links function setAdditionalLinks() { var packageID = window.location.pathname.replace(/.*\/packages\//, "").split("/")[0]; document.querySelector('ul.package-links').innerHTML += ` `; } // Colapse permissions summary initially function collapsePerms() { document.getElementById("latest").querySelector(".package-version-permissions>details").removeAttribute("open"); } (function () { setSearchShortcut(); if (window.location.pathname.includes("/packages/")) { // visiting package page, then: setInfoTitle(); setAdditionalLinks(); collapsePerms(); } }());