$(function() {
	interjector.registerFillUpdates();
	interjector.registerAAnUpdates();
});

var interjector = {
	//Names of classes to update
	fillNames: [
		'linux',
		'gnu',
		'components',
		'os',
		'posix',
		'project',
		'kernel',
		'kernel-role',
		'osys',
	],
	//Get the element for filling in the value
	getFillElement: function(name) {
		return $('#ijtr-fill-' + name);
	},
	//Get the elements that are tied to the value
	getTiedElements: function(name) {
		return $('#interjector .tied-' + name);
	},
	//Register an event handler on update
	registerUpdateHandler: function(name, handler) {
		this.getFillElement(name).keyup(handler);
	},
	//Get the filled text
	getFillText: function(name) {
		return this.getFillElement(name).val();
	},
	//Set the text on the tied elements
	setTiedText: function(name, text) {
		this.getTiedElements(name).text(text);
	},
	//Update "tied" elements on each change of the "fill" input
	registerFillUpdates: function() {
		var t = this;
		this.fillNames.forEach(function(name) {
			t.registerUpdateHandler(name, function() {
				t.setTiedText(name, t.getFillText(name));
			});
		});
	},
	//Deal with "a/an" selection
	registerAAnUpdates: function() {
		var t = this;
		$('#ijtr-option-a').click(function() {
			t.setTiedText('a-an', 'a');
		});
		$('#ijtr-option-an').click(function() {
			t.setTiedText('a-an', 'an');
		});
	},
}
$(function() {
	//Names of classes to update
	var fillNames = [
		'linux',
		'gnu',
		'components',
		'os',
		'posix',
		'project',
		'kernel',
		'kernel-role',
		'osys',
	];

	//Get the element for filling in the value
	function getFillElement(name) {
		return $('#ijtr-fill-' + name);
	}

	//Get the elements that are tied to the value
	function getTiedElements(name) {
		return $('#interjector .tied-' + name);
	}

	//Register an event handler on update
	function registerUpdateHandler(name, handler) {
		getFillElement(name).keyup(handler);
	}

	//Get the filled text
	function getFillText(name) {
		return getFillElement(name).val();
	}

	//Set the text on the tied elements
	function setTiedText(name, text) {
		getTiedElements(name).text(text);
	}

	//Update "tied" elements on each change of the "fill" input
	function registerFillUpdates() {
		fillNames.forEach(function(name) {
			registerUpdateHandler(name, function() {
				setTiedText(name, getFillText(name));
			});
		});
	}

	//Deal with "a/an" selection
	function registerAAnUpdates() {
		$('#ijtr-option-a').click(function() {
			setTiedText('a-an', 'a');
		});
		$('#ijtr-option-an').click(function() {
			setTiedText('a-an', 'an');
		});
	}

	registerFillUpdates();
	registerAAnUpdates();
});
Move all code inside function instead of using a global variable