|
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="en"> |
| 3 | +<head> |
| 4 | + <meta charset="utf-8"> |
| 5 | + <title>programming | A repo for first time contributors</title> |
| 6 | + <!--Import Google Icon Font--> |
| 7 | + <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> |
| 8 | + <!--Import materialize.css--> |
| 9 | + <link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css" media="screen,projection" /> |
| 10 | + |
| 11 | + <!--Let browser know website is optimized for mobile--> |
| 12 | + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
| 13 | + <style> |
| 14 | + .header { |
| 15 | + font-weight: 300; |
| 16 | + } |
| 17 | + |
| 18 | + .page_header { |
| 19 | + height: 20rem; |
| 20 | + } |
| 21 | + |
| 22 | + @media only screen and (max-width: 400px) { |
| 23 | + h1 { |
| 24 | + font-size: 1.2rem; |
| 25 | + } |
| 26 | + h5 { |
| 27 | + font-size: 1rem; |
| 28 | + } |
| 29 | + .page_header { |
| 30 | + height: 15rem; |
| 31 | + } |
| 32 | + } |
| 33 | + |
| 34 | + @media only screen and (min-width: 400px) and (max-width: 600px) { |
| 35 | + .page_header { |
| 36 | + height: 25rem; |
| 37 | + } |
| 38 | + } |
| 39 | + |
| 40 | + .margin-top-20 { |
| 41 | + margin-top: 20px |
| 42 | + } |
| 43 | + /*footer*/ |
| 44 | + |
| 45 | + body { |
| 46 | + display: flex; |
| 47 | + min-height: 100vh; |
| 48 | + flex-direction: column; |
| 49 | + } |
| 50 | + |
| 51 | + main { |
| 52 | + flex: 1 0 auto; |
| 53 | + } |
| 54 | + </style> |
| 55 | +</head> |
| 56 | + |
| 57 | +<body> |
| 58 | + |
| 59 | + <div class="had-container page_header purple darken-2 white-text valign-wrapper"> |
| 60 | + <div class="row "> |
| 61 | + <div class="col s12 m12 l12 center-align"> |
| 62 | + <h1 class="project-name header">programming</h1> |
| 63 | + <h5 class="project-tagline light purple-text text-lighten-4">Celebrate HacktoberFest with your first contribution</h5> |
| 64 | + <a href="https://github.com/hacktoberfest17/programming" target="_blank" class="waves-effect waves-light btn white purple-text margin-top-20">Start Coding</a> |
| 65 | + |
| 66 | + </div> |
| 67 | + </div> |
| 68 | + |
| 69 | + </div> |
| 70 | + <div class="container"> |
| 71 | + <div class="row"> |
| 72 | + <h1 class="purple-text header">Contributors</h1> |
| 73 | + </div> |
| 74 | + <div class="row" id="contributor_list"> |
| 75 | + |
| 76 | + </div> |
| 77 | + </div> |
| 78 | + |
| 79 | + <footer class="page-footer purple darken-3"> |
| 80 | + <div class="footer-copyright"> |
| 81 | + <div class="container"> |
| 82 | + <!--© 2014 Copyright Text |
| 83 | + <a class=" grey-text text-lighten-4 right" href="#!">More Links</a>--> |
| 84 | + </div> |
| 85 | + </div> |
| 86 | + </footer> |
| 87 | + |
| 88 | + <!--Import jQuery before materialize.js--> |
| 89 | + <script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script> |
| 90 | + <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script> |
| 91 | + <script> |
| 92 | + function getContribList(current_page, final_page) { |
| 93 | + $.getJSON("https://api.github.com/repos/hacktoberfest17/programming/contributors?page=" + current_page, function(data, textStatus, xhr) { |
| 94 | + //console.log(data); |
| 95 | + populateList(data); |
| 96 | + |
| 97 | + if (current_page == 1) { |
| 98 | + const regex = /(page=)([0-9]*)/gi; |
| 99 | + var str = xhr.getResponseHeader("Link").split(",")[1] |
| 100 | + m = regex.exec(str) |
| 101 | + final_page = m[2]; |
| 102 | + } |
| 103 | + current_page += 1; |
| 104 | + if (current_page > final_page) |
| 105 | + return true; |
| 106 | + else |
| 107 | + return getContribList(current_page, final_page); |
| 108 | + |
| 109 | + }); |
| 110 | + } |
| 111 | + getContribList(1, 2); |
| 112 | + |
| 113 | + function populateList(data) { |
| 114 | + var elems = ""; |
| 115 | + data.forEach(function(item) { |
| 116 | + //console.log(item); |
| 117 | + elems+='<div class="col s12 m4"><div class="card small"><div class="card-image"><img src=\"'+item['avatar_url']+'\"><span class="card-title">'+item["login"]+'</span></div><div class="card-content"><p>#'+item["contributions"]+' contributions</p></div><div class="card-action"><a target="_blank" class="purple-text" href="'+item["html_url"]+'">My Profile</a></div></div></div>'; |
| 118 | + }); |
| 119 | + $("#contributor_list").append(elems); |
| 120 | + |
| 121 | + } |
| 122 | + </script> |
| 123 | +</body> |
| 124 | + |
| 125 | +</html> |
0 commit comments