Skip to content
Browse files

remove bad whitespaces

  • Loading branch information...
1 parent e5c95bf commit dc8af918ffaa5f2292bc0a8a69df0634bd9c2e23 @bernardofire bernardofire committed Dec 19, 2011
View
18 README.md
@@ -1,17 +1,17 @@
metabrag - show your geek cred off
========
-This is a jQuery plugin for showing off your Github user info, Github repositories
-and all your Coderwall badges.
+This is a jQuery plugin for showing off your Github user info, Github repositories
+and all your Coderwall badges.
Metabrag has support for showing multiple user infos and sets aim at being highly
-customizable.
+customizable.
Downloading and Installing
--------------------------
### Downloading metabrag
-To download either clone the git repository or download autogenerated tarball.
+To download either clone the git repository or download autogenerated tarball.
#### Using git
@@ -22,7 +22,7 @@ git clone git@github.com:mikaelbr/metabrag.git
#### Downloading autogenerated tarball
-Use this link to download tarball
+Use this link to download tarball
https://github.com/mikaelbr/metabrag/tarball/master
### Installing
@@ -52,12 +52,12 @@ With the HTML structure
<body>
<!-- metabrag plugin wrapper -->
<div class="element-name" data-metabrag-username="mikaelbr">
-
+
</div>
</body>
```
-You can also drop using the data attribute and only support one user. Initiate the
+You can also drop using the data attribute and only support one user. Initiate the
plugin using:
```javascript
@@ -101,7 +101,7 @@ metabrag can use two data attributes
* data-metabrag-username
* data-metabrag-coderwall-username
-The latter is used to set a spesific username for Coderwall, if it is not the same as your Github user.
+The latter is used to set a spesific username for Coderwall, if it is not the same as your Github user.
### Events
There are 3 events set up with this plugin. They all use the namespace ```metabrag```. You can change the
@@ -138,7 +138,7 @@ Here are the settings that can be altered to customize your geek creds
```
What's important to remember is that the data attributes are of a higher priority than the
-username property. If you have set property username and the data attribute.
+username property. If you have set property username and the data attribute.
## Further plans
View
4 index.html
@@ -15,7 +15,7 @@
showForks: false
});
});
-
+
$(".metabrag").live("userinfoLoaded.metabrag", function (event, jsonObj, username) {
console.log("userinfoLoaded.metabrag event triggered:");
console.log(jsonObj);
@@ -27,7 +27,7 @@
<div class="page-wrapper">
<!-- The metabrag plugin will automaticly fetch the username -->
<div class="metabrag" data-metabrag-username="mikaelbr"></div>
-
+
<div class="metabrag" data-metabrag-username="dustin"></div>
</div>
</body>
View
18 iphone-demo/index.html
@@ -4,7 +4,7 @@
<title>metabrag</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
- <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, user-scalable=no">
+ <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, user-scalable=no">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="../jquery.min.js"></script>
<script type="text/javascript" src="jquery.mobile.js"></script>
@@ -24,35 +24,35 @@
showExtendedInfo: true
});
});
-
-
+
+
$(".metabrag-box").live("scrollpage", function (event, position) {
var page = (position.x/$("#ex4").width());
if(typeof(page)=='number' && parseInt(page)==page) {
$(".indicators span").removeClass("indicator-active");
$(".indicators span").eq(page).addClass("indicator-active");
}
});
-
+
$(".metabrag-box").live("userinfoLoaded.metabrag", function (event, jsonObj, username) {
var $elm = $(this+"[data-metabrag-username='"+username+"']").find(".ui-metabrag-github-userbox");
$elm.wrapInner("<div data-scroll='y'/>");
updateScrollView($elm);
});
-
+
$(".metabrag-box").live("repoinfoLoaded.metabrag", function (event, jsonObj, username) {
var $elm = $(this+"[data-metabrag-username='"+username+"']").find(".ui-metabrag-github-repobox");
$elm.wrapInner("<div data-scroll='y'/>");
updateScrollView($elm);
});
-
+
$(".metabrag-box").live("badgesLoaded.metabrag", function (event, jsonObj, username) {
var $elm = $(this+"[data-metabrag-coderwall-username='"+username+"']").find(".ui-metabrag-coderwall-badges");
$elm.wrapInner("<div data-scroll='y' />");
updateScrollView($elm);
});
-
-
+
+
</script>
</head>
<body>
@@ -64,7 +64,7 @@
<div data-role="content">
<div id="ex4" data-scroll="xp" class="metabrag-box" data-metabrag-username="mikaelbr">
-
+
</div>
<div class="indicators">
<span class="indicator-active"></span>
View
66 iphone-demo/jquery.easing.js
@@ -5,33 +5,33 @@
* to offer multiple easing options
*
* TERMS OF USE - jQuery Easing
- *
- * Open source under the BSD License.
- *
+ *
+ * Open source under the BSD License.
+ *
* Copyright © 2008 George McGinley Smith
* All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this list of
+ *
+ * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list
- * of conditions and the following disclaimer in the documentation and/or other materials
+ * Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
- * Neither the name of the author nor the names of contributors may be used to endorse
+ *
+ * Neither the name of the author nor the names of contributors may be used to endorse
* or promote products derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
@@ -147,7 +147,7 @@ jQuery.extend( jQuery.easing,
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
},
easeInOutBack: function (x, t, b, c, d, s) {
- if (s == undefined) s = 1.70158;
+ if (s == undefined) s = 1.70158;
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
},
@@ -174,32 +174,32 @@ jQuery.extend( jQuery.easing,
/*
*
* TERMS OF USE - EASING EQUATIONS
- *
- * Open source under the BSD License.
- *
+ *
+ * Open source under the BSD License.
+ *
* Copyright © 2001 Robert Penner
* All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this list of
+ *
+ * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list
- * of conditions and the following disclaimer in the documentation and/or other materials
+ * Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
- * Neither the name of the author nor the names of contributors may be used to endorse
+ *
+ * Neither the name of the author nor the names of contributors may be used to endorse
* or promote products derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
View
66 iphone-demo/jquery.mobile.scrollview.js
@@ -2,33 +2,33 @@
* jQuery Mobile Framework : scrollview plugin
* Copyright (c) 2010 Adobe Systems Incorporated - Kin Blas (jblas@adobe.com)
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
-* Note: Code is in draft form and is subject to change
+* Note: Code is in draft form and is subject to change
*/
(function($,window,document,undefined){
jQuery.widget( "mobile.scrollview", jQuery.mobile.widget, {
options: {
fps: 60, // Frames per second in msecs.
direction: null, // "x", "y", or null for both.
-
+
scrollDuration: 2000, // Duration of the scrolling animation in msecs.
overshootDuration: 250, // Duration of the overshoot animation in msecs.
snapbackDuration: 500, // Duration of the snapback animation in msecs.
-
+
moveThreshold: 10, // User must move this many pixels in any direction to trigger a scroll.
moveIntervalThreshold: 150, // Time between mousemoves must not exceed this threshold.
-
+
scrollMethod: "translate", // "translate", "position", "scroll"
-
+
startEventName: "scrollstart",
updateEventName: "scrollupdate",
stopEventName: "scrollstop",
updatePageEventName: "scrollpage",
-
+
eventType: $.support.touch ? "touch" : "mouse",
-
+
showScrollBars: true,
-
+
pagingEnabled: false,
delayedClickSelector: "a,input,textarea,select,button,.ui-btn",
delayedClickEnabled: false
@@ -41,7 +41,7 @@ jQuery.widget( "mobile.scrollview", jQuery.mobile.widget, {
},
_create: function()
- {
+ {
this._$clip = $(this.element).addClass("ui-scrollview-clip");
var $child = this._$clip.children();
if ($child.length > 1) {
@@ -68,17 +68,17 @@ jQuery.widget( "mobile.scrollview", jQuery.mobile.widget, {
this._sx = 0;
this._sy = 0;
-
+
var direction = this.options.direction;
this._hTracker = (direction !== "y") ? new MomentumTracker(this.options) : null;
this._vTracker = (direction !== "x") ? new MomentumTracker(this.options) : null;
-
+
this._timerInterval = 1000/this.options.fps;
this._timerID = 0;
-
+
var self = this;
this._timerCB = function(){ self._handleMomentumScroll(); };
-
+
this._addBehaviors();
},
@@ -132,7 +132,7 @@ jQuery.widget( "mobile.scrollview", jQuery.mobile.widget, {
this._hTracker.reset();
this._hideScrollBars();
-
+
},
_handleMomentumScroll: function()
@@ -162,8 +162,8 @@ jQuery.widget( "mobile.scrollview", jQuery.mobile.widget, {
this._$clip.trigger(this.options.updateEventName, [ { x: x, y: y } ]);
if (keepGoing)
- this._timerID = setTimeout(this._timerCB, this._timerInterval);
- else
+ this._timerID = setTimeout(this._timerCB, this._timerInterval);
+ else
this._stopMScroll();
},
@@ -189,7 +189,7 @@ jQuery.widget( "mobile.scrollview", jQuery.mobile.widget, {
var c = this._$clip[0];
c.scrollLeft = -x;
c.scrollTop = -y;
-
+
break;
}
@@ -213,7 +213,7 @@ jQuery.widget( "mobile.scrollview", jQuery.mobile.widget, {
else
$sbt.css("left", -x/$v.width()*100 + "%");
}
-
+
},
scrollTo: function(x, y, duration)
@@ -325,7 +325,7 @@ jQuery.widget( "mobile.scrollview", jQuery.mobile.widget, {
this._pageDelta = 0;
this._pageSize = 0;
- this._pagePos = 0;
+ this._pagePos = 0;
if (this.options.pagingEnabled && (svdir === "x" || svdir === "y"))
{
@@ -482,16 +482,16 @@ jQuery.widget( "mobile.scrollview", jQuery.mobile.widget, {
this._lastY = ey;
this._setScrollPosition(newX, newY);
-
-
+
+
this._showScrollBars();
// Call preventDefault() to prevent touch devices from
// scrolling the main window.
// e.preventDefault();
-
+
return false;
},
@@ -530,7 +530,7 @@ jQuery.widget( "mobile.scrollview", jQuery.mobile.widget, {
.trigger("mouseup")
.trigger("click");
}
-
+
// If a view scrolled, then we need to absorb
// the event so that links etc, underneath our
@@ -686,15 +686,15 @@ $.extend(MomentumTracker.prototype, {
if (state == tstates.scrolling || state == tstates.overshot)
{
var dx = this.speed * (1 - $.easing[this.easing](elapsed/duration, elapsed, 0, 1, duration));
-
+
var x = this.pos + dx;
-
+
var didOverShoot = (state == tstates.scrolling) && (x < this.minPos || x > this.maxPos);
if (didOverShoot)
x = (x < this.minPos) ? this.minPos : this.maxPos;
-
+
this.pos = x;
-
+
if (state == tstates.overshot)
{
if (elapsed >= duration)
@@ -725,7 +725,7 @@ $.extend(MomentumTracker.prototype, {
if (elapsed >= duration)
{
this.pos = this.toPos;
- this.state = tstates.done;
+ this.state = tstates.done;
}
else
this.pos = this.fromPos + ((this.toPos - this.fromPos) * $.easing[this.easing](elapsed/duration, elapsed, 0, 1, duration));
@@ -745,21 +745,21 @@ jQuery.widget( "mobile.scrolllistview", jQuery.mobile.scrollview, {
_create: function() {
$.mobile.scrollview.prototype._create.call(this);
-
+
// Cache the dividers so we don't have to search for them everytime the
// view is scrolled.
//
// XXX: Note that we need to update this cache if we ever support lists
// that can dynamically update their content.
-
+
this._$dividers = this._$view.find(":jqmData(role='list-divider')");
this._lastDivider = null;
},
_setScrollPosition: function(x, y)
{
// Let the view scroll like it normally does.
-
+
$.mobile.scrollview.prototype._setScrollPosition.call(this, x, y);
y = -y;
@@ -784,8 +784,8 @@ jQuery.widget( "mobile.scrolllistview", jQuery.mobile.scrollview, {
else if (d)
break;
}
-
-
+
+
// If we found a divider to move position it at the top of the
// clip view.
View
22 iphone-demo/metabrag.iphone.demo.css
@@ -1,4 +1,4 @@
-/*
+/*
Document : metabrag.iphone.demo
Created on : Aug 1, 2011, 9:24:31 PM
Author : mikaelbrevik
@@ -11,7 +11,7 @@
padding: 0px;
margin: 0px;
background: url("images/texture_075.png") #333;
-
+
}
/**** Project spesific ****/
@@ -75,13 +75,13 @@ span.indicator-active {
/** metabrag box styling **/
-.ui-metabrag-github-userbox .ui-metabrag-avatar {
+.ui-metabrag-github-userbox .ui-metabrag-avatar {
float: left;
margin-right: 30px;
margin-bottom: 20px;
}
-.ui-metabrag-github-userbox .ui-metabrag-avatar img {
+.ui-metabrag-github-userbox .ui-metabrag-avatar img {
border: 2px solid #1b8fd1;
display: block;
border-radius: 5px;
@@ -95,19 +95,19 @@ span.indicator-active {
text-shadow: 1px 1px 0px #999;
}
-.ui-metabrag-github-userbox h2 span {
+.ui-metabrag-github-userbox h2 span {
font-size: 0.7em;
margin-left: 10px;
font-weight: 100;
}
-.ui-metabrag-github-userbox h2 a:link,
-.ui-metabrag-github-userbox h2 a:visited {
+.ui-metabrag-github-userbox h2 a:link,
+.ui-metabrag-github-userbox h2 a:visited {
text-decoration: none;
color: #eee;
}
-.ui-metabrag-github-userbox h2 a:hover,
-.ui-metabrag-github-userbox h2 a:active {
+.ui-metabrag-github-userbox h2 a:hover,
+.ui-metabrag-github-userbox h2 a:active {
color: #999;
}
@@ -138,7 +138,7 @@ span.indicator-active {
/** box structures **/
-.ui-metabrag-github-userbox,
+.ui-metabrag-github-userbox,
.ui-metabrag-github-repobox,
.ui-metabrag-coderwall-badges {
font-size: 14px;
@@ -161,7 +161,7 @@ span.indicator-active {
}
.ui-metabrag-github-repobox .ui-metabrag-repolist > li {
- margin: 0px;
+ margin: 0px;
background: -webkit-gradient(linear, left top, left bottom, from(#B6B6C3), to(#9B9BAC));
background: -moz-linear-gradient(top, #B6B6C3, #9B9BAC);
display: block;
View
2 iphone-demo/scrollview.js
@@ -50,7 +50,7 @@ $(":jqmData(role='page')").live("pageshow", function(event) {
// into the jqm page processing code when scrollview support is "official"
// instead of "experimental".
updateScrollView($page);
-
+
// For the demos, we want to make sure the page being shown has a content
// area that is sized to fit completely within the viewport. This should
View
4 jquery.metabrag.css
@@ -1,9 +1,9 @@
-/*
+/*
Document : jquery.metabrag
Created on : Jul 30, 2011, 8:30:59 PM
Author : Mikael Brevik
Description: Structural settings for metabrag.
-
+
*/
/** Generic styling **/
View
100 jquery.metabrag.js
@@ -7,13 +7,13 @@
* Date: Thu Jul 29 21:48:21 2011 +0100
*/
(function( $ ){
-
+
var methods = {
init : function( options ) {
return this.each(function(){
-
+
var $this = $(this),
data = $this.data('metabrag');
@@ -31,7 +31,7 @@
}
});
},
-
+
refresh: function () {
var $this = $(this),
@@ -42,15 +42,15 @@
}
var username = data._settings.username;
-
+
$this.empty();
// Check for overwritten data attr.
if(typeof $this.attr("data-metabrag-username") !== "undefined") {
username = $this.attr("data-metabrag-username");
} else {
$this.attr("data-metabrag-username", username);
- }
+ }
// Try for a coderwall spesific username
var coderwallUsername = username;
@@ -64,7 +64,7 @@
} else {
$this.attr("data-metabrag-coderwall-username", coderwallUsername);
}
-
+
if(typeof username === "undefined" || username == "") {
$.error( 'No username is defined for the jquery.metabrag plugin.' );
}
@@ -73,42 +73,42 @@
var $userWrapper = $("<div />")
.addClass(data._settings.userInfoBoxClass)
.appendTo(this);
-
+
$("<p />").addClass("ui-metabrag-loading").html(data._settings.loadingMessage).appendTo($userWrapper);
// $this._getGithubUserInfo(username);
methods._getGithubUserInfo.apply( this, [username] );
}
-
+
if(!!data._settings.showGithubRepoInfo) {
var $repoWrapper = $("<div />")
.addClass(data._settings.repoInfoBoxClass)
.appendTo(this);
-
+
$("<p />").addClass("ui-metabrag-loading").html(data._settings.loadingMessage).appendTo($repoWrapper);
-
+
//$this._getGithubRepoInfo(username);
methods._getGithubRepoInfo.apply( this, [username] );
}
-
+
if(!!data._settings.showCoderwallBadges) {
var $badgeWrapper = $("<div />")
.addClass(data._settings.coderwallBadgesClass)
.appendTo(this);
-
+
$("<p />").addClass("ui-metabrag-loading").html(data._settings.loadingMessage).appendTo($badgeWrapper);
-
+
// $this._getCoderwallBadges(coderwallUsername);
methods._getCoderwallBadges.apply( this, [coderwallUsername] );
}
-
+
return this;
},
-
+
_insertGithubUserInfo: function (jsonObj, username) {
var $this = $(this),
data = $this.data('metabrag');
-
+
var $child = $this.closest("[data-metabrag-username='"+username+"']").find("."+data._settings.userInfoBoxClass);
if(jsonObj.meta.status == 404) {
// We have an error
@@ -118,43 +118,43 @@
$("<p />").text(data._settings.errorMessage).appendTo($child);
return;
}
-
- // Add title
+
+ // Add title
$("<a />")
.attr("href", jsonObj.data.html_url)
.html(jsonObj.data.name)
.append($("<span />").html(jsonObj.data.login))
.wrap("<h2 />")
.parent()
.appendTo($child);
-
+
// Add avatar
var $avatarBox = $("<div />")
.addClass("ui-metabrag-avatar")
.appendTo($child);
-
+
$("<img />")
.attr("src", jsonObj.data.avatar_url)
.attr("alt", jsonObj.data.name)
.appendTo($avatarBox);
-
+
// Add short info
var $infoList = $("<ul />")
.addClass("ui-metabrag-infolist")
.appendTo($child);
-
+
methods._insertList($infoList, jsonObj.data, {
public_repos: "Public repos",
public_gists: "Public gists",
followers: "Followers",
following: "Following"
});
-
+
if(!!data._settings.showExtendedInfo) {
var $eInfoList = $("<ul />")
.addClass("ui-metabrag-extended-infolist")
.appendTo($child);
-
+
methods._insertList($eInfoList, jsonObj.data, {
company: "Company",
type: "Type of account",
@@ -165,14 +165,14 @@
created_at: "Member since"
});
}
-
+
$child.find(".ui-metabrag-loading").fadeOut("normal", function () {
$(this).remove();
});
$child.trigger(data._settings.eventLoadedGithubUserInfo, [jsonObj, username]);
},
-
+
_insertList: function (element, data, fields) {
for(o in fields) {
// Drop showing empty string properties.
@@ -185,14 +185,14 @@
}
return element;
},
-
+
_insertGithubRepoInfo: function (jsonObj, username) {
var $this = $(this),
data = $this.data('metabrag');
var $child = $this.closest("[data-metabrag-username='"+username+"']").find("."+data._settings.repoInfoBoxClass);
-
+
if(jsonObj.meta.status == 404) {
// We have an error
$child.find(".ui-metabrag-loading").fadeOut("normal", function () {
@@ -201,44 +201,44 @@
$("<p />").text(data._settings.errorMessage).appendTo($child);
return this;
}
-
+
var $repoList = $("<ul />")
.addClass("ui-metabrag-repolist")
.appendTo($child);
-
+
$(jsonObj.data).each(function () {
if(!data._settings.showForks && this.fork) {
return;
}
$listElement = $("<li />");
-
+
$("<a />")
.attr("href", this.html_url)
.attr("title", this.name)
.text(this.name)
.wrap("<h3>")
.parent()
.appendTo($listElement);
-
+
methods._insertList($("<ul />"), this, {
forks: "Forks",
watchers: "Watchers"
}).appendTo($listElement);
-
+
$("<p />")
.append(this.description)
- .appendTo($listElement);
-
+ .appendTo($listElement);
+
$listElement.appendTo($repoList);
});
-
+
$child.find(".ui-metabrag-loading").fadeOut("normal", function () {
$(this).remove();
});
$child.trigger(data._settings.eventLoadedGithubRepoInfo, [jsonObj, username]);
},
-
-
+
+
_insertCoderwallBadges: function (jsonObj, username) {
var $this = $(this),
@@ -253,22 +253,22 @@
$(jsonObj.data.badges).each(function () {
methods._insertBadge($badgeList, this);
});
-
+
$child.find(".ui-metabrag-loading").fadeOut("normal", function () {
$(this).remove();
});
$child.trigger(data._settings.eventLoadedCoderwallBadges, [jsonObj, username]);
},
-
+
_insertBadge: function (element, data) {
var $imgElm = $("<img />")
.attr("src", data.badge)
.attr("alt", data.name)
.attr("title", data.name + ": " + data.description);
-
+
$("<li />").append($imgElm).appendTo(element);
},
-
+
_githubApiURL: "https://api.github.com/users/",
_coderwallApiURL: "http://coderwall.com/",
_getGithubUserInfo: function (username) {
@@ -290,7 +290,7 @@
var $this = $(this),
data = $this.data('metabrag');
-
+
$.getJSON(methods._githubApiURL + username + "/repos?callback=?", function(data) {
// $this._insertGithubRepoInfo(data, username);
methods._insertGithubRepoInfo.apply( $this, [data, username] );
@@ -319,25 +319,25 @@
}
};
- // Define metabrag as a part of the jQuery namespace.
+ // Define metabrag as a part of the jQuery namespace.
$.fn.metabrag = function( method ) {
-
+
// Allow method calls (but not prefixed by _
if ( typeof method == "string" && method.substr(0,1) != "_" && methods[ method ] ) {
return methods[method].call(this, Array.prototype.slice.call( arguments, 1 ));
- }
+ }
// If argument is object or not set, init plugin.
else if ( typeof method === 'object' || ! method ) {
return methods.init.apply( this, arguments );
- }
+ }
// No method found by argument input. Could be a private method.
else {
$.error( 'Method ' + method + ' does not exist on jQuery.metabrag' );
return this;
}
-
+
};
-
+
$.fn.metabrag.defaults = {
username: '', // Global username - if only one username is supported.
coderwallUsername: '', // Global coderwall username
@@ -355,5 +355,5 @@
eventLoadedGithubRepoInfo: "repoinfoLoaded.metabrag", // Event triggered when a repo box is loaded
eventLoadedCoderwallBadges: "badgesLoaded.metabrag" // Event triggered when badges are loaded
};
-
+
})( jQuery );
View
20 metabrag.demo.css
@@ -1,9 +1,9 @@
-/*
+/*
Document : metabrag.demo
Created on : Jul 30, 2011, 10:10:09 PM
Author : mikaelbrevik
Description:
- Demo styling of the metabrag jquery plugin.
+ Demo styling of the metabrag jquery plugin.
*/
* {padding: 0px; margin: 0px;}
body {
@@ -19,11 +19,11 @@ body {
margin: 0px auto;
}
-.ui-metabrag-github-userbox .ui-metabrag-avatar {
+.ui-metabrag-github-userbox .ui-metabrag-avatar {
float: left;
}
-.ui-metabrag-github-userbox .ui-metabrag-avatar img {
+.ui-metabrag-github-userbox .ui-metabrag-avatar img {
border: 1px solid #1871a5;
}
@@ -41,9 +41,9 @@ body {
display: block;
width: 84%;
}
-.ui-metabrag-github-userbox h2 a:link,
-.ui-metabrag-github-userbox h2 a:visited {
- font-family: "Georgia", Helvetica, sans-serif;
+.ui-metabrag-github-userbox h2 a:link,
+.ui-metabrag-github-userbox h2 a:visited {
+ font-family: "Georgia", Helvetica, sans-serif;
font-size: 1.5em;
text-decoration: none;
color: #eee;
@@ -71,11 +71,11 @@ body {
font-weight: bold;
}
-.ui-metabrag-github-userbox h2 a:hover,
-.ui-metabrag-github-userbox h2 a:active {
+.ui-metabrag-github-userbox h2 a:hover,
+.ui-metabrag-github-userbox h2 a:active {
color: #ddd;
}
-.ui-metabrag-github-userbox h2 span {
+.ui-metabrag-github-userbox h2 span {
font-size: 0.7em;
font-weight: 100;
}

0 comments on commit dc8af91

Please sign in to comment.
Something went wrong with that request. Please try again.