|
11 | 11 | // @updateURL https://github.com/jerone/UserScripts/raw/master/Github_Pull_Request_From/Github_Pull_Request_From.user.js |
12 | 12 | // @supportURL https://github.com/jerone/UserScripts/issues |
13 | 13 | // @contributionURL https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW |
14 | | -// @version 16 |
| 14 | +// @version 17 |
15 | 15 | // @grant none |
16 | 16 | // @include https://github.com/*/* |
17 | 17 | // ==/UserScript== |
18 | | -/* global unsafeWindow */ |
19 | 18 |
|
20 | | -(function(unsafeWindow) { |
| 19 | +(function() { |
21 | 20 |
|
22 | 21 | String.format = function(string) { |
23 | 22 | var args = Array.prototype.slice.call(arguments, 1, arguments.length); |
|
27 | 26 | }; |
28 | 27 |
|
29 | 28 | 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; |
32 | 31 | Array.prototype.filter.call(document.querySelectorAll("span.commit-ref"), function(treeSpan) { |
33 | 32 | return !treeSpan.querySelector(".unknown-repo"); |
34 | 33 | }).forEach(function(treeSpan) { |
|
49 | 48 | } |
50 | 49 |
|
51 | 50 | // Page load; |
52 | | - console.log('GithubPullRequestFromLink', 'page load'); |
53 | 51 | init(); |
54 | 52 |
|
55 | 53 | // On pjax; |
56 | | - unsafeWindow.$(document).on("pjax:end", function() { |
57 | | - console.log('GithubPullRequestFromLink', 'pjax'); |
58 | | - init(); |
59 | | - }); |
| 54 | + document.addEventListener('pjax:end', init); |
60 | 55 |
|
61 | | -})(typeof unsafeWindow !== "undefined" ? unsafeWindow : window); |
| 56 | +})(); |
0 commit comments