Created
June 3, 2023 09:27
-
-
Save gn-spawn/df4a4c767ed972bbd39fc3184862a854 to your computer and use it in GitHub Desktop.
特定の時間でmergeしたくないときにmerge messageを非表示にする
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 Hide Button during specific time | |
// @namespace http://your-namespace.com | |
// @version 1.0 | |
// @description Hide a specific button during a specific time range | |
// @match https://github.com/gaudiy/gaudiy-monorepo/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
const targetButtonSelector = 'div.merge-message'; // 対象のボタンのセレクター | |
const startTime = 7; // 非表示開始時刻(24時間形式、例: 7時) | |
const endTime = 21; // 非表示終了時刻(24時間形式、例: 21時) | |
const currentTime = new Date().getHours(); | |
function hideButton() { | |
const targetButton = document.querySelector(targetButtonSelector); | |
if (targetButton) { | |
targetButton.style.display = 'none'; | |
} else { | |
setTimeout(hideButton, 500); // ボタンが見つからない場合、500ミリ秒後に再試行する | |
} | |
} | |
if (currentTime >= startTime && currentTime <= endTime) { | |
hideButton(); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment