您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds an option to the Github PR review page to mark moved files as viewed.
// ==UserScript== // @name Github PR review: mark moved files as viewed // @description Adds an option to the Github PR review page to mark moved files as viewed. // @include https://github.com/* // @license GPLv2 // @version 1 // @grant none // @namespace https://greatest.deepsurf.us/users/13329 // ==/UserScript== function should_mark(file) { if (file.dataset.fileDeleted === 'true') { return true; } const changes = file.getElementsByClassName('diffstat')[0].childNodes[0].textContent.trim(); if (changes === '0' || changes === 'BIN') { return true; } } function mark_moved_files(event) { event.preventDefault(); for (const file of document.getElementsByClassName('file')) { if (should_mark(file)) { const checkbox = file.getElementsByClassName('js-reviewed-checkbox')[0]; if (!checkbox.checked) { checkbox.click(); } } } return false; } function add_checkbox(callback) { const submit_button = document.getElementById('whitespace-cb-lg')?.form?.elements?.[5]; if (!submit_button) { return; } const button = document.createElement('button'); button.addEventListener('click', callback); button.setAttribute('class', 'btn-sm btn'); button.setAttribute('id', 'ignore-moved-files'); button.append(document.createTextNode('Mark moved files as read')); submit_button.parentNode.insertBefore(button, submit_button); } function init() { add_checkbox(mark_moved_files); } window.addEventListener('DOMContentLoaded', init);