Skip to content

Commit 194c7f3

Browse files
anishagg17mariobehling
authored andcommitted
Fixes #389 - Created a separate Js file for fetching issues from github (#398)
* cleanup * Fixed Links to direct to correct area * Fixed Links to direct to correct area * removed spaces * Fixed * Added scroll to top button * conflicts removed * external services removed * external services removed * Script to get issues has been reallocated to js folder * Added fade in/out button * Fade in/out button added * Re * Delete .DS_Store * Update index.html * removed ds store * Delete .DS_Store * Update .gitignore * Update scripts.js * Update scripts.js * Relocated github scripts to JS folder * Relocated github scripts to JS folder * Update index.html Done
1 parent dbb9bc1 commit 194c7f3

File tree

2 files changed

+54
-53
lines changed

2 files changed

+54
-53
lines changed

index.html

+1-53
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,7 @@ <h1>How Can I Participate in FOSSASIA projects?</h1>
611611
<script src="js/twitterfetcher.min.js"></script>
612612
<script src="js/placeholders.min.js"></script>
613613
<script src="js/scripts.js"></script>
614+
<script src="js/githubScripts.js"></script>
614615
<script src="js/backToTop.js"></script>
615616

616617

@@ -619,59 +620,6 @@ <h1>How Can I Participate in FOSSASIA projects?</h1>
619620

620621

621622
<script type="text/javascript">
622-
$.getJSON(
623-
"https://api.github.com/repos/fossasia/labs.fossasia.org/issues?labels=project&state=open&per_page=100"
624-
)
625-
.done(function(data){
626-
$('.loading').hide();
627-
$.each(data, function(i, item) {
628-
//List of Content
629-
var tag, tempHeading;
630-
$.each(item["labels"], function(i, label) {
631-
if (label["name"] != "project") {
632-
//tag = label["name"].replace(" ", "-");
633-
tempHeading = label["name"];
634-
tag = label["name"].split(" ").join("-");
635-
}
636-
});
637-
if ($("#" + tag + "-issues").length <= 0) {
638-
var a0 = $("<a>", {href: "#" + tag + "", id:"issue-tag", onClick: "desc"});
639-
var li0 = $("<li>", {class: "tags"});
640-
var ul = $("<ul>", {id: tag + "-issues"});
641-
var wrapperDiv = $("<div>", {id: tag + ""});
642-
var h1 = $("<h1>", {id: tag + "-description"});
643-
a0.html(tempHeading);
644-
li0.html(a0);
645-
li0.append(ul);
646-
$('#table').append(li0);
647-
h1.html(tempHeading);
648-
wrapperDiv.html(h1);
649-
$('#results_projects').append(wrapperDiv);
650-
}
651-
var a = $("<a>", {href: "#" + item["id"], id:"issue-link", onClick:"desc()"});
652-
var li = $("<li>");
653-
a.html(item["title"] + "<br>");
654-
li.html(a);
655-
$('#' + tag + '-issues').append(li);
656-
//Content Description
657-
var div = $("<div>", {id: item["id"]});
658-
var h4 = $("<h4>");
659-
var p = $("<p>");
660-
var bes = $("<a>",{href: item["html_url"], id: "issue-button"});
661-
var converter = new showdown.Converter();
662-
converter.setOption('simplifiedAutoLink', true);
663-
var body = converter.makeHtml(item["body"]);
664-
h4.html(item["title"]);
665-
p.html(body);
666-
bes.html("<p>"+"Read More.."+"</p>");
667-
div.html(h4);
668-
div.append(p);
669-
div.append(bes);
670-
$('#'+tag+'-description').append(div);
671-
});
672-
$("#results_projects div img").parent().css("border", "none");
673-
$("#results_projects div a").parent().css("list-style", "none");
674-
});
675623
function desc(){
676624
document.getElementById("gsoc-proj").style.paddingTop="0rem";
677625
};

js/githubScripts.js

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
$.getJSON(
2+
"https://api.github.com/repos/fossasia/labs.fossasia.org/issues?labels=project&state=open&per_page=100"
3+
)
4+
.done(function(data){
5+
$('.loading').hide();
6+
$.each(data, function(i, item) {
7+
//List of Content
8+
var tag, tempHeading;
9+
$.each(item["labels"], function(i, label) {
10+
if (label["name"] != "project") {
11+
//tag = label["name"].replace(" ", "-");
12+
tempHeading = label["name"];
13+
tag = label["name"].split(" ").join("-");
14+
}
15+
});
16+
if ($("#" + tag + "-issues").length <= 0) {
17+
var a0 = $("<a>", {href: "#" + tag + "", id:"issue-tag", onClick: "desc"});
18+
var li0 = $("<li>", {class: "tags"});
19+
var ul = $("<ul>", {id: tag + "-issues"});
20+
var wrapperDiv = $("<div>", {id: tag + ""});
21+
var h1 = $("<h1>", {id: tag + "-description"});
22+
a0.html(tempHeading);
23+
li0.html(a0);
24+
li0.append(ul);
25+
$('#table').append(li0);
26+
h1.html(tempHeading);
27+
wrapperDiv.html(h1);
28+
$('#results_projects').append(wrapperDiv);
29+
}
30+
var a = $("<a>", {href: "#" + item["id"], id:"issue-link", onClick:"desc()"});
31+
var li = $("<li>");
32+
a.html(item["title"] + "<br>");
33+
li.html(a);
34+
$('#' + tag + '-issues').append(li);
35+
//Content Description
36+
var div = $("<div>", {id: item["id"]});
37+
var h4 = $("<h4>");
38+
var p = $("<p>");
39+
var bes = $("<a>",{href: item["html_url"], id: "issue-button"});
40+
var converter = new showdown.Converter();
41+
converter.setOption('simplifiedAutoLink', true);
42+
var body = converter.makeHtml(item["body"]);
43+
h4.html(item["title"]);
44+
p.html(body);
45+
bes.html("<p>"+"Read More.."+"</p>");
46+
div.html(h4);
47+
div.append(p);
48+
div.append(bes);
49+
$('#'+tag+'-description').append(div);
50+
});
51+
$("#results_projects div img").parent().css("border", "none");
52+
$("#results_projects div a").parent().css("list-style", "none");
53+
});

0 commit comments

Comments
 (0)