Skip to content

Instantly share code, notes, and snippets.

@gn-spawn
Created June 3, 2023 09:27
Show Gist options
  • Save gn-spawn/df4a4c767ed972bbd39fc3184862a854 to your computer and use it in GitHub Desktop.
Save gn-spawn/df4a4c767ed972bbd39fc3184862a854 to your computer and use it in GitHub Desktop.
特定の時間でmergeしたくないときにmerge messageを非表示にする
// ==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