fixed many things and added search

This commit is contained in:
jeena 2013-03-25 19:13:09 +01:00
parent c6220b1dc1
commit cbc6755791
10 changed files with 128 additions and 75 deletions

View file

@ -11,15 +11,22 @@ function(jQuery, Paths, URI, HostApp, Cache) {
function Core() {
this.cache = new Cache();
this.saveScrollTop = 0;
}
Core.prototype.show = function() {
if (this.body) $(this.body).show();
Core.prototype.show = function(container) {
if (container) {
$(container).show();
document.body.scrollTop = this.saveScrollTop;
}
}
Core.prototype.hide = function() {
if (this.body) $(this.body).hide();
Core.prototype.hide = function(container) {
if (container && $(container).is(":visible")) {
this.saveScrollTop = document.body.scrollTop;
$(container).hide();
}
}
Core.prototype.getTemplate = function() {
@ -270,11 +277,19 @@ function(jQuery, Paths, URI, HostApp, Cache) {
text = text.escapeHTML().replace(/\n/g, "<br>");
var entities = [status.entity];
status.mentions.map(function (mention) {
entities.push(mention.entity)
});
if (status.mentions) {
status.mentions.map(function (mention) {
entities.push(mention.entity)
});
}
template.message.innerHTML = this.replaceURLWithHTMLLinks(text, entities, template.message);
// adding show search on click hash
$(template.message).find("a.hash").click(function(e) {
bungloo.search.searchFor("#" + e.target.innerHTML);
return false;
});
if (status.type == "https://tent.io/types/post/photo/v0.1.0") {
@ -802,7 +817,7 @@ function(jQuery, Paths, URI, HostApp, Cache) {
var hash = /(^|\s)(#)(\w+)/ig;
return URI.withinString(text, callback).replace(hash, "$1$2<a href='https://skate.io/search?q=%23$3'>$3</a>");
return URI.withinString(text, callback).replace(hash, "$1$2<a class='hash' href='https://skate.io/search?q=%23$3'>$3</a>");
}
Core.prototype.parseForMedia = function(text, images) {