//initialize settings
HN.settings.initSettings();

var currentUrl = window.location.href;

if(currentUrl.match(/\/comments\/?.*$/i)){
	if(currentUrl.match(/ask\/comments\/?.*$/i)){
		var commentsType = 'ask';
	}
	else if(currentUrl.match(/show\/comments\/?.*$/i)){
		var commentsType = 'show';
	}
	else{
		var commentsType = 'general';
	}
	//add listener for if user clicks on comments link while on comments page
	window.addEventListener('hashchange', function(){HN.clearComments(); HN.displayComments(commentsType);}, false);
	HN.displayComments(commentsType);
}
else if(currentUrl.match(/\/settings\/?$/i)){
	HN.settings.initSettingsPage();
}
else{
	if(currentUrl.match(/ask\/?$/i)){
		var pageSettings = HN.pages.ask;
	}
	else if(currentUrl.match(/show\/?$/i)){
		var pageSettings = HN.pages.show;
	}
	else{
		var pageSettings = HN.pages.home;
	}
	HN.displayStories(pageSettings);
}
@@ -127,16 +127,47 @@
 *$/i))%7B%0A
+%09var commentsType = 'general';%0A
 %09if(curr
@@ -199,36 +199,32 @@
 ts%5C/?.*$/i))%7B%0A%09%09
-var 
 commentsType = '
@@ -283,28 +283,24 @@
 ?.*$/i))%7B%0A%09%09
-var 
 commentsType
@@ -317,50 +317,8 @@
 %0A%09%7D%0A
-%09else%7B%0A%09%09var commentsType = 'general';%0A%09%7D%0A
 %09//a
@@ -626,16 +626,51 @@
 %7D%0Aelse%7B%0A
+%09var pageSettings = HN.pages.home;%0A
 %09if(curr
@@ -690,36 +690,32 @@
 /ask%5C/?$/i))%7B%0A%09%09
-var 
 pageSettings = H
@@ -769,28 +769,24 @@
 %5C/?$/i))%7B%0A%09%09
-var 
 pageSettings
@@ -810,54 +810,8 @@
 %0A%09%7D%0A
-%09else%7B%0A%09%09var pageSettings = HN.pages.home;%0A%09%7D%0A
 %09HN.

Refactor to simplify if else statements