Skip to content

Commit

Permalink
moved js files to js folder, added github widget
Browse files Browse the repository at this point in the history
  • Loading branch information
bitsteller committed Sep 1, 2011
1 parent fdff676 commit a036f09
Show file tree
Hide file tree
Showing 9 changed files with 1,288 additions and 47 deletions.
56 changes: 13 additions & 43 deletions index.html
Expand Up @@ -4,9 +4,19 @@
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
<title>Isometric 3D maps</title>
<script type="text/javascript" src="khtml_all.js"> </script>
<script type="text/javascript" src="osm-isometric-3d.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script>
<script type="text/javascript" src="js/khtml_all.js"> </script>
<script type="text/javascript" src="js/osm-isometric-3d.js"></script>
<script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script>
<script src="js/github.js"></script>
<script src="js/md5.js"></script>
<script src="js/github.commits.widget.js"></script>
<script>
$(function() {
$('#github-commits-osm2pov').githubInfoWidget(
{ user: 'bitsteller', repo: 'osm2pov', branch: 'master', last: 15, limitMessageTo: 30 });
});
</script>
</head>
<body onload="initIndex()">
<div id="page">
Expand Down Expand Up @@ -48,48 +58,8 @@ <h2>osm2pov</h2>
</div>
<div class="box">
<h2>osm2pov - rendering changes</h2>
<ul>
<li>2011-08-31: render waterway=dock </li>
<li>2011-03-14: parse building/building:use tag to get the building type</li>
<li>2011-02-10: add support for buildings above floor. See <a href="http://osm.kyblsoft.cz/3dmapa/?zoom=17&amp;lat=75.71906&amp;lon=14.45092&amp;layers=B">here</a> for example (thanks to Aleš Janda)</li>
<li>2011-01-26: render landuse=greenfield</li>
<li>2011-01-19: render leisure=garden</li>
<li>2011-01-18: render waterway=drain</li>
<li>2011-01-18: render pedestrian area lower than streets (fixes streets missing in pedestrian areas)</li>
<li>2011-01-18: use the lanes tag to compute way width if no width tag is given</li>
<li>2011-01-16: render railway=preserved and railway=narrow_gauge</li>
<li>2011-01-08: don't render walls (and other objects) as area (thanks to Aleš Janda)</li>
<li>2010-12-29: render meadows (landuse=meadow)</li>
<li>2010-12-20: render man_made=chimney at way (thanks to Aleš Janda)</li>
<li>2010-12-19: nicer farmland texture (more decent)</li>
<li>2010-12-13: render farmland (landuse=farm, farmland or farmyard)</li>
<li>2010-12-13: nicer lighting; little more natural building parts in shadow (thanks to Aleš Janda)</li>
<li>2010-12-13: render tunnels, forests and areas even if layer &lt; 0 (thanks to Aleš Janda)</li>
<li>2010-11-21: map looks more spatially (thanks to Aleš Janda)</li>
<li>2010-11-19: fix to building height (thanks to Aleš Janda)</li>
<li>2010-11-19: Ways have seamless links to bridges (thanks to Aleš Janda)</li>
<li>2010-11-19: More types of building roofs, autodetection of (non)living building (thanks to Aleš Janda)</li>
<li>2010-11-07: Don't render ways with layer &lt; 0</li>
<li>2010-11-06: Use width tag also on ways with border</li>
<li>2010-11-04: Fixes to way width</li>
<li>2010-11-01: Render primary_link (thanks to Aleš Janda)</li>
<li>2010-10-29: Render way width (thanks to andrewharvey)</li>
<li>2010-09-25: Render windmills</li>
<li>2010-07-27: Render parking areas</li>
<li>2010-05-04: Reunifed code: Changes of my fork are now available in the official osm2pov</li>
<li>2010-04-17: Add rendering of tramways (railway=tram)</li>
<li>2010-04-16: Improved rendering of railways (now with textures)</li>
<li>2010-04-15: Render beach (natural=beach)</li>
<li>2010-04-15: Vastly improved rendering of railways</li>
<li>2010-04-15: Render litterboxes (amenity=post_box) for testing</li>
<li>2010-04-15: Change scale of single trees (natural=tree) to 0.2</li>
<li>2010-04-14: Add rendering of stadiums (leisure=stadium)</li>
<li>2010-04-14: Add rendering of single trees (natural=tree)</li>
<li>2010-04-09: Add rendering of obelisks (preliminary)</li>
<li>2010-04-08: Add rendering of residential areas</li>
<li>2010-04-07: initial version 0.1.2 from <a href="http://osm.kyblsoft.cz/3dmapa/">http://osm.kyblsoft.cz/3dmapa/</a></li>
</ul>

<div id="github-commits-osm2pov"></div>
</div>

<div id="bottom">
Expand Down
121 changes: 121 additions & 0 deletions js/github.commits.widget-min.js

Large diffs are not rendered by default.

99 changes: 99 additions & 0 deletions js/github.commits.widget.js
@@ -0,0 +1,99 @@
(function ($) {
function widget(element, options) {
this.element = element;
this.options = options;
}

widget.prototype = (function() {

function _widgetRun(widget) {
if (!widget.options) {
widget.element.append('<span class="error">Options for widget are not set.</span>');
return;
}

var element = widget.element;
var user = widget.options.user;
var repo = widget.options.repo;
var branch = widget.options.branch;
var last = widget.options.last == undefined ? 0 : widget.options.last;
var limitMessage = widget.options.limitMessageTo == undefined ? 0 : widget.options.limitMessageTo;

element.append('<h3>Widget intitalization, please wait...</h3>');
gh.commit.forBranch(user, repo, branch, function (data) {
var commits = data.commits;
var totalCommits = (last < commits.length ? last : commits.length);

element.empty();
element.append('<ul>');

for (var c = 0; c < totalCommits; c++) {
element.append(
'<li>' +
' ' + avatar(commits[c].author.email) +
' ' + author(commits[c].author.login) +
' commited ' + message(commits[c].message, commits[c].url) +
' ' + when(commits[c].committed_date) +
'</li>');
}
element.append('</ul>');
element.append('<br/><h5>by <a href="https://github.com/alexanderbeletsky/github.commits.widget">github.commits.widget</a></h5>');

function avatar(email) {
var emailHash = hex_md5(email);
return '<img src="http://www.gravatar.com/avatar/' + emailHash + '?s=20"/>';
}

function author(login) {
return '<a href="https://github.com/' + login + '">' + login + '</a>';
}

function message(commitMessage, url) {
if (limitMessage > 0 && commitMessage.length > limitMessage)
{
commitMessage = commitMessage.substr(0, limitMessage) + '...';
}
return '"' + '<a href="https://github.com' + url + '">' + commitMessage + '</a>"';
}

function when(commitDate) {
var commitTime = new Date(commitDate).getTime();
var todayTime = new Date().getTime();

var differenceInDays = Math.floor(((todayTime - commitTime)/(24*3600*1000)));
if (differenceInDays == 0) {
var differenceInHours = Math.floor(((todayTime - commitTime)/(3600*1000)));
if (differenceInHours == 0) {
var differenceInMinutes = Math.floor(((todayTime - commitTime)/(600*1000)));
if (differenceInMinutes == 0) {

return 'just now';
}

return 'about ' + differenceInMinutes + ' minutes ago';
}

return 'about ' + differenceInHours + ' hours ago';
}

return differenceInDays + ' days ago';
}
});
}

return {
run: function () {
_widgetRun(this);
}
};

})();

$.fn.githubInfoWidget = function(options) {
var w = new widget(this, options);
w.run();

return this;
}

})(jQuery);

0 comments on commit a036f09

Please sign in to comment.