Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions GitHub_Commit_Compare/GitHub_Commit_Compare.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// @namespace https://github.com/jerone/UserScripts
// @description Add controls to compare commits.
// @author jerone
// @contributor darkred

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

// @copyright 2017+, jerone (http://jeroenvanwarmerdam.nl)
// @license GPL-3.0
// @homepage https://github.com/jerone/UserScripts/tree/master/GitHub_Commit_Compare
Expand All @@ -16,7 +17,7 @@
// @include https://github.com/*/*/commits/*
// @exclude https://github.com/*/*.diff
// @exclude https://github.com/*/*.patch
// @version 0.0.1
// @version 0.0.2
// @grant none
// ==/UserScript==

Expand Down Expand Up @@ -143,9 +144,9 @@
const repo = document.querySelector('meta[property="og:url"]').content;

const compareA = document.querySelector('.GitHubCommitCompareButtonAB [name="GitHubCommitCompareButtonA"]:checked');
const hashA = compareA.parentNode.parentNode.parentNode.querySelector('[data-clipboard-text]').dataset.clipboardText;
const hashA = compareA.parentNode.parentNode.parentNode.querySelector('clipboard-copy').value;
const compareB = document.querySelector('.GitHubCommitCompareButtonAB [name="GitHubCommitCompareButtonB"]:checked');
const hashB = compareB.parentNode.parentNode.parentNode.querySelector('[data-clipboard-text]').dataset.clipboardText;
const hashB = compareB.parentNode.parentNode.parentNode.querySelector('clipboard-copy').value;

const a = document.getElementById('GitHubCommitCompareButton');
a.setAttribute('href', `${repo}/compare/${hashA}...${hashB}`);
Expand Down
13 changes: 13 additions & 0 deletions GitHub_Commit_Compare/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@ Add controls to compare commits.

## Version History

* **0.0.2**

* 🐛 Fix after GitHub site update (fixed by [@darkred](https://github.com/darkred) in [#128](https://github.com/jerone/UserScripts/issues/128)).

* **0.0.1**

* Initial version.

## Contributors

* [darkred](https://github.com/darkred)

## External links

* [Greasy Fork](https://greasyfork.org/en/scripts/33563-github-commit-compare)
* [OpenUserJS](https://openuserjs.org/scripts/jerone/GitHub_Commit_Compare)