Skip to content

Instantly share code, notes, and snippets.

@ta1kt0me
Forked from sinsoku/unhighlignter.js
Last active July 25, 2019 09:26
Show Gist options
  • Save ta1kt0me/a2787d74a83ed2734de734772728ab0d to your computer and use it in GitHub Desktop.
Save ta1kt0me/a2787d74a83ed2734de734772728ab0d to your computer and use it in GitHub Desktop.
WIP Pull Request Unhighlignter for GitHub が使えなくなったので、 Tampermonkey の UserScript で再実装した
// ==UserScript==
// @name WIP Pull Request Unhighlignter
// @author sinsoku
// @version 0.4.1
// @match https://github.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
var unhighlignter = function() {
if (!location.pathname.match(/pulls$/)) {
return;
}
var pulls = document.querySelectorAll('[id^="issue"]');
var wipPulls = Array.from(pulls).filter(function(el) {
// TODO: draft may be normal keyword
return el.textContent.match(/wip|draft/i);
});
wipPulls.forEach(function(el) {
el.style.backgroundColor = 'lightgray';
el.style.opacity = 0.7;
});
};
window.addEventListener('load', unhighlignter);
window.addEventListener('pjax:end', unhighlignter);
var observer = new MutationObserver(unhighlignter);
var body = document.querySelector('body');
observer.observe(body, { childList: true, subtree: true});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment