From 0757109c16307076ab53372f506007c3f16b7a08 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 30 Dec 2016 01:00:15 -0500 Subject: [PATCH] Allow direct install from styles page in viewer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When "Get Additional Styles…" is clicked, open a stripped-down version of the Zotero styles page in a window. When a style is clicked on, install it and close the window. I'm going to say that this closes #767, but as Aurimas notes there, if you know the style you're looking for, being able to just type the name in a dialog would be faster, so further improvements could be made. But as it stands, this is much better than clicking through to a browser (and hoping that it's one with the new connector with style installation support). --- .../zotero/preferences/preferences_cite.js | 14 ++++++++++++++ .../zotero/preferences/preferences_cite.xul | 4 +++- chrome/content/zotero/xpcom/mimeTypeHandler.js | 16 +++++++++++++++- 3 files changed, 32 insertions(+), 2 deletions(-) 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 @@ -