Permalink
Browse files

adding jquery support for octopress 2.1

  • Loading branch information...
1 parent 93a356e commit 1d43e98813275f7d03349292e6883166da62badf @robertkowalski committed May 25, 2012
View
7 README.markdown
@@ -8,12 +8,13 @@ Adds your coderwall.com badges to the octopress sidebar
* triggered by entering a username for coderwall in _config.yml
* badges linking to the coderwall profile
* uses the in octopress available ender.js (bonzo / qwery)
+ * or the new jQuery (since Octopress 2.1)
Installation
------------
- - Copy the files to your octopress rootfolder
+ - Copy the files to your octopress rootfolder (don't forget the hidden files)
- Add ```asides/coderwall.html``` to the ```default_asides``` or ```default_asides``` ```post_asides``` or ```page_asides``` in the ```_config.yml```
@@ -23,7 +24,7 @@ Example:
default_asides: [asides/recent_posts.html, asides/github.html, asides/twitter.html, asides/delicious.html, asides/pinboard.html, asides/googleplus.html, asides/coderwall.html]
```
- - Additionally, add to the ```_config.yml```:
+ - Additionally, add to your ```_config.yml```:
```
coderwall_user: YOUR_USERNAME
@@ -34,7 +35,7 @@ coderwall_user: YOUR_USERNAME
---------------------------------------
-License
+License
-------
Copyright (c) 2012, Robert Kowalski
View
5 ...ic/source/_includes/asides/coderwall.html → ...ic/source/_includes/asides/coderwall.html
@@ -8,7 +8,7 @@
<script type="text/javascript">
var coderwall = (function(){
function render(options, badges){
- var fragment = '',
+ var fragment = '',
t = $(options.target)[0],
height = 65,
width = 65,
@@ -29,7 +29,6 @@
, type: 'jsonp'
, error: function (err) { $(options.target + ' li.loading').addClass('error').text("Error loading feed"); }
, success: function(res) {
- console.log(res.data.badges);
render(options, res.data.badges);
}
});
@@ -57,7 +56,7 @@
target: '#cw_badges'
});
});
- </script>
+ </script>
<style type="text/css">
.cw_badge img {
padding: 5px;
View
5 source/_includes/asides/coderwall.html → ender/source/_includes/asides/coderwall.html
@@ -8,7 +8,7 @@
<script type="text/javascript">
var coderwall = (function(){
function render(options, badges){
- var fragment = '',
+ var fragment = '',
t = $(options.target)[0],
height = 65,
width = 65,
@@ -29,7 +29,6 @@
, type: 'jsonp'
, error: function (err) { $(options.target + ' li.loading').addClass('error').text("Error loading feed"); }
, success: function(res) {
- console.log(res.data.badges);
render(options, res.data.badges);
}
});
@@ -57,7 +56,7 @@
target: '#cw_badges'
});
});
- </script>
+ </script>
<style type="text/css">
.cw_badge img {
padding: 5px;
View
57 jQuery/.themes/classic/source/_includes/asides/coderwall.html
@@ -0,0 +1,57 @@
+{% if site.coderwall_user %}
+<section>
+ <h1>Coderwall</h1>
+ <ul id="cw_badges">
+ <li class="loading">Status updating...</li>
+ </ul>
+
+ <script type="text/javascript">
+ var coderwall = (function(){
+ function render(options, badges){
+ var fragment = '',
+ t = $(options.target),
+ height = 65,
+ width = 65,
+ index;
+
+ for (index in badges) {
+ fragment += '<a class="cw_badge"title="' + badges[index].description + '" href="http://coderwall.com/' + options.user + '">';
+ fragment += '<img alt="' + badges[index].description + '" height="' + width + '" width="' + height + '" src="' + badges[index].badge + '"/>';
+ fragment += '</a>';
+ }
+
+ t.html(fragment);
+ }
+ return {
+ showBadges: function(options){
+ $.ajax({
+ url: 'http://coderwall.com/' + options.user + '.json?callback=?'
+ , dataType: 'jsonp'
+ , error: function (err) { $(options.target + ' li.loading').addClass('error').text("Error loading feed"); }
+ , success: function(res) {
+ render(options, res.data.badges);
+ }
+ });
+ }
+ };
+ })();
+
+ $(document).ready(function(){
+ coderwall.showBadges({
+ user: '{{site.coderwall_user}}',
+ target: '#cw_badges'
+ });
+ });
+ </script>
+ <style type="text/css">
+ .cw_badge img {
+ padding: 5px;
+ border: 0 none !important;
+ -moz-box-shadow: none !important;
+ -webkit-box-shadow: none !important;
+ -o-box-shadow: none !important;
+ box-shadow: none !important;
+ }
+ </style>
+</section>
+{% endif %}
View
57 jQuery/source/_includes/asides/coderwall.html
@@ -0,0 +1,57 @@
+{% if site.coderwall_user %}
+<section>
+ <h1>Coderwall</h1>
+ <ul id="cw_badges">
+ <li class="loading">Status updating...</li>
+ </ul>
+
+ <script type="text/javascript">
+ var coderwall = (function(){
+ function render(options, badges){
+ var fragment = '',
+ t = $(options.target),
+ height = 65,
+ width = 65,
+ index;
+
+ for (index in badges) {
+ fragment += '<a class="cw_badge"title="' + badges[index].description + '" href="http://coderwall.com/' + options.user + '">';
+ fragment += '<img alt="' + badges[index].description + '" height="' + width + '" width="' + height + '" src="' + badges[index].badge + '"/>';
+ fragment += '</a>';
+ }
+
+ t.html(fragment);
+ }
+ return {
+ showBadges: function(options){
+ $.ajax({
+ url: 'http://coderwall.com/' + options.user + '.json?callback=?'
+ , dataType: 'jsonp'
+ , error: function (err) { $(options.target + ' li.loading').addClass('error').text("Error loading feed"); }
+ , success: function(res) {
+ render(options, res.data.badges);
+ }
+ });
+ }
+ };
+ })();
+
+ $(document).ready(function(){
+ coderwall.showBadges({
+ user: '{{site.coderwall_user}}',
+ target: '#cw_badges'
+ });
+ });
+ </script>
+ <style type="text/css">
+ .cw_badge img {
+ padding: 5px;
+ border: 0 none !important;
+ -moz-box-shadow: none !important;
+ -webkit-box-shadow: none !important;
+ -o-box-shadow: none !important;
+ box-shadow: none !important;
+ }
+ </style>
+</section>
+{% endif %}

0 comments on commit 1d43e98

Please sign in to comment.