Show full item titles in eBay search results

By nice_bow_tie Last update Oct 10, 2012 — Installed 2,706 times.

There are 6 previous versions of this script.

// ==UserScript==

// @name          Show full item titles in eBay search results
// @description   Shows the full 80 character item titles in search results and shop pages. Works on the UK and US sites.

// @author        nice_bow_tie
// @homepage      http://userscripts.org/scripts/show/113886
// @updateURL     https://userscripts.org/scripts/source/113886.meta.js
// @downloadURL   https://userscripts.org/scripts/source/113886.user.js

// @include       http://www.ebay.co.uk/*
// @include       http://www.ebay.com/*
// @include       http://stores.ebay.co.uk/*
// @include       http://stores.ebay.com/*

// @version       1.3

// ==/UserScript==

var title_links = document.querySelectorAll (".ttl>a, .ittl>a");
for (var i = 0; i < title_links.length; i++)
{
	var full_title =     title_links[i].title;
	var link_text_node = title_links[i].firstChild;
	var link_title =     link_text_node && link_text_node.nodeValue;

	if (full_title && link_title)
	{
		var match_array;
		//check if it's a truncated item title...
		if (match_array = link_title.match (/^(.+)(\.\u200B*){3}$/))
		{
			link_title = match_array[1]; //trim the ellipsis

			//where item titles begin with one or more whitespace characters,
			//those characters are not included in the truncated title, so also
			//remove them from the full title to ensure the check below works
			if (full_title.match (/^\s/) && !link_title.match (/^\s/))
				full_title = full_title.replace (/^\s+/, "");

			//remove all zwsp's
			var full_title_no_zwsp = full_title.replace (/\u200B/g, "");
			var link_title_no_zwsp = link_title.replace (/\u200B/g, "");

			//check the truncated title really is a truncated version of the
			//full title and if so, append the extra text from the full title -
			//this check is done so that the title isn't replaced with wrong
			//text if for some reason the title attribute isn't the full title
			if (full_title_no_zwsp.indexOf (link_title_no_zwsp) == 0)
				link_text_node.nodeValue = link_title +
					full_title_no_zwsp.substr (link_title_no_zwsp.length);
		}
	}
}