diff --git a/chrome/content/zotero/preferences/preferences_cite.js b/chrome/content/zotero/preferences/preferences_cite.js
index e48784100..ddb0ee574 100644
--- a/chrome/content/zotero/preferences/preferences_cite.js
+++ b/chrome/content/zotero/preferences/preferences_cite.js
@@ -90,6 +90,20 @@ Zotero_Preferences.Cite = {
}),
+ openStylesPage: function () {
+ Zotero.openInViewer("https://www.zotero.org/styles/", function (doc) {
+ // Hide header, intro paragraph, Link, and Source
+ //
+ // (The first two aren't sent to the client normally, but hide anyway in case they are.)
+ var style = doc.createElement('style');
+ style.type = 'text/css';
+ style.innerHTML = 'h1, #intro, .style-individual-link, .style-view-source { display: none !important; }';
+ Zotero.debug(doc.documentElement.innerHTML);
+ doc.getElementsByTagName('head')[0].appendChild(style);
+ });
+ },
+
+
/**
* Adds a new style to the style pane
**/
diff --git a/chrome/content/zotero/preferences/preferences_cite.xul b/chrome/content/zotero/preferences/preferences_cite.xul
index 1907458c0..233d0d91a 100644
--- a/chrome/content/zotero/preferences/preferences_cite.xul
+++ b/chrome/content/zotero/preferences/preferences_cite.xul
@@ -58,7 +58,9 @@
-
+
diff --git a/chrome/content/zotero/xpcom/mimeTypeHandler.js b/chrome/content/zotero/xpcom/mimeTypeHandler.js
index fbb219a89..3af578281 100644
--- a/chrome/content/zotero/xpcom/mimeTypeHandler.js
+++ b/chrome/content/zotero/xpcom/mimeTypeHandler.js
@@ -62,7 +62,21 @@ Zotero.MIMETypeHandler = new function () {
else this.unregisterMetadataHandlers();
}.bind(this));
- this.addHandler("application/vnd.citationstyles.style+xml", function(a1, a2) { Zotero.Styles.install(a1, a2) });
+ this.addHandler("application/vnd.citationstyles.style+xml", Zotero.Promise.coroutine(function* (a1, a2) {
+ let win = Services.wm.getMostRecentWindow("zotero:basicViewer");
+ try {
+ yield Zotero.Styles.install(a1, a2, true);
+ }
+ catch (e) {
+ Zotero.logError(e);
+ (new Zotero.Exception.Alert("styles.install.unexpectedError",
+ a2, "styles.install.title", e)).present();
+ }
+ // Close styles page in basic viewer after installing a style
+ if (win) {
+ win.close();
+ }
+ }));
this.addHandler("text/x-csl", function(a1, a2) { Zotero.Styles.install(a1, a2) }); // deprecated
this.addHandler("application/x-zotero-schema", Zotero.Schema.importSchema);
this.addHandler("application/x-zotero-settings", Zotero.Prefs.importSettings);