Redirect WordPress Plugins to Instawp

Redirect WordPress plugin links to Instawp.io

Verze ze dne 27. 07. 2023. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Redirect WordPress Plugins to Instawp
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Redirect WordPress plugin links to Instawp.io
// @author       You
// @include      https://wordpress.org/plugins/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Function to redirect the URL to Instawp.io
    function redirectToInstawp(url) {
        var instawpURL = url.replace("https://wordpress.org/plugins/", "https://instawp.io/plugins/");
        window.location.href = instawpURL;
    }

    // Create a button element
    var redirectButton = document.createElement("button");
    redirectButton.textContent = "InstaWP";
    redirectButton.style.padding = "6px 20px";
    redirectButton.style.backgroundColor = "#005E54";
    redirectButton.style.color = "#fff";
    redirectButton.style.border = "1px solid #000";
    redirectButton.style.borderRadius = "3px";
    redirectButton.style.cursor = "pointer";
    redirectButton.style.transition = "background-color 0.3s ease";
    redirectButton.style.marginLeft = "20px";
    redirectButton.style.fontSize = "14.4px";

    // Add CSS hover effect
    redirectButton.addEventListener("mouseenter", function() {
        redirectButton.style.backgroundColor = "#337E76";
    });
    redirectButton.addEventListener("mouseleave", function() {
        redirectButton.style.backgroundColor = "#005E54";
    });

    // Add a click event listener to the button
    redirectButton.addEventListener("click", function() {
        // Get the current URL and redirect to Instawp
        redirectToInstawp(window.location.href);
    });

    // Find the "Download" button
    var downloadButton = document.querySelector('.plugin-actions a.plugin-download');

    // Insert the new button after the "Download" button
    if (downloadButton) {
        downloadButton.parentNode.insertBefore(redirectButton, downloadButton.nextSibling);
    }
})();