From f913bad2979233fcff73eaa5c0ff6b110906ec24 Mon Sep 17 00:00:00 2001 From: Frank Bennett Date: Sat, 2 Jul 2011 07:26:33 +0000 Subject: [PATCH] Trans: set parallel citations when grabbing legal cases from search list. --- translators/Google Scholar.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/translators/Google Scholar.js b/translators/Google Scholar.js index 86f4b06a82..ee13a6f788 100644 --- a/translators/Google Scholar.js +++ b/translators/Google Scholar.js @@ -44,6 +44,8 @@ * ############################### */ +var bogusItemID = 1; + var detectWeb = function (doc, url) { // Icon shows only for search results and law cases if (url.match(/scholar_case/)) { @@ -432,6 +434,7 @@ ItemFactory.prototype.saveItem = function () { if (this.v.title) { this.repairTitle(); if (this.vv.volRepPag.length) { + var completed_items = []; for (i = 0, ilen = this.vv.volRepPag.length; i < ilen; i += 1) { this.item = new Zotero.Item("case"); for (key in this.vv.volRepPag[i]) { @@ -443,8 +446,19 @@ ItemFactory.prototype.saveItem = function () { if (i === (this.vv.volRepPag.length - 1)) { this.pushAttachments("Judgement"); } - this.item.complete(); - }; + this.item.itemID = "" + bogusID; + bogusID += 1; + completed_items.push(this.item); + } + for (i = 0, ilen = completed_items.length; i < ilen; i += 1) { + for (j = 0, jlen = completed_items.length; j < jlen; j += 1) { + if (i === j) { + continue; + } + completed_items[i].seeAlso.push(completed_items[j].itemID); + } + completed_items[i].complete(); + } } else { this.item = new Zotero.Item("case"); this.saveItemCommonVars();