Last active
March 27, 2018 04:50
-
-
Save take-cheeze/98b8b65329f7dd237ca28ac8c348597c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Fix github assignee link | |
// @namespace http://github.com/take-cheeze | |
// @version 0.1 | |
// @description Fix GitHub assignee link in issue and PR page to issues list instead of profile link. | |
// @author @take-cheeze | |
// @include https://github.com/* | |
// @grant none | |
// @run-at document-end | |
// @updateURL https://gist.github.com/take-cheeze/98b8b65329f7dd237ca28ac8c348597c/raw/github.assignee_link.user.js | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const update_links = () => { | |
// console.log("github assignee link replace start:"); | |
const doms = document.querySelectorAll('.sidebar-assignee a:not([data-hovercard-user-id=""])'); | |
const repo_base = location.href.match(/github.com\/([^\/]+\/[^\/]+)/)[1]; | |
doms.forEach((v,k) => { | |
const replaced = `github.com/${repo_base}/issues?q=assignee%3A$1+is%3Aopen`; | |
v.href = v.href.replace(/github.com\/([^\/]+)$/, replaced); | |
// console.log(v.href); | |
}); | |
}; | |
update_links(); | |
setInterval(update_links, 1000); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment