Skip to content
This repository has been archived by the owner on May 14, 2018. It is now read-only.

Commit

Permalink
Improved thread loading speeds
Browse files Browse the repository at this point in the history
  • Loading branch information
Serubin committed May 14, 2017
1 parent c8c95e6 commit 524da26
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 27 deletions.
48 changes: 24 additions & 24 deletions resources/js/Conversations.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,31 +51,31 @@ function Conversations(data, elem) {
$("[data-conversation-list=true]").html("")
.removeAttr("data-conversations-list");

page_id = "conversationlist" + new Date();
current_page_id = page_id;

$back_btn.hide(); // Hide back button by default
$more_btn.hide(); // Hide back button by default
$expand_btn.css("display", "") // Show expand button by default

// Set colors
$toolbar.css("background-color", color);
$navd_title.css("background-color", colorDark);
$navd_subtitle.css("background-color", colorDark);

$("meta[name=theme-color]").attr("content", colorDark);

// Set page title
document.title = "Pulse";
$toolbar_title.html("Pulse");
$navd_title.html(localStorage.getItem("name"));
$navd_subtitle.html(
formatPhoneNumber(localStorage.getItem("phone_number"))
);

if(typeof elem == "undefined")
if(typeof elem == "undefined") {
page_id = "conversationlist" + new Date();
current_page_id = page_id;

$back_btn.hide(); // Hide back button by default
$more_btn.hide(); // Hide back button by default
$expand_btn.css("display", "") // Show expand button by default

// Set colors
$toolbar.css("background-color", color);
$navd_title.css("background-color", colorDark);
$navd_subtitle.css("background-color", colorDark);

$("meta[name=theme-color]").attr("content", colorDark);

// Set page title
document.title = "Pulse";
$toolbar_title.html("Pulse");
$navd_title.html(localStorage.getItem("name"));
$navd_subtitle.html(
formatPhoneNumber(localStorage.getItem("phone_number"))
);
Nav();

}
$refresh_btn.on('click', function() {
initial_load = true
$elem.empty();
Expand Down
7 changes: 4 additions & 3 deletions resources/js/Thread.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ function Thread(data) {

function constructor() {

Conversations(null, $("#side-menu-insert"));
$("[data-conversation-list=inserted]").off();


page_id = "thread" + conversation_id + new Date();
current_page_id = page_id;

Expand Down Expand Up @@ -266,6 +264,9 @@ function Thread(data) {
setTimeout(checkNewMessages, refresh_rate);
$msg_entry.focus();

Conversations(null, $("#side-menu-insert"));
$("[data-conversation-list=inserted]").off();

}

function checkNewMessages() {
Expand Down

0 comments on commit 524da26

Please sign in to comment.