Redirect WordPress Plugins to Instawp

Redirect WordPress plugin links to Instawp.io

Från och med 2023-07-27. Se den senaste versionen.

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         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);
    }
})();