From a1f19e9356809d6601ab7285a4df1c9771e34b05 Mon Sep 17 00:00:00 2001 From: Marcus Whybrow Date: Fri, 16 Nov 2012 02:11:20 +0000 Subject: [PATCH] Add contributors and stargazers to the front page --- _config.yml | 2 +- assets/css/style.css | 104 ++++++++++++++++++++++++++++++++++++------ assets/js/index.js | 105 ++++++++++++++++++++++++++++++++++++++++++- index.html | 34 +++++++++++--- 4 files changed, 222 insertions(+), 23 deletions(-) diff --git a/_config.yml b/_config.yml index 0d24cfa..c5931fd 100644 --- a/_config.yml +++ b/_config.yml @@ -1,3 +1,3 @@ permalink: /:categories/:title -baseurl: http://msmhq.com +# baseurl: http://msmhq.com paginate: 10 \ No newline at end of file diff --git a/assets/css/style.css b/assets/css/style.css index 065a1fc..31d1d85 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -344,28 +344,106 @@ body { .donators { text-align: center; - margin-bottom: 50px; - margin-top: 50px; padding-top: 50px; padding-bottom: 50px; border-top: 1px solid #e5e5e5; border-bottom: 1px solid #e5e5e5; - background-image: -webkit-radial-gradient(center, 500px 500px, #f5f7ff, white); } -.donator { +.donators .donator { font-size: 30px; - margin: 0 auto; display: inline-block; + margin: 20px 10px 0; +} + +.donators .donator img { + width: 80px; + height: 80px; +} + +.stargazers { + display: none; + background-image: -webkit-radial-gradient(top center, 500px 500px, #f5f7ff, white); + padding-top: 40px; + padding-bottom: 40px; + margin-bottom: 40px; + border-bottom: 1px solid #eee; +} + +#stargazers { + text-align: center; margin-top: 30px; } -.donator img { - padding: 5px; - background: white; - box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15); - width: 110px; - height: 110px; - border: 1px solid #ddd; - margin-right: 20px; +#stargazers:hover .stargazer { + opacity: 0.5; +} + +#stargazers .stargazer { + width: 80px; + height: 80px; + display: inline-block; + z-index: 50; + position: relative; + -webkit-transition: all .1s ease-in-out; +} + +#stargazers .stargazer:hover { + -webkit-box-shadow: 0 0 40px rgba(0, 0, 0, 1); + box-shadow: 0 0 40px rgba(0, 0, 0, 1); + z-index: 100; + -webkit-transform: scale(1.5); + opacity: 1; +} + +#stargazers .stargazer img { + width: 80px; + height: 80px; +} + +#stargazers .stargazer.maintainer { + +} + +#stargazers .stargazer.donator { + +} + +.contributors { + border-top: 1px solid #eee; + padding-top: 40px; + background-image: -webkit-radial-gradient(center, 500px 500px, #fffafa, white); + padding-bottom: 40px; +} + +#contributors { + text-align: center; + margin-top: 20px; + margin-bottom: 30px; +} + +#contributors .contributor { + display: inline-block; + width: 80px; + text-align: center; + margin: 0 10px; + position: relative; +} + +#contributors .contributor span { + clear: left; + text-align: center; + padding-top: 3px; + background-color: white; + border-radius: 6px; + position: relative; + bottom: -10px; + display: inline-block; + padding: 2px 0 0; + width: 50px; +} + +.contributors .byline .fork-btn { + position: relative; + top: 9px; } diff --git a/assets/js/index.js b/assets/js/index.js index 0a6f573..efd163e 100644 --- a/assets/js/index.js +++ b/assets/js/index.js @@ -1,6 +1,104 @@ $(function() { var milestonesUrl = "https://api.github.com/repos/marcuswhybrow/minecraft-server-manager/milestones?callback=?", - tagsUrl = "https://api.github.com/repos/marcuswhybrow/minecraft-server-manager/tags?callback=?"; + tagsUrl = "https://api.github.com/repos/marcuswhybrow/minecraft-server-manager/tags?callback=?" + stargazersUrl = "https://api.github.com/repos/marcuswhybrow/minecraft-server-manager/stargazers?per_page=100", + contributorsUrl = "https://api.github.com/repos/marcuswhybrow/minecraft-server-manager/contributors?per_page=100"; + + var maintainers = [ + "marcuswhybrow", + ]; + var donators = [ + "joecabezas", + ]; + + function populateContributors() { + var contributors = getAllPages(contributorsUrl); + + // Sort contributors by the number of contributins (most first) + contributors.sort(function(a, b) { + var aCount = a.contributions; + var bCount = b.contributions; + return (aCount < bCount) ? 1 : (aCount > bCount) ? -1 : 0; + }); + + $.each(contributors, function(i, contributor) { + var $link = $("") + .attr("target", "_blank") + .attr("href", "https://github.com/" + contributor.login + "/") + .attr("ref", "tooltip") + .attr("title", contributor.login) + .addClass("contributor ga-track") + .appendTo("#contributors") + .tooltip({ + placement: "bottom", + }); + $('') + .text('#' + contributor.contributions) + .appendTo($link); + $("") + .attr("src", contributor.avatar_url) + .appendTo($link); + + if (maintainers.indexOf(contributor.login) >= 0) { + $link.addClass("maintainer"); + } + if (donators.indexOf(contributor.login) >= 0) { + $link.addClass("donator"); + } + }); + } + + function populateStargazers() { + var stargazers = getAllPages(stargazersUrl);; + $.each(stargazers, function(i, stargazer) { + var $link = $("") + .attr("target", "_blank") + .attr("href", "https://github.com/" + stargazer.login + "/") + .attr("ref", "tooltip") + .attr("title", stargazer.login) + .addClass("stargazer ga-track") + .appendTo("#stargazers") + .tooltip({ + placement: "bottom", + }); + $("") + .attr("src", stargazer.avatar_url) + .appendTo($link); + + if (maintainers.indexOf(stargazer.login) >= 0) { + $link.addClass("maintainer"); + } + if (donators.indexOf(stargazer.login) >= 0) { + $link.addClass("donator"); + } + }); + $('.stargazers').slideDown(); + } + + function getAllPages(url, output, page) { + if (typeof(output) === 'undefined') { + output = []; + } + if (typeof(page) === 'undefined') { + page = 1; + } + $.ajax({ + url: url + "&page=" + page, + dataType: 'json', + async: false, + success: function(data) { + if (data.length == 100) { + output = getAllPages(url, output.concat(data), page + 1); + } else { + output = output.concat(data); + } + }, + }); + return output; + } + + populateContributors(); + populateStargazers(); $.getJSON(milestonesUrl, function(result) { var milestones = result.data; @@ -11,7 +109,7 @@ $(function() { var milestonePercentage = closedIssues / totalIssues * 100; var $div = $("
").addClass("milestone"); - var $link =$("") + var $link = $("") .attr("href", "https://github.com/marcuswhybrow/minecraft-server-manager/issues?state=open&milestone=" + milestone.number) .addClass("ga-track") .appendTo($div); @@ -61,6 +159,9 @@ $(function() { }); $('.player').tooltip(); + $('.donator').tooltip({ + placement: 'bottom', + }); $('a.ga-track').live('click', function() { var $this = $(this); diff --git a/index.html b/index.html index df2c984..634f310 100644 --- a/index.html +++ b/index.html @@ -131,15 +131,35 @@ tab: overview
-
-

Donators

-
- -
- - Joe Cabezas +
+
+

Contributors

+
+
+
+

Donators

+ + +
+ +
+ +
+ +
+
+ +
+

Stargazers

+ +
+