{"action":"created","comment":{"url":"https://api.github.com/repos/zotero/translators/pulls/comments/41699933","id":41699933,"diff_hunk":"@@ -31,185 +29,191 @@ function detectWeb(doc, url) {\n \t\t\t} else {\n \t\t\t\treturn false;\n \t\t\t}\n-\t\tbreak;\n+\t\t\tbreak;\n \t\tcase \"article\":\n \t\t\treturn \"journalArticle\";\n-\t\tbreak;\n+\t\t\tbreak;\n \t\tcase \"chapter\":\n \t\tcase \"referenceworkentry\":\n \t\tcase \"protocol\":\n \t\t\treturn \"bookSection\";\n-\t\tbreak;\n+\t\t\tbreak;\n \t}\n }\n \n function getResultList(doc) {\n-\tvar results =  ZU.xpath(doc,\n-\t\t'//ol[@class=\"content-item-list\"]/li/*[self::h3 or self::h2]/a');\n+\tvar results = ZU.xpath(doc, '//ol[@class=\"content-item-list\"]/li/*[self::h3 or self::h2]/a');\n \tif(!results.length) {\n-\t\tresults = ZU.xpath(doc,\n-\t\t\t'//div[@class=\"toc\"]/ol//div[contains(@class,\"toc-item\")]/h3/a');\n+\t\tresults = ZU.xpath(doc, '//div[@class=\"toc\"]/ol//div[contains(@class,\"toc-item\")]/h3/a');\n \t}\n \tif(!results.length) {\n \t\tresults = ZU.xpath(doc, '//div[@class=\"toc\"]/ol\\\n \t\t\t//li[contains(@class,\"toc-item\")]/p[@class=\"title\"]/a');\n \t}\n-\n \treturn results;\n }\n \n-function doWeb(doc, url){ \n+function doWeb(doc, url) {\n \tvar type = detectWeb(doc, url);\n \tif(type == \"multiple\") {\n \t\tvar list = getResultList(doc);\n \t\tvar items = {};\n-\t\tfor(var i=0, n=list.length; i<n; i++) {\n+\t\tfor(var i = 0, n = list.length; i < n; i++) {\n \t\t\titems[list[i].href] = list[i].textContent;\n \t\t}\n-\n \t\tZotero.selectItems(items, function(selectedItems) {\n \t\t\tif(!selectedItems) return true;\n-\n \t\t\tfor(var i in selectedItems) {\n \t\t\t\tZU.processDocuments(i, scrape);\n \t\t\t}\n \t\t})\n \t} else {\n-\t\tscrape(doc)\n+\t\tscrape(doc, url)\n \t}\n }\n \n-function scrape(doc) {\n+function complementItem(doc, item) {\n \tvar itemType = detectWeb(doc, doc.location.href);\n-\t\n-\t//use Embeded Metadata translator\n-\tvar translator = Zotero.loadTranslator(\"web\");\n-\ttranslator.setTranslator(\"951c027d-74ac-47d4-a107-9c3069ab7b48\");\n-\ttranslator.setDocument(doc);\n-\t\t\n-\ttranslator.setHandler(\"itemDone\", function(obj, item) {\n-\t\t//sometimes we get an error about title not being set\n-\t\tif(!item.title) {\n-\t\t\tZ.debug(\"Springer Link: title not found\");\n-\t\t\tZ.debug(item);\n-\t\t\tif(doc.head) {\n-\t\t\t\t//clean up and strip out uninteresting content\n-\t\t\t\tZ.debug(doc.head.innerHTML\n-\t\t\t\t\t.replace(/<style[^<]+(?:<\\/style>|\\/>)/ig, '')\n-\t\t\t\t\t.replace(/<link[^>]+>/ig, '')\n-\t\t\t\t\t.replace(/(?:\\s*[\\r\\n]\\s*)+/g, '\\n'));\n-\t\t\t} else {\n-\t\t\t\tZ.debug(\"Springer Link: no head tag\");\n-\t\t\t}\n-\t\t}\n-\t\t\n-\t\t//in case we're missing something, we can try supplementing it from page\n-\t\tif(!item.DOI) {\n-\t\t\titem.DOI = ZU.xpathText(doc,\n-\t\t\t\t'//dd[@id=\"abstract-about-book-chapter-doi\"\\\n+\t//in case we're missing something, we can try supplementing it from page\n+\tif(!item.DOI) {\n+\t\titem.DOI = ZU.xpathText(doc,\n+\t\t\t'//dd[@id=\"abstract-about-book-chapter-doi\"\\\n \t\t\t\t\tor @id=\"abstract-about-doi\"][1]');\n+\t}\n+\tif(!item.publisher) {\n+\t\titem.publisher = ZU.xpathText(doc, '//dd[@id=\"abstract-about-publisher\"]');\n+\t}\n+\tif(!item.date) {\n+\t\titem.date = ZU.xpathText(doc, '//dd[@id=\"abstract-about-cover-date\"]') || ZU.xpathText(doc,\n+\t\t\t'//dd[@id=\"abstract-about-book-chapter-copyright-year\"]');","path":"Springer Link.js","position":120,"original_position":120,"commit_id":"3a23e7716005fd2fe3a015614348342351527651","original_commit_id":"3a23e7716005fd2fe3a015614348342351527651","user":{"login":"adam3smith","id":128986,"avatar_url":"https://avatars.githubusercontent.com/u/128986?v=3","gravatar_id":"","url":"https://api.github.com/users/adam3smith","html_url":"https://github.com/adam3smith","followers_url":"https://api.github.com/users/adam3smith/followers","following_url":"https://api.github.com/users/adam3smith/following{/other_user}","gists_url":"https://api.github.com/users/adam3smith/gists{/gist_id}","starred_url":"https://api.github.com/users/adam3smith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adam3smith/subscriptions","organizations_url":"https://api.github.com/users/adam3smith/orgs","repos_url":"https://api.github.com/users/adam3smith/repos","events_url":"https://api.github.com/users/adam3smith/events{/privacy}","received_events_url":"https://api.github.com/users/adam3smith/received_events","type":"User","site_admin":false},"body":"OK, I'll switch to 80.","created_at":"2015-10-10T18:20:39Z","updated_at":"2015-10-10T18:20:39Z","html_url":"https://github.com/zotero/translators/pull/955#discussion_r41699933","pull_request_url":"https://api.github.com/repos/zotero/translators/pulls/955","_links":{"self":{"href":"https://api.github.com/repos/zotero/translators/pulls/comments/41699933"},"html":{"href":"https://github.com/zotero/translators/pull/955#discussion_r41699933"},"pull_request":{"href":"https://api.github.com/repos/zotero/translators/pulls/955"}}},"pull_request":{"url":"https://api.github.com/repos/zotero/translators/pulls/955","id":46993853,"html_url":"https://github.com/zotero/translators/pull/955","diff_url":"https://github.com/zotero/translators/pull/955.diff","patch_url":"https://github.com/zotero/translators/pull/955.patch","issue_url":"https://api.github.com/repos/zotero/translators/issues/955","number":955,"state":"open","locked":false,"title":"[Springer] Work when no EM is present","user":{"login":"adam3smith","id":128986,"avatar_url":"https://avatars.githubusercontent.com/u/128986?v=3","gravatar_id":"","url":"https://api.github.com/users/adam3smith","html_url":"https://github.com/adam3smith","followers_url":"https://api.github.com/users/adam3smith/followers","following_url":"https://api.github.com/users/adam3smith/following{/other_user}","gists_url":"https://api.github.com/users/adam3smith/gists{/gist_id}","starred_url":"https://api.github.com/users/adam3smith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adam3smith/subscriptions","organizations_url":"https://api.github.com/users/adam3smith/orgs","repos_url":"https://api.github.com/users/adam3smith/repos","events_url":"https://api.github.com/users/adam3smith/events{/privacy}","received_events_url":"https://api.github.com/users/adam3smith/received_events","type":"User","site_admin":false},"body":"Changes look bigger than they are (also ran this through jsbeautify because I moved code around a bit, accounts for some changes).\r\nEssentially does 2 things:\r\n1. If we don't have EM, use the RIS data from Springer\r\n2. Move the scraping from the page to a separate function so we can call it in the item handler of both. \r\n\r\nAlso: add DOI for non-journal item types. ","created_at":"2015-10-07T07:18:37Z","updated_at":"2015-10-10T18:20:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"edaebc8688278c36bb334b669e04e4b57714d48b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/zotero/translators/pulls/955/commits","review_comments_url":"https://api.github.com/repos/zotero/translators/pulls/955/comments","review_comment_url":"https://api.github.com/repos/zotero/translators/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zotero/translators/issues/955/comments","statuses_url":"https://api.github.com/repos/zotero/translators/statuses/3a23e7716005fd2fe3a015614348342351527651","head":{"label":"adam3smith:springer","ref":"springer","sha":"3a23e7716005fd2fe3a015614348342351527651","user":{"login":"adam3smith","id":128986,"avatar_url":"https://avatars.githubusercontent.com/u/128986?v=3","gravatar_id":"","url":"https://api.github.com/users/adam3smith","html_url":"https://github.com/adam3smith","followers_url":"https://api.github.com/users/adam3smith/followers","following_url":"https://api.github.com/users/adam3smith/following{/other_user}","gists_url":"https://api.github.com/users/adam3smith/gists{/gist_id}","starred_url":"https://api.github.com/users/adam3smith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adam3smith/subscriptions","organizations_url":"https://api.github.com/users/adam3smith/orgs","repos_url":"https://api.github.com/users/adam3smith/repos","events_url":"https://api.github.com/users/adam3smith/events{/privacy}","received_events_url":"https://api.github.com/users/adam3smith/received_events","type":"User","site_admin":false},"repo":{"id":2577651,"name":"translators","full_name":"adam3smith/translators","owner":{"login":"adam3smith","id":128986,"avatar_url":"https://avatars.githubusercontent.com/u/128986?v=3","gravatar_id":"","url":"https://api.github.com/users/adam3smith","html_url":"https://github.com/adam3smith","followers_url":"https://api.github.com/users/adam3smith/followers","following_url":"https://api.github.com/users/adam3smith/following{/other_user}","gists_url":"https://api.github.com/users/adam3smith/gists{/gist_id}","starred_url":"https://api.github.com/users/adam3smith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adam3smith/subscriptions","organizations_url":"https://api.github.com/users/adam3smith/orgs","repos_url":"https://api.github.com/users/adam3smith/repos","events_url":"https://api.github.com/users/adam3smith/events{/privacy}","received_events_url":"https://api.github.com/users/adam3smith/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/adam3smith/translators","description":"Zotero Translators","fork":true,"url":"https://api.github.com/repos/adam3smith/translators","forks_url":"https://api.github.com/repos/adam3smith/translators/forks","keys_url":"https://api.github.com/repos/adam3smith/translators/keys{/key_id}","collaborators_url":"https://api.github.com/repos/adam3smith/translators/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/adam3smith/translators/teams","hooks_url":"https://api.github.com/repos/adam3smith/translators/hooks","issue_events_url":"https://api.github.com/repos/adam3smith/translators/issues/events{/number}","events_url":"https://api.github.com/repos/adam3smith/translators/events","assignees_url":"https://api.github.com/repos/adam3smith/translators/assignees{/user}","branches_url":"https://api.github.com/repos/adam3smith/translators/branches{/branch}","tags_url":"https://api.github.com/repos/adam3smith/translators/tags","blobs_url":"https://api.github.com/repos/adam3smith/translators/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/adam3smith/translators/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/adam3smith/translators/git/refs{/sha}","trees_url":"https://api.github.com/repos/adam3smith/translators/git/trees{/sha}","statuses_url":"https://api.github.com/repos/adam3smith/translators/statuses/{sha}","languages_url":"https://api.github.com/repos/adam3smith/translators/languages","stargazers_url":"https://api.github.com/repos/adam3smith/translators/stargazers","contributors_url":"https://api.github.com/repos/adam3smith/translators/contributors","subscribers_url":"https://api.github.com/repos/adam3smith/translators/subscribers","subscription_url":"https://api.github.com/repos/adam3smith/translators/subscription","commits_url":"https://api.github.com/repos/adam3smith/translators/commits{/sha}","git_commits_url":"https://api.github.com/repos/adam3smith/translators/git/commits{/sha}","comments_url":"https://api.github.com/repos/adam3smith/translators/comments{/number}","issue_comment_url":"https://api.github.com/repos/adam3smith/translators/issues/comments{/number}","contents_url":"https://api.github.com/repos/adam3smith/translators/contents/{+path}","compare_url":"https://api.github.com/repos/adam3smith/translators/compare/{base}...{head}","merges_url":"https://api.github.com/repos/adam3smith/translators/merges","archive_url":"https://api.github.com/repos/adam3smith/translators/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/adam3smith/translators/downloads","issues_url":"https://api.github.com/repos/adam3smith/translators/issues{/number}","pulls_url":"https://api.github.com/repos/adam3smith/translators/pulls{/number}","milestones_url":"https://api.github.com/repos/adam3smith/translators/milestones{/number}","notifications_url":"https://api.github.com/repos/adam3smith/translators/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/adam3smith/translators/labels{/name}","releases_url":"https://api.github.com/repos/adam3smith/translators/releases{/id}","created_at":"2011-10-14T17:26:44Z","updated_at":"2015-04-06T06:35:46Z","pushed_at":"2015-10-07T07:14:47Z","git_url":"git://github.com/adam3smith/translators.git","ssh_url":"git@github.com:adam3smith/translators.git","clone_url":"https://github.com/adam3smith/translators.git","svn_url":"https://github.com/adam3smith/translators","homepage":"http://www.zotero.org/support/dev/translators","size":12256,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"zotero:master","ref":"master","sha":"52e97f8915b9991de112087e3c321ea2c692222e","user":{"login":"zotero","id":891917,"avatar_url":"https://avatars.githubusercontent.com/u/891917?v=3","gravatar_id":"","url":"https://api.github.com/users/zotero","html_url":"https://github.com/zotero","followers_url":"https://api.github.com/users/zotero/followers","following_url":"https://api.github.com/users/zotero/following{/other_user}","gists_url":"https://api.github.com/users/zotero/gists{/gist_id}","starred_url":"https://api.github.com/users/zotero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zotero/subscriptions","organizations_url":"https://api.github.com/users/zotero/orgs","repos_url":"https://api.github.com/users/zotero/repos","events_url":"https://api.github.com/users/zotero/events{/privacy}","received_events_url":"https://api.github.com/users/zotero/received_events","type":"Organization","site_admin":false},"repo":{"id":1991863,"name":"translators","full_name":"zotero/translators","owner":{"login":"zotero","id":891917,"avatar_url":"https://avatars.githubusercontent.com/u/891917?v=3","gravatar_id":"","url":"https://api.github.com/users/zotero","html_url":"https://github.com/zotero","followers_url":"https://api.github.com/users/zotero/followers","following_url":"https://api.github.com/users/zotero/following{/other_user}","gists_url":"https://api.github.com/users/zotero/gists{/gist_id}","starred_url":"https://api.github.com/users/zotero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zotero/subscriptions","organizations_url":"https://api.github.com/users/zotero/orgs","repos_url":"https://api.github.com/users/zotero/repos","events_url":"https://api.github.com/users/zotero/events{/privacy}","received_events_url":"https://api.github.com/users/zotero/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zotero/translators","description":"Zotero Translators","fork":false,"url":"https://api.github.com/repos/zotero/translators","forks_url":"https://api.github.com/repos/zotero/translators/forks","keys_url":"https://api.github.com/repos/zotero/translators/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zotero/translators/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zotero/translators/teams","hooks_url":"https://api.github.com/repos/zotero/translators/hooks","issue_events_url":"https://api.github.com/repos/zotero/translators/issues/events{/number}","events_url":"https://api.github.com/repos/zotero/translators/events","assignees_url":"https://api.github.com/repos/zotero/translators/assignees{/user}","branches_url":"https://api.github.com/repos/zotero/translators/branches{/branch}","tags_url":"https://api.github.com/repos/zotero/translators/tags","blobs_url":"https://api.github.com/repos/zotero/translators/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zotero/translators/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zotero/translators/git/refs{/sha}","trees_url":"https://api.github.com/repos/zotero/translators/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zotero/translators/statuses/{sha}","languages_url":"https://api.github.com/repos/zotero/translators/languages","stargazers_url":"https://api.github.com/repos/zotero/translators/stargazers","contributors_url":"https://api.github.com/repos/zotero/translators/contributors","subscribers_url":"https://api.github.com/repos/zotero/translators/subscribers","subscription_url":"https://api.github.com/repos/zotero/translators/subscription","commits_url":"https://api.github.com/repos/zotero/translators/commits{/sha}","git_commits_url":"https://api.github.com/repos/zotero/translators/git/commits{/sha}","comments_url":"https://api.github.com/repos/zotero/translators/comments{/number}","issue_comment_url":"https://api.github.com/repos/zotero/translators/issues/comments{/number}","contents_url":"https://api.github.com/repos/zotero/translators/contents/{+path}","compare_url":"https://api.github.com/repos/zotero/translators/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zotero/translators/merges","archive_url":"https://api.github.com/repos/zotero/translators/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zotero/translators/downloads","issues_url":"https://api.github.com/repos/zotero/translators/issues{/number}","pulls_url":"https://api.github.com/repos/zotero/translators/pulls{/number}","milestones_url":"https://api.github.com/repos/zotero/translators/milestones{/number}","notifications_url":"https://api.github.com/repos/zotero/translators/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zotero/translators/labels{/name}","releases_url":"https://api.github.com/repos/zotero/translators/releases{/id}","created_at":"2011-07-03T17:40:38Z","updated_at":"2015-09-19T14:32:50Z","pushed_at":"2015-10-10T18:12:40Z","git_url":"git://github.com/zotero/translators.git","ssh_url":"git@github.com:zotero/translators.git","clone_url":"https://github.com/zotero/translators.git","svn_url":"https://github.com/zotero/translators","homepage":"http://www.zotero.org/support/dev/translators","size":17518,"stargazers_count":152,"watchers_count":152,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":136,"mirror_url":null,"open_issues_count":131,"forks":136,"open_issues":131,"watchers":152,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zotero/translators/pulls/955"},"html":{"href":"https://github.com/zotero/translators/pull/955"},"issue":{"href":"https://api.github.com/repos/zotero/translators/issues/955"},"comments":{"href":"https://api.github.com/repos/zotero/translators/issues/955/comments"},"review_comments":{"href":"https://api.github.com/repos/zotero/translators/pulls/955/comments"},"review_comment":{"href":"https://api.github.com/repos/zotero/translators/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zotero/translators/pulls/955/commits"},"statuses":{"href":"https://api.github.com/repos/zotero/translators/statuses/3a23e7716005fd2fe3a015614348342351527651"}}}}