Skip to content

Commit c1997ab

Browse files
committed
Fixed issues after recent layout updates. Fixes jerone#111
Signed-off-by: Jeroen van Warmerdam <jeronevw@hotmail.com>
1 parent 1232e0f commit c1997ab

2 files changed

Lines changed: 8 additions & 12 deletions

File tree

Github_Pull_Request_From/Github_Pull_Request_From.user.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@
1111
// @updateURL https://github.com/jerone/UserScripts/raw/master/Github_Pull_Request_From/Github_Pull_Request_From.user.js
1212
// @supportURL https://github.com/jerone/UserScripts/issues
1313
// @contributionURL https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW
14-
// @version 16
14+
// @version 17
1515
// @grant none
1616
// @include https://github.com/*/*
1717
// ==/UserScript==
18-
/* global unsafeWindow */
1918

20-
(function(unsafeWindow) {
19+
(function() {
2120

2221
String.format = function(string) {
2322
var args = Array.prototype.slice.call(arguments, 1, arguments.length);
@@ -27,8 +26,8 @@
2726
};
2827

2928
function init() {
30-
var repo = document.querySelector(".entry-title a[data-pjax]").textContent,
31-
author = document.querySelector('.entry-title .author').textContent;
29+
var repo = document.querySelector('.repohead-details-container h1 [itemprop="name"]').textContent,
30+
author = document.querySelector('.repohead-details-container h1 [itemprop="author"]').textContent;
3231
Array.prototype.filter.call(document.querySelectorAll("span.commit-ref"), function(treeSpan) {
3332
return !treeSpan.querySelector(".unknown-repo");
3433
}).forEach(function(treeSpan) {
@@ -49,13 +48,9 @@
4948
}
5049

5150
// Page load;
52-
console.log('GithubPullRequestFromLink', 'page load');
5351
init();
5452

5553
// On pjax;
56-
unsafeWindow.$(document).on("pjax:end", function() {
57-
console.log('GithubPullRequestFromLink', 'pjax');
58-
init();
59-
});
54+
document.addEventListener('pjax:end', init);
6055

61-
})(typeof unsafeWindow !== "undefined" ? unsafeWindow : window);
56+
})();

Github_Pull_Request_From/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Make pull request branches linkable.
2323

2424
## Version History
2525

26+
* **17**
27+
* Fixed issues after recent layout updates (fixes https://github.com/jerone/UserScripts/issues/111);
2628
* **16**
2729
* Show underline (fixes https://github.com/jerone/UserScripts/issues/93);
2830
* **15**
@@ -45,7 +47,6 @@ Make pull request branches linkable.
4547
* https://github.com/jerone/UserScripts/pull/12 (2 valid, 1 missing);
4648
* https://github.com/jerone/UserScripts/pull/29 (1 mine, 1 extern);
4749
* https://github.com/jerone/UserScripts/pull/47 (3 without username);
48-
* https://github.com/atom/timecop/pull/12 (1 with invalid url chars);
4950

5051

5152
## Contributions

0 commit comments

Comments
 (0)