diff --git a/Core/FormBrowser.cs b/Core/FormBrowser.cs index 54744917..2351fecf 100644 --- a/Core/FormBrowser.cs +++ b/Core/FormBrowser.cs @@ -155,10 +155,6 @@ private void Browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){ ScriptLoader.ExecuteFile(e.Frame, "code.js"); ReinjectCustomCSS(Config.CustomBrowserCSS); - #if DEBUG - ScriptLoader.ExecuteFile(e.Frame, "debug.js"); - #endif - if (plugins.HasAnyPlugin(PluginEnvironment.Browser)){ ScriptLoader.ExecuteFile(e.Frame, PluginManager.PluginBrowserScriptFile); ScriptLoader.ExecuteFile(e.Frame, PluginManager.PluginGlobalScriptFile); diff --git a/Resources/Plugins/.debug/.meta b/Resources/Plugins/.debug/.meta index 967d3afa..31b4209b 100644 --- a/Resources/Plugins/.debug/.meta +++ b/Resources/Plugins/.debug/.meta @@ -2,13 +2,14 @@ Debug plugin [description] -- Runs several tests on startup, only included in debug configuration +- Enables debug functionality and tests +- Only included in debug configuration [author] chylex [version] -1.0 +1.1 [website] https://tweetduck.chylex.com \ No newline at end of file diff --git a/Resources/Plugins/.debug/browser.js b/Resources/Plugins/.debug/browser.js index 0e9640e9..7d336b97 100644 --- a/Resources/Plugins/.debug/browser.js +++ b/Resources/Plugins/.debug/browser.js @@ -1,3 +1,56 @@ enabled(){ + this.isDebugging = false; + this.onKeyDown = (e) => { + // ========================== + // F4 key - toggle debug mode + // ========================== + + if (e.keyCode === 115){ + this.isDebugging = !this.isDebugging; + $(".app-title").first().css("background-color", this.isDebugging ? "#5A6B75" : "#292F33"); + } + + // Debug mode handling + + else if (this.isDebugging){ + e.preventDefault(); + + // =================================== + // 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(); + } + } + } + }; +} + +ready(){ + $(document).on("keydown", this.onKeyDown); +} + +disabled(){ + $(document).off("keydown", this.onKeyDown); } diff --git a/Resources/Scripts/debug.js b/Resources/Scripts/debug.js deleted file mode 100644 index 1892feef..00000000 --- a/Resources/Scripts/debug.js +++ /dev/null @@ -1,49 +0,0 @@ -(function($, $TD, $TDX, TD){ - var isDebugging = false; - - $(document).keydown(function(e){ - - // ========================== - // F4 key - toggle debug mode - // ========================== - - 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]; - - $.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, $TDX, TD); diff --git a/_postbuild.bat b/_postbuild.bat index 3171ba1d..ff7c1a07 100644 --- a/_postbuild.bat +++ b/_postbuild.bat @@ -3,7 +3,6 @@ del "bin\x86\Release\*.pdb" del "bin\x86\Release\devtools_resources.pak" del "bin\x86\Release\d3dcompiler_43.dll" del "bin\x86\Release\widevinecdmadapter.dll" -del "bin\x86\Release\Scripts\debug.js" del "bin\x86\Release\TweetDuck.Browser.exe" ren "bin\x86\Release\CefSharp.BrowserSubprocess.exe" "TweetDuck.Browser.exe" \ No newline at end of file diff --git a/bld/gen_full.iss b/bld/gen_full.iss index 022d8a78..ac42e833 100644 --- a/bld/gen_full.iss +++ b/bld/gen_full.iss @@ -39,7 +39,7 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{ [Files] Source: "..\bin\x86\Release\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion -Source: "..\bin\x86\Release\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Excludes: "*.xml,*.pdb,devtools_resources.pak,d3dcompiler_43.dll,widevinecdmadapter.dll,debug.js" +Source: "..\bin\x86\Release\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Excludes: "*.xml,*.pdb,devtools_resources.pak,d3dcompiler_43.dll,widevinecdmadapter.dll" [Icons] Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Check: TDIsUninstallable diff --git a/bld/gen_port.iss b/bld/gen_port.iss index e9805f63..f133d65b 100644 --- a/bld/gen_port.iss +++ b/bld/gen_port.iss @@ -36,7 +36,7 @@ Name: "english"; MessagesFile: "compiler:Default.isl" [Files] Source: "..\bin\x86\Release\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion -Source: "..\bin\x86\Release\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Excludes: "*.xml,*.pdb,devtools_resources.pak,d3dcompiler_43.dll,widevinecdmadapter.dll,debug.js" +Source: "..\bin\x86\Release\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Excludes: "*.xml,*.pdb,devtools_resources.pak,d3dcompiler_43.dll,widevinecdmadapter.dll" [Run] Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall shellexec skipifsilent diff --git a/bld/gen_upd.iss b/bld/gen_upd.iss index 2ceb641b..4bd9179c 100644 --- a/bld/gen_upd.iss +++ b/bld/gen_upd.iss @@ -41,7 +41,7 @@ Name: "english"; MessagesFile: "compiler:Default.isl" [Files] Source: "..\bin\x86\Release\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion -Source: "..\bin\x86\Release\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Excludes: "*.xml,*.pdb,*.dll,*.pak,*.bin,*.dat,debug.js" +Source: "..\bin\x86\Release\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Excludes: "*.xml,*.pdb,*.dll,*.pak,*.bin,*.dat" [Icons] Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Check: TDIsUninstallable