fixed many things and added search
This commit is contained in:
parent
c6220b1dc1
commit
cbc6755791
10 changed files with 128 additions and 75 deletions
|
@ -233,23 +233,23 @@ class Console(QtCore.QObject):
|
|||
|
||||
@QtCore.pyqtSlot(str)
|
||||
def log(self, string):
|
||||
print "<js>: " + string
|
||||
print "<js>: " + unicode(string)
|
||||
|
||||
@QtCore.pyqtSlot(str)
|
||||
def error(self, string):
|
||||
print "<js ERROR>: " + string
|
||||
print "<js ERROR>: " + unicode(string)
|
||||
|
||||
@QtCore.pyqtSlot(str)
|
||||
def warn(self, string):
|
||||
print "<js WARN>: " + string
|
||||
print "<js WARN>: " + unicode(string)
|
||||
|
||||
@QtCore.pyqtSlot(str)
|
||||
def notice(self, string):
|
||||
print "<js NOTICE>: " + string
|
||||
print "<js NOTICE>: " + unicode(string)
|
||||
|
||||
@QtCore.pyqtSlot(str)
|
||||
def debug(self, string):
|
||||
print "<js DEBUG>: " + string
|
||||
print "<js DEBUG>: " + unicode(string)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
@ -44,6 +44,10 @@ class WebViewCreator(QtWebKit.QWebView):
|
|||
self.actions = []
|
||||
QtWebKit.QWebSettings.globalSettings().setAttribute(QtWebKit.QWebSettings.DeveloperExtrasEnabled, True)
|
||||
|
||||
def copy_link():
|
||||
self.page().triggerAction(QtWebKit.QWebPage.CopyLinkToClipboard)
|
||||
self.action_copy_link = QtGui.QAction('Copy Lin&k', self, triggered=copy_link)
|
||||
|
||||
def context_menu_requested(self, point):
|
||||
context_menu = QtGui.QMenu()
|
||||
|
||||
|
|
|
@ -397,3 +397,14 @@ a.youtube:before {
|
|||
iframe {
|
||||
max-width: 500px;
|
||||
}
|
||||
|
||||
form.search {
|
||||
text-align: center;
|
||||
padding: 5px 10%;
|
||||
}
|
||||
|
||||
form.search input {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
font-size: 1.2em;
|
||||
}
|
|
@ -23,6 +23,14 @@ function(HostApp, Core, Paths, URI) {
|
|||
|
||||
Conversation.prototype = Object.create(Core.prototype);
|
||||
|
||||
Conversation.prototype.show = function() {
|
||||
Core.prototype.show.call(this, this.body);
|
||||
}
|
||||
|
||||
Conversation.prototype.hide = function() {
|
||||
Core.prototype.hide.call(this, this.body);
|
||||
}
|
||||
|
||||
|
||||
Conversation.addStatus = function(status) {
|
||||
|
||||
|
|
|
@ -2,10 +2,11 @@ define([
|
|||
"helper/HostApp",
|
||||
"controller/Timeline",
|
||||
"lib/URI",
|
||||
"helper/Paths"
|
||||
"helper/Paths",
|
||||
"helper/Core"
|
||||
],
|
||||
|
||||
function(HostApp, Timeline, URI, Paths) {
|
||||
function(HostApp, Timeline, URI, Paths, Core) {
|
||||
|
||||
|
||||
function Mentions() {
|
||||
|
@ -23,6 +24,14 @@ function(HostApp, Timeline, URI, Paths) {
|
|||
|
||||
Mentions.prototype = Object.create(Timeline.prototype);
|
||||
|
||||
Mentions.prototype.show = function() {
|
||||
Core.prototype.show.call(this, this.body);
|
||||
}
|
||||
|
||||
Mentions.prototype.hide = function() {
|
||||
Core.prototype.hide.call(this, this.body);
|
||||
}
|
||||
|
||||
|
||||
Mentions.prototype.newStatus = function(statuses) {
|
||||
|
||||
|
|
|
@ -20,19 +20,20 @@ function(HostApp, Core, Paths, URI) {
|
|||
this.initProfileTemplate();
|
||||
this.hide();
|
||||
|
||||
this.showProfileForEntity(); // Load users profile on start
|
||||
var _this = this;
|
||||
setTimeout(function() { _this.showProfileForEntity() }, 5000); // Load users profile on start
|
||||
}
|
||||
|
||||
Profile.prototype = Object.create(Core.prototype);
|
||||
|
||||
|
||||
Profile.prototype.show = function() {
|
||||
$(this.container).show();
|
||||
Core.prototype.show.call(this, this.container);
|
||||
}
|
||||
|
||||
Profile.prototype.hide = function() {
|
||||
$(this.container).hide();
|
||||
};
|
||||
Core.prototype.hide.call(this, this.container);
|
||||
}
|
||||
|
||||
Profile.prototype.showList = function(list) {
|
||||
$(this.body).hide();
|
||||
|
@ -247,6 +248,7 @@ function(HostApp, Core, Paths, URI) {
|
|||
}
|
||||
|
||||
Profile.prototype.getFollowing = function() {
|
||||
if(this.entity != HostApp.stringForKey("entity")) {
|
||||
var url = Paths.mkApiRootPath("/followings") + "/" + encodeURIComponent(this.entity);
|
||||
var _this = this;
|
||||
Paths.getURL(url, "GET", function(resp) {
|
||||
|
@ -259,6 +261,10 @@ function(HostApp, Core, Paths, URI) {
|
|||
_this.following_id = null;
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.setFollowingButton(false);
|
||||
this.following_id = null;
|
||||
}
|
||||
}
|
||||
|
||||
Profile.prototype.showProfile = function(profile) {
|
||||
|
@ -320,6 +326,7 @@ function(HostApp, Core, Paths, URI) {
|
|||
_this.populate(_this.profile_template.followed, resp.responseText);
|
||||
}, null, false);
|
||||
|
||||
if (this.entity != HostApp.stringForKey("entity")) {
|
||||
Paths.getURL(URI(root_url + "/followers/" + encodeURIComponent(HostApp.stringForKey("entity"))).toString(), "GET", function(resp) {
|
||||
if (resp.status == 200) {
|
||||
_this.relationships.following_you = true;
|
||||
|
@ -333,9 +340,12 @@ function(HostApp, Core, Paths, URI) {
|
|||
_this.relationships.followed_by_you = true;
|
||||
}
|
||||
_this.setRelationships();
|
||||
|
||||
});
|
||||
|
||||
} else {
|
||||
this.setRelationships();
|
||||
}
|
||||
|
||||
var url = URI(root_url + "/posts/count");
|
||||
var post_types = [
|
||||
"https://tent.io/types/post/repost/v0.1.0",
|
||||
|
|
|
@ -18,13 +18,13 @@ function(HostApp, Paths, Cache) {
|
|||
|
||||
this.menu = {};
|
||||
|
||||
this.menu.user = this.createItem("User", function() { _this.onEntity() }, "img/sidebar/user.png", "img/sidebar/user.png");
|
||||
this.menu.timeline = this.createItem("Timeline", function() { _this.onTimeline() }, "img/sidebar/timeline.png", "img/sidebar/timeline_active.png", true);
|
||||
this.menu.mentions = this.createItem("Mentions", function() { _this.onMentions() }, "img/sidebar/mentions.png", "img/sidebar/mentions_active.png");
|
||||
this.menu.user = this.createItem("User", function() { _this.onEntity(); return false; }, "img/sidebar/user.png", "img/sidebar/user.png");
|
||||
this.menu.timeline = this.createItem("Timeline", function() { _this.onTimeline(); return false; }, "img/sidebar/timeline.png", "img/sidebar/timeline_active.png", true);
|
||||
this.menu.mentions = this.createItem("Mentions", function() { _this.onMentions(); return false; }, "img/sidebar/mentions.png", "img/sidebar/mentions_active.png");
|
||||
|
||||
this.menu.conversation = this.createItem("Conversation", function() { _this.onConversation() }, "img/sidebar/conversation.png", "img/sidebar/conversation_active.png");
|
||||
this.menu.entityProfile = this.createItem("Profile", function() { _this.onEntityProfile() }, "img/sidebar/profile.png", "img/sidebar/profile_active.png");
|
||||
this.menu.search = this.createItem("Search", function() { _this.onSearch() }, "img/sidebar/search.png", "img/sidebar/search_active.png")
|
||||
this.menu.conversation = this.createItem("Conversation", function() { _this.onConversation(); return false; }, "img/sidebar/conversation.png", "img/sidebar/conversation_active.png");
|
||||
this.menu.entityProfile = this.createItem("Profile", function() { _this.onEntityProfile(); return false; }, "img/sidebar/profile.png", "img/sidebar/profile_active.png");
|
||||
this.menu.search = this.createItem("Search", function() { _this.onSearch(); return false; }, "img/sidebar/search.png", "img/sidebar/search_active.png")
|
||||
|
||||
this.body.appendChild(this.menu.user);
|
||||
this.body.appendChild(this.menu.timeline);
|
||||
|
@ -174,7 +174,7 @@ function(HostApp, Paths, Cache) {
|
|||
}
|
||||
|
||||
Sidebar.prototype.onSearch = function() {
|
||||
debug("Search not implemented yet")
|
||||
this.showContentFor(bungloo.search, this.menu.search);
|
||||
}
|
||||
|
||||
return Sidebar;
|
||||
|
|
|
@ -14,7 +14,7 @@ function(Core, Paths, HostApp, URI) {
|
|||
this.action = "timeline";
|
||||
this.reload_blocked = false;
|
||||
|
||||
this.max_length = 20;
|
||||
this.max_length = 200;
|
||||
this.timeout = 10 * 1000; // every 10 seconds
|
||||
this.since_id = null;
|
||||
this.since_id_entity = null;
|
||||
|
@ -32,6 +32,14 @@ function(Core, Paths, HostApp, URI) {
|
|||
|
||||
Timeline.prototype = Object.create(Core.prototype);
|
||||
|
||||
Timeline.prototype.show = function() {
|
||||
Core.prototype.show.call(this, this.body);
|
||||
}
|
||||
|
||||
Timeline.prototype.hide = function() {
|
||||
Core.prototype.hide.call(this, this.body);
|
||||
}
|
||||
|
||||
|
||||
Timeline.prototype.newStatus = function(statuses) {
|
||||
|
||||
|
|
|
@ -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,12 +277,20 @@ function(jQuery, Paths, URI, HostApp, Cache) {
|
|||
text = text.escapeHTML().replace(/\n/g, "<br>");
|
||||
|
||||
var entities = [status.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") {
|
||||
|
||||
for (var i = 0; i < status.attachments.length; i++) {
|
||||
|
@ -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) {
|
||||
|
|
|
@ -6,6 +6,7 @@ var bungloo = {
|
|||
mentions: null,
|
||||
entityProfile: null,
|
||||
conversation: null,
|
||||
search: null,
|
||||
cache: {}
|
||||
};
|
||||
|
||||
|
@ -21,37 +22,24 @@ function start() {
|
|||
|
||||
});*/
|
||||
|
||||
require(["controller/Sidebar"], function(Sidebar) {
|
||||
require([
|
||||
"controller/Sidebar",
|
||||
"controller/Timeline",
|
||||
"controller/Mentions",
|
||||
"controller/Profile",
|
||||
"controller/Conversation",
|
||||
"controller/Search"
|
||||
|
||||
], function(Sidebar, Timeline, Mentions, Profile, Conversation, Search) {
|
||||
|
||||
bungloo.sidebar = new Sidebar();
|
||||
|
||||
});
|
||||
|
||||
require(["controller/Timeline"], function(Timeline) {
|
||||
|
||||
bungloo.timeline = new Timeline();
|
||||
|
||||
});
|
||||
|
||||
require(["controller/Mentions"], function(Mentions) {
|
||||
|
||||
bungloo.mentions = new Mentions();
|
||||
|
||||
});
|
||||
|
||||
|
||||
require(["controller/Profile"], function(Profile) {
|
||||
|
||||
bungloo.entityProfile = new Profile();
|
||||
|
||||
});
|
||||
|
||||
require(["controller/Conversation"], function(Conversation) {
|
||||
|
||||
bungloo.conversation = new Conversation();
|
||||
bungloo.search = new Search();
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Reference in a new issue