Skip to content

Instantly share code, notes, and snippets.

@yuya
Created June 27, 2018 06:11
Show Gist options
  • Save yuya/b6caf3a42f1cc1c5fd54f2983ac61739 to your computer and use it in GitHub Desktop.
Save yuya/b6caf3a42f1cc1c5fd54f2983ac61739 to your computer and use it in GitHub Desktop.
javascript:(function(){if(/https:\/\/github.+\/milestone\/\d+/.test(location.href)){var c=[],d=/(#\d+)/;[].slice.call(document.querySelectorAll(".opened-by")).forEach(function(a){a=a.innerText.match(d);a.length&&c.push(a[1])});(function(a){var b=document.createElement("textarea");b.textContent=a;document.body.appendChild(b);b.select();document.execCommand("copy");document.body.removeChild(b)})(c.join("\n"));alert("\u30af\u30ea\u30c3\u30d7\u30dc\u30fc\u30c9\u306b\u30b3\u30d4\u30fc\u3057\u307e\u3057\u305f")}else alert("Error: \u5404 milestone \u306e\u753b\u9762\u306b\u3066\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044")})();
;(function () {
if (!/https\:\/\/github.+\/milestone\/\d+/.test(location.href)) {
alert("Error: 各 milestone の画面にて実行してください");
return;
}
function copyToClipboard(str) {
var textarea = document.createElement("textarea");
textarea.textContent = str;
document.body.appendChild(textarea);
textarea.select();
document.execCommand("copy");
document.body.removeChild(textarea);
}
var idList = [];
var regex = /(\#\d+)/;
[].slice.call(document.querySelectorAll(".opened-by")).forEach(function (itr) {
var matched = (itr.innerText).match(regex);
if (!matched.length) {
return;
}
idList.push(matched[1]);
});
copyToClipboard(idList.join("\n"));
alert("クリップボードにコピーしました");
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment