Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit02c61a2

Browse files
committed
Added repo support
1 parent8239459 commit02c61a2

File tree

1 file changed

+53
-7
lines changed

1 file changed

+53
-7
lines changed

‎repos.html‎

Lines changed: 53 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
<scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
1111
<scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
1212
<scriptsrc="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
13+
<style>
14+
body {
15+
word-break: break-all;
16+
}
17+
</style>
1318
<body>
1419

1520
<divid="app"class="container">
@@ -44,24 +49,54 @@
4449
<divid="information">
4550
<ulclass="list-group mx-auto mb-5">
4651
<liclass="list-group-item"v-for="x in data">
47-
<p><strong>Repo:</strong>{{x['Repos']}}</p>
48-
<p><strong>Description:</strong>{{x['description']}}</p>
49-
<p><strong>URL:</strong><ahref="{{x['html_url']}}">{{x['html_url']}}</a></p>
52+
<p><strong>Repo:</strong>{{x['name']}}</p>
53+
<p><strong>Description:</strong>{{x['description']}}</p>
54+
<p><strong>URL:</strong><a:href="x['html_url']"target="_blank">{{x['html_url']}}</a></p>
5055
</li>
5156
</ul>
52-
57+
<h3style="text-align: center;display: none"id="no_more">
58+
No more repos
59+
</h3>
60+
<br>
5361
</div>
5462

5563

5664
</div>
5765

5866
<script>
5967
window.page=0;
68+
window.username=undefined;
69+
window.max=false;
6070
functionget_repos(username){
61-
$.get(`https://api.github.com/users/${username}/repos?page=${window.page+1}`,function(data){
71+
if(window.username===username){
6272
window.page+=1;
63-
console.log(data)
64-
$("#Wrong_Username").css("display","none")
73+
if(window.max){
74+
75+
return;
76+
}
77+
78+
}else{
79+
window.page=0;
80+
window.username=username;
81+
window.max=false;
82+
}
83+
84+
$.get(`https://api.github.com/users/${username}/repos?page=${window.page+1}`,function(data){
85+
console.log(data);
86+
87+
if(data.length===0){
88+
$("#no_more").css("display","");
89+
window.max=true;
90+
}else{
91+
$("#no_more").css("display","none");
92+
}
93+
94+
if(window.page===0){
95+
myObject.$data.data=data;
96+
}else{
97+
myObject.$data.data=myObject.$data.data.concat(data);
98+
}
99+
$("#Wrong_Username").css("display","none");
65100
}).fail(function(){
66101
console.log("Problem")
67102
$('#Wrong_Username').css("display","")
@@ -74,6 +109,17 @@
74109
data:[],
75110
}
76111
})
112+
113+
$(window).scroll(function(){
114+
if(Math.ceil($(window).scrollTop())===Math.ceil(($(document).height()-$(window).height()))){
115+
get_repos(window.username)
116+
}
117+
});
118+
119+
$('#submit').on("click",function(){
120+
constusername=$("#username").val();
121+
get_repos(username)
122+
})
77123
</script>
78124

79125
</body>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp