-
-
Save orionrush/9730839 to your computer and use it in GitHub Desktop.
Revisions
-
jarmo revised this gist
Nov 12, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,7 +17,7 @@ It supports also second parameter specifying the posts count (default is 10). License: Copyright (c) 2012 Jarmo Pertman Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the -
jarmo revised this gist
Nov 12, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -75,7 +75,7 @@ Tumblr.RecentPosts = function(el, postsCount) { return { render: function() { var loadingEl = $("<div>").text("Loading...").appendTo($(el)); $.getJSON(apiUrl, function(data) { loadingEl.remove(); $("<ul class='recent-posts'>").appendTo($(el)).hide().append(renderPosts(data.posts).join("\n")).slideDown('slow'); -
jarmo revised this gist
Nov 12, 2012 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,7 +11,7 @@ <script type='text/javascript' src='https://raw.github.com/gist/4056588'></script> <script type='text/javascript' $(function() { new Tumblr.RecentPosts($("#recent-posts")).render() }) </script> It supports also second parameter specifying the posts count (default is 10). @@ -39,7 +39,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ var Tumblr = Tumblr || {}; Tumblr.RecentPosts = function(el, postsCount) { var apiUrl = "http://" + document.domain + "/api/read/json?callback=?&filter=text&num=" + (postsCount || 10); var titleTypes = { -
jarmo revised this gist
Nov 11, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,7 @@ <div id="recent-posts"></div> 2) Add code into the <head>: <script type='text/javascript' src='https://raw.github.com/gist/4056588'></script> <script type='text/javascript' $(function() { new TumblrRecentPosts($("#recent-posts")).render() }) -
jarmo revised this gist
Nov 11, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,7 @@ <div id="recent-posts"></div> 2) Add code into the <head>: <script type='text/javascript' src='https://raw.github.com/gist/4056588#file_tumblr_recent_posts.js'></script> <script type='text/javascript' $(function() { new TumblrRecentPosts($("#recent-posts")).render() }) -
jarmo revised this gist
Nov 11, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,7 @@ <div id="recent-posts"></div> 2) Add code into the <head>: <script type='text/javascript' src='https://raw.github.com/gist/4056588/c160b66421f3efbae0f973a9141ddcbc059ea7dc/tumblr-recent-posts.js'></script> <script type='text/javascript' $(function() { new TumblrRecentPosts($("#recent-posts")).render() }) -
jarmo revised this gist
Nov 11, 2012 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,9 @@ <div id="recent-posts"></div> 2) Add code into the <head>: <script type='text/javascript' src='https://raw.github.com/gist/4056588/5f6c3bf0fc610c5ce4955aca216d248cad1769be/tumblr-recent-posts.js'></script> <script type='text/javascript' $(function() { new TumblrRecentPosts($("#recent-posts")).render() }) </script> -
jarmo revised this gist
Nov 11, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,7 @@ <div id="recent-posts"></div> 2) Add code into the <head>: <script type='text/javascript' src='https://raw.github.com/gist/4056588/5f6c3bf0fc610c5ce4955aca216d248cad1769be/tumblr-recent-posts.js'> $(function() { new TumblrRecentPosts($("#recent-posts")).render() }) </script> -
jarmo revised this gist
Nov 11, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,7 +9,7 @@ 2) Add code into the <head>: <script type='text/javascript' src='https://raw.github.com/gist/4056588/c6702d067bb160447a01cb785e027c3823d3f4b0/tumblr-recent-posts.js'> $(function() { new TumblrRecentPosts($("#recent-posts")).render() }) </script> It supports also second parameter specifying the posts count (default is 10). -
jarmo revised this gist
Nov 11, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,7 @@ <div id="recent-posts"></div> 2) Add code into the <head>: <script type='text/javascript' src='https://raw.github.com/gist/4056588/c6702d067bb160447a01cb785e027c3823d3f4b0/tumblr-recent-posts.js'> $(function() { new Tumblr.RecentPosts($("#recent-posts")).render() }) </script> -
jarmo revised this gist
Nov 11, 2012 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,9 @@ <div id="recent-posts"></div> 2) Add code into the <head>: <script type='text/javascript' src='https://raw.github.com/gist/4056588/1f49a01c3f238aadd2cae2f17fda8f1a0f03f4fa/tumblr-recent-posts.js'> $(function() { new Tumblr.RecentPosts($("#recent-posts")).render() }) </script> It supports also second parameter specifying the posts count (default is 10). @@ -35,7 +37,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ var TumblrRecentPosts = function(el, postsCount) { var apiUrl = "http://" + document.domain + "/api/read/json?callback=?&filter=text&num=" + (postsCount || 10); var titleTypes = { -
jarmo created this gist
Nov 11, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,81 @@ /* This widget shows Recent Posts on your Tumblr blog. Its dependency is jQuery. Usage: 1) Add html: <div id="recent-posts"></div> 2) Add code into the <head>: $(function() { new Tumblr.RecentPosts($("#recent-posts")).render() }) It supports also second parameter specifying the posts count (default is 10). License: Copyright (c) 2010-2012 Jarmo Pertman Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ Tumblr.RecentPosts = function(el, postsCount) { var apiUrl = "http://" + document.domain + "/api/read/json?callback=?&filter=text&num=" + (postsCount || 10); var titleTypes = { regular: "regular-title", link: "link-text", quote: "quote-source", photo: "photo-caption", conversation: "conversation-title", video: "video-caption", audio: "audio-caption", answer: "question" }; var renderPosts = function(posts) { return $.map($.map(posts, postInfo), renderPost); }; var renderPost = function(post) { return "<li><a href='" + post.url + "'>" + post.title + "</a></li>"; }; var postInfo = function(post) { var titleType = titleTypes[post.type]; if (titleType in post) { return { title: post[titleType], url: post["url-with-slug"] }; } }; return { render: function() { var loadingEl = $("<div>").text("Loading recent posts list...").appendTo($(el)); $.getJSON(apiUrl, function(data) { loadingEl.remove(); $("<ul class='recent-posts'>").appendTo($(el)).hide().append(renderPosts(data.posts).join("\n")).slideDown('slow'); }); return this; } } };