Greasy Fork by-site-searching URL autoextract

Automatically extract the domain name from an input URL.

  1. // ==UserScript==
  2. // @name Greasy Fork by-site-searching URL autoextract
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Automatically extract the domain name from an input URL.
  6. // @author shiquda
  7. // @match https://greasyfork.org/*/scripts/by-site
  8. // @grant none
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14. var tab = document.querySelector("body > div.width-constraint > section > form > input[type=search]:nth-child(2)")
  15. tab.addEventListener("input",change)
  16. function change(){
  17. var text = tab.value
  18. var change = text.match(/^https?:\/\/(?:www\.)?([^/?#]+)/i)[1]
  19. tab.value = change
  20. }
  21. // Your code here...
  22. })();