Multireddit to link

Convert a new-style multireddit to an old-style link

  1. // ==UserScript==
  2. // @name Multireddit to link
  3. // @namespace https://nucular.github.io
  4. // @version 0.2
  5. // @description Convert a new-style multireddit to an old-style link
  6. // @author nucular
  7. // @match https://www.reddit.com/*/m/*
  8. // @grant none
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. $("<a></a>")
  16. .attr("href",
  17. "https://www.reddit.com/r/" +
  18. $(".titlebox.multi-details .subreddits li").map(function(i, li) {
  19. return $(li).find("a").attr("href").match(/\/r\/(.+)/)[1];
  20. }).toArray().join("+")
  21. )
  22. .attr("target", "__new")
  23. .css("margin-right", "12px")
  24. .append(
  25. $("<button>multilink</button>")
  26. )
  27. .prependTo(
  28. $(".titlebox.multi-details .gray-buttons.settings .spacer")
  29. );
  30. })();