<commit_before>
// Add listener for pageaction
chrome.pageAction.onClicked.addListener(function(tab) {
	// function to nav tab, action begins below
	function navigateTab(commentsPage) {
		// create URL of comments page
		var commentsURL = "http://news.ycombinator.com/";
		// navigate tab to new url
		chrome.tabs.update(tabId, {url: commentsURL});
	}

	var tabId = tab.id, // get tabId from tab object
		tabURL,
		pageIndex,
		commentsURL;
	// get tab URL
	tabURL = tab.url;

	// get post url index then comments URl
	pageIndex = posInList( tabURL, hnPostList );
	commentsURL = hnPostList[pageIndex].discussionURL

	// pass URL of function to navigate tab
	navigateTab( commentsURL );
});

// listens for messages passed when chrome storage is altered
chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) {
    commentURL = message;
});

// tab change listener runs URL checking function
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
	var updateTime = new Date().getTime(),
		latency;

	if ( clickFlag ) {
		
		// show page action
		chrome.pageAction.show( tabId );

		// turn clickFlag off 
		clickFlag = false;		
	}
} );

// create array to which all scraped pages are pushed
var hnPostList = [],
	commentURL;<commit_msg>Navigates to comments now.<commit_after>
// Add listener for pageaction
chrome.pageAction.onClicked.addListener(function(tab) {
	var destination,
		tabId;

	// create URL of comments page
	destination = "http://news.ycombinator.com/" + commentURL;
	// get tab id
	tabId = tab.id;

	// navigate tab to new url
	chrome.tabs.update(tabId, {url: destination});
});

// listens for messages passed when chrome storage is altered
chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) {
    clickFlag = true;
    commentURL = message;
});

// tab change listener runs URL checking function
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
	var updateTime = new Date().getTime(),
		latency;

	if ( clickFlag ) {
		
		// show page action
		chrome.pageAction.show( tabId );

		// turn clickFlag off 
		clickFlag = false;		
	}
} );

// create array to which all scraped pages are pushed
var hnPostList = [],
	commentURL,
	clickFlag;
{'fraction_non_alphanumeric': 0.10917225950782998, 'fraction_numerical': 0.0, 'mean_word_length': 3.7777777777777777, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1915809', 'n_tokens_mistral': 721, 'n_tokens_neox': 676, 'n_words': 210}