Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added some links in github block

  • Loading branch information...
commit f7817f186e233f150ca639971bd5d17bb148828a 1 parent 8d3a1bd
@msoap authored
Showing with 35 additions and 5 deletions.
  1. +18 −0 index.html
  2. +16 −4 js/script.js
  3. +1 −1  js/script.min.js
View
18 index.html
@@ -109,6 +109,24 @@
<a href="${link_to_all}">All items&hellip;</a>
</ul>
</script>
+ <script id="tmpl_links_block_github" type="text/x-jquery-tmpl">
+ <span class="service_title">${name}</span>
+ <ul>
+ {{each(i, item) items}}
+ <li title="${item.description}">
+ ${item.title}.
+ ({{each(j, url_item) item.urls}}
+ <a href="${url_item.url}">${url_item.title}</a>
+ {{if j < item.urls.length - 1}}
+ /
+ {{/if}}
+ {{/each}})
+ <span class="item_data">${item.date}</span>
+ </li>
+ {{/each}}
+ <a href="${link_to_all}">All items&hellip;</a>
+ </ul>
+ </script>
<!-- Yandex.Metrika counter -->
<div style="display:none;"><script type="text/javascript">
View
20 js/script.js
@@ -46,16 +46,26 @@ var App = {
name: 'Github repositories:',
link_to_all: 'http://github.com/msoap',
items: github_data.data.map(function(i) {
+
+ var urls = [];
+ if (i.homepage.length) {
+ urls.push({title: "home", url: i.homepage})
+ };
+ urls.push({title: "repo", url: i.html_url});
+ if (i.has_wiki) {
+ urls.push({title: "wiki", url: i.html_url + '/wiki'})
+ };
+
return {
title: i.description,
description: i.description,
- url: i.html_url,
+ urls: urls,
date: new Date(i.updated_at).toLocaleDateString()
};
})
};
- App.render_any('div#github', vars);
+ App.render_any('div#github', vars, "script#tmpl_links_block_github");
});
},
@@ -176,7 +186,9 @@ var App = {
},
// -------- render any block ---------
- render_any: function(where_selector, vars) {
- $("script#tmpl_links_block").tmpl(vars).appendTo(where_selector);
+ render_any: function(where_selector, vars, template) {
+ if (! template)
+ template = "script#tmpl_links_block";
+ $(template).tmpl(vars).appendTo(where_selector);
}
};
View
2  js/script.min.js
@@ -1 +1 @@
-"use strict",$(function(){App.init()});var App={init:function(){$("div#navbar ul.nav li a").click(App.on_click_navbar),setTimeout(App.on_init_set_active,10),App.on_init_render_github(),App.on_init_render_delicious(),App.on_init_render_lastfm(),App.on_init_render_fotkiyandexru(),App.on_init_render_twitter(),App.on_init_render_linkedin()},on_init_set_active:function(){var a=document.location.hash.replace(/^#/,"");a.length&&$("div#"+a).length&&($("div#navbar ul.nav li").removeClass("active"),$("div#navbar ul.nav li a[href=#"+a+"]").parent("li").addClass("active"))},on_click_navbar:function(){$(this).parents("ul").find("li").removeClass("active"),$(this).parent("li").addClass("active")},on_init_render_github:function(){$.getJSON("https://api.github.com/users/msoap/repos?callback=?",{format:"json"},function(a){var b={name:"Github repositories:",link_to_all:"http://github.com/msoap",items:a.data.map(function(a){return{title:a.description,description:a.description,url:a.html_url,date:(new Date(a.updated_at)).toLocaleDateString()}})};App.render_any("div#github",b)})},on_init_render_delicious:function(){$.getJSON("http://feeds.delicious.com/v2/json/msoap?callback=?",{},function(a){var b={name:"Last delicious links:",link_to_all:"http://delicious.com/msoap",items:a.map(function(a){return{title:a.d,description:a.n,url:a.u,date:(new Date(a.dt)).toLocaleDateString()}})};App.render_any("div#delicious",b)})},on_init_render_lastfm:function(){$.getJSON("http://ws.audioscrobbler.com/2.0/?callback=?",{method:"user.getRecentTracks",format:"json",user:"msoap",api_key:"f013c46eeee32be481c90eb2c79378c5"},function(a){var b={without_url:!0,name:"Recently Listened Tracks:",link_to_all:"http://www.lastfm.ru/user/msoap",items:a.recenttracks.track.map(function(a){return{title:a.name,description:[a.artist["#text"],a.album["#text"]].join(" / "),url:a.url,date:a.date?(new Date(a.date.uts*1e3)).toLocaleDateString():(new Date).toLocaleDateString()}})};App.render_any("div#lastfm",b)})},on_init_render_fotkiyandexru:function(){$.getJSON("http://api-fotki.yandex.ru/api/users/msoap/photos/?callback=?",{limit:10,format:"json"},function(a){var b={without_url:!0,name:"Last photos:",link_to_all:"http://fotki.yandex.ru/users/msoap/",items:a.entries.filter(function(a,b){return b<15?!0:!1}).map(function(a){return{title:a.title,description:a.description,url:a.links.alternate,date:(new Date(a.published)).toLocaleDateString()}})};App.render_any("div#fotkiyandexru",b)})},on_init_render_twitter:function(){$.getJSON("https://api.twitter.com/1/statuses/user_timeline.json?callback=?",{include_entities:"false",include_rts:"false",screen_name:"msoap",count:10},function(a){var b={without_url:!0,name:"Last twits, one twit per year:)",link_to_all:"http://twitter.com/msoap",items:a.map(function(a){return{title:a.text,description:"",url:"http://twitter.com/#!/msoap/status/"+a.id_str,date:(new Date(a.created_at)).toLocaleDateString()}})};App.render_any("div#twitter",b)})},on_init_render_linkedin:function(){$("div#linkedin_div").append('<script src="http://platform.linkedin.com/in.js" type="text/javascript"></script><script type="IN/MemberProfile" data-id="http://www.linkedin.com/in/mudrik" data-format="click" data-related="false"></script>'),$("div#linkedin_div").one("mouseenter mouseleave",function(){$("span.IN-widget a.li-connect-link").append('<span style="color: black; font-size: 70%; text-decoration: none;">Linkedin<span>'),$(this).unbind("mouseenter mouseleave")})},render_any:function(a,b){$("script#tmpl_links_block").tmpl(b).appendTo(a)}};
+"use strict";$(function(){App.init()});var App={init:function(){$("div#navbar ul.nav li a").click(App.on_click_navbar),setTimeout(App.on_init_set_active,10),App.on_init_render_github(),App.on_init_render_delicious(),App.on_init_render_lastfm(),App.on_init_render_fotkiyandexru(),App.on_init_render_twitter(),App.on_init_render_linkedin()},on_init_set_active:function(){var a=document.location.hash.replace(/^#/,"");a.length&&$("div#"+a).length&&($("div#navbar ul.nav li").removeClass("active"),$("div#navbar ul.nav li a[href=#"+a+"]").parent("li").addClass("active"))},on_click_navbar:function(){$(this).parents("ul").find("li").removeClass("active"),$(this).parent("li").addClass("active")},on_init_render_github:function(){$.getJSON("https://api.github.com/users/msoap/repos?callback=?",{format:"json"},function(a){var b={name:"Github repositories:",link_to_all:"http://github.com/msoap",items:a.data.map(function(a){var b=[];return a.homepage.length&&b.push({title:"home",url:a.homepage}),b.push({title:"repo",url:a.html_url}),a.has_wiki&&b.push({title:"wiki",url:a.html_url+"/wiki"}),{title:a.description,description:a.description,urls:b,date:(new Date(a.updated_at)).toLocaleDateString()}})};App.render_any("div#github",b,"script#tmpl_links_block_github")})},on_init_render_delicious:function(){$.getJSON("http://feeds.delicious.com/v2/json/msoap?callback=?",{},function(a){var b={name:"Last delicious links:",link_to_all:"http://delicious.com/msoap",items:a.map(function(a){return{title:a.d,description:a.n,url:a.u,date:(new Date(a.dt)).toLocaleDateString()}})};App.render_any("div#delicious",b)})},on_init_render_lastfm:function(){$.getJSON("http://ws.audioscrobbler.com/2.0/?callback=?",{method:"user.getRecentTracks",format:"json",user:"msoap",api_key:"f013c46eeee32be481c90eb2c79378c5"},function(a){var b={without_url:!0,name:"Recently Listened Tracks:",link_to_all:"http://www.lastfm.ru/user/msoap",items:a.recenttracks.track.map(function(a){return{title:a.name,description:[a.artist["#text"],a.album["#text"]].join(" / "),url:a.url,date:a.date?(new Date(a.date.uts*1e3)).toLocaleDateString():(new Date).toLocaleDateString()}})};App.render_any("div#lastfm",b)})},on_init_render_fotkiyandexru:function(){$.getJSON("http://api-fotki.yandex.ru/api/users/msoap/photos/?callback=?",{limit:10,format:"json"},function(a){var b={without_url:!0,name:"Last photos:",link_to_all:"http://fotki.yandex.ru/users/msoap/",items:a.entries.filter(function(a,b){return b<15?!0:!1}).map(function(a){return{title:a.title,description:a.description,url:a.links.alternate,date:(new Date(a.published)).toLocaleDateString()}})};App.render_any("div#fotkiyandexru",b)})},on_init_render_twitter:function(){$.getJSON("https://api.twitter.com/1/statuses/user_timeline.json?callback=?",{include_entities:"false",include_rts:"false",screen_name:"msoap",count:10},function(a){var b={without_url:!0,name:"Last twits, one twit per year:)",link_to_all:"http://twitter.com/msoap",items:a.map(function(a){return{title:a.text,description:"",url:"http://twitter.com/#!/msoap/status/"+a.id_str,date:(new Date(a.created_at)).toLocaleDateString()}})};App.render_any("div#twitter",b)})},on_init_render_linkedin:function(){$("div#linkedin_div").append('<script src="http://platform.linkedin.com/in.js" type="text/javascript"></script><script type="IN/MemberProfile" data-id="http://www.linkedin.com/in/mudrik" data-format="click" data-related="false"></script>'),$("div#linkedin_div").one("mouseenter mouseleave",function(){$("span.IN-widget a.li-connect-link").append('<span style="color: black; font-size: 70%; text-decoration: none;">Linkedin<span>'),$(this).unbind("mouseenter mouseleave")})},render_any:function(a,b,c){c||(c="script#tmpl_links_block"),$(c).tmpl(b).appendTo(a)}};
Please sign in to comment.
Something went wrong with that request. Please try again.