Skip to content

Commit

Permalink
Merge pull request #18 from jamesfleeting/master
Browse files Browse the repository at this point in the history
Ability to show or hide the languages.
  • Loading branch information
Zeno Rocha committed Jan 27, 2012
2 parents f7e8a58 + 3402419 commit 599dc67
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 56 deletions.
71 changes: 36 additions & 35 deletions index.html
@@ -1,36 +1,37 @@
<!DOCTYPE html>
<html>
<head>

<meta charset="utf-8">
<meta name = "viewport" content="width=device-width, maximum-scale=1">

<title>my open source gallery</title>
<link id="default-css" rel="stylesheet" href="css/screen.css">
<link id="theme-css" rel="stylesheet" href="css/themes/blue.css">

<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

</head>
<body>

<footer>
<img src="img/cat.png" alt="Github's Logo" />
</footer>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script src="scripts/css3-mediaqueries.js"></script>
<script src="scripts/hub.me.js"></script>

<script>
$('body').hubMe({
'username': 'clark-kent', // you're not Clark Kent, right?
'theme': 'gray', // available themes: blue (default), black & gray
'exclude': ['wormz', 'cufon'] // exclude project by name
});
</script>

</body>
<!DOCTYPE html>
<html>
<head>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, maximum-scale=1">

<title>my open source gallery</title>
<link id="default-css" rel="stylesheet" href="css/screen.css">
<link id="theme-css" rel="stylesheet" href="css/themes/blue.css">

<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

</head>
<body>

<footer>
<img src="img/cat.png" alt="Github's Logo" />
</footer>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script src="scripts/css3-mediaqueries.js"></script>
<script src="scripts/hub.me.js"></script>

<script>
$('body').hubMe({
'username': 'clark-kent', // you're not Clark Kent, right?
'theme': 'gray', // available themes: blue (default), black & gray
'exclude': ['wormz', 'cufon'], // exclude project by name
'languages': true // sort repos by languages true : false
});
</script>

</body>
</html>
42 changes: 21 additions & 21 deletions scripts/hub.me.js
Expand Up @@ -24,7 +24,8 @@
defaults = {
username: 'github',
theme: 'blue',
exclude: []
exclude: [],
languages: true
};

// The actual plugin constructor
Expand Down Expand Up @@ -55,33 +56,32 @@

var self = this,
repos = [],
thisRepo = this.options.username + '.github.com';
thisRepo = self.options.username + '.github.com';

$.getJSON('https://api.github.com/users/' + this.options.username + '/repos?callback=?', function (result) {

$.each(result.data, function(i, field) {
if (field.language != null)
repos.push(field);
});

$.each(result.data, function(i, field) {
if(field.language != null && field.name != thisRepo)
repos.push(field);
});

repos = orderByLanguages(repos);

$.each(repos, function(i, field) {

if ( $.inArray( repos[i].name, self.options.exclude ) === -1 ) {

if (i > 0) {
if (repos[i].language != repos[i-1].language) {
self.createCategory(repos[i].language);
}
}
else {
self.createCategory(repos[i].language);
}

if (repos[i].name != thisRepo) {
self.createRepo(repos[i]);
if (self.options.languages) {
if (i > 0) {
if (repos[i].language != repos[i-1].language) {
self.createCategory(repos[i].language);
}
}
else {
self.createCategory(repos[i].language);
}
}

self.createRepo(repos[i]);
}

});
Expand All @@ -94,7 +94,7 @@
var cat = '<section>' +
'<h1>' + catName + '</h1>' +
'</section>';

$(this.element).append(cat);

};
Expand Down

0 comments on commit 599dc67

Please sign in to comment.