<commit_before>
// Function to check if location is hacker news.
function checkLocation() {
	var hackerNewsHost;

	hackerNewsHost = "news.ycombinator.com";

	// return true or false.
	if ( location.host == hackerNewsHost ) {
		return true;
	} else {
		return false;
	}
}

function nodelistToArray( nodelist ) {
	var array = [];

	for (var i = 0; i < nodelist.length; i++ ) 
		array.push( nodelist[i] );

	return array;
}

function onLinkClick(e) {
	var linkURL,
		discussionURL;

	// prevent link from opening immediately.
	e.preventDefault();

	linkURL = this.getAttribute("href");

	chrome.storage.local.set( { "location": linkURL }, function() {
		window.location.href = linkURL;
	} );	
}

// function for when on hacker news.
function onHackerNews() {
	var linkList,
		linkArray;

	// grab all links including "more" link and conver to array.
	linkList = document.querySelectorAll("td.title a");
	linkArray = nodelistToArray(linkList);

	// remove the last element ("more" link)
	linkArray.splice(31, 1);

	for ( var i = 0; i < linkArray.length; i++ ) {
		linkArray[i].addEventListener( "click", onLinkClick, false );
	}
}

// function when on a site navigated to from HN
function onPost() {
	console.log("You are not on hacker news.");
}

// check if the page is hacker news and run onHackerNews if so.
var locationIsHackerNews;

locationIsHackerNews = checkLocation();

chrome.storage.local.get("location", function(result) {
	console.log(result);
});

if ( locationIsHackerNews ) {
	onHackerNews();
} else {
	onPost();
}<commit_msg>Removed callback for link clicking.<commit_after>
// Function to check if location is hacker news.
function checkLocation() {
	var hackerNewsHost;

	hackerNewsHost = "news.ycombinator.com";

	// return true or false.
	if ( location.host == hackerNewsHost ) {
		return true;
	} else {
		return false;
	}
}

function nodelistToArray( nodelist ) {
	var array = [];

	for (var i = 0; i < nodelist.length; i++ ) 
		array.push( nodelist[i] );

	return array;
}

function onLinkClick(e) {
	var linkURL,
		discussionURL;

	// prevent link from opening immediately.
	e.preventDefault();

	// get url of post and discussion
	linkURL = this.getAttribute("href");
	discussionURL = "http://example.com";

	chrome.storage.local.set( { linkURL: discussionURL }, function() {
		window.location.href = linkURL;
	} );	
}

// function for when on hacker news.
function onHackerNews() {
	var linkList,
		linkArray;

	// grab all links including "more" link and conver to array.
	linkList = document.querySelectorAll("td.title a");
	linkArray = nodelistToArray(linkList);

	// remove the last element ("more" link)
	linkArray.splice(31, 1);

	for ( var i = 0; i < linkArray.length; i++ ) {
		linkArray[i].addEventListener( "click", onLinkClick, false );
	}
}

// function when on a site navigated to from HN
function onPost() {
	chrome.storage.local.get("location", function(result) {
		console.log(result);
	});
}

// check if the page is hacker news and run onHackerNews if so.
var locationIsHackerNews;

locationIsHackerNews = checkLocation();



if ( locationIsHackerNews ) {
	onHackerNews();
} else {
	onPost();
}
{'fraction_non_alphanumeric': 0.13010204081632654, 'fraction_numerical': 0.0031887755102040817, 'mean_word_length': 3.9015625, 'pattern_counts': {'":': 1, '<': 7, '<?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': '3163714', 'n_tokens_mistral': 1086, 'n_tokens_neox': 1015, 'n_words': 302}