Clickable GameFAQs Links

Plaintext URLs in people's posts are linkified and open in a new tab when clicked.

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

  1. // ==UserScript==
  2. // @name Clickable GameFAQs Links
  3. // @namespace http://userscripts.org/users/527104
  4. // @include *gamefaqs.com/boards/*
  5. // @version 1.1
  6. // @grant none
  7. // @description Plaintext URLs in people's posts are linkified and open in a new tab when clicked.
  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. });