From 4ea6f336f8e501c41f98f619e4155b808846bc41 Mon Sep 17 00:00:00 2001 From: chylex <info@chylex.com> Date: Wed, 5 Apr 2017 23:19:49 +0200 Subject: [PATCH] Fix debug plugin to simulate notifications more reliably --- Resources/Plugins/.debug/browser.js | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/Resources/Plugins/.debug/browser.js b/Resources/Plugins/.debug/browser.js index 7d336b97..35f8f7bb 100644 --- a/Resources/Plugins/.debug/browser.js +++ b/Resources/Plugins/.debug/browser.js @@ -18,30 +18,29 @@ enabled(){ // =================================== // N key - simulate popup notification + // S key - simulate sound notification // =================================== - if (e.keyCode === 78){ + if (e.keyCode === 78 || e.keyCode === 83){ var col = TD.controller.columnManager.getAllOrdered()[0]; - + + var prevPopup = col.model.getHasNotification(); + var prevSound = col.model.getHasSound(); + + col.model.setHasNotification(e.keyCode === 78); + col.model.setHasSound(e.keyCode === 83); + $.publish("/notifications/new",[{ column: col, items: [ col.updateArray[Math.floor(Math.random()*col.updateArray.length)] ] }]); - } - - // =================================== - // S key - simulate sound notification - // =================================== - - else if (e.keyCode === 83){ - if ($TDX.hasCustomNotificationSound){ - $TD.onTweetSound(); - } - else{ - document.getElementById("update-sound").play(); - } + + setTimeout(function(){ + col.model.setHasNotification(prevPopup); + col.model.setHasSound(prevSound); + }, 1); } } };