From addd0ffa4bdc63cb03f3a498e5486b124731f020 Mon Sep 17 00:00:00 2001 From: ntoff Date: Sun, 12 Nov 2017 16:26:38 +1000 Subject: [PATCH] check for notifications and don't display if one is active check for high / low speed out of range popups and only display one, block popping up of multiple notifications for the same event --- octoprint_fanspeedslider/static/js/fanslider.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/octoprint_fanspeedslider/static/js/fanslider.js b/octoprint_fanspeedslider/static/js/fanslider.js index d6e0eff..6d0ebe1 100644 --- a/octoprint_fanspeedslider/static/js/fanslider.js +++ b/octoprint_fanspeedslider/static/js/fanslider.js @@ -40,16 +40,22 @@ $(function () { self.control.fanSpeed(self.control.minFanSpeed()); var options = { text: 'Fan speed increased to meet minimum requirement.', + addclass: 'fan_speed_notice_low', + } + if ($(".fan_speed_notice_low").length <1) { + self.showNotify(self, options); } - self.showNotify(self, options); } else if (self.control.fanSpeed() > self.control.maxFanSpeed()) { console.log("Fan Speed Control Plugin: " + self.control.fanSpeed() + "% is more than the maximum speed (" + self.control.maxFanSpeed() + "%), decreasing."); self.control.fanSpeed(self.control.maxFanSpeed()); var options = { text: 'Fan speed decreased to meet maximum requirement.', + addclass: 'fan_speed_notice_high', + } + if ($(".fan_speed_notice_high").length <1) { + self.showNotify(self, options); } - self.showNotify(self, options); } });