From 17fea61997ceabfce61eab06c428075a0a51177b Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Mon, 23 Nov 2015 09:29:44 +0800 Subject: [PATCH] Allows preview while styles disabled, fix #226 --- components/stylishStyle.js | 6 +++--- content/edit.js | 2 +- content/install.xul | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/stylishStyle.js b/components/stylishStyle.js index 4c1389a..e25acdc 100644 --- a/components/stylishStyle.js +++ b/components/stylishStyle.js @@ -373,14 +373,14 @@ Style.prototype = { //no-op return; //if this style is enabled, then preview doesn't really have an effect atm - if (!this.enabled) { + this.previewOn = on; + if (!this.enabled || !this.stylishOn) { //if preview is being turned on, register the style if (on) this.register(); else this.unregister(); } - this.previewOn = on; }, //set the code back to the saved state @@ -695,7 +695,7 @@ Style.prototype = { }, register: function() { - if (!this.stylishOn) { + if (!this.stylishOn && !this.previewOn) { // Allow user to preview return; } var dataUrl = this.dataUrl; diff --git a/content/edit.js b/content/edit.js index 5de73c5..1af7c8b 100644 --- a/content/edit.js +++ b/content/edit.js @@ -151,7 +151,7 @@ function initStyle() { if (id) { style = service.find(id, service.CALCULATE_META | service.REGISTER_STYLE_ON_CHANGE); enableSave(false); - enablePreview(!style.enabled); + enablePreview(!style.enabled || !style.stylishOn); document.documentElement.setAttribute("windowtype", stylishCommon.getWindowName("stylishEdit", id)); } else { if (code == null) { diff --git a/content/install.xul b/content/install.xul index 696e57a..faed7a2 100644 --- a/content/install.xul +++ b/content/install.xul @@ -18,7 +18,7 @@ onload="init()" onunload="callCallback()" title="&title;" - ondialogaccept="return save(true)" + ondialogaccept="style.setPreview(false);return save(true)" ondialogextra1="preview();" ondialogcancel="style.setPreview(false)" buttonlabelaccept="&install;"