Forked from joshuaflanagan/pull_request_labels.user.js
Created
September 13, 2013 06:53
Revisions
-
fabpot revised this gist
Sep 13, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,7 @@ // @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js // ==/UserScript== $(function(){ var $pull_requests = $(".pulls-list .list-group-item h4"); $pull_requests.each(function(){ var pull_request = this; $(pull_request).addClass("issues-list"); // styling -
joshuaflanagan created this gist
Feb 2, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ // ==UserScript== // @name Pull Request Labels // @namespace http://joshuaflanagan.com // @include https://github.com/*/*/pulls // @version 1 // @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js // ==/UserScript== $(function(){ var $pull_requests = $(".pulls-list .list-browser-item h3"); $pull_requests.each(function(){ var pull_request = this; $(pull_request).addClass("issues-list"); // styling var $link = $("a:first", pull_request); var href = $link.attr("href"); //ex: /user/repo/pulls/42 var href_parts = href.split('/'); href_parts[3] = "issues"; var issue_href = href_parts.join('/'); $.getJSON("https://api.github.com/repos" + issue_href, function(issue){ $.each(issue.labels, function(l_i, label){ // <span data-name="actionpack" class="label labelstyle-FFF700">actionpack</span> var new_elem = $('<span class="label">' + label.name + '</span>'). css("background", '#' + label.color); $(pull_request).append(new_elem); }); }); }); });