diff --git a/Resources/Scripts/debug.js b/Resources/Scripts/debug.js index b4005d1a..1892feef 100644 --- a/Resources/Scripts/debug.js +++ b/Resources/Scripts/debug.js @@ -1,19 +1,49 @@ -(function($, $TD, TD){ +(function($, $TD, $TDX, TD){ + var isDebugging = false; + $(document).keydown(function(e){ - // ============================== - // F4 key - simulate notification - // ============================== + // ========================== + // F4 key - toggle debug mode + // ========================== if (e.keyCode === 115){ - var col = TD.controller.columnManager.getAllOrdered()[0]; + isDebugging = !isDebugging; + $(".app-title").first().css("background-color", isDebugging ? "#5A6B75" : "#292F33"); + } + + // Debug mode handling + + else if (isDebugging){ + e.preventDefault(); - $.publish("/notifications/new",[{ - column: col, - items: [ - col.updateArray[Math.floor(Math.random()*col.updateArray.length)] - ] - }]); + // =================================== + // N key - simulate popup notification + // =================================== + + if (e.keyCode === 78){ + var col = TD.controller.columnManager.getAllOrdered()[0]; + + $.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(); + } + } } }); -})($, $TD, TD); +})($, $TD, $TDX, TD);