From 7f07f48c14cf713b42c33c157f78255e89554862 Mon Sep 17 00:00:00 2001 From: "J.P. Given" Date: Mon, 16 Jan 2012 15:21:30 -0800 Subject: [PATCH] Hash change for comments. --- public/javascripts/application.js | 12 ++++++++---- public/stylesheets/lib.css | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/public/javascripts/application.js b/public/javascripts/application.js index d6c22ce..a583012 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -57,7 +57,7 @@ MHN = { this.lockGetStory = true; // Set the hash - window.location.hash = "story?id=" + id; + window.location.hash = "comments?id=" + id; // Set users current scroll pos this.currentScroll = $("body").scrollTop(); // Animations are fun. Who needs a mobile framework? @@ -128,10 +128,12 @@ $(document).ready(function() { // If the hash is not blank, get the story. if (window.location.hash != "") { // RegEx to grab the URL query param. - var url = location.hash.replace(/^.*\=/, ''); + var id = location.hash.replace(/^.*\=/, ''); // Fire the method. - if (!MHN.isNumeric(url)) { - MHN.getStory(url); + if (window.location.hash.indexOf("story") > -1) { + MHN.getStory(id); + } else { + MHN.getComments(id); } } // Window Location event listener...so, so handy... @@ -139,6 +141,8 @@ $(document).ready(function() { jQuery(window.location).change(function() { // Is the hash blank? That means someone must have hit the back button. if (window.location.hash === "") { + // Hide that loader + $("#loader").css("display","none"); // Position the content div off the screen. $('#contentContainer').css("left", 0 - $(window).width()); // Hide the story div diff --git a/public/stylesheets/lib.css b/public/stylesheets/lib.css index fd0d44b..9fae3d6 100644 --- a/public/stylesheets/lib.css +++ b/public/stylesheets/lib.css @@ -134,7 +134,7 @@ li { margin-left: 40px; border-left: 3px solid #dcdcdc; border-bottom: 1px dotted #dcdcdc; - padding-left: 10px; + padding: 0 0 10px 10px; } .commentSecondChild { @@ -143,5 +143,5 @@ li { margin-left: 80px; border-left: 3px solid #dcdcdc; border-bottom: 1px dotted #dcdcdc; - padding-left: 10px; + padding: 0 0 10px 10px; } \ No newline at end of file