您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Add top level button to sort both issues/pull requests by the most recently updated.
当前为
- // ==UserScript==
- // @name GitHub: Issue sort:updated-desc Button
- // @description Add top level button to sort both issues/pull requests by the most recently updated.
- // @author Chris H (Zren / Shade)
- // @icon https://github.com/favicon.ico
- // @namespace http://xshade.ca
- // @version 2
- // @include https://github.com*
- // ==/UserScript==
- (function(uw){
- var $ = uw.$;
- var createElement = function(html) {
- var e = document.createElement('div');
- e.innerHTML = html;
- return e.firstChild;
- };
- var blameUrlPattern = /^https:\/\/github.com\/[^\/]+\/[^\/]+\/(issues|pulls)/;
- var main = function() {
- var m = blameUrlPattern.exec(document.location.href);
- if (!m)
- return;
- if (document.getElementById('sort-issues-recently-updated'))
- return;
- Array.prototype.forEach.call(document.querySelectorAll('.table-list-header-toggle.right'), function(e) {
- var url = m[0] + '?q=sort%3Aupdated-desc';
- var html = '<div class="left"><a id="sort-issues-recently-updated" class="btn-link icon-only js-menu-target" role="button" aria-haspopup="true" style="padding-right: 15px; padding-left: 15px;" href="' + url + '">sort:recently-updated</a></div>';
- var a = createElement(html);
- e.insertBefore(a, e.firstChild);
- });
- };
- main();
- $(document).on('pjax:end', main);
- })(typeof unsafeWindow === 'undefined' ? window : unsafeWindow);