1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-05-31 17:34:14 +02:00

Improve debug script for easier extendibility, add sound notification simulation

This commit is contained in:
chylex 2017-01-27 21:48:57 +01:00
parent 5fd5a2a436
commit 028d5ed01f

View File

@ -1,11 +1,27 @@
(function($, $TD, TD){ (function($, $TD, $TDX, TD){
var isDebugging = false;
$(document).keydown(function(e){ $(document).keydown(function(e){
// ============================== // ==========================
// F4 key - simulate notification // F4 key - toggle debug mode
// ============================== // ==========================
if (e.keyCode === 115){ if (e.keyCode === 115){
isDebugging = !isDebugging;
$(".app-title").first().css("background-color", isDebugging ? "#5A6B75" : "#292F33");
}
// Debug mode handling
else if (isDebugging){
e.preventDefault();
// ===================================
// N key - simulate popup notification
// ===================================
if (e.keyCode === 78){
var col = TD.controller.columnManager.getAllOrdered()[0]; var col = TD.controller.columnManager.getAllOrdered()[0];
$.publish("/notifications/new",[{ $.publish("/notifications/new",[{
@ -15,5 +31,19 @@
] ]
}]); }]);
} }
// ===================================
// 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);