Redirect userstyles.org to uso.kkx.one (UserStyles.org Archive)

Makes userstyles.org actually usable

  1. // ==UserScript==
  2. // @name Redirect userstyles.org to uso.kkx.one (UserStyles.org Archive)
  3. // @namespace https://gf.qytechs.cn/users/124677-pabli
  4. // @version 0.4
  5. // @description Makes userstyles.org actually usable
  6. // @author Pabli
  7. // @license MIT
  8. // @match http*://userstyles.org/*
  9. // @match http*://uso.kkx.one/*
  10. // @run-at document-start
  11. // @icon https://www.google.com/s2/favicons?sz=64&domain=https://uso.kkx.one
  12. // @grant none
  13. // ==/UserScript==
  14.  
  15. if (window.location.hostname == 'userstyles.org' && window.location.search != '?noredirect') {
  16.  
  17. let path = window.location.pathname.split('/')
  18. let p
  19.  
  20. path[3] == 'newest-styles' ? p = 'browse/styles?sort=created' :
  21. path[3] == 'recently-updated' ? p = 'browse/styles?sort=updated' :
  22. path[3] == 'editors-choice' ? p = 'browse/styles?sort=rating' :
  23. path[2] == 'browse' && !path[3] ? p = 'browse/styles' :
  24. path[2] == 'browse' ? p = 'browse/styles?search=%23' + path[3] :
  25. path[1] == 'user-profile' ? p = 'browse/styles?search=%40' + path[2] :
  26. path[1] == 'categories' ? p = 'browse/categories' :
  27. path[1] == 'styles' ? p = 'style/' + path[2] : p = ''
  28.  
  29. location.href = 'https://uso.kkx.one/' + p
  30. }
  31. // Make "View on UserStyles.org" button work without disabling the script
  32. if (window.location.hostname == 'uso.kkx.one') {
  33.  
  34. let observer = new MutationObserver(mutations => {
  35. let btn = document.querySelector('.container a[href^="https://userstyles.org/styles"]:not([href$="?noredirect"])')
  36. if (btn) {
  37. let title = document.querySelector('.container > h1').innerText
  38. title = title.replaceAll(/\W+/g, '-').replace(/-$/, '').toLowerCase()
  39. btn.href += '/' + title + '?noredirect'
  40. }
  41. })
  42. observer.observe(document.body, { childList: true, subtree: true })
  43.  
  44. }

QingJ © 2025

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