Clickable GameFAQs Links

Turns URL text in posts into clickable links.

目前为 2014-05-11 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Clickable GameFAQs Links
  3. // @description Turns URL text in posts into clickable links.
  4. // @namespace http://userscripts.org/users/527104
  5. // @include *gamefaqs.com/boards/*
  6. // @version 1.1.1
  7. // @grant none
  8. // ==/UserScript==
  9.  
  10. var regex = /(https?\:\/\/)+[\w\.\/\-\?=\(\)]*/gi;
  11.  
  12. $("td.msg").each(function() {
  13. var text = $(this).html();
  14. $(this).html(text.replace(regex, function(match) {
  15. console.log(match);
  16. return "<a href='" + match + "' target='_blank'>" + match + "</a>";
  17. }));
  18. });