From 6952f469866085aa98723a40db5def53cf9eb746 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sun, 14 Apr 2013 21:20:24 -0400 Subject: [PATCH 01/40] Fix Attachment Content regexp search --- chrome/content/zotero/xpcom/fulltext.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/fulltext.js b/chrome/content/zotero/xpcom/fulltext.js index adf9a54df..559397d2c 100644 --- a/chrome/content/zotero/xpcom/fulltext.js +++ b/chrome/content/zotero/xpcom/fulltext.js @@ -575,8 +575,14 @@ Zotero.Fulltext = new function(){ flags += 'i'; } - var re = new RegExp(searchText, flags); - var matches = re(str); + try { + var re = new RegExp(searchText, flags); + var matches = re.exec(str); + } + catch (e) { + Zotero.debug(e, 1); + Components.utils.reportError(e); + } if (matches){ Zotero.debug("Text found"); return str.substr(matches.index, 50); From 4f6fbf364da71636b64ca320a001f53a009c4d58 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 15 Apr 2013 02:56:32 -0400 Subject: [PATCH 02/40] Use renamed-styles.json and flag from repo to replace renamed styles Currently updating renamed-styles.json is a manual process. --- chrome/content/zotero/xpcom/schema.js | 23 +++++------- chrome/content/zotero/xpcom/style.js | 34 ++++++++++-------- resource/schema/renamed-styles.json | 52 +++++++++++++++++++++++++++ styles | 2 +- 4 files changed, 82 insertions(+), 29 deletions(-) create mode 100644 resource/schema/renamed-styles.json diff --git a/chrome/content/zotero/xpcom/schema.js b/chrome/content/zotero/xpcom/schema.js index 74b6f189d..97c1b1416 100644 --- a/chrome/content/zotero/xpcom/schema.js +++ b/chrome/content/zotero/xpcom/schema.js @@ -31,8 +31,8 @@ Zotero.Schema = new function(){ var _dbVersions = []; var _schemaVersions = []; var _repositoryTimer; - var _remoteUpdateInProgress = false, - _localUpdateInProgress = false; + var _remoteUpdateInProgress = false, _localUpdateInProgress = false; + var _renamedStylesByNew = null; var self = this; @@ -597,6 +597,8 @@ Zotero.Schema = new function(){ // Delete renamed/obsolete files case 'chicago-note.csl': case 'mhra_note_without_bibliography.csl': + case 'mhra.csl': + case 'mla.csl': toDelete.push(file); continue; @@ -1714,6 +1716,7 @@ Zotero.Schema = new function(){ xmlnode.normalize(); var uri = xmlnode.getAttribute('id'); + var shortName = uri.replace("http://www.zotero.org/styles/", ""); // Delete local style if CSL code is empty if (!xmlnode.firstChild) { @@ -1724,18 +1727,10 @@ Zotero.Schema = new function(){ return; } - // Remove renamed styles - if (uri == 'http://www.zotero.org/styles/american-medical-association') { - var oldID = 'http://www.zotero.org/styles/ama'; - var style = Zotero.Styles.get(oldID); - if (style && style.file.exists()) { - Zotero.debug("Deleting renamed style '" + oldID + "'"); - style.file.remove(false); - } - } - else if (uri == 'http://www.zotero.org/styles/national-library-of-medicine') { - var oldID = 'http://www.zotero.org/styles/nlm'; - var style = Zotero.Styles.get(oldID); + // Remove renamed styles, as instructed by the server + var oldID = xmlnode.getAttribute('oldID'); + if (oldID) { + var style = Zotero.Styles.get(oldID, true); if (style && style.file.exists()) { Zotero.debug("Deleting renamed style '" + oldID + "'"); style.file.remove(false); diff --git a/chrome/content/zotero/xpcom/style.js b/chrome/content/zotero/xpcom/style.js index a8c3ab24f..1484c2f79 100644 --- a/chrome/content/zotero/xpcom/style.js +++ b/chrome/content/zotero/xpcom/style.js @@ -32,6 +32,8 @@ Zotero.Styles = new function() { var _initialized = false; var _styles, _visibleStyles, _cacheTranslatorData; + var _renamedStyles = null; + Components.utils.import("resource://zotero/q.js"); Components.utils.import("resource://gre/modules/Services.jsm"); @@ -116,22 +118,26 @@ Zotero.Styles = new function() { /** * Gets a style with a given ID * @param {String} id + * @param {Boolean} skipMappings Don't automatically return renamed style */ - this.get = function(id) { - // Map some obsolete styles to current ones - const MAPPINGS = { - "http://www.zotero.org/styles/chicago-note": "http://www.zotero.org/styles/chicago-note-bibliography", - "http://www.zotero.org/styles/mhra_note_without_bibliography": "http://www.zotero.org/styles/mhra", - "http://www.zotero.org/styles/aaa": "http://www.zotero.org/styles/american-anthropological-association", - "http://www.zotero.org/styles/ama": "http://www.zotero.org/styles/american-medical-association", - "http://www.zotero.org/styles/nlm": "http://www.zotero.org/styles/national-library-of-medicine" - }; - + this.get = function(id, skipMappings) { if(!_initialized) this.init(); - - if(MAPPINGS.hasOwnProperty(id) && _styles[MAPPINGS[id]]) { - Zotero.debug("Mapping " + id + " to " + MAPPINGS[id]); - return _styles[MAPPINGS[id]]; + + // Map some obsolete styles to current ones + if(!_renamedStyles) { + _renamedStyles = JSON.parse(Zotero.File.getContentsFromURL( + "resource://zotero/schema/renamed-styles.json" + )); + } + + if(!skipMappings) { + var prefix = "http://www.zotero.org/styles/"; + var shortName = id.replace(prefix, ""); + if(_renamedStyles.hasOwnProperty(shortName) && _styles[prefix + _renamedStyles[shortName]]) { + let newID = prefix + _renamedStyles[shortName]; + Zotero.debug("Mapping " + id + " to " + newID); + return _styles[newID]; + } } return _styles[id] || false; diff --git a/resource/schema/renamed-styles.json b/resource/schema/renamed-styles.json new file mode 100644 index 000000000..7aa81f5ea --- /dev/null +++ b/resource/schema/renamed-styles.json @@ -0,0 +1,52 @@ +{ + "aaa": "american-anthropological-association", + "ama": "american-medical-association", + "american-journal-of-cardiology": "the-american-journal-of-cardiology", + "american-journal-of-pathology": "the-american-journal-of-pathology", + "amiens": "universite-de-picardie-jules-verne-ufr-de-medecine", + "annalen-des-naturhistorischen-museums-wien": "annalen-des-naturhistorischen-museums-in-wien", + "apa5th": "apa-5th-edition", + "apsa": "american-political-science-association", + "asa": "american-sociological-association", + "chicago-note": "chicago-note-bibliography", + "cuadernos-filologia-clasica": "cuadernos-de-filologia-clasica", + "febs-journal": "the-febs-journal", + "fems": "federation-of-european-microbiological-societies", + "geological-society-of-america": "the-geological-society-of-america", + "gost-r-7-0-5-2008-csl-1-0": "gost-r-7-0-5-2008", + "graefes-archive-and-experimental-ophthalmology": "graefes-archive-for-clinical-and-experimental-ophthalmology", + "harvard-anglia-ruskin": "harvard-anglia-ruskin-university", + "harvard-sheffield": "harvard-the-university-of-sheffield-town-and-regional-planning", + "harvard-sheffield1": "harvard-the-university-of-sheffield-school-of-east-asian-studies", + "harvard-university-of-northampton": "harvard-the-university-of-northampton", + "harvard-university-west-london": "harvard-university-of-west-london", + "harvard1-unisa-gbfe": "harvard-gesellschaft-fur-bildung-und-forschung-in-europa", + "harvard3": "harvard-swinburne-university-of-technology", + "hwr-berlin": "hochschule-fur-wirtschaft-und-recht-berlin", + "ieee-w-url": "ieee-with-url", + "institute-of-electronics-information-and-communication-engineers": "the-institute-of-electronics-information-and-communication-engineers", + "international-journal-of-psychoanalysis": "the-international-journal-of-psychoanalysis", + "international-journal-of-tropical-biology-and-conservation": "revista-de-biologia-tropical", + "journal-of-clinical-endocrinology-and-metabolism": "the-journal-of-clinical-endocrinology-and-metabolism", + "journal-of-clinical-investigation": "the-journal-of-clinical-investigation", + "journal-of-hellenic-studies": "the-journal-of-hellenic-studies", + "journal-of-juristic-papyrology": "the-journal-of-juristic-papyrology", + "journal-of-pharmacology-and-experimental-therapeutics": "the-journal-of-pharmacology-and-experimental-therapeutics", + "journal-of-the-torrey-botanical-society": "the-journal-of-the-torrey-botanical-society", + "journal-of-wildlife-management": "the-journal-of-wildlife-management", + "juristische-zitierweise-deutsch": "juristische-zitierweise", + "lancet": "the-lancet", + "lichenologist": "the-lichenologist", + "lncs": "springer-lecture-notes-in-computer-science", + "lncs2": "springer-lecture-notes-in-computer-science-alphabetical", + "methods-information-medicine": "methods-of-information-in-medicine", + "mhra-author-date": "modern-humanities-research-association-author-date", + "mhra": "modern-humanities-research-association", + "mhra_note_without_bibliography": "modern-humanities-research-association", + "mla-notes": "modern-language-association-note", + "mla-underline": "modern-language-association-underline", + "mla-url": "modern-language-association-with-url", + "mla": "modern-language-association", + "molecular-biochemical-parasitology": "molecular-and-biochemical-parasitology", + "nlm": "national-library-of-medicine" +} \ No newline at end of file diff --git a/styles b/styles index b53019e1e..e136c9f0b 160000 --- a/styles +++ b/styles @@ -1 +1 @@ -Subproject commit b53019e1e601c6e843c58ad12c8149afc29ce4d6 +Subproject commit e136c9f0b4cd82fcd1bed4b4a35bb7139a40d9ea From 00bb7a168b16d3fca0613c0a1591d0cb642827d0 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 15 Apr 2013 02:58:25 -0400 Subject: [PATCH 03/40] Update versions --- chrome/content/zotero/xpcom/zotero.js | 2 +- install.rdf | 2 +- update.rdf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index cbcce6383..5bfe87605 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -36,7 +36,7 @@ const ZOTERO_CONFIG = { API_VERSION: 2, PREF_BRANCH: 'extensions.zotero.', BOOKMARKLET_URL: 'https://www.zotero.org/bookmarklet/', - VERSION: "4.0.4.SOURCE" + VERSION: "4.0.5.SOURCE" }; // Commonly used imports accessible anywhere diff --git a/install.rdf b/install.rdf index 7ac97d08d..d2e56135b 100644 --- a/install.rdf +++ b/install.rdf @@ -6,7 +6,7 @@ zotero@chnm.gmu.edu Zotero - 4.0.4.SOURCE + 4.0.5.SOURCE Center for History and New Media
George Mason University
Dan Cohen Sean Takats diff --git a/update.rdf b/update.rdf index 1996056ca..d28da1890 100644 --- a/update.rdf +++ b/update.rdf @@ -7,7 +7,7 @@ - 4.0.4.SOURCE + 4.0.5.SOURCE {ec8030f7-c20a-464f-9b0e-13a3a9e97384} From 210e71b8a583908ceb0d385e811fb50ee86ebbcd Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Mon, 15 Apr 2013 13:18:21 -0400 Subject: [PATCH 04/40] Tweak timeouts and add additional debugging info for IE Standalone XDR --- chrome/content/zotero/xpcom/connector/connector.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/xpcom/connector/connector.js b/chrome/content/zotero/xpcom/connector/connector.js index 3f4f91a8e..5a575c375 100644 --- a/chrome/content/zotero/xpcom/connector/connector.js +++ b/chrome/content/zotero/xpcom/connector/connector.js @@ -54,12 +54,17 @@ Zotero.Connector = new function() { callback(false); }; - window.setTimeout(fail, 1000); + window.setTimeout(fail, 1200); try { var xdr = new XDomainRequest(); - xdr.timeout = 700; + xdr.timeout = 1000; xdr.open("POST", "http://127.0.0.1:23119/connector/ping", true); - xdr.onerror = xdr.ontimeout = fail + xdr.onerror = function() { + Zotero.debug("Connector: XDomainRequest to Zotero Standalone experienced an error"); + }; + xdr.ontimeout = function() { + Zotero.debug("Connector: XDomainRequest to Zotero Standalone timed out"); + }; xdr.onload = function() { if(me.isOnline !== null) return; me.isOnline = true; From 11316d952b836d193012421ed51f64dc84521b49 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Mon, 15 Apr 2013 13:25:40 -0400 Subject: [PATCH 05/40] Don't forget to call fail() after debug messages from IE XDR --- chrome/content/zotero/xpcom/connector/connector.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/chrome/content/zotero/xpcom/connector/connector.js b/chrome/content/zotero/xpcom/connector/connector.js index 5a575c375..33dfd788d 100644 --- a/chrome/content/zotero/xpcom/connector/connector.js +++ b/chrome/content/zotero/xpcom/connector/connector.js @@ -61,9 +61,11 @@ Zotero.Connector = new function() { xdr.open("POST", "http://127.0.0.1:23119/connector/ping", true); xdr.onerror = function() { Zotero.debug("Connector: XDomainRequest to Zotero Standalone experienced an error"); + fail(); }; xdr.ontimeout = function() { Zotero.debug("Connector: XDomainRequest to Zotero Standalone timed out"); + fail(); }; xdr.onload = function() { if(me.isOnline !== null) return; From 771cfc9ca6204c209dc50a30b57cc50360c50b45 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Mon, 15 Apr 2013 13:43:07 -0400 Subject: [PATCH 06/40] Make bookmarklet origin configurable for tests --- chrome/content/zotero/xpcom/server.js | 3 ++- chrome/content/zotero/xpcom/zotero.js | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/server.js b/chrome/content/zotero/xpcom/server.js index c16e3c018..5a84e6297 100755 --- a/chrome/content/zotero/xpcom/server.js +++ b/chrome/content/zotero/xpcom/server.js @@ -306,7 +306,8 @@ Zotero.Server.DataListener.prototype._generateResponse = function(status, conten if(!Zotero.isServer) { response += "X-Zotero-Version: "+Zotero.version+"\r\n"; response += "X-Zotero-Connector-API-Version: "+CONNECTOR_API_VERSION+"\r\n"; - if(this.origin === "https://www.zotero.org" || this.origin === "http://www.zotero.org") { + if(this.origin === ZOTERO_CONFIG.BOOKMARKLET_ORIGIN || + this.origin === ZOTERO_CONFIG.HTTP_BOOKMARKLET_ORIGIN) { response += "Access-Control-Allow-Origin: "+this.origin+"\r\n"; response += "Access-Control-Allow-Methods: POST, GET, OPTIONS\r\n"; response += "Access-Control-Allow-Headers: Content-Type,X-Zotero-Connector-API-Version,X-Zotero-Version\r\n"; diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index 5bfe87605..2248ef4a9 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -35,6 +35,8 @@ const ZOTERO_CONFIG = { API_URL: 'https://api.zotero.org/', API_VERSION: 2, PREF_BRANCH: 'extensions.zotero.', + BOOKMARKLET_ORIGIN : 'https://www.zotero.org', + HTTP_BOOKMARKLET_ORIGIN : 'http://www.zotero.org', BOOKMARKLET_URL: 'https://www.zotero.org/bookmarklet/', VERSION: "4.0.5.SOURCE" }; From 5a664ec3d95fd06b0b41f2351bec13aad8ac4d6d Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Mon, 15 Apr 2013 14:51:53 -0400 Subject: [PATCH 07/40] Revert XDR timeout changes from 11316d952b836d193012421ed51f64dc84521b49 --- chrome/content/zotero/xpcom/connector/connector.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/connector/connector.js b/chrome/content/zotero/xpcom/connector/connector.js index 33dfd788d..64ad77912 100644 --- a/chrome/content/zotero/xpcom/connector/connector.js +++ b/chrome/content/zotero/xpcom/connector/connector.js @@ -54,10 +54,10 @@ Zotero.Connector = new function() { callback(false); }; - window.setTimeout(fail, 1200); + window.setTimeout(fail, 1000); try { var xdr = new XDomainRequest(); - xdr.timeout = 1000; + xdr.timeout = 700; xdr.open("POST", "http://127.0.0.1:23119/connector/ping", true); xdr.onerror = function() { Zotero.debug("Connector: XDomainRequest to Zotero Standalone experienced an error"); From 80b10184b0f91bdf49c17df1aacd9f8267438cac Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Mon, 15 Apr 2013 14:52:51 -0400 Subject: [PATCH 08/40] Fix race condition when running bookmarklet from Standalone server --- chrome/content/zotero/xpcom/connector/connector.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/connector/connector.js b/chrome/content/zotero/xpcom/connector/connector.js index 64ad77912..4b0cf8de8 100644 --- a/chrome/content/zotero/xpcom/connector/connector.js +++ b/chrome/content/zotero/xpcom/connector/connector.js @@ -74,7 +74,8 @@ Zotero.Connector = new function() { _ieConnectorCallbacks = []; var listener = function(event) { - if(event.origin !== "http://127.0.0.1:23119") return; + if(event.origin !== "http://127.0.0.1:23119" + || event.source !== iframe.contentWindow) return; if(event.stopPropagation) { event.stopPropagation(); } else { From bafad27311f3e51daf35d6ced23cd30a3c3de256 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Mon, 15 Apr 2013 15:15:01 -0400 Subject: [PATCH 09/40] IE doesn't support normalize --- chrome/content/zotero/xpcom/translation/translate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js index 54edc41a7..1cc1df643 100644 --- a/chrome/content/zotero/xpcom/translation/translate.js +++ b/chrome/content/zotero/xpcom/translation/translate.js @@ -2307,7 +2307,7 @@ Zotero.Translate.IO = { throw "DOMParser error: loading data into data store failed"; } - nodes.normalize(); + if("normalize" in nodes) nodes.normalize(); return nodes; }, From 5442e2e8a8635f1de0ea54645a393caacaa898c5 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 15 Apr 2013 22:21:54 -0400 Subject: [PATCH 10/40] Fix ZFS purging when switching to WebDAV --- chrome/content/zotero/preferences/preferences_sync.js | 2 +- chrome/content/zotero/xpcom/storage/zfs.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/preferences/preferences_sync.js b/chrome/content/zotero/preferences/preferences_sync.js index 15f1679a9..8b4263e73 100644 --- a/chrome/content/zotero/preferences/preferences_sync.js +++ b/chrome/content/zotero/preferences/preferences_sync.js @@ -72,7 +72,7 @@ Zotero_Preferences.Sync = { } if (oldProtocol == 'zotero' && protocol == 'webdav') { - var sql = "SELECT COUNT(*) FROM version WHERE schema='storage_zfs'"; + var sql = "SELECT COUNT(*) FROM version WHERE schema LIKE 'storage_zfs%'"; if (Zotero.DB.valueQuery(sql)) { var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService); diff --git a/chrome/content/zotero/xpcom/storage/zfs.js b/chrome/content/zotero/xpcom/storage/zfs.js index cdad1f030..7ec6513a9 100644 --- a/chrome/content/zotero/xpcom/storage/zfs.js +++ b/chrome/content/zotero/xpcom/storage/zfs.js @@ -1043,6 +1043,10 @@ Zotero.Sync.Storage.ZFS = (function () { */ obj._purgeDeletedStorageFiles = function () { return Q.fcall(function () { + // Cache the credentials at the root + return self._cacheCredentials(); + }.bind(this)) + then(function () { // If we don't have a user id we've never synced and don't need to bother if (!Zotero.userID) { return false; From c2ddecc8a3f61a40aa432c8361d598789bbf97db Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 15 Apr 2013 22:25:03 -0400 Subject: [PATCH 11/40] Update renamed styles list --- resource/schema/renamed-styles.json | 114 +++++++++++++++++++++++++++- 1 file changed, 112 insertions(+), 2 deletions(-) diff --git a/resource/schema/renamed-styles.json b/resource/schema/renamed-styles.json index 7aa81f5ea..943ebb96e 100644 --- a/resource/schema/renamed-styles.json +++ b/resource/schema/renamed-styles.json @@ -1,17 +1,73 @@ { "aaa": "american-anthropological-association", + "advances-physiology-education": "advances-in-physiology-education", + "agriculture-ecosystems-environment": "agriculture-ecosystems-and-environment", + "ajp-heart-circulatory-physiology": "ajp-heart-and-circulatory-physiology", + "ajp-regulatory-integrative-comparative-physiology": "ajp-regulatory-integrative-and-comparative-physiology", "ama": "american-medical-association", "american-journal-of-cardiology": "the-american-journal-of-cardiology", + "american-journal-of-clinical-nutrition": "the-american-journal-of-clinical-nutrition", + "american-journal-of-emergency-medicine": "the-american-journal-of-emergency-medicine", + "american-journal-of-medicine": "the-american-journal-of-medicine", "american-journal-of-pathology": "the-american-journal-of-pathology", + "american-journal-of-sports-medicine": "the-american-journal-of-sports-medicine", + "american-journal-of-surgery": "the-american-journal-of-surgery", + "american-journal-of-tropical-medicine-and-hygiene": "the-american-journal-of-tropical-medicine-and-hygiene", + "american-medical-writers-association": "american-medical-writers-association-journal", + "american-surgeon": " the-american-surgeon", "amiens": "universite-de-picardie-jules-verne-ufr-de-medecine", "annalen-des-naturhistorischen-museums-wien": "annalen-des-naturhistorischen-museums-in-wien", + "annals-of-allergy": "annals-of-allergy-asthma-and-immunology", + "annals-of-thoracic-surgery": "the-annals-of-thoracic-surgery", + "annual-reviews-alphabetically": "annual-reviews-alphabetical", + "annual-reviews-by-appearance": "annual-reviews", "apa5th": "apa-5th-edition", "apsa": "american-political-science-association", "asa": "american-sociological-association", + "bba-biochimica-et-biophysica-acta": "biochimica-et-biophysica-acta", + "bio-medical-reviews": "biomedical-reviews", + "bmc-pharmacology": "bmc-pharmacology-and-toxicology", + "bmj-supportive-palliative-care": "bmj-supportive-and-palliative-care", + "brain-and-development-english-language": "brain-and-development", + "british-journal-of-medical-economics": "journal-of-medical-economics", + "british-volume-of-the-journal-of-bone-and-joint-surgery": "the-journal-of-bone-and-joint-surgery", + "bulletin-of-the-medical-library-association": "journal-of-the-medical-library-association", + "canadian-journal-of-anaesthesia": "canadian-journal-of-anesthesia", + "canadian-journal-of-hospital-pharmacy": "the-canadian-journal-of-hospital-pharmacy", + "canadian-medical-association-journal": "cmaj", + "canadian-veterinary-journal": "the-canadian-veterinary-journal", + "cancer-epidemiology-biomarkers-prevention": "cancer-epidemiology-biomarkers-and-prevention", + "cardiovascular-pharmacology-and-therapeutics": "journal-of-cardiovascular-pharmacology-and-therapeutics", + "central-african-journal-of-medicine": "the-central-african-journal-of-medicine", + "ceylon-journal-of-medical-science": "the-ceylon-journal-of-medical-science", + "ceylon-medical-journal": "the-ceylon-medical-journal", "chicago-note": "chicago-note-bibliography", + "chronic-diseases-in-canada": "chronic-diseases-and-injuries-in-canada", + "college-of-physicians-and-surgeons-pakistan": "journal-of-the-college-of-physicians-and-surgeons-pakistan", "cuadernos-filologia-clasica": "cuadernos-de-filologia-clasica", + "current-opinion-biotechnology": "current-opinion-in-biotechnology", + "current-opinion-cell-biology": "current-opinion-in-cell-biology", + "current-opinion-chemical-biology": "current-opinion-in-chemical-biology", + "current-opinion-environmental-sustainability": "current-opinion-in-environmental-sustainability", + "current-opinion-genetics-development": "current-opinion-in-genetics-development", + "current-opinion-immunology": "current-opinion-in-immunology", + "current-opinion-microbiology": "current-opinion-in-microbiology", + "current-opinion-neurobiology": "current-opinion-in-neurobiology", + "current-opinion-pharmacology": "current-opinion-in-pharmacology", + "current-opinion-plant-biology": "current-opinion-in-plant-biology", + "current-opinion-structural-biology": "current-opinion-in-structural-biology", + "danish-dental-journal": "tandlaegebladet", + "diabetes-vascular-disease-research": "diabetes-and-vascular-disease-research", + "disease-models-mechanisms": "disease-models-and-mechanisms", + "diseases-aquatic-organisms": "diseases-of-aquatic-organisms", + "edizioni-minerva-medica": "minerva-medica", + "ethics-science-environmental-politics": "ethics-in-science-and-environmental-politics", + "f1000-research": "f1000research", "febs-journal": "the-febs-journal", "fems": "federation-of-european-microbiological-societies", + "firstmonday": "first-monday", + "future-science": "future-science-journals", + "geological-society-america-bulletin": "geological-society-of-america-bulletin", "geological-society-of-america": "the-geological-society-of-america", "gost-r-7-0-5-2008-csl-1-0": "gost-r-7-0-5-2008", "graefes-archive-and-experimental-ophthalmology": "graefes-archive-for-clinical-and-experimental-ophthalmology", @@ -22,31 +78,85 @@ "harvard-university-west-london": "harvard-university-of-west-london", "harvard1-unisa-gbfe": "harvard-gesellschaft-fur-bildung-und-forschung-in-europa", "harvard3": "harvard-swinburne-university-of-technology", + "hbp": "hpb", "hwr-berlin": "hochschule-fur-wirtschaft-und-recht-berlin", + "ices-jms": "ices-journal-of-marine-science", "ieee-w-url": "ieee-with-url", "institute-of-electronics-information-and-communication-engineers": "the-institute-of-electronics-information-and-communication-engineers", + "international-journal-cross-cultural-management": "international-journal-of-cross-cultural-management", + "international-journal-of-psychiatry-in-medicine": "the-international-journal-of-psychiatry-in-medicine", "international-journal-of-psychoanalysis": "the-international-journal-of-psychoanalysis", "international-journal-of-tropical-biology-and-conservation": "revista-de-biologia-tropical", + "iso690-author-date-fr-without-abstract": "iso690-author-date-fr-no-abstract", + "jid-symposium-proceedings": "journal-of-investigative-dermatology-symposium-proceedings", + "journal-of-aapos": "journal-of-american-association-for-pediatric-ophthalmology-and-strabismus", + "journal-of-allergy-and-clinical-immunology": "the-journal-of-allergy-and-clinical-immunology", + "journal-of-bone-and-joint-surgery": "the-journal-of-bone-and-joint-surgery", + "journal-of-cardiovascular-surgery": "the-journal-of-cardiovascular-surgery", + "journal-of-cell-biology": "the-journal-of-cell-biology", + "journal-of-chemical-physics": "the-journal-of-chemical-physics", "journal-of-clinical-endocrinology-and-metabolism": "the-journal-of-clinical-endocrinology-and-metabolism", "journal-of-clinical-investigation": "the-journal-of-clinical-investigation", + "journal-of-clinical-psychiatry": "the-journal-of-clinical-psychiatry", + "journal-of-experimental-medicine": "the-journal-of-experimental-medicine", + "journal-of-general-physiology": "the-journal-of-general-physiology", + "journal-of-hand-surgery": "the-journal-of-hand-surgery", + "journal-of-heart-and-lung-transplantation": "the-journal-of-heart-and-lung-transplantation", "journal-of-hellenic-studies": "the-journal-of-hellenic-studies", + "journal-of-hong-kong-medical-association": "hong-kong-medical-journal", + "journal-of-indian-prosthodontic-society": "the-journal-of-indian-prosthodontic-society", "journal-of-juristic-papyrology": "the-journal-of-juristic-papyrology", + "journal-of-medieval-and-early-modern-studies": "the-journal-of-medieval-and-early-modern-studies", + "journal-of-modern-history": "the-journal-of-modern-history", + "journal-of-nuclear-medicine": "the-journal-of-nuclear-medicine", + "journal-of-organic-chemistry": "the-journal-of-organic-chemistry", + "journal-of-pediatrics": "the-journal-of-pediatrics", "journal-of-pharmacology-and-experimental-therapeutics": "the-journal-of-pharmacology-and-experimental-therapeutics", + "journal-of-pharmacy-technology": "the-journal-of-pharmacy-technology", + "journal-of-physical-chemistry": "the-journal-of-physical-chemistry-a", + "journal-of-prosthetic-dentistry": "the-journal-of-prosthetic-dentistry", + "journal-of-the-american-academy-of-physician-assistants": "jaapa", + "journal-of-the-american-dental-association": "the-journal-of-the-american-dental-association", + "journal-of-the-american-medical-association": "jama", + "journal-of-the-american-osteopathic-association": "the-journal-of-the-american-osteopathic-association", + "journal-of-the-indian-society-of-pedodontics-and-preventative-dentistry": "journal-of-the-indian-society-of-pedodontics-and-preventive-dentistry", + "journal-of-the-institute-of-medicine": "journal-of-institute-of-medicine", "journal-of-the-torrey-botanical-society": "the-journal-of-the-torrey-botanical-society", + "journal-of-thoracic-and-cardiovascular-surgery": "the-journal-of-thoracic-and-cardiovascular-surgery", "journal-of-wildlife-management": "the-journal-of-wildlife-management", "juristische-zitierweise-deutsch": "juristische-zitierweise", + "korean-journal-of-gynecologic-oncology": "journal-of-gynecologic-oncology", + "lancet-infectious-diseases": "the-lancet-infectious-diseases", + "lancet-neurology": "the-lancet-neurology", + "lancet-oncology": "the-lancet-oncology", "lancet": "the-lancet", "lichenologist": "the-lichenologist", "lncs": "springer-lecture-notes-in-computer-science", "lncs2": "springer-lecture-notes-in-computer-science-alphabetical", + "malaysian-journal-of-pathology": "the-malaysian-journal-of-pathology", + "manedsskrift-for-praktk-laegegerning": "manedsskrift-for-almen-praksis", + "medical-journal-of-australia": "the-medical-journal-of-australia", + "medicina-militar": "sanidad-militar", "methods-information-medicine": "methods-of-information-in-medicine", + "mhra_note_without_bibliography": "modern-humanities-research-association", "mhra-author-date": "modern-humanities-research-association-author-date", "mhra": "modern-humanities-research-association", - "mhra_note_without_bibliography": "modern-humanities-research-association", "mla-notes": "modern-language-association-note", "mla-underline": "modern-language-association-underline", "mla-url": "modern-language-association-with-url", "mla": "modern-language-association", "molecular-biochemical-parasitology": "molecular-and-biochemical-parasitology", - "nlm": "national-library-of-medicine" + "netherlands-journal-of-medicine": "the-netherlands-journal-of-medicine", + "neumologica-y-cirugia-de-torax-neurofibromatosis": "neumologia-y-cirugia-de-torax", + "new-iraqi-journal-of-medicine": "the-new-iraqi-journal-of-medicine", + "new-zealand-journal-of-medical-laboratory-technology": "new-zealand-journal-of-medical-laboratory-science", + "new-zealand-medical-journal": "the-new-zealand-medical-journal", + "nlm": "national-library-of-medicine", + "physiological-biochemical-zoology": "physiological-and-biochemical-zoology", + "quaderni-avogadro-colloquia": "quaderni-degli-avogadro-colloquia", + "taylor-and-francis-reference-style-f": "taylor-and-francis-chicago-f", + "ulster-medical-journal": "the-ulster-medical-journal", + "uni-freiburg-geschichte-autor-jahr": "universitat-freiburg-geschichte", + "uqam-universite-du-quebec-a-montreal": "universite-du-quebec-a-montreal", + "world-health-organization-journals": "world-health-organization" } \ No newline at end of file From 9b1b4803dc675b8d01d0953389dd51fe1c5e9547 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 15 Apr 2013 22:25:48 -0400 Subject: [PATCH 12/40] Update submodules and repotime --- chrome/content/zotero/locale/csl | 2 +- resource/schema/repotime.txt | 2 +- translators | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/locale/csl b/chrome/content/zotero/locale/csl index 5b7a687df..007de1a82 160000 --- a/chrome/content/zotero/locale/csl +++ b/chrome/content/zotero/locale/csl @@ -1 +1 @@ -Subproject commit 5b7a687df6464af87eaacc4088bd136ec1039d1b +Subproject commit 007de1a82c0359e897610d67edd11e0086f48689 diff --git a/resource/schema/repotime.txt b/resource/schema/repotime.txt index 933c1ca0f..374bf70d9 100644 --- a/resource/schema/repotime.txt +++ b/resource/schema/repotime.txt @@ -1 +1 @@ -2013-04-07 18:45:00 +2013-04-15 18:15:00 diff --git a/translators b/translators index c70b413c7..95d2177e3 160000 --- a/translators +++ b/translators @@ -1 +1 @@ -Subproject commit c70b413c796b294f98a19667d48081ba4d042e0c +Subproject commit 95d2177e3e3500b7c05e3a4c6608e0b55a1c5ad3 From ff5353fec1025157769d54817985f8da96ac5aaf Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Tue, 16 Apr 2013 00:11:19 -0400 Subject: [PATCH 13/40] Update to citeproc-js 1.0.450 --- chrome/content/zotero/xpcom/citeproc.js | 1131 ++++++++++++----------- 1 file changed, 599 insertions(+), 532 deletions(-) diff --git a/chrome/content/zotero/xpcom/citeproc.js b/chrome/content/zotero/xpcom/citeproc.js index 0e8aa510f..d9ee488c0 100644 --- a/chrome/content/zotero/xpcom/citeproc.js +++ b/chrome/content/zotero/xpcom/citeproc.js @@ -57,7 +57,9 @@ if (!Array.indexOf) { }; } var CSL = { - PROCESSOR_VERSION: "1.0.446", + PROCESSOR_VERSION: "1.0.450", + CONDITION_LEVEL_TOP: 1, + CONDITION_LEVEL_BOTTOM: 2, PLAIN_HYPHEN_REGEX: /(?:[^\\]-|\u2013)/, LOCATOR_LABELS_REGEXP: new RegExp("^((art|ch|Ch|subch|col|fig|l|n|no|op|p|pp|para|subpara|pt|r|sec|subsec|Sec|sv|sch|tit|vrs|vol)\\.)\\s+(.*)"), STATUTE_SUBDIV_GROUPED_REGEX: /((?:^| )(?:art|ch|Ch|subch|p|pp|para|subpara|pt|r|sec|subsec|Sec|sch|tit)\.)/g, @@ -348,7 +350,7 @@ var CSL = { ret[ret.length - 1] += str; return ret; }, - SKIP_WORDS: ["but", "or", "yet", "so", "for", "and", "nor", "a", "an", "the", "at", "by", "from", "in", "into", "of", "on", "to", "with", "up", "down", "as", "via", "onto", "over", "till"], + SKIP_WORDS: ["but", "or", "yet", "so", "for", "and", "nor", "a", "an", "the", "at", "by", "from", "in", "into", "of", "on", "to", "with", "up", "down", "as", "via", "onto", "over", "till", "de", "d'", "von", "van"], FORMAT_KEY_SEQUENCE: [ "@strip-periods", "@font-style", @@ -1273,6 +1275,13 @@ CSL.Output.Queue.prototype.string = function (state, myblobs, blob) { state.tmp.count_offset_characters = false; } } + for (i=0,ilen=ret.length - 1;i -1) { + myitem = item; + } + if (CSL.NUMERIC_VARIABLES.indexOf(variable) > -1) { + if (!state.tmp.shadow_numbers[variable]) { + state.processNumber(false, myitem, variable, Item.type); + } + if (myitem[variable] && state.tmp.shadow_numbers[variable].numeric) { + return reverse ? false : true; + } + } else if (["title", "locator-revision","version"].indexOf(variable) > -1) { + if (myitem[variable]) { + if (myitem[variable].slice(-1) === "" + parseInt(myitem[variable].slice(-1), 10)) { + return reverse ? false : true; + } } } - if (persons > 1) { - ret = true; - } else if (institutions > 1) { - ret = true; - } else if (institutions && last_is_person) { - ret = true; - } + return reverse ? true : false; } - return ret; - }; - this.tests.push(func); -}; -CSL.Attributes["@subjurisdictions"] = function (state, arg) { - var trysubjurisdictions = parseInt(arg, 10); - var func = function (state, Item, item) { - var subjurisdictions = 0; - if (Item.jurisdiction) { - subjurisdictions = Item.jurisdiction.split(";").length; - } - if (subjurisdictions) { - subjurisdictions += -1; - } - var ret = false; - if (subjurisdictions >= trysubjurisdictions) { - ret = true; - } - return [ret]; - }; - this.tests.push(func); -}; -CSL.Attributes["@label-form"] = function (state, arg) { - this.strings.label_form_override = arg; -}; -CSL.Attributes["@has-year-only"] = function (state, arg) { - var trydates = arg.split(/\s+/); - var func = function (state, Item, item) { - var ret = []; - for (var i = 0, ilen = trydates.length; i < ilen; i += 1) { - var trydate = Item[trydates[i]]; - if (!trydate || trydate.month || trydate.season) { - ret.push(false); - } else { - ret.push(true); - } - } - return ret; - }; - this.tests.push(func); -}; -CSL.Attributes["@has-month-or-season-only"] = function (state, arg) { - var trydates = arg.split(/\s+/); - var func = function (state, Item, item) { - var ret = []; - for (var i = 0, ilen = trydates.length; i < ilen; i += 1) { - var trydate = Item[trydates[i]]; - if (!trydate || (!trydate.month && !trydate.season) || trydate.day) { - ret.push(false); - } else { - ret.push(true); - } - } - return ret; - }; - this.tests.push(func); -}; -CSL.Attributes["@has-day-only"] = function (state, arg) { - var trydates = arg.split(/\s+/); - var func = function (state, Item, item) { - var ret = []; - for (var i = 0, ilen = trydates.length; i < ilen; i += 1) { - var trydate = Item[trydates[i]]; - if (!trydate || !trydate.day) { - ret.push(false); - } else { - ret.push(true); - } - } - return ret; - }; - this.tests.push(func); -}; -CSL.Attributes["@part-separator"] = function (state, arg) { - this.strings["part-separator"] = arg; -}; -CSL.Attributes["@context"] = function (state, arg) { - var func = function (state, Item) { - var area = state.tmp.area.slice(0, arg.length); - var result = false; - if (area === arg) { - result = true; - } - return result; - }; - this.tests.push(func); -}; -CSL.Attributes["@leading-noise-words"] = function (state, arg) { - this["leading-noise-words"] = arg; -}; -CSL.Attributes["@class"] = function (state, arg) { - state.opt["class"] = arg; -}; -CSL.Attributes["@version"] = function (state, arg) { - state.opt.version = arg; -}; -CSL.Attributes["@value"] = function (state, arg) { - this.strings.value = arg; -}; -CSL.Attributes["@name"] = function (state, arg) { - this.strings.name = arg; -}; -CSL.Attributes["@form"] = function (state, arg) { - this.strings.form = arg; -}; -CSL.Attributes["@date-parts"] = function (state, arg) { - this.strings["date-parts"] = arg; -}; -CSL.Attributes["@range-delimiter"] = function (state, arg) { - this.strings["range-delimiter"] = arg; -}; -CSL.Attributes["@macro"] = function (state, arg) { - this.postponed_macro = arg; -}; -CSL.Attributes["@term"] = function (state, arg) { - if (arg === "sub verbo") { - this.strings.term = "sub-verbo"; - } else { - this.strings.term = arg; } -}; -CSL.Attributes["@xmlns"] = function (state, arg) {}; -CSL.Attributes["@lang"] = function (state, arg) { - if (arg) { - state.build.lang = arg; + var mytests = []; + for (var i=0; i 0 && item.position >= tryposition) { + return true; + } + } else if (tryposition === 0) { + return true; + } + return false; + } + } + var mytests = []; + for (var i=0,ilen=trypositions.length;i -1) { @@ -9092,46 +9124,230 @@ CSL.Attributes["@variable"] = function (state, arg) { }; this.execs.push(func); } else if (["if", "else-if"].indexOf(this.name) > -1) { - func = function (state, Item, item) { - var key, x; - ret = []; - len = this.variables.length; - for (pos = 0; pos < len; pos += 1) { - variable = this.variables[pos]; - x = false; - myitem = Item; + var reverses = CSL.Util.setReverseConditions.call(this, this.variables); + var maketest = function (variable, reverse) { + return function(Item,item){ + var myitem = Item; if (item && ["locator", "locator-revision", "first-reference-note-number", "locator-date"].indexOf(variable) > -1) { myitem = item; } if (variable === "hereinafter" && state.sys.getAbbreviation && myitem.id) { if (state.transform.abbrevs["default"].hereinafter[myitem.id]) { - x = true; + return reverse ? false : true; } } else if (myitem[variable]) { if ("number" === typeof myitem[variable] || "string" === typeof myitem[variable]) { - x = true; + return reverse ? false : true; } else if ("object" === typeof myitem[variable]) { for (key in myitem[variable]) { if (myitem[variable][key]) { - x = true; - break; - } else { - x = false; + return reverse ? false : true; } } } } - ret.push(x); + return reverse ? true : false; } - return ret; - }; + } + var mytests = []; + for (var i=0,ilen=this.variables.length;i0;i+=-1) { + var tryjurisdictionStr = tryjurisdiction.slice(0,i).join(";"); + var jurisdiction = jurisdictions.slice(0,i).join(";"); + if (tryjurisdictionStr === jurisdiction) { + return reverse ? false : true; + } + } + return reverse ? true : false; + } + } + var mytests = []; + for (var i=0,ilen=tryjurisdictions.length;i= trysubjurisdictions) { + return true; + } + return false; + }; + this.tests.push(func); +}; +CSL.Attributes["@is-plural"] = function (state, arg) { + var func = function (Item, item) { + var nameList = Item[arg]; + if (nameList && nameList.length) { + var persons = 0; + var institutions = 0; + var last_is_person = false; + for (var i = 0, ilen = nameList.length; i < ilen; i += 1) { + if (nameList[i].isInstitution && (nameList[i].literal || (nameList[i].family && !nameList[i].given))) { + institutions += 1; + last_is_person = false; + } else { + persons += 1; + last_is_person = true; + } + } + if (persons > 1) { + return true; + } else if (institutions > 1) { + return true; + } else if (institutions && last_is_person) { + return true; + } + } + return false; + }; + this.tests.push(func); }; CSL.Attributes["@locale"] = function (state, arg) { var func, ret, len, pos, variable, myitem, langspec, lang, lst, i, ilen, fallback; @@ -9152,43 +9368,113 @@ CSL.Attributes["@locale"] = function (state, arg) { this.locale_default = state.opt["default-locale"][0]; this.locale = lst[0].best; this.locale_list = lst.slice(); - func = function (state, Item, item) { - var key, res; - ret = []; - res = false; - var langspec = false; - if (Item.language) { - lang = Item.language; - langspec = CSL.localeResolve(lang); - if (langspec.best === state.opt["default-locale"][0]) { - langspec = false; - } - } - if (langspec) { - for (i = 0, ilen = this.locale_list.length; i < ilen; i += 1) { - if (langspec.best === this.locale_list[i].best) { - state.opt.lang = this.locale; - state.tmp.last_cite_locale = this.locale; - state.output.openLevel("empty"); - state.output.current.value().new_locale = this.locale; - res = true; - break; + var maketest = function (me) { + return function (Item, item) { + var key, res; + ret = []; + res = false; + var langspec = false; + if (Item.language) { + lang = Item.language; + langspec = CSL.localeResolve(lang); + if (langspec.best === state.opt["default-locale"][0]) { + langspec = false; } } - if (!res && this.locale_bares.indexOf(langspec.bare) > -1) { - state.opt.lang = this.locale; - state.tmp.last_cite_locale = this.locale; - state.output.openLevel("empty"); - state.output.current.value().new_locale = this.locale; - res = true; + if (langspec) { + for (i = 0, ilen = me.locale_list.length; i < ilen; i += 1) { + if (langspec.best === me.locale_list[i].best) { + state.opt.lang = me.locale; + state.tmp.last_cite_locale = me.locale; + state.output.openLevel("empty"); + state.output.current.value().new_locale = me.locale; + res = true; + break; + } + } + if (!res && me.locale_bares.indexOf(langspec.bare) > -1) { + state.opt.lang = me.locale; + state.tmp.last_cite_locale = me.locale; + state.output.openLevel("empty"); + state.output.current.value().new_locale = me.locale; + res = true; + } } + return res; } - ret.push(res); - return ret; - }; - this.tests.push(func); + } + var me = this; + this.tests.push(maketest(me)); } }; +CSL.Attributes["@is-parallel"] = function (state, arg) { + var values = arg.split(" "); + for (var i = 0, ilen = values.length; i < ilen; i += 1) { + if (values[i] === "true") { + values[i] = true; + } else if (values[i] === "false") { + values[i] = false; + } + } + this.strings.set_parallel_condition = values; +}; +CSL.Attributes["@gender"] = function (state, arg) { + this.gender = arg; +} +CSL.Attributes["@cslid"] = function (state, arg) { + this.cslid = parseInt(arg, 10); +}; +CSL.Attributes["@label-form"] = function (state, arg) { + this.strings.label_form_override = arg; +}; +CSL.Attributes["@part-separator"] = function (state, arg) { + this.strings["part-separator"] = arg; +}; +CSL.Attributes["@leading-noise-words"] = function (state, arg) { + this["leading-noise-words"] = arg; +}; +CSL.Attributes["@class"] = function (state, arg) { + state.opt["class"] = arg; +}; +CSL.Attributes["@version"] = function (state, arg) { + state.opt.version = arg; +}; +CSL.Attributes["@value"] = function (state, arg) { + this.strings.value = arg; +}; +CSL.Attributes["@name"] = function (state, arg) { + this.strings.name = arg; +}; +CSL.Attributes["@form"] = function (state, arg) { + this.strings.form = arg; +}; +CSL.Attributes["@date-parts"] = function (state, arg) { + this.strings["date-parts"] = arg; +}; +CSL.Attributes["@range-delimiter"] = function (state, arg) { + this.strings["range-delimiter"] = arg; +}; +CSL.Attributes["@macro"] = function (state, arg) { + this.postponed_macro = arg; +}; +CSL.Attributes["@term"] = function (state, arg) { + if (arg === "sub verbo") { + this.strings.term = "sub-verbo"; + } else { + this.strings.term = arg; + } +}; +CSL.Attributes["@xmlns"] = function (state, arg) {}; +CSL.Attributes["@lang"] = function (state, arg) { + if (arg) { + state.build.lang = arg; + } +}; +CSL.Attributes["@lingo"] = function (state, arg) { +}; +CSL.Attributes["@macro-has-date"] = function (state, arg) { + this["macro-has-date"] = true; +}; CSL.Attributes["@suffix"] = function (state, arg) { this.strings.suffix = arg; }; @@ -9203,107 +9489,23 @@ CSL.Attributes["@delimiter"] = function (state, arg) { } }; CSL.Attributes["@match"] = function (state, arg) { - var evaluator; + var match; if (this.tokentype === CSL.START || CSL.SINGLETON) { - if ("none" === arg) { - evaluator = state.fun.match.none; - } else if ("any" === arg) { - evaluator = state.fun.match.any; - } else if ("all" === arg) { - evaluator = state.fun.match.all; - } else { - throw "Unknown match condition \"" + arg + "\" in @match"; - } - this.evaluator = evaluator; + this.match = arg; + this.evaluator = function (token, state, Item, item) { + var record = function (result) { + if (result) { + state.tmp.jump.replace("succeed"); + return token.succeed; + } else { + state.tmp.jump.replace("fail"); + return token.fail; + } + } + return record(state.fun.match[arg](token, state, token.tests, CSL.CONDITION_LEVEL_TOP)(Item, item)); + }; } }; -CSL.Attributes["@jurisdiction"] = function (state, arg) { - var style_lexlst = arg.split(/\s+/); - var func = function (state, Item) { - var input_lex = false; - var ret = false; - if (Item.jurisdiction) { - input_lex = Item.jurisdiction; - } else if (Item.language) { - var m = Item.language.match(/^.*-x-lex-([.;a-zA-Z]+).*$/); - if (m) { - input_lex = m[1]; - } - } - if (input_lex) { - var input_lexlst = input_lex.split(";"); - outerLoop: for (var i = 0, ilen = style_lexlst.length; i < ilen; i += 1) { - var style_lexlst_subjur = style_lexlst[i].split(";"); - middleLoop: for (var j = 0, jlen = style_lexlst_subjur.length; j < jlen; j += 1) { - var style_lex_elem = style_lexlst_subjur[j]; - innerLoop: for (var k = 0, klen = input_lexlst.length; k < klen; k += 1) { - var input_lex_elem = input_lexlst[k]; - if (style_lex_elem === input_lex_elem && j === style_lexlst_subjur.length - 1) { - ret = true; - break outerLoop; - } - } - } - } - } - return ret; - }; - this.tests.push(func); -}; -CSL.Attributes["@is-uncertain-date"] = function (state, arg) { - var variables, len, pos, func, variable, ret; - variables = arg.split(/\s+/); - len = variables.length; - func = function (state, Item) { - ret = []; - for (pos = 0; pos < len; pos += 1) { - variable = variables[pos]; - if (Item[variable] && Item[variable].circa) { - ret.push(true); - } else { - ret.push(false); - } - } - return ret; - }; - this.tests.push(func); -}; -CSL.Attributes["@is-numeric"] = function (state, arg) { - var variables, func, len, ret; - variables = arg.split(/\s+/); - len = variables.length; - func = function (state, Item, item) { - ret = []; - for (var i = 0; i < len; i += 1) { - var myitem = Item; - if (["locator","locator-revision"].indexOf(variables[i]) > -1) { - myitem = item; - } - if (CSL.NUMERIC_VARIABLES.indexOf(variables[i]) > -1) { - if (!state.tmp.shadow_numbers[variables[i]]) { - state.processNumber(false, myitem, variables[i], Item.type); - } - if (myitem[variables[i]] && state.tmp.shadow_numbers[variables[i]].numeric) { - ret.push(true); - } else { - ret.push(false); - } - } else if (["title", "locator-revision","version"].indexOf(variables[i]) > -1) { - if (myitem[variables[i]]) { - if (myitem[variables[i]].slice(-1) === "" + parseInt(myitem[variables[i]].slice(-1), 10)) { - ret.push(true); - } else { - ret.push(false); - } - } else { - ret.push(false); - } - } - } - return ret; - }; - this.tests.push(func); -}; CSL.Attributes["@names-min"] = function (state, arg) { var val = parseInt(arg, 10); if (state.opt.max_number_of_names < val) { @@ -9335,61 +9537,6 @@ CSL.Attributes["@plural"] = function (state, arg) { this.strings.plural = false; } }; -CSL.Attributes["@locator"] = function (state, arg) { - var func; - var trylabels = arg.replace("sub verbo", "sub-verbo"); - trylabels = trylabels.split(/\s+/); - if (["if", "else-if"].indexOf(this.name) > -1) { - func = function (state, Item, item) { - var ret = []; - var label; - if ("undefined" === typeof item || !item.label) { - label = "page"; - } else if (item.label === "sub verbo") { - label = "sub-verbo"; - } else { - label = item.label; - } - for (var i = 0, ilen = trylabels.length; i < ilen; i += 1) { - if (trylabels[i] === label) { - ret.push(true); - } else { - ret.push(false); - } - } - return ret; - }; - this.tests.push(func); - } -}; -CSL.Attributes["@page"] = function (state, arg) { - var func; - var trylabels = arg.replace("sub verbo", "sub-verbo"); - trylabels = trylabels.split(/\s+/); - if (["if", "else-if"].indexOf(this.name) > -1) { - func = function (state, Item, item) { - var ret = []; - var label; - state.processNumber(false, Item, "page", Item.type); - if (!state.tmp.shadow_numbers.page.label) { - label = "page"; - } else if (state.tmp.shadow_numbers.page.label === "sub verbo") { - label = "sub-verbo"; - } else { - label = state.tmp.shadow_numbers.page.label; - } - for (var i = 0, ilen = trylabels.length; i < ilen; i += 1) { - if (trylabels[i] === label) { - ret.push(true); - } else { - ret.push(false); - } - } - return ret; - }; - this.tests.push(func); - } -}; CSL.Attributes["@number"] = function (state, arg) { var func; var trylabels = arg.replace("sub verbo", "sub-verbo"); @@ -9432,69 +9579,6 @@ CSL.Attributes["@publisher-and"] = function (state, arg) { }; CSL.Attributes["@newdate"] = function (state, arg) { }; -CSL.Attributes["@position"] = function (state, arg) { - var tryposition; - state.opt.update_mode = CSL.POSITION; - state.parallel.use_parallels = true; - if ("near-note" === arg) { - var near_note_func = function (state, Item, item) { - if (item && item.position === CSL.POSITION_SUBSEQUENT && item["near-note"]) { - return true; - } - return false; - }; - this.tests.push(near_note_func); - } else { - var factory = function (tryposition) { - return function (state, Item, item) { - if (state.tmp.area === "bibliography") { - return false; - } - if (item && "undefined" === typeof item.position) { - item.position = 0; - } - if (item && typeof item.position === "number") { - if (item.position === 0 && tryposition === 0) { - return true; - } else if (tryposition > 0 && item.position >= tryposition) { - return true; - } - } else if (tryposition === 0) { - return true; - } - return false; - }; - }; - var lst = arg.split(/\s+/); - for (var i = 0, ilen = lst.length; i < ilen; i += 1) { - if (lst[i] === "first") { - tryposition = CSL.POSITION_FIRST; - } else if (lst[i] === "subsequent") { - tryposition = CSL.POSITION_SUBSEQUENT; - } else if (lst[i] === "ibid") { - tryposition = CSL.POSITION_IBID; - } else if (lst[i] === "ibid-with-locator") { - tryposition = CSL.POSITION_IBID_WITH_LOCATOR; - } - var func = factory(tryposition); - this.tests.push(func); - } - } -}; -CSL.Attributes["@disambiguate"] = function (state, arg) { - if (this.tokentype === CSL.START && ["if", "else-if"].indexOf(this.name) > -1) { - if (arg === "true") { - state.opt.has_disambiguate = true; - var func = function (state, Item) { - if (state.tmp.disambig_settings.disambiguate) { - return true; - } - return false; - }; - this.tests.push(func); - } - } -}; CSL.Attributes["@givenname-disambiguation-rule"] = function (state, arg) { if (CSL.GIVENNAME_DISAMBIGUATION_RULES.indexOf(arg) > -1) { state.opt["givenname-disambiguation-rule"] = arg; @@ -9767,88 +9851,57 @@ CSL.Stack.prototype.value = function () { CSL.Stack.prototype.length = function () { return this.mystack.length; }; -CSL.Util = {}; +CSL.Util = { + setReverseConditions: function (lst) { + reverses = []; + for (var i=0,ilen=lst.length;i 10 && num < 20)) { suffix = this.suffixes[this.state.opt.lang][gender][3]; From c185ffc7280c515095a3797ed58d4480891bf56e Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 16 Apr 2013 00:15:54 -0400 Subject: [PATCH 14/40] Fix purgeDeletedStorageFiles() (from 5442e2e8) --- chrome/content/zotero/xpcom/storage/zfs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/storage/zfs.js b/chrome/content/zotero/xpcom/storage/zfs.js index 7ec6513a9..fa3a30321 100644 --- a/chrome/content/zotero/xpcom/storage/zfs.js +++ b/chrome/content/zotero/xpcom/storage/zfs.js @@ -1044,7 +1044,7 @@ Zotero.Sync.Storage.ZFS = (function () { obj._purgeDeletedStorageFiles = function () { return Q.fcall(function () { // Cache the credentials at the root - return self._cacheCredentials(); + return this._cacheCredentials(); }.bind(this)) then(function () { // If we don't have a user id we've never synced and don't need to bother From b82a28e7085fa3b3a7ca131b518b21b4ed9bd502 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 16 Apr 2013 01:10:42 -0400 Subject: [PATCH 15/40] Extra file sync debugging --- chrome/content/zotero/xpcom/storage/webdav.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/chrome/content/zotero/xpcom/storage/webdav.js b/chrome/content/zotero/xpcom/storage/webdav.js index ee0c5578c..756934c23 100644 --- a/chrome/content/zotero/xpcom/storage/webdav.js +++ b/chrome/content/zotero/xpcom/storage/webdav.js @@ -1002,6 +1002,10 @@ Zotero.Sync.Storage.WebDAV = (function () { var lastModified = req.getResponseHeader("Last-Modified"); var date = new Date(lastModified); + // TEMP + if (date.getTime() == 0) { + Zotero.debug(lastModified); + } Zotero.debug("Last successful WebDAV sync was " + date); return Zotero.Date.toUnixTimestamp(date); }) From e8934723319aa219fd37b0ad416c4f0ff893a8f3 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Tue, 16 Apr 2013 12:45:54 -0400 Subject: [PATCH 16/40] Register as handler for BibTeX mime typese --- chrome/content/zotero/xpcom/mimeTypeHandler.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/mimeTypeHandler.js b/chrome/content/zotero/xpcom/mimeTypeHandler.js index 01a2243d5..84f444767 100644 --- a/chrome/content/zotero/xpcom/mimeTypeHandler.js +++ b/chrome/content/zotero/xpcom/mimeTypeHandler.js @@ -57,8 +57,11 @@ Zotero.MIMETypeHandler = new function () { if(Zotero.Prefs.get("parseEndNoteMIMETypes")) { this.addHandler("application/x-endnote-refer", _importHandler, true); this.addHandler("application/x-research-info-systems", _importHandler, true); - // Add ISI this.addHandler("application/x-inst-for-scientific-info", _importHandler, true); + + this.addHandler("text/x-bibtex", _importHandler, true); + this.addHandler("application/x-bibtex", _importHandler, true); + // // And some non-standard ones // From a0bc26713ea7488a40c7b3a4fec04227f694d747 Mon Sep 17 00:00:00 2001 From: Aurimas Vinckevicius Date: Mon, 15 Apr 2013 17:26:13 -0500 Subject: [PATCH 17/40] Revise translator binding rules for clarity & to favor top frame translators --- chrome/content/zotero/browser.js | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/chrome/content/zotero/browser.js b/chrome/content/zotero/browser.js index baf7d7c5f..08d853060 100644 --- a/chrome/content/zotero/browser.js +++ b/chrome/content/zotero/browser.js @@ -804,16 +804,23 @@ Zotero_Browser.Tab.prototype._selectItems = function(obj, itemList, callback) { */ Zotero_Browser.Tab.prototype._translatorsAvailable = function(translate, translators) { if(translators && translators.length) { - // if there's already a scrapable page in the browser window, and it's - // still there, ensure it is actually part of the page, then return - if(this.page.translators && this.page.translators.length && this.page.document.location) { - if(this.page.document.defaultView && !this.page.document.defaultView.closed - && this.page.document.location.href != translate.document.location.href) { - // if it is still there, switch translation to take place on - if(!translators.length || this.page.translators[0].priority <= translators[0].priority) return; - } else { - this.clear(); - } + //see if we should keep the previous set of translators + if(//we already have a translator for part of this page + this.page.translators && this.page.translators.length && this.page.document.location + //and the page is still there + && this.page.document.defaultView && !this.page.document.defaultView.closed + //this set of translators is not targeting the same URL as a previous set of translators, + // because otherwise we want to use the newer set + && this.page.document.location.href != translate.document.location.href + //the previous set of translators targets the top frame or the current one does not either + && (this.page.document.defaultView == this.page.document.defaultView.top + || translate.document.defaultView !== this.page.document.defaultView.top) + //the best translator we had was of higher priority than the new set + && this.page.translators[0].priority <= translators[0].priority + ) { + return; //keep what we had + } else { + this.clear(); //clear URL bar icon } this.page.translate = translate; From deca49c433053ffbe16c47717cc672c767e88aec Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Tue, 16 Apr 2013 23:31:23 -0400 Subject: [PATCH 18/40] Avoid stack overflow in tests --- .../content/zotero/tools/testTranslators/translatorTester.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/tools/testTranslators/translatorTester.js b/chrome/content/zotero/tools/testTranslators/translatorTester.js index 713deee9e..34f7251a3 100644 --- a/chrome/content/zotero/tools/testTranslators/translatorTester.js +++ b/chrome/content/zotero/tools/testTranslators/translatorTester.js @@ -334,7 +334,9 @@ Zotero_TranslatorTester.prototype._runTestsRecursively = function(testDoneCallba if(this.type === "web") { this.fetchPageAndRunTest(test, callback); } else { - this.runTest(test, null, callback); + (Zotero.setTimeout ? Zotero : window).setTimeout(function() { + this.runTest(test, null, callback); + }, 0); } (Zotero.setTimeout ? Zotero : window).setTimeout(function() { From ba103721fe08e10b35571227c6a7738013359789 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Tue, 16 Apr 2013 23:33:18 -0400 Subject: [PATCH 19/40] Fix typo in deca49c433053ffbe16c47717cc672c767e88aec --- chrome/content/zotero/tools/testTranslators/translatorTester.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/content/zotero/tools/testTranslators/translatorTester.js b/chrome/content/zotero/tools/testTranslators/translatorTester.js index 34f7251a3..ac4c6c499 100644 --- a/chrome/content/zotero/tools/testTranslators/translatorTester.js +++ b/chrome/content/zotero/tools/testTranslators/translatorTester.js @@ -335,7 +335,7 @@ Zotero_TranslatorTester.prototype._runTestsRecursively = function(testDoneCallba this.fetchPageAndRunTest(test, callback); } else { (Zotero.setTimeout ? Zotero : window).setTimeout(function() { - this.runTest(test, null, callback); + me.runTest(test, null, callback); }, 0); } From f42ded42c6340fb7074036a8b2052dc371c9e035 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Wed, 17 Apr 2013 01:11:44 -0400 Subject: [PATCH 20/40] Fix https://forums.zotero.org/discussion/28810/ --- chrome/content/zotero/xpcom/server_connector.js | 1 - 1 file changed, 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/server_connector.js b/chrome/content/zotero/xpcom/server_connector.js index 402426e7f..5e755155b 100644 --- a/chrome/content/zotero/xpcom/server_connector.js +++ b/chrome/content/zotero/xpcom/server_connector.js @@ -285,7 +285,6 @@ Zotero.Server.Connector.SavePage.prototype = { Zotero.Server.Connector.AttachmentProgressManager.onProgress(attachment, progress, error); }); translate.setHandler("itemsDone", function(obj, item) { - Zotero.Server.Connector.AttachmentProgressManager.add(item.attachments); Zotero.Browser.deleteHiddenBrowser(me._browser); if(jsonItems.length || me.selectedItems === false) { me.sendResponse(201, "application/json", JSON.stringify({"items":jsonItems})); From d154d7ed7f726a15ebce832d0e976eb60ca51048 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Wed, 17 Apr 2013 01:42:11 -0400 Subject: [PATCH 21/40] Remove -moz-border-radius (supplanted by border-radius) --- chrome/skin/default/zotero/integration.css | 2 -- chrome/skin/default/zotero/zotero.css | 1 - 2 files changed, 3 deletions(-) diff --git a/chrome/skin/default/zotero/integration.css b/chrome/skin/default/zotero/integration.css index ea6d2ba74..10d32a5f2 100644 --- a/chrome/skin/default/zotero/integration.css +++ b/chrome/skin/default/zotero/integration.css @@ -107,7 +107,6 @@ } .quick-format-bubble { - -moz-border-radius: 8px; border-radius: 8px; background-color: #dee7f8; border-style: solid; @@ -124,7 +123,6 @@ } .quick-format-bubble[selected="true"] { - -moz-border-radius: 8px !important; border-radius: 8px !important; background-color: #598bec; color: #fff; diff --git a/chrome/skin/default/zotero/zotero.css b/chrome/skin/default/zotero/zotero.css index 4900c63a7..e3ac5ad57 100644 --- a/chrome/skin/default/zotero/zotero.css +++ b/chrome/skin/default/zotero/zotero.css @@ -179,7 +179,6 @@ label.zotero-text-link { .zotero-clicky { - -moz-border-radius: 6px; border-radius: 6px; border: 1px solid transparent; } From d81e80168509135fb3502454851cd1c665e2f2a3 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Wed, 17 Apr 2013 02:00:07 -0400 Subject: [PATCH 22/40] Add about:memory button to Standalone --- chrome.manifest | 2 +- .../preferences_advanced_standalone.xul | 36 +++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 chrome/content/zotero/preferences/preferences_advanced_standalone.xul diff --git a/chrome.manifest b/chrome.manifest index d6ad9a764..f8b8f8493 100644 --- a/chrome.manifest +++ b/chrome.manifest @@ -47,7 +47,6 @@ locale zotero zh-TW chrome/locale/zh-TW/zotero/ skin zotero default chrome/skin/default/zotero/ -overlay chrome://browser/content/browser.xul chrome://zotero/content/statusBarOverlay.xul appversion<4.0 overlay chrome://browser/content/browser.xul chrome://zotero/content/overlay.xul overlay chrome://zotero/content/preferences/preferences.xul chrome://zotero/content/preferences/preferences_firefox.xul application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} @@ -55,6 +54,7 @@ overlay chrome://zotero/content/preferences/preferences.xul#cite chrome://zotero overlay chrome://zotero/content/preferences/preferences_general.xul chrome://zotero/content/preferences/preferences_general_firefox.xul application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} overlay chrome://zotero/content/preferences/preferences_export.xul chrome://zotero/content/preferences/preferences_export_firefox.xul application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} overlay chrome://zotero/content/preferences/preferences_advanced.xul chrome://zotero/content/preferences/preferences_advanced_firefox.xul application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} +overlay chrome://zotero/content/preferences/preferences_advanced.xul chrome://zotero/content/preferences/preferences_advanced_standalone.xul application=zotero@chnm.gmu.edu overlay chrome://mozapps/content/downloads/unknownContentType.xul chrome://zotero/content/downloadOverlay.xul diff --git a/chrome/content/zotero/preferences/preferences_advanced_standalone.xul b/chrome/content/zotero/preferences/preferences_advanced_standalone.xul new file mode 100644 index 000000000..ce9f45e5f --- /dev/null +++ b/chrome/content/zotero/preferences/preferences_advanced_standalone.xul @@ -0,0 +1,36 @@ + + + + + + + +