Redirect WordPress Plugins to Instawp

Redirect WordPress plugin links to Instawp.io

От 27.07.2023. Виж последната версия.

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey, Greasemonkey или Violentmonkey.

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey или Violentmonkey.

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey или Violentmonkey.

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey или Userscripts.

За да инсталирате скрипта, трябва да инсталирате разширение като Tampermonkey.

За да инсталирате този скрипт, трябва да имате инсталиран скриптов мениджър.

(Вече имам скриптов мениджър, искам да го инсталирам!)

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

(Вече имам инсталиран мениджър на стиловете, искам да го инсталирам!)

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