Skip to content

Instantly share code, notes, and snippets.

@andrewle
Created April 28, 2010 11:30
Show Gist options
  • Save andrewle/382025 to your computer and use it in GitHub Desktop.
Save andrewle/382025 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'closure-compiler'
desc "Use the Closure Compiler to compress Tumbletag.js"
task :build do
js = File.open('tumbletag.js', 'r')
min = Closure::Compiler.new.compile(js)
File.open('tumbletag.min.js', 'w') {|f| f.write(min) }
end
/*
// Tumblr Widget for displaying lists of posts
NOTES:
Maybe you should use this widget by doing this:
1. Stick a containing div somewhere:
<div id="tumblelist"></div>
2. Include the script
<script type="" src=""></script>
3. Run and configure
<script>
$('#tumblelist').tumbletag({ type: 'link' });
</script>
--
* Read only api
* Support all the tumblr api parameters?
*/
(function () {
if (typeof jQuery !== 'function') {
var t = document.createElement('script');
t.type = 'text/javascript';
t.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(t, s);
}
$(document).ready(function () {
$.get('http://tangovoice.com/api/read/json?type=link', {} , function () {
var links = [];
$.each(tumblr_api_read.posts, function () {
links.push("<li><a href=\""+this['link-url']+"\">"+this['link-text']+"</a></li>");
});
$('#tumbletag').append("<h3>Links</h3><ul></ul>");
$('#tumbletag ul').append(links.join());
});
});
})();
(function(){function scriptTag(src){var t=document.createElement('script');t.type='text/javascript';t.src=src;var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(t,s);}
if(typeof jQuery!=='function'){scriptTag('http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js');}
$(document).ready(function(){$.get('http://tangovoice.com/api/read/json?type=link',{},function(){$('#tumbletag').append("<h3>Links</h3><ul></ul>");$.each(tumblr_api_read.posts,function(){$('#tumbletag ul').append("<li><a href=\""+this['link-url']+"\">"+this['link-text']+"</a></li>");});});});})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment