From 754aef8a846485be48a89dfa3d4b544a5804bd49 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Sat, 19 Oct 2013 11:31:01 -0400 Subject: [PATCH 1/4] fixes #392 - needs testing on try to see if google updates title correctly order of events: 1. title changes, 2. content fades in, 3. history pushState --- public/src/ajaxify.js | 33 ++++++++++++++++----------------- public/src/utils.js | 6 +++++- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js index 01b438b7b0..89801eb76b 100644 --- a/public/src/ajaxify.js +++ b/public/src/ajaxify.js @@ -61,14 +61,6 @@ var ajaxify = {}; } if (templates.is_available(tpl_url) && !templates.force_refresh(tpl_url)) { - if (quiet !== true) { - if (window.history && window.history.pushState) { - window.history.pushState({ - "url": url - }, url, RELATIVE_PATH + "/" + url); - } - } - translator.load(tpl_url); jQuery('#footer, #content').fadeOut(100); @@ -84,17 +76,24 @@ var ajaxify = {}; callback(); } - jQuery('#content, #footer').stop(true, true).fadeIn(200, function () { - - app.process_page(); - if (window.location.hash) - hash = window.location.hash; - if (hash) - app.scrollToPost(hash.substr(1)); + utils.refreshTitle(url, function() { + jQuery('#content, #footer').stop(true, true).fadeIn(200, function () { + if (quiet !== true) { + if (window.history && window.history.pushState) { + window.history.pushState({ + "url": url + }, url, RELATIVE_PATH + "/" + url); + } + } + + app.process_page(); + if (window.location.hash) + hash = window.location.hash; + if (hash) + app.scrollToPost(hash.substr(1)); + }); }); - utils.refreshTitle(url); - }, url, template); return true; diff --git a/public/src/utils.js b/public/src/utils.js index c99fbb99a3..353a8ab177 100644 --- a/public/src/utils.js +++ b/public/src/utils.js @@ -129,7 +129,7 @@ return tags; }, - refreshTitle: function(url) { + refreshTitle: function(url, callback) { if (!url) { var a = document.createElement('a'); a.href = document.location; @@ -139,6 +139,10 @@ socket.emit('api:meta.buildTitle', url, function(title, numNotifications) { document.title = (numNotifications > 0 ? '(' + numNotifications + ') ' : '') + title; + if (callback) { + callback(); + } + notificationIcon = notificationIcon || document.querySelector('.notifications a i'); if (numNotifications > 0 && notificationIcon) notificationIcon.className = 'icon-circle active'; }); From 40319a66ff704a900427d5b55ab221b4f4d3c548 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Sat, 19 Oct 2013 11:48:46 -0400 Subject: [PATCH 2/4] reverting 754aef8a846485be48a89dfa3d4b544a5804bd49 --- public/src/ajaxify.js | 33 +++++++++++++++++---------------- public/src/utils.js | 6 +----- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js index 89801eb76b..01b438b7b0 100644 --- a/public/src/ajaxify.js +++ b/public/src/ajaxify.js @@ -61,6 +61,14 @@ var ajaxify = {}; } if (templates.is_available(tpl_url) && !templates.force_refresh(tpl_url)) { + if (quiet !== true) { + if (window.history && window.history.pushState) { + window.history.pushState({ + "url": url + }, url, RELATIVE_PATH + "/" + url); + } + } + translator.load(tpl_url); jQuery('#footer, #content').fadeOut(100); @@ -76,24 +84,17 @@ var ajaxify = {}; callback(); } - utils.refreshTitle(url, function() { - jQuery('#content, #footer').stop(true, true).fadeIn(200, function () { - if (quiet !== true) { - if (window.history && window.history.pushState) { - window.history.pushState({ - "url": url - }, url, RELATIVE_PATH + "/" + url); - } - } - - app.process_page(); - if (window.location.hash) - hash = window.location.hash; - if (hash) - app.scrollToPost(hash.substr(1)); - }); + jQuery('#content, #footer').stop(true, true).fadeIn(200, function () { + + app.process_page(); + if (window.location.hash) + hash = window.location.hash; + if (hash) + app.scrollToPost(hash.substr(1)); }); + utils.refreshTitle(url); + }, url, template); return true; diff --git a/public/src/utils.js b/public/src/utils.js index 353a8ab177..c99fbb99a3 100644 --- a/public/src/utils.js +++ b/public/src/utils.js @@ -129,7 +129,7 @@ return tags; }, - refreshTitle: function(url, callback) { + refreshTitle: function(url) { if (!url) { var a = document.createElement('a'); a.href = document.location; @@ -139,10 +139,6 @@ socket.emit('api:meta.buildTitle', url, function(title, numNotifications) { document.title = (numNotifications > 0 ? '(' + numNotifications + ') ' : '') + title; - if (callback) { - callback(); - } - notificationIcon = notificationIcon || document.querySelector('.notifications a i'); if (numNotifications > 0 && notificationIcon) notificationIcon.className = 'icon-circle active'; }); From 9d36d2c7490a8c7491f1b3cc1795b963daf7ae68 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Sat, 19 Oct 2013 15:31:17 -0400 Subject: [PATCH 3/4] fixed placeholder text in chat modal --- public/language/en/footer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/language/en/footer.json b/public/language/en/footer.json index 91cb43fb42..32d2e92bbe 100644 --- a/public/language/en/footer.json +++ b/public/language/en/footer.json @@ -1,6 +1,6 @@ { "chat.chatting_with": "Chat with ", - "chat.placeholder": "type chat message, here press enter to send", + "chat.placeholder": "type chat message here, press enter to send", "chat.send": "Send", "stats.online": "Online", "stats.users": "Users", From e9b6cdb37a9c0225fe134ba818a128f5e6731c96 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Sat, 19 Oct 2013 15:58:54 -0400 Subject: [PATCH 4/4] add responsive class to imgs --- public/src/app.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/src/app.js b/public/src/app.js index 9098cce749..3feb9b3f2e 100644 --- a/public/src/app.js +++ b/public/src/app.js @@ -273,7 +273,7 @@ var socket, } $('span.timeago').timeago(); - + $('.post-content img').addClass('img-responsive'); setTimeout(function () { window.scrollTo(0, 1); // rehide address bar on mobile after page load completes. @@ -342,6 +342,7 @@ var socket, app.populate_online_users(); app.addCommasToNumbers(); $('span.timeago').timeago(); + $('.post-content img').addClass('img-responsive'); }); }