diff --git a/app/assets/javascripts/initializePage.js.erb b/app/assets/javascripts/initializePage.js.erb index e1dd22939..9c513224a 100644 --- a/app/assets/javascripts/initializePage.js.erb +++ b/app/assets/javascripts/initializePage.js.erb @@ -33,7 +33,6 @@ function callInitalizers(){ initNotifications(); initializeSplitTestTracking(); initializeNavSearchListener(); - initializePreloads(); initializeStylesheetAppend(); initializeAnalytics(); initializeCommentDropdown(); diff --git a/app/assets/javascripts/initializers/initializePreloads.js b/app/assets/javascripts/initializers/initializePreloads.js deleted file mode 100644 index 6053dd9ac..000000000 --- a/app/assets/javascripts/initializers/initializePreloads.js +++ /dev/null @@ -1,27 +0,0 @@ -function initializePreloads() { - if (document.getElementById("index-container")) { - setTimeout(function(){ - var articleLinks = document.getElementsByClassName("index-article-link"); - var hrefs = []; - for(var i=0; i < articleLinks.length; i++) { - var href = articleLinks[i].href; - if (instantClick && i < 7 && hrefs.indexOf(href) == -1 ) { - InstantClick.preload(articleLinks[i].href, "force"); - hrefs.push(href); - } - } - },750); - } - else { - setTimeout(function(){ - if (instantClick) { - InstantClick.preload(document.getElementById("logo-link").href, "force"); - } - },2000) - } - setTimeout(function(){ - if (instantClick && checkUserLoggedIn()) { - InstantClick.preload(document.getElementById("notifications-link").href, "force"); - } - },501) -} \ No newline at end of file diff --git a/app/views/articles/show.html.erb b/app/views/articles/show.html.erb index cee386228..4e67d682a 100644 --- a/app/views/articles/show.html.erb +++ b/app/views/articles/show.html.erb @@ -168,6 +168,9 @@ commentable: @article, commentable_type: "Article" %>
+ <% cache "comment_root_#{user_signed_in?}", expires_in: 1.hours do %> + <%= render "comments/login_cta_comment" %> + <% end %> <% Comment.rooted_on(@article.id,"Article").order("score DESC").limit(@comments_to_show_count).each do |comment| %> <% cache ["comment_root_#{user_signed_in?}", comment] do %> <%= render("/comments/comment", diff --git a/app/views/comments/_login_cta_comment.html.erb b/app/views/comments/_login_cta_comment.html.erb new file mode 100644 index 000000000..b7bb9af3f --- /dev/null +++ b/app/views/comments/_login_cta_comment.html.erb @@ -0,0 +1,32 @@ +<% unless user_signed_in? %> +
+
+
+
+ + + + <%= User.first.name %> + + + FOUNDER +
+
+

+ Dear lurker, this message is for you. +

+

+ Please consider creating an account on dev.to. It literally takes a few seconds and we'd appreciate the support so much. ❤️ +

+ +
+ +
+
+<% end %> \ No newline at end of file