<commit_before>{
        "translatorID":"1885b93c-cf37-4b25-aef5-283f42eada9d",
        "label":"Informaworld",
        "creator":"<NAME>",
        "target":"^http://www\\.informaworld\\.com",
        "minVersion":"1.0.0b4.r5",
        "maxVersion":"",
        "priority":100,
        "inRepository":true,
        "translatorType":4,
        "lastUpdated":"2010-09-28 09:08:13"
}

/* Test URLs
Book section:
Book:
  http://www.informaworld.com/smpp/title~db=all~content=t777453493
Journal article:
  http://www.informaworld.com/smpp/content~content=a903855250&db=all
Journal issue ToC:
  http://www.informaworld.com/smpp/title~db=all~content=g921992177
*/

function detectWeb(doc, url) {
	if (url.indexOf("quicksearch") != -1) {
		return "multiple";
	} else if (doc.evaluate('//a[substring(text(), 2, 8) = "Download"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) {
		if (doc.evaluate('//img[substring(@title, 1, 17) = "Publication type:"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) {
			var pubtype = doc.evaluate('//img[substring(@title, 1, 17) = "Publication type:"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext().title;
			if (pubtype.match("journal")) {
				return "journalArticle";
			} else if (pubtype.match("book")) {
				return "bookSection";
			}
		} else {
			return "book";
		}
	} else if (url.indexOf("content=g") != -1 || 
			doc.evaluate('//div[@id="browse"]//tbody/tr/td[2]/a[2]', doc, null, XPathResult.ANY_TYPE, null).iterateNext() ||
			doc.evaluate('//div[@id="title"]//td[2]/div/strong/a', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) {
		return "multiple";
	} else {
		return true;
	}
}


function doWeb(doc, url) {
	// Scrape some data from page
	var getDocumentData = function (newDoc, data) {
		var xpath = '//div[@id="metahead"]/div';
		var stuff = newDoc.evaluate(xpath, newDoc, null, XPathResult.ANY_TYPE, null);
		var thing = stuff.iterateNext();
		while (thing) {
			if (thing.textContent.match(/DOI/)) {
				data.doi = Zotero.Utilities.trimInternal(thing.textContent).match(/:\s+(.*)/)[1];
				break;
			}
			thing = stuff.iterateNext();
		}
		// There seem to be multiple page structures
		data.pdfurl = newDoc.evaluate('//div[@id="content"]/div/a[1]', newDoc, null, XPathResult.ANY_TYPE, null).iterateNext();
		if (data.pdfurl == null) {
		// If we didn't find the URL there, try elsewhere:
			data.pdfurl = newDoc.evaluate('//a[@title="Download PDF"]', newDoc, null, XPathResult.ANY_TYPE, null).iterateNext();
		}
		data.pdfurl = data.pdfurl ? data.pdfurl.href : null; // Don't break on missing PDF
		var id = newDoc.location.href.match(/content=([\w\d]+)/);
		// If URL has DOI rather than id, use navbar link to get id
		if (id[1] == 10) {
			id = newDoc.evaluate('//table[@id="tabbar_table"]//td//a[@title = "Article"]', newDoc, null, XPathResult.ANY_TYPE, null).iterateNext().href;
			id = id.match(/content=([\w\d]+)/);
		}
		var post = 'tab=citation&selecteditems=' + id[1].substr(1) + '&content=' + id[1] + '&citstyle=refworks&showabs=false&format=file';
		data.postdata = post;
	}
	
	
	var sets = [];
	if (detectWeb(doc, url) == "multiple") {
		var items = new Object();
		if (doc.evaluate('//div[@id="quicksearch"]//tr/td/b/a', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) {
			var xpath = '//div[@id="quicksearch"]//tr/td/b/a';
		} else if (doc.evaluate('//div[@id="title"]/table/tbody/tr[2]//strong/a', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) {
			var xpath = '//div[@id="title"]/table/tbody/tr[2]//strong/a';
		} else if (doc.evaluate('//div[@id="browse"]//tbody/tr/td[2]/a[2]', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) {
			var xpath = '//div[@id="browse"]//tbody/tr/td[2]/a[2]';
		} else if (doc.evaluate('//div[@id="title"]//td[2]/div/strong/a', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) {
			var xpath = '//div[@id="title"]//td[2]/div/strong/a';
		} else if (doc.evaluate('//div[@id="title"]/table//tr[2]/td/table//tr/td[2]/b/a', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) {
			var xpath = '//div[@id="title"]/table//tr[2]/td/table//tr/td[2]/b/a';
		}
		
		var titles = doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null);
		var title = titles.iterateNext();
		while (title) {
			items[title.href] = title.textContent;
			title = titles.iterateNext();
		}<commit_msg>Trans: - Fix regression for DOI searches in Informaworld        - Add support for additional result page structure in Informaworld<commit_after>{
        "translatorID":"1885b93c-cf37-4b25-aef5-283f42eada9d",
        "label":"Informaworld",
        "creator":"<NAME>",
        "target":"^http://www\\.informaworld\\.com",
        "minVersion":"1.0.0b4.r5",
        "maxVersion":"",
        "priority":100,
        "inRepository":true,
        "translatorType":4,
        "lastUpdated":"2010-09-28 09:28:40"
}

/* Test URLs
Book section:
Book:
  http://www.informaworld.com/smpp/title~db=all~content=t777453493
Journal article:
  http://www.informaworld.com/smpp/content~content=a903855250&db=all
Journal issue ToC:
  http://www.informaworld.com/smpp/title~db=all~content=g921992177
*/

function detectWeb(doc, url) {
	if (url.indexOf("quicksearch") != -1) {
		return "multiple";
	} else if (doc.evaluate('//a[substring(text(), 2, 8) = "Download"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) {
		if (doc.evaluate('//img[substring(@title, 1, 17) = "Publication type:"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) {
			var pubtype = doc.evaluate('//img[substring(@title, 1, 17) = "Publication type:"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext().title;
			if (pubtype.match("journal")) {
				return "journalArticle";
			} else if (pubtype.match("book")) {
				return "bookSection";
			}
		} else {
			return "book";
		}
	} else if (url.indexOf("content=g") != -1 || 
			doc.evaluate('//div[@id="browse"]//tbody/tr/td[2]/a[2]', doc, null, XPathResult.ANY_TYPE, null).iterateNext() ||
			doc.evaluate('//div[@id="title"]//td[2]/div/strong/a', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) {
		return "multiple";
	} else {
		return true;
	}
}


function doWeb(doc, url) {
	// Scrape some data from page
	var getDocumentData = function (newDoc, data) {
		var xpath = '//div[@id="metahead"]/div';
		var stuff = newDoc.evaluate(xpath, newDoc, null, XPathResult.ANY_TYPE, null);
		var thing = stuff.iterateNext();
		while (thing) {
			if (thing.textContent.match(/DOI/)) {
				data.doi = Zotero.Utilities.trimInternal(thing.textContent).match(/:\s+(.*)/)[1];
				break;
			}
			thing = stuff.iterateNext();
		}
		// There seem to be multiple page structures
		data.pdfurl = newDoc.evaluate('//div[@id="content"]/div/a[1]', newDoc, null, XPathResult.ANY_TYPE, null).iterateNext();
		if (data.pdfurl == null) {
		// If we didn't find the URL there, try elsewhere:
			data.pdfurl = newDoc.evaluate('//a[@title="Download PDF"]', newDoc, null, XPathResult.ANY_TYPE, null).iterateNext();
		}
		data.pdfurl = data.pdfurl ? data.pdfurl.href : null; // Don't break on missing PDF
		var id = newDoc.location.href.match(/content=([\w\d]+)/);
		// If URL has DOI rather than id, use navbar link to get id
		if (id[1] == 10) {
			id = newDoc.evaluate('//div[@id="contenttabs"]//a[@title = "Article"]', newDoc, null, XPathResult.ANY_TYPE, null).iterateNext().href;
			id = id.match(/content=([\w\d]+)/);
		}
		var post = 'tab=citation&selecteditems=' + id[1].substr(1) + '&content=' + id[1] + '&citstyle=refworks&showabs=false&format=file';
		data.postdata = post;
	}
	
	
	var sets = [];
	if (detectWeb(doc, url) == "multiple") {
		var items = new Object();
		if (doc.evaluate('//div[@id="quicksearch"]//tr/td/b/a', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) {
			var xpath = '//div[@id="quicksearch"]//tr/td/b/a';
		} else if (doc.evaluate('//div[@id="title"]/table/tbody/tr[2]//strong/a', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) {
			var xpath = '//div[@id="title"]/table/tbody/tr[2]//strong/a';
		} else if (doc.evaluate('//div[@id="browse"]//tbody/tr/td[2]/a[2]', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) {
			var xpath = '//div[@id="browse"]//tbody/tr/td[2]/a[2]';
		} else if (doc.evaluate('//div[@id="title"]//td[2]/div/strong/a', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) {
			var xpath = '//div[@id="title"]//td[2]/div/strong/a';
		} else if (doc.evaluate('//div[@id="title"]/table//tr[2]/td/table//tr/td[2]/b/a', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) {
			var xpath = '//div[@id="title"]/table//tr[2]/td/table//tr/td[2]/b/a';
		} else if (doc.evaluate('//a[@title="Click to view this record"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) {
            		var xpath = '//a[@title="Click to view this record"]';
        	}
		
		var titles = doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null);
		var title = titles.iterateNext();
		while (title) {
			items[title.href] = title.textContent;
			title = titles.iterateNext();
		}
{'fraction_non_alphanumeric': 0.21163076236187076, 'fraction_numerical': 0.022547159281169772, 'mean_word_length': 3.8616386326641345, 'pattern_counts': {'":': 20, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 8, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7560502', 'n_tokens_mistral': 3656, 'n_tokens_neox': 3271, 'n_words': 600}