| 1 | // ==UserScript== |
| 2 | // @name Bugzilla Coq autolink |
| 3 | // @namespace CoqScript |
| 4 | // @include https://coq.inria.fr/bugs/* |
| 5 | // @description Makes #XXXX into links to Github Coq PRs |
| 6 | // @version 1 |
| 7 | // @grant none |
| 8 | // ==/UserScript== |
| 9 | |
| 10 | var regex = /#(\d+)/g; |
| 11 | var substr = '<a href="https://github.com/rocq-prover/rocq/pull/$1">$&</a>'; |
| 12 | |
| 13 | function doNode(node) |
| 14 | { |
| 15 | node.innerHTML = node.innerHTML.replace(regex,substr); |
| 16 | } |
| 17 | |
| 18 | var comments = document.getElementsByClassName("bz_comment_table")[0]; |
| 19 | var pars = comments.getElementsByClassName("bz_comment_text"); |
| 20 | |
| 21 | for(var j=0; j<pars.length; j++) |
| 22 | { |
| 23 | doNode(pars[j]); |
| 24 | } |
| 25 |