Skip to content

Commit 0f16e7f

Browse files
gh-autoload-large-diffs.user.js
1 parent 912b62a commit 0f16e7f

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// ==UserScript==
2+
// @name GitHub Autoload Large Diffs
3+
// @namespace http://github.com/softwareengineerprogrammer
4+
// @version 0.1
5+
// @description I want to see large diffs
6+
// @author softwareengineerprogrammer
7+
// @match https://github.com/*/*/pull/*/files*
8+
// @grant none
9+
// @updateURL https://softwareengineerprogrammer.github.io/userscripts/gh-autoload-large-diffs.user.js
10+
// @downloadURL https://softwareengineerprogrammer.github.io/userscripts/gh-autoload-large-diffs.user.js
11+
// ==/UserScript==
12+
13+
(function() {
14+
'use strict';
15+
16+
setTimeout(function(){
17+
document.querySelectorAll('button.load-diff-button').forEach(it => {
18+
let doLoad = true;
19+
try{
20+
let viewedElt = it.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.querySelector('form.js-toggle-user-reviewed-file-form input[value="viewed"]')
21+
let isMarkedViewed = viewedElt.checked || false;
22+
console.log(it, viewedElt, isMarkedViewed)
23+
doLoad = !isMarkedViewed
24+
}catch(e){
25+
console.warning('Failed determine whether large diff file has been marked as viewed',e)
26+
}
27+
28+
if(doLoad) {
29+
it.click()
30+
}
31+
});
32+
}, 2000);
33+
})();

0 commit comments

Comments
 (0)