Plugins at WordPress.org: PluginTests.com Link

Userscript adds PluginTests.com link below the download button on WordPress.org for quick plugin compatibility checks.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name        Plugins at WordPress.org: PluginTests.com Link
// @namespace   cvladan.com
// @match       https://*wordpress.org/plugins/*
// @run-at      document-start
// @inject-into content
// @grant       none
// @version     1.0
// @license     MIT
// @author      Vladan Colovic
// @description Userscript adds PluginTests.com link below the download button on WordPress.org for quick plugin compatibility checks.
// ==/UserScript==

var css = `

  a.plugintests-button {
    display: block;
    width: fit-content;
    font-size: 0.6rem;
    color: currentColor;
    margin: 4px auto 0 auto;
    font-style: italic;
    padding: 0 0 0 45px;
  }

`

/* Inject CSS in document head */

function injectStyle(css) {
	var doc = document;
  var script = document.createElement('style');
  script.textContent = css;

  var where = doc.getElementsByTagName ('head')[0] || doc.body || doc.documentElement;
  where.appendChild(script);
}

injectStyle(css)


/* Insert PluginTests.com link */

document.addEventListener('DOMContentLoaded', function() {

  const currentUrl = window.location.href.split('#')[0].split('?')[0].replace(/\/$/, ''); // cleanup and remove trailing slash
  const pluginSlug = currentUrl.split("/").pop();

  const a = document.createElement("a");
  a.href = "https://plugintests.com/plugins/wporg/" + pluginSlug + "/latest";
  a.className = "plugintests-button";
  a.textContent = "pluginTests.com";

  const downloadButton = document.querySelector("a.download-button");

  if (downloadButton) {
    downloadButton.after(a);
  }

});