mirror of
https://github.com/codeguy/php-the-right-way.git
synced 2025-08-06 22:16:34 +02:00
Load contributors from GitHub API
This commit is contained in:
@@ -69,9 +69,7 @@
|
||||
</ul>
|
||||
|
||||
<h2 class="epsilon">Project contributors</h2>
|
||||
<p>
|
||||
This project would not be possible without the help of <a href="https://github.com/codeguy/php-the-right-way/graphs/contributors">our amazing contributors</a> on GitHub.
|
||||
</p>
|
||||
<div id="contributors">Loading…</div>
|
||||
|
||||
<h2 class="epsilon">Project sponsors</h2>
|
||||
<ul class="mbd">
|
||||
@@ -85,5 +83,7 @@
|
||||
</div>
|
||||
|
||||
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
|
||||
<script src="/scripts/setup.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
26
scripts/setup.js
Normal file
26
scripts/setup.js
Normal file
@@ -0,0 +1,26 @@
|
||||
(function ($) {
|
||||
// Load contributors
|
||||
var $contributors = $('#contributors');
|
||||
if ( $contributors.length ) {
|
||||
var fail = function () {
|
||||
$contributors.html('<p>This project would not be possible without the help of <a href="https://github.com/codeguy/php-the-right-way/graphs/contributors">our amazing contributors</a> on GitHub.</p>');
|
||||
};
|
||||
$.ajax({
|
||||
cache: false,
|
||||
dataType: 'jsonp',
|
||||
timeout: 3000,
|
||||
type: 'GET',
|
||||
url: 'https://api.github.com/repos/codeguy/php-the-right-way/contributors'
|
||||
}).done(function (data) {
|
||||
if ( data.data && data.data.length ) {
|
||||
var $ul = $('<ul></ul>'), dataLength = data.data.length;
|
||||
for ( var i = 0; i < dataLength; i++ ) {
|
||||
$ul.append(['<li><a href="https://github.com/', data.data[i].login, '" target="_blank">', data.data[i].login, '</a></li>'].join(''));
|
||||
}
|
||||
$contributors.html($ul);
|
||||
} else {
|
||||
fail();
|
||||
}
|
||||
}).fail(fail);
|
||||
}
|
||||
})(jQuery);
|
Reference in New Issue
Block a user