ACM translator modification to grab TOCs

Great tool ! But sometimes missing functions... too bad !
I needed to grab all papers from a given conference from the ACM DL TOC (e.g. http://tinyurl.com/ck5mw8), so I modified the ACM translator.
I tried to include all kings of TOC (proceedings, journals, magazines...) ; it seems to work fine at first glance, but certainly needs further check.
Hope it will be usefull for everyone !

===

Three modifications in the ACM.js file :
1. replace the "target" regexp

=> change "target" line to :
"target":"https?://[^/]*portal\\.acm\\.org[^/]*/(?:results\\.cfm|citation\\.cfm|toc\\.cfm)",


2. adding a "toc case" in the function detectWeb(doc, url)

=> insert after the "if(url.indexOf("/results.cfm") { ...}" block :
} else if(url.indexOf("/toc.cfm") != -1) {
var items = Zotero.Utilities.getItemArray(doc, doc, '^https?://[^/]+/citation.cfm\\?.+(&dl=[^&]+&idx=[^&]+&part=|&dl=[^&]+&type=series&idx=)[^#]+$');
// hack to return multiple if there are items
for(var i in items) {
return "multiple";
}


3. adding a "toc case" in the function doWeb(doc, url)

=> insert after the "if(url.indexOf("/results.cfm") != -1) {...}" block :

}else if(url.indexOf("/toc.cfm") != -1) {
var items = Zotero.Utilities.getItemArray(doc, doc, '^https?://[^/]+/citation.cfm\\?.+(&dl=[^&]+&idx=[^&]+&part=|&dl=[^&]+&type=series&idx=)[^#]+$');
items = Zotero.selectItems(items);
if(!items) return true;
for(var url in items) {
urls.push(url);
}
getNext();

This is an old discussion that has not been active in a long time. Instead of commenting here, you should start a new discussion. If you think the content of this discussion is still relevant, you can link to it from your new discussion.