- 2-3x speedup getting field codes in MacWord
- show field retrieval time in integration output - activate Firefox before showing an error if the plug-in XPI is not installed
This commit is contained in:
parent
17c082db20
commit
76cab84373
|
@ -126,6 +126,7 @@ Zotero.Integration = new function() {
|
||||||
var application = Components.classes[componentClass]
|
var application = Components.classes[componentClass]
|
||||||
.getService(Components.interfaces.zoteroIntegrationApplication);
|
.getService(Components.interfaces.zoteroIntegrationApplication);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
|
Zotero.Integration.activate();
|
||||||
Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||||
.getService(Components.interfaces.nsIPromptService)
|
.getService(Components.interfaces.nsIPromptService)
|
||||||
.alert(null, Zotero.getString("integration.error.title"),
|
.alert(null, Zotero.getString("integration.error.title"),
|
||||||
|
@ -137,6 +138,7 @@ Zotero.Integration = new function() {
|
||||||
try {
|
try {
|
||||||
var integration = new Zotero.Integration.Document(application);
|
var integration = new Zotero.Integration.Document(application);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
|
Zotero.Integration.activate();
|
||||||
Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||||
.getService(Components.interfaces.nsIPromptService)
|
.getService(Components.interfaces.nsIPromptService)
|
||||||
.alert(null, Zotero.getString("integration.error.title"),
|
.alert(null, Zotero.getString("integration.error.title"),
|
||||||
|
@ -327,11 +329,14 @@ Zotero.Integration.Document.prototype._getFields = function(require) {
|
||||||
if(this._fields) return;
|
if(this._fields) return;
|
||||||
if(!this._session && !this._getSession(require, true)) return;
|
if(!this._session && !this._getSession(require, true)) return;
|
||||||
|
|
||||||
|
var getFieldsTime = (new Date()).getTime();
|
||||||
var fields = this._doc.getFields(this._session.data.prefs['fieldType']);
|
var fields = this._doc.getFields(this._session.data.prefs['fieldType']);
|
||||||
this._fields = [];
|
this._fields = [];
|
||||||
while(fields.hasMoreElements()) {
|
while(fields.hasMoreElements()) {
|
||||||
this._fields.push(fields.getNext().QueryInterface(Components.interfaces.zoteroIntegrationField));
|
this._fields.push(fields.getNext().QueryInterface(Components.interfaces.zoteroIntegrationField));
|
||||||
}
|
}
|
||||||
|
var endTime = (new Date()).getTime();;
|
||||||
|
Zotero.debug("Got "+this._fields.length+" fields in "+(endTime-getFieldsTime)/1000+"; "+1000/((endTime-getFieldsTime)/this._fields.length)+" fields/second");
|
||||||
|
|
||||||
if(require && !this._fields.length) {
|
if(require && !this._fields.length) {
|
||||||
throw new Zotero.Integration.DisplayException("mustInsertCitation");
|
throw new Zotero.Integration.DisplayException("mustInsertCitation");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user