added map link with pin

This commit is contained in:
Jeena Paradies 2010-09-24 07:04:33 +02:00
parent 7182a25c28
commit ba0ba32fc3
175 changed files with 8012 additions and 7 deletions

View file

@ -88,6 +88,12 @@ Twittia.prototype.getItem = function(status) {
template.ago.appendChild(time);
template.ago.href = "http://twitter.com/" + status.user.screen_name + "/status/" + status.id;
// {"type":"Point","coordinates":[57.10803113,12.25854746]}
if (status.geo && status.geo.type == "Point") {
template.geo.href = "http://maps.google.com/maps?q=" + status.geo.coordinates[0] + "," + status.geo.coordinates[1];
template.geo.style.display = "";
}
template.source.innerHTML = status.source;
return template.item;
@ -118,8 +124,8 @@ Twittia.prototype.getTemplate = function() {
var image = document.createElement("img");
image.className = "image";
image.onmousedown = function(e) { e.preventDefault(); };
item.appendChild(image);
image.onmousedown = function(e) { e.preventDefault(); };
item.appendChild(image);
var image_username = a.cloneNode();
image.appendChild(image_username);
@ -138,6 +144,18 @@ Twittia.prototype.getTemplate = function() {
in_reply.className = "reply";
head.appendChild(in_reply);
var space = document.createTextNode(" ");
head.appendChild(space);
var geo = document.createElement("a");
geo.style.display = "none";
head.appendChild(geo);
var pin = document.createElement("img");
pin.src = "pin.png";
pin.alt = "Map link";
geo.appendChild(pin);
var in_reply_text = document.createTextNode(" in reply to ");
in_reply.appendChild(in_reply_text)
@ -161,7 +179,7 @@ Twittia.prototype.getTemplate = function() {
var source = document.createElement("span");
source.className = "source";
date.appendChild(source)
this.template = {
item: item,
reply_to: reply_to,
@ -171,7 +189,8 @@ Twittia.prototype.getTemplate = function() {
in_reply: in_reply_a,
message: message,
ago: ago,
source: source
source: source,
geo: geo
}
return jQuery.extend(true, {}, this.template);