Fix first item drag of session

https://forums.zotero.org/discussion/35206/
This commit is contained in:
Dan Stillman 2014-03-02 05:22:58 -05:00
parent 015b37a85e
commit 5ddfdec584
2 changed files with 14 additions and 6 deletions

View file

@ -45,6 +45,18 @@ Zotero.Styles = new function() {
"csl":"http://purl.org/net/xbiblio/csl"
};
// TEMP
// Until we get asynchronous style loading, load renamed styles at startup, since the
// synchronous call we were using breaks the first drag of the session (on OS X, at least)
this.preinit = function () {
_renamedStyles = {};
Zotero.HTTP.promise("GET", "resource://zotero/schema/renamed-styles.json")
.then(function (xmlhttp) {
// Map some obsolete styles to current ones
_renamedStyles = JSON.parse(xmlhttp.responseText);
})
.done();
}
/**
* Initializes styles cache, loading metadata for styles into memory
@ -123,12 +135,7 @@ Zotero.Styles = new function() {
this.get = function(id, skipMappings) {
if(!_initialized) this.init();
// Map some obsolete styles to current ones
if(!_renamedStyles) {
_renamedStyles = JSON.parse(Zotero.File.getContentsFromURL(
"resource://zotero/schema/renamed-styles.json"
));
}
// TODO: With asynchronous style loading, move renamedStyles call back here
if(!skipMappings) {
var prefix = "http://www.zotero.org/styles/";

View file

@ -725,6 +725,7 @@ Components.utils.import("resource://gre/modules/Services.jsm");
}
// Initialize various services
Zotero.Styles.preinit();
Zotero.Integration.init();
if(Zotero.Prefs.get("httpServer.enabled")) {