Plugins at WordPress.org: TasteWP Link

Userscript adds TasteWP link below the download button on WordPress.org for easy access to plugin sandbox testing.

  1. // ==UserScript==
  2. // @name Plugins at WordPress.org: TasteWP Link
  3. // @namespace cvladan.com
  4. // @match https://*wordpress.org/plugins/*
  5. // @run-at document-start
  6. // @inject-into content
  7. // @grant none
  8. // @version 1.0
  9. // @license MIT
  10. // @author Vladan Colovic
  11. // @description Userscript adds TasteWP link below the download button on WordPress.org for easy access to plugin sandbox testing.
  12. // ==/UserScript==
  13.  
  14. var css = `
  15.  
  16. a.tastewp-button {
  17. display: block;
  18. width: fit-content;
  19. font-size: 0.6rem;
  20. color: currentColor;
  21. margin: 4px auto 0 auto;
  22. font-style: italic;
  23. padding: 0 0 0 45px;
  24. }
  25.  
  26. `
  27.  
  28. /* Inject CSS in document head */
  29.  
  30. function injectStyle(css) {
  31. var doc = document;
  32. var script = document.createElement('style');
  33. script.textContent = css;
  34.  
  35. var where = doc.getElementsByTagName ('head')[0] || doc.body || doc.documentElement;
  36. where.appendChild(script);
  37. }
  38.  
  39. injectStyle(css)
  40.  
  41.  
  42. /* Insert PluginTests.com link */
  43.  
  44. document.addEventListener('DOMContentLoaded', function() {
  45.  
  46. const currentUrl = window.location.href.split('#')[0].split('?')[0].replace(/\/$/, ''); // cleanup and remove trailing slash
  47. const pluginSlug = currentUrl.split("/").pop();
  48.  
  49. const a = document.createElement("a");
  50. a.href = "https://tastewp.com/create/NMS/8.2/6.2/create-block-theme,missing-menu-items," + pluginSlug + "/blocksy/WP_DEBUG,WP_DEBUG_LOG,WP_DEBUG_DISPLAY,CONCATENATE_SCRIPTS";
  51. a.className = "tastewp-button";
  52. a.textContent = "Run PHP 8.2 @ TasteWP.com";
  53.  
  54. const downloadButton = document.querySelector("a.download-button");
  55.  
  56. if (downloadButton) {
  57. downloadButton.after(a);
  58. }
  59.  
  60. });

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址