added add/show geolocation and changed name from TweetModel to PostModel

This commit is contained in:
Jeena Paradies 2012-11-22 19:21:38 +01:00
parent d39b643844
commit 76b63d5c68
12 changed files with 398 additions and 50 deletions

View file

@ -117,10 +117,10 @@ function(Core, Paths, HostApp, URI) {
}
}
Timeline.prototype.sendNewMessage = function(content, in_reply_to_status_id, in_reply_to_entity) {
Timeline.prototype.sendNewMessage = function(content, in_reply_to_status_id, in_reply_to_entity, location) {
var _this = this;
var callback = function(data) { _this.getNewData(); }
Core.prototype.sendNewMessage.call(this, content, in_reply_to_status_id, in_reply_to_entity, callback);
Core.prototype.sendNewMessage.call(this, content, in_reply_to_status_id, in_reply_to_entity, location, callback);
}
Timeline.prototype.remove = function(id) {

View file

@ -237,7 +237,7 @@ function(jQuery, Paths, URI, HostApp, Followings) {
}
// {"type":"Point","coordinates":[57.10803113,12.25854746]}
if (status.content && status.content.location && status.content.location.type == "Point") {
if (status.content && status.content.location && (typeof status.content.location.type == "undefined" || status.content.location.type == "Point")) {
template.geo.href = "http://maps.google.com/maps?q=" + status.content.location.coordinates[0] + "," + status.content.location.coordinates[1];
template.geo.style.display = "";
}
@ -249,7 +249,7 @@ function(jQuery, Paths, URI, HostApp, Followings) {
return template.item;
}
Core.prototype.sendNewMessage = function(content, in_reply_to_status_id, in_reply_to_entity, callback) {
Core.prototype.sendNewMessage = function(content, in_reply_to_status_id, in_reply_to_entity, location, callback) {
var url = URI(Paths.mkApiRootPath("/posts"));
@ -266,6 +266,10 @@ function(jQuery, Paths, URI, HostApp, Followings) {
},
};
if (location) {
data["content"]["location"] = { "type": "Point", "coordinates": location }
}
var mentions = this.parseMentions(content, in_reply_to_status_id, in_reply_to_entity);
if (mentions.length > 0) {

View file

@ -105,17 +105,23 @@ var console = {
}
};
function loadPlugin(js_url, css_url) {
function loadJsPlugin(js_url) {
if (js_url) {
var js_plugin = document.createElement("script");
js_plugin.type = "text/javascript";
js_plugin.src = js_url;
document.getElementsByTagName("head")[0].appendChild(js_plugin);
}
var plugin = document.createElement("script");
plugin.type = "text/javascript";
plugin.src = js_url;
document.getElementsByTagName("head")[0].appendChild(plugin);
}
if (css_url != null) {
function loadCssPlugin(css_url) {
if (css_url) {
var css_plugin = document.createElement("link");
css_plugin.rel = 'stylesheet';
css_plugin.type = 'text/css'
css_plugin.href = css_url;
document.getElementsByTagName("head")[0].appendChild(css_plugin);
}
}