F-Droid QR code generator

Generate QR codes for F-Droid packages

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        F-Droid QR code generator
// @namespace   Xenokore
// @match       https://f-droid.org/*/packages/*
// @grant       none
// @version     1.0
// @author      Yani
// @description Generate QR codes for F-Droid packages
// @require     https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js
// @license     MIT
// ==/UserScript==

(function () {

    // Find the existing sidebar element
    var sidebar = document.querySelector('.sidebar');

    // Check if the sidebar exists before appending
    if (sidebar) {

        // Create a new sidebar widget for the QR code
        var qrWidget = document.createElement('div');
        qrWidget.className = 'sidebar-widget';
        qrWidget.id = 'qr-code';
        sidebar.appendChild(qrWidget);

        // Create the QR Code
        new QRCode(qrWidget, document.location.href);
    }
}());