mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-09-14 01:32:10 +02:00
Compare commits
38 Commits
Author | SHA1 | Date | |
---|---|---|---|
ecbcbcaed4 | |||
1677b73ff8 | |||
5929067a3d | |||
d06834617b | |||
9d048efe06 | |||
6a379bc2cd | |||
9f415b11b5 | |||
b9b9193222 | |||
867c2d1632 | |||
5447afc3f5 | |||
b5e58db242 | |||
8ab99619d6 | |||
4c7660ee65 | |||
c1b9bde7b0 | |||
0e8c6c066f | |||
9e44a86be0 | |||
b61479f84f | |||
e3c709b005 | |||
b2b3dba504 | |||
4d05441aa8 | |||
419b3ee850 | |||
4c31e72d29 | |||
e3b2ff7f0e | |||
4c5f5e2cce | |||
39ae9b8ba0 | |||
5c7eb0535d | |||
235718390b | |||
5d4b72f224 | |||
dc76ae9d1f | |||
e44f4bb003 | |||
1fc1370d41 | |||
80a669c989 | |||
801c9eba2d | |||
f9704d2836 | |||
39687171e9 | |||
1d73691ef4 | |||
f8678d2515 | |||
fb108ea18d |
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using TweetDck.Core.Utils;
|
||||
using TweetDuck.Core.Utils;
|
||||
|
||||
namespace TweetDck.Configuration{
|
||||
namespace TweetDuck.Configuration{
|
||||
static class Arguments{
|
||||
// public args
|
||||
public const string ArgDataFolder = "-datafolder";
|
||||
@@ -12,6 +12,7 @@ namespace TweetDck.Configuration{
|
||||
// internal args
|
||||
public const string ArgRestart = "-restart";
|
||||
public const string ArgImportCookies = "-importcookies";
|
||||
public const string ArgUpdated = "-updated";
|
||||
|
||||
// class data and methods
|
||||
private static readonly CommandLineArgs Current = CommandLineArgs.FromStringArray('-', Environment.GetCommandLineArgs());
|
||||
@@ -28,7 +29,18 @@ namespace TweetDck.Configuration{
|
||||
CommandLineArgs args = Current.Clone();
|
||||
args.RemoveFlag(ArgRestart);
|
||||
args.RemoveFlag(ArgImportCookies);
|
||||
args.RemoveFlag(ArgUpdated);
|
||||
return args;
|
||||
}
|
||||
|
||||
public static CommandLineArgs GetCurrentForInstaller(){
|
||||
CommandLineArgs args = GetCurrentClean();
|
||||
args.AddFlag(ArgUpdated);
|
||||
return args;
|
||||
}
|
||||
|
||||
public static string GetCurrentForInstallerCmd(){
|
||||
return GetCurrentForInstaller().ToString().Replace("\"", "::");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -2,9 +2,9 @@
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using TweetDck.Core.Utils;
|
||||
using TweetDuck.Core.Utils;
|
||||
|
||||
namespace TweetDck.Configuration{
|
||||
namespace TweetDuck.Configuration{
|
||||
sealed class LockManager{
|
||||
public enum Result{
|
||||
Success, HasProcess, Fail
|
||||
|
66
Configuration/SystemConfig.cs
Normal file
66
Configuration/SystemConfig.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace TweetDuck.Configuration{
|
||||
sealed class SystemConfig{
|
||||
public static readonly bool IsHardwareAccelerationSupported = File.Exists(Path.Combine(Program.ProgramPath, "libEGL.dll")) &&
|
||||
File.Exists(Path.Combine(Program.ProgramPath, "libGLESv2.dll"));
|
||||
|
||||
public bool HardwareAcceleration{
|
||||
get => hardwareAcceleration && IsHardwareAccelerationSupported;
|
||||
set => hardwareAcceleration = value;
|
||||
}
|
||||
|
||||
private readonly string file;
|
||||
|
||||
private bool hardwareAcceleration;
|
||||
|
||||
private SystemConfig(string file){
|
||||
this.file = file;
|
||||
|
||||
HardwareAcceleration = true;
|
||||
}
|
||||
|
||||
private void WriteToStream(Stream stream){
|
||||
stream.WriteByte((byte)(HardwareAcceleration ? 1 : 0));
|
||||
}
|
||||
|
||||
private void ReadFromStream(Stream stream){
|
||||
HardwareAcceleration = stream.ReadByte() > 0;
|
||||
}
|
||||
|
||||
public bool Save(){
|
||||
try{
|
||||
string directory = Path.GetDirectoryName(file);
|
||||
if (directory == null)return false;
|
||||
|
||||
Directory.CreateDirectory(directory);
|
||||
|
||||
using(Stream stream = new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.None)){
|
||||
WriteToStream(stream);
|
||||
}
|
||||
|
||||
return true;
|
||||
}catch(Exception e){
|
||||
Program.Reporter.HandleException("Configuration Error", "Could not save the system configuration file.", true, e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static SystemConfig Load(string file){
|
||||
SystemConfig config = new SystemConfig(file);
|
||||
|
||||
try{
|
||||
using(Stream stream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read)){
|
||||
config.ReadFromStream(stream);
|
||||
}
|
||||
}catch(FileNotFoundException){
|
||||
}catch(DirectoryNotFoundException){
|
||||
}catch(Exception e){
|
||||
Program.Reporter.HandleException("Configuration Error", "Could not open the system configuration file. If you continue, you will lose system specific configuration such as Hardware Acceleration.", true, e);
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
}
|
||||
}
|
@@ -3,16 +3,22 @@ using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using TweetDck.Core;
|
||||
using TweetDck.Core.Controls;
|
||||
using TweetDck.Core.Notification;
|
||||
using TweetDck.Core.Utils;
|
||||
using TweetDck.Plugins;
|
||||
using TweetDuck.Core;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Notification;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Plugins;
|
||||
|
||||
namespace TweetDck.Configuration{
|
||||
namespace TweetDuck.Configuration{
|
||||
[Serializable]
|
||||
sealed class UserConfig{
|
||||
private static readonly IFormatter Formatter = new BinaryFormatter();
|
||||
private static readonly IFormatter Formatter = new BinaryFormatter{ Binder = new LegacyBinder() };
|
||||
|
||||
private class LegacyBinder : SerializationBinder{
|
||||
public override Type BindToType(string assemblyName, string typeName){
|
||||
return Type.GetType(string.Format("{0}, {1}", typeName.Replace("TweetDck", "TweetDuck"), assemblyName.Replace("TweetDck", "TweetDuck")));
|
||||
}
|
||||
}
|
||||
|
||||
private const int CurrentFileVersion = 9;
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using TweetDck.Core.Controls;
|
||||
using TweetDuck.Core.Controls;
|
||||
|
||||
namespace TweetDck.Core.Bridge{
|
||||
namespace TweetDuck.Core.Bridge{
|
||||
sealed class CallbackBridge{
|
||||
private readonly Control owner;
|
||||
private readonly Action safeCallback;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace TweetDck.Core.Bridge{
|
||||
namespace TweetDuck.Core.Bridge{
|
||||
static class PropertyBridge{
|
||||
[Flags]
|
||||
public enum Properties{
|
||||
|
@@ -1,9 +1,9 @@
|
||||
using System.Windows.Forms;
|
||||
using TweetDck.Core.Controls;
|
||||
using TweetDck.Core.Notification;
|
||||
using TweetDck.Core.Utils;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Notification;
|
||||
using TweetDuck.Core.Utils;
|
||||
|
||||
namespace TweetDck.Core.Bridge{
|
||||
namespace TweetDuck.Core.Bridge{
|
||||
sealed class TweetDeckBridge{
|
||||
public static string LastRightClickedLink = string.Empty;
|
||||
public static string LastHighlightedTweet = string.Empty;
|
||||
@@ -83,6 +83,10 @@ namespace TweetDck.Core.Bridge{
|
||||
form.InvokeAsyncSafe(WindowsUtils.ClipboardStripHtmlStyles);
|
||||
}
|
||||
|
||||
public int GetIdleSeconds(){
|
||||
return NativeMethods.GetIdleSeconds();
|
||||
}
|
||||
|
||||
public void OpenBrowser(string url){
|
||||
BrowserUtils.OpenExternalBrowser(url);
|
||||
}
|
||||
@@ -100,6 +104,13 @@ namespace TweetDck.Core.Bridge{
|
||||
MessageBox.Show(contents, Program.BrandName+" Browser Message", MessageBoxButtons.OK, icon);
|
||||
}
|
||||
|
||||
public void CrashDebug(string message){
|
||||
#if DEBUG
|
||||
Log(message);
|
||||
System.Diagnostics.Debugger.Break();
|
||||
#endif
|
||||
}
|
||||
|
||||
public void Log(string data){
|
||||
System.Diagnostics.Debug.WriteLine(data);
|
||||
}
|
||||
|
@@ -2,9 +2,9 @@
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using TweetDck.Core.Utils;
|
||||
using TweetDuck.Core.Utils;
|
||||
|
||||
namespace TweetDck.Core.Controls{
|
||||
namespace TweetDuck.Core.Controls{
|
||||
static class ControlExtensions{
|
||||
public static readonly Point InvisibleLocation = new Point(-32000, -32000);
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace TweetDck.Core.Controls{
|
||||
namespace TweetDuck.Core.Controls{
|
||||
class FlatButton : Button{
|
||||
protected override bool ShowFocusCues => false;
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace TweetDck.Core.Controls{
|
||||
namespace TweetDuck.Core.Controls{
|
||||
sealed class FlatProgressBar : ProgressBar{
|
||||
private readonly SolidBrush brush;
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace TweetDck.Core.Controls{
|
||||
namespace TweetDuck.Core.Controls{
|
||||
sealed class TabButton : FlatButton{
|
||||
public Action Callback { get; private set; }
|
||||
|
||||
|
2
Core/Controls/TabPanel.Designer.cs
generated
2
Core/Controls/TabPanel.Designer.cs
generated
@@ -1,4 +1,4 @@
|
||||
namespace TweetDck.Core.Controls {
|
||||
namespace TweetDuck.Core.Controls {
|
||||
partial class TabPanel {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
|
@@ -4,7 +4,7 @@ using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace TweetDck.Core.Controls{
|
||||
namespace TweetDuck.Core.Controls{
|
||||
sealed partial class TabPanel : UserControl{
|
||||
public Panel Content => panelContent;
|
||||
public IEnumerable<TabButton> Buttons => panelButtons.Controls.Cast<TabButton>();
|
||||
|
9
Core/FormBrowser.Designer.cs
generated
9
Core/FormBrowser.Designer.cs
generated
@@ -1,4 +1,4 @@
|
||||
namespace TweetDck.Core {
|
||||
namespace TweetDuck.Core {
|
||||
sealed partial class FormBrowser {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@@ -24,7 +24,7 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent() {
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.trayIcon = new TweetDck.Core.TrayIcon(this.components);
|
||||
this.trayIcon = new TweetDuck.Core.TrayIcon(this.components);
|
||||
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@@ -32,15 +32,16 @@
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = TweetDck.Core.Utils.BrowserUtils.BackgroundColor;
|
||||
this.BackColor = TweetDuck.Core.Utils.BrowserUtils.BackgroundColor;
|
||||
this.ClientSize = new System.Drawing.Size(324, 386);
|
||||
this.Icon = Properties.Resources.icon;
|
||||
this.Location = TweetDck.Core.Controls.ControlExtensions.InvisibleLocation;
|
||||
this.Location = TweetDuck.Core.Controls.ControlExtensions.InvisibleLocation;
|
||||
this.MinimumSize = new System.Drawing.Size(340, 424);
|
||||
this.Name = "FormBrowser";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
|
||||
this.Activated += new System.EventHandler(this.FormBrowser_Activated);
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormBrowser_FormClosing);
|
||||
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FormBrowser_FormClosed);
|
||||
this.ResizeEnd += new System.EventHandler(this.FormBrowser_ResizeEnd);
|
||||
this.Resize += new System.EventHandler(this.FormBrowser_Resize);
|
||||
this.ResumeLayout(false);
|
||||
|
@@ -5,23 +5,23 @@ using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using TweetDck.Configuration;
|
||||
using TweetDck.Core.Bridge;
|
||||
using TweetDck.Core.Controls;
|
||||
using TweetDck.Core.Handling;
|
||||
using TweetDck.Core.Notification;
|
||||
using TweetDck.Core.Notification.Screenshot;
|
||||
using TweetDck.Core.Notification.Sound;
|
||||
using TweetDck.Core.Other;
|
||||
using TweetDck.Core.Utils;
|
||||
using TweetDck.Plugins;
|
||||
using TweetDck.Plugins.Enums;
|
||||
using TweetDck.Plugins.Events;
|
||||
using TweetDck.Resources;
|
||||
using TweetDck.Updates;
|
||||
using TweetDck.Updates.Events;
|
||||
using TweetDuck.Configuration;
|
||||
using TweetDuck.Core.Bridge;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Handling;
|
||||
using TweetDuck.Core.Notification;
|
||||
using TweetDuck.Core.Notification.Screenshot;
|
||||
using TweetDuck.Core.Notification.Sound;
|
||||
using TweetDuck.Core.Other;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Plugins;
|
||||
using TweetDuck.Plugins.Enums;
|
||||
using TweetDuck.Plugins.Events;
|
||||
using TweetDuck.Resources;
|
||||
using TweetDuck.Updates;
|
||||
using TweetDuck.Updates.Events;
|
||||
|
||||
namespace TweetDck.Core{
|
||||
namespace TweetDuck.Core{
|
||||
sealed partial class FormBrowser : Form{
|
||||
private static UserConfig Config => Program.UserConfig;
|
||||
|
||||
@@ -64,7 +64,8 @@ namespace TweetDck.Core{
|
||||
this.browser = new ChromiumWebBrowser("https://tweetdeck.twitter.com/"){
|
||||
MenuHandler = new ContextMenuBrowser(this),
|
||||
JsDialogHandler = new JavaScriptDialogHandler(),
|
||||
LifeSpanHandler = new LifeSpanHandler()
|
||||
LifeSpanHandler = new LifeSpanHandler(),
|
||||
RequestHandler = new RequestHandlerBrowser()
|
||||
};
|
||||
|
||||
#if DEBUG
|
||||
@@ -247,6 +248,12 @@ namespace TweetDck.Core{
|
||||
}
|
||||
}
|
||||
|
||||
private void FormBrowser_FormClosed(object sender, FormClosedEventArgs e){
|
||||
if (isLoaded && UpdateInstallerPath == null){
|
||||
updates.CleanupDownload();
|
||||
}
|
||||
}
|
||||
|
||||
private void Config_MuteToggled(object sender, EventArgs e){
|
||||
UpdateProperties(PropertyBridge.Properties.MuteNotifications);
|
||||
}
|
||||
@@ -279,23 +286,19 @@ namespace TweetDck.Core{
|
||||
}
|
||||
|
||||
private void updates_UpdateAccepted(object sender, UpdateAcceptedEventArgs e){
|
||||
Hide();
|
||||
foreach(Form form in Application.OpenForms.Cast<Form>().Reverse()){
|
||||
if (form is FormSettings || form is FormPlugins || form is FormAbout){
|
||||
form.Close();
|
||||
}
|
||||
}
|
||||
|
||||
updates.BeginUpdateDownload(this, e.UpdateInfo, update => {
|
||||
if (update.DownloadStatus == UpdateDownloadStatus.Done){
|
||||
UpdateInstallerPath = update.InstallerPath;
|
||||
}
|
||||
|
||||
FormUpdateDownload downloadForm = new FormUpdateDownload(e.UpdateInfo);
|
||||
downloadForm.MoveToCenter(this);
|
||||
downloadForm.ShowDialog();
|
||||
downloadForm.Dispose();
|
||||
|
||||
if (downloadForm.UpdateStatus == FormUpdateDownload.Status.Succeeded){
|
||||
UpdateInstallerPath = downloadForm.InstallerPath;
|
||||
ForceClose();
|
||||
}
|
||||
else if (downloadForm.UpdateStatus == FormUpdateDownload.Status.Manual){
|
||||
ForceClose();
|
||||
}
|
||||
else{
|
||||
Show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void updates_UpdateDismissed(object sender, UpdateDismissedEventArgs e){
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using CefSharp;
|
||||
using System;
|
||||
|
||||
namespace TweetDck.Core.Handling{
|
||||
namespace TweetDuck.Core.Handling{
|
||||
class BrowserProcessHandler : IBrowserProcessHandler{
|
||||
void IBrowserProcessHandler.OnContextInitialized(){
|
||||
using(IRequestContext ctx = Cef.GetGlobalRequestContext()){
|
||||
|
@@ -3,13 +3,14 @@ using System;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
using TweetDck.Core.Bridge;
|
||||
using TweetDck.Core.Controls;
|
||||
using TweetDck.Core.Utils;
|
||||
using TweetDuck.Core.Bridge;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Utils;
|
||||
|
||||
namespace TweetDck.Core.Handling{
|
||||
namespace TweetDuck.Core.Handling{
|
||||
abstract class ContextMenuBase : IContextMenuHandler{
|
||||
private static readonly Regex RegexTwitterAccount = new Regex(@"^https?://twitter\.com/([^/]+)/?$", RegexOptions.Compiled);
|
||||
private static readonly Lazy<Regex> RegexTwitterAccount = new Lazy<Regex>(() => new Regex(@"^https?://twitter\.com/([^/]+)/?$", RegexOptions.Compiled), false);
|
||||
protected static readonly bool HasDevTools = File.Exists(Path.Combine(Program.ProgramPath, "devtools_resources.pak"));
|
||||
|
||||
private const int MenuOpenLinkUrl = 26500;
|
||||
private const int MenuCopyLinkUrl = 26501;
|
||||
@@ -17,15 +18,8 @@ namespace TweetDck.Core.Handling{
|
||||
private const int MenuOpenImage = 26503;
|
||||
private const int MenuSaveImage = 26504;
|
||||
private const int MenuCopyImageUrl = 26505;
|
||||
|
||||
#if DEBUG
|
||||
private const int MenuOpenDevTools = 26599;
|
||||
|
||||
protected void AddDebugMenuItems(IMenuModel model){
|
||||
model.AddItem((CefMenuCommand)MenuOpenDevTools, "Open dev tools");
|
||||
}
|
||||
#endif
|
||||
|
||||
private readonly Form form;
|
||||
|
||||
protected ContextMenuBase(Form form){
|
||||
@@ -34,7 +28,7 @@ namespace TweetDck.Core.Handling{
|
||||
|
||||
public virtual void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model){
|
||||
if (parameters.TypeFlags.HasFlag(ContextMenuType.Link) && !parameters.UnfilteredLinkUrl.EndsWith("tweetdeck.twitter.com/#", StringComparison.Ordinal)){
|
||||
if (RegexTwitterAccount.IsMatch(parameters.UnfilteredLinkUrl)){
|
||||
if (RegexTwitterAccount.Value.IsMatch(parameters.UnfilteredLinkUrl)){
|
||||
model.AddItem((CefMenuCommand)MenuOpenLinkUrl, "Open account in browser");
|
||||
model.AddItem((CefMenuCommand)MenuCopyLinkUrl, "Copy account address");
|
||||
model.AddItem((CefMenuCommand)MenuCopyUsername, "Copy account username");
|
||||
@@ -85,7 +79,7 @@ namespace TweetDck.Core.Handling{
|
||||
}
|
||||
|
||||
if (saveTarget != null){
|
||||
BrowserUtils.DownloadFileAsync(parameters.SourceUrl, saveTarget, ex => {
|
||||
BrowserUtils.DownloadFileAsync(parameters.SourceUrl, saveTarget, null, ex => {
|
||||
MessageBox.Show("An error occurred while downloading the image: "+ex.Message, Program.BrandName+" Has Failed :(", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
});
|
||||
}
|
||||
@@ -97,15 +91,13 @@ namespace TweetDck.Core.Handling{
|
||||
break;
|
||||
|
||||
case MenuCopyUsername:
|
||||
Match match = RegexTwitterAccount.Match(parameters.UnfilteredLinkUrl);
|
||||
Match match = RegexTwitterAccount.Value.Match(parameters.UnfilteredLinkUrl);
|
||||
SetClipboardText(match.Success ? match.Groups[1].Value : parameters.UnfilteredLinkUrl);
|
||||
break;
|
||||
|
||||
#if DEBUG
|
||||
|
||||
case MenuOpenDevTools:
|
||||
browserControl.ShowDevTools();
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -120,6 +112,10 @@ namespace TweetDck.Core.Handling{
|
||||
protected void SetClipboardText(string text){
|
||||
form.InvokeAsyncSafe(() => WindowsUtils.SetClipboard(text, TextDataFormat.UnicodeText));
|
||||
}
|
||||
|
||||
protected void AddDebugMenuItems(IMenuModel model){
|
||||
model.AddItem((CefMenuCommand)MenuOpenDevTools, "Open dev tools");
|
||||
}
|
||||
|
||||
protected static void RemoveSeparatorIfLast(IMenuModel model){
|
||||
if (model.Count > 0 && model.GetTypeAt(model.Count-1) == MenuItemType.Separator){
|
||||
|
@@ -1,10 +1,10 @@
|
||||
using CefSharp;
|
||||
using System.Windows.Forms;
|
||||
using TweetDck.Core.Bridge;
|
||||
using TweetDck.Core.Controls;
|
||||
using TweetDck.Core.Utils;
|
||||
using TweetDuck.Core.Bridge;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Utils;
|
||||
|
||||
namespace TweetDck.Core.Handling{
|
||||
namespace TweetDuck.Core.Handling{
|
||||
class ContextMenuBrowser : ContextMenuBase{
|
||||
private const int MenuGlobal = 26600;
|
||||
private const int MenuMute = 26601;
|
||||
@@ -82,10 +82,10 @@ namespace TweetDck.Core.Handling{
|
||||
globalMenu.AddItem((CefMenuCommand)MenuPlugins, TitlePlugins);
|
||||
globalMenu.AddItem((CefMenuCommand)MenuAbout, TitleAboutProgram);
|
||||
|
||||
#if DEBUG
|
||||
globalMenu.AddSeparator();
|
||||
AddDebugMenuItems(globalMenu);
|
||||
#endif
|
||||
if (HasDevTools){
|
||||
globalMenu.AddSeparator();
|
||||
AddDebugMenuItems(globalMenu);
|
||||
}
|
||||
}
|
||||
|
||||
RemoveSeparatorIfLast(model);
|
||||
|
@@ -1,8 +1,8 @@
|
||||
using CefSharp;
|
||||
using TweetDck.Core.Controls;
|
||||
using TweetDck.Core.Notification;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Notification;
|
||||
|
||||
namespace TweetDck.Core.Handling{
|
||||
namespace TweetDuck.Core.Handling{
|
||||
class ContextMenuNotification : ContextMenuBase{
|
||||
private const int MenuSkipTweet = 26600;
|
||||
private const int MenuFreeze = 26601;
|
||||
@@ -43,10 +43,10 @@ namespace TweetDck.Core.Handling{
|
||||
model.AddSeparator();
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
AddDebugMenuItems(model);
|
||||
#endif
|
||||
|
||||
if (HasDevTools){
|
||||
AddDebugMenuItems(model);
|
||||
}
|
||||
|
||||
RemoveSeparatorIfLast(model);
|
||||
|
||||
|
@@ -2,10 +2,10 @@
|
||||
using CefSharp.WinForms;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using TweetDck.Core.Controls;
|
||||
using TweetDck.Core.Other;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Other;
|
||||
|
||||
namespace TweetDck.Core.Handling {
|
||||
namespace TweetDuck.Core.Handling {
|
||||
class JavaScriptDialogHandler : IJsDialogHandler{
|
||||
bool IJsDialogHandler.OnJSDialog(IWebBrowser browserControl, IBrowser browser, string originUrl, CefJsDialogType dialogType, string messageText, string defaultPromptText, IJsDialogCallback callback, ref bool suppressMessage){
|
||||
((ChromiumWebBrowser)browserControl).InvokeSafe(() => {
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using CefSharp;
|
||||
using TweetDck.Core.Utils;
|
||||
using TweetDuck.Core.Utils;
|
||||
|
||||
namespace TweetDck.Core.Handling{
|
||||
namespace TweetDuck.Core.Handling{
|
||||
class LifeSpanHandler : ILifeSpanHandler{
|
||||
public bool OnBeforePopup(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, string targetFrameName, WindowOpenDisposition targetDisposition, bool userGesture, IPopupFeatures popupFeatures, IWindowInfo windowInfo, IBrowserSettings browserSettings, ref bool noJavascriptAccess, out IWebBrowser newBrowser){
|
||||
newBrowser = null;
|
||||
|
68
Core/Handling/RequestHandler.cs
Normal file
68
Core/Handling/RequestHandler.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using CefSharp;
|
||||
|
||||
namespace TweetDuck.Core.Handling{
|
||||
abstract class RequestHandler : IRequestHandler{
|
||||
// Browser
|
||||
|
||||
public virtual void OnRenderViewReady(IWebBrowser browserControl, IBrowser browser){}
|
||||
|
||||
public virtual void OnRenderProcessTerminated(IWebBrowser browserControl, IBrowser browser, CefTerminationStatus status){}
|
||||
|
||||
public virtual bool OnBeforeBrowse(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, bool isRedirect){
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool OnOpenUrlFromTab(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, WindowOpenDisposition targetDisposition, bool userGesture){
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool OnProtocolExecution(IWebBrowser browserControl, IBrowser browser, string url){
|
||||
return false;
|
||||
}
|
||||
|
||||
// Resources
|
||||
|
||||
public virtual CefReturnValue OnBeforeResourceLoad(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IRequestCallback callback){
|
||||
return CefReturnValue.Continue;
|
||||
}
|
||||
|
||||
public virtual void OnResourceRedirect(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response, ref string newUrl){}
|
||||
|
||||
public virtual bool OnResourceResponse(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response){
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual IResponseFilter GetResourceResponseFilter(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response){
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual void OnResourceLoadComplete(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response, UrlRequestStatus status, long receivedContentLength){}
|
||||
|
||||
// JavaScript & Plugins
|
||||
|
||||
public virtual bool OnQuotaRequest(IWebBrowser browserControl, IBrowser browser, string originUrl, long newSize, IRequestCallback callback){
|
||||
callback.Dispose();
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual void OnPluginCrashed(IWebBrowser browserControl, IBrowser browser, string pluginPath){}
|
||||
|
||||
// Auth
|
||||
|
||||
public virtual bool GetAuthCredentials(IWebBrowser browserControl, IBrowser browser, IFrame frame, bool isProxy, string host, int port, string realm, string scheme, IAuthCallback callback){
|
||||
callback.Dispose();
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool OnSelectClientCertificate(IWebBrowser browserControl, IBrowser browser, bool isProxy, string host, int port, X509Certificate2Collection certificates, ISelectClientCertificateCallback callback){
|
||||
callback.Dispose();
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool OnCertificateError(IWebBrowser browserControl, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback){
|
||||
callback.Dispose();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
9
Core/Handling/RequestHandlerBrowser.cs
Normal file
9
Core/Handling/RequestHandlerBrowser.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using CefSharp;
|
||||
|
||||
namespace TweetDuck.Core.Handling{
|
||||
class RequestHandlerBrowser : RequestHandler{
|
||||
public override void OnRenderProcessTerminated(IWebBrowser browserControl, IBrowser browser, CefTerminationStatus status){
|
||||
browser.Reload();
|
||||
}
|
||||
}
|
||||
}
|
@@ -3,7 +3,7 @@ using System.Collections.Specialized;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace TweetDck.Core.Handling{
|
||||
namespace TweetDuck.Core.Handling{
|
||||
class ResourceHandlerNotification : IResourceHandler{
|
||||
private readonly NameValueCollection headers = new NameValueCollection(0);
|
||||
private MemoryStream dataIn;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace TweetDck.Core.Notification {
|
||||
namespace TweetDuck.Core.Notification {
|
||||
partial class FormNotificationBase {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@@ -34,7 +34,7 @@
|
||||
this.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.ClientSize = new System.Drawing.Size(284, 122);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.Location = TweetDck.Core.Controls.ControlExtensions.InvisibleLocation;
|
||||
this.Location = TweetDuck.Core.Controls.ControlExtensions.InvisibleLocation;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "FormNotification";
|
||||
|
@@ -3,12 +3,12 @@ using CefSharp.WinForms;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using TweetDck.Configuration;
|
||||
using TweetDck.Core.Controls;
|
||||
using TweetDck.Core.Handling;
|
||||
using TweetDck.Core.Utils;
|
||||
using TweetDuck.Configuration;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Handling;
|
||||
using TweetDuck.Core.Utils;
|
||||
|
||||
namespace TweetDck.Core.Notification{
|
||||
namespace TweetDuck.Core.Notification{
|
||||
partial class FormNotificationBase : Form{
|
||||
protected Point PrimaryLocation{
|
||||
get{
|
||||
@@ -54,7 +54,14 @@ namespace TweetDck.Core.Notification{
|
||||
|
||||
public new Point Location{
|
||||
get => base.Location;
|
||||
set => Visible = (base.Location = value) != ControlExtensions.InvisibleLocation;
|
||||
|
||||
set{
|
||||
Visible = (base.Location = value) != ControlExtensions.InvisibleLocation;
|
||||
|
||||
if (WindowsUtils.ShouldAvoidToolWindow){
|
||||
FormBorderStyle = Visible ? FormBorderStyle.FixedSingle : FormBorderStyle.FixedToolWindow; // workaround for alt+tab
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Func<bool> CanMoveWindow = () => true;
|
||||
@@ -105,10 +112,6 @@ namespace TweetDck.Core.Notification{
|
||||
this.browser.Dispose();
|
||||
this.owner.FormClosed -= owner_FormClosed;
|
||||
};
|
||||
|
||||
if (WindowsUtils.ShouldAvoidToolWindow){
|
||||
FormBorderStyle = FormBorderStyle.FixedSingle;
|
||||
}
|
||||
|
||||
// ReSharper disable once VirtualMemberCallInContructor
|
||||
UpdateTitle();
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace TweetDck.Core.Notification {
|
||||
namespace TweetDuck.Core.Notification {
|
||||
partial class FormNotificationMain {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@@ -26,7 +26,7 @@
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.timerDisplayDelay = new System.Windows.Forms.Timer(this.components);
|
||||
this.timerProgress = new System.Windows.Forms.Timer(this.components);
|
||||
this.progressBarTimer = new TweetDck.Core.Controls.FlatProgressBar();
|
||||
this.progressBarTimer = new TweetDuck.Core.Controls.FlatProgressBar();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// timerDisplayDelay
|
||||
|
@@ -2,14 +2,14 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using TweetDck.Core.Bridge;
|
||||
using TweetDck.Core.Controls;
|
||||
using TweetDck.Core.Utils;
|
||||
using TweetDck.Plugins;
|
||||
using TweetDck.Plugins.Enums;
|
||||
using TweetDck.Resources;
|
||||
using TweetDuck.Core.Bridge;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Plugins;
|
||||
using TweetDuck.Plugins.Enums;
|
||||
using TweetDuck.Resources;
|
||||
|
||||
namespace TweetDck.Core.Notification{
|
||||
namespace TweetDuck.Core.Notification{
|
||||
partial class FormNotificationMain : FormNotificationBase{
|
||||
private const string NotificationScriptFile = "notification.js";
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace TweetDck.Core.Notification {
|
||||
namespace TweetDuck.Core.Notification {
|
||||
partial class FormNotificationTweet {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
|
@@ -1,11 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using TweetDck.Plugins;
|
||||
using TweetDuck.Plugins;
|
||||
using System.Windows.Forms;
|
||||
using TweetDck.Core.Utils;
|
||||
using TweetDuck.Core.Utils;
|
||||
|
||||
namespace TweetDck.Core.Notification{
|
||||
namespace TweetDuck.Core.Notification{
|
||||
sealed partial class FormNotificationTweet : FormNotificationMain{
|
||||
private const int NonIntrusiveIdleLimit = 30;
|
||||
private const int TrimMinimum = 32;
|
||||
|
@@ -2,11 +2,11 @@
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Windows.Forms;
|
||||
using TweetDck.Core.Bridge;
|
||||
using TweetDck.Core.Utils;
|
||||
using TweetDck.Resources;
|
||||
using TweetDuck.Core.Bridge;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Resources;
|
||||
|
||||
namespace TweetDck.Core.Notification.Screenshot{
|
||||
namespace TweetDuck.Core.Notification.Screenshot{
|
||||
sealed class FormNotificationScreenshotable : FormNotificationBase{
|
||||
public FormNotificationScreenshotable(Action callback, Form owner) : base(owner, false){
|
||||
browser.RegisterAsyncJsObject("$TD_NotificationScreenshot", new CallbackBridge(this, callback));
|
||||
|
@@ -3,9 +3,9 @@
|
||||
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using TweetDck.Core.Controls;
|
||||
using TweetDuck.Core.Controls;
|
||||
|
||||
namespace TweetDck.Core.Notification.Screenshot{
|
||||
namespace TweetDuck.Core.Notification.Screenshot{
|
||||
sealed class TweetScreenshotManager : IDisposable{
|
||||
private readonly Form owner;
|
||||
private readonly Timer timeout;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace TweetDck.Core.Notification.Sound{
|
||||
namespace TweetDuck.Core.Notification.Sound{
|
||||
interface ISoundNotificationPlayer : IDisposable{
|
||||
string SupportedFormats { get; }
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace TweetDck.Core.Notification.Sound{
|
||||
namespace TweetDuck.Core.Notification.Sound{
|
||||
sealed class PlaybackErrorEventArgs : EventArgs{
|
||||
public string Message { get; }
|
||||
public bool Ignore { get; set; }
|
||||
|
@@ -2,7 +2,7 @@
|
||||
using System.IO;
|
||||
using System.Media;
|
||||
|
||||
namespace TweetDck.Core.Notification.Sound{
|
||||
namespace TweetDuck.Core.Notification.Sound{
|
||||
sealed class SoundPlayerImplFallback : ISoundNotificationPlayer{
|
||||
string ISoundNotificationPlayer.SupportedFormats => "*.wav";
|
||||
|
||||
|
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using TweetDck.Core.Utils;
|
||||
using TweetDuck.Core.Utils;
|
||||
using WMPLib;
|
||||
|
||||
namespace TweetDck.Core.Notification.Sound{
|
||||
namespace TweetDuck.Core.Notification.Sound{
|
||||
sealed class SoundPlayerImplWMP : ISoundNotificationPlayer{
|
||||
string ISoundNotificationPlayer.SupportedFormats => "*.wav;*.mp3;*.mp2;*.m4a;*.mid;*.midi;*.rmi;*.wma;*.aif;*.aifc;*.aiff;*.snd;*.au";
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using TweetDck.Core.Notification.Sound;
|
||||
using TweetDuck.Core.Notification.Sound;
|
||||
|
||||
namespace TweetDck.Core.Notification{
|
||||
namespace TweetDuck.Core.Notification{
|
||||
static class SoundNotification{
|
||||
private static bool? IsWMPAvailable;
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using TweetDck.Resources;
|
||||
using TweetDuck.Resources;
|
||||
|
||||
namespace TweetDck.Core.Notification{
|
||||
namespace TweetDuck.Core.Notification{
|
||||
sealed class TweetNotification{
|
||||
private static string FontSizeClass { get; set; }
|
||||
private static string HeadTag { get; set; }
|
||||
@@ -51,24 +51,22 @@ namespace TweetDck.Core.Notification{
|
||||
TopLeft, TopRight, BottomLeft, BottomRight, Custom
|
||||
}
|
||||
|
||||
public string Column => column;
|
||||
public string TweetUrl => tweetUrl;
|
||||
public string QuoteUrl => quoteUrl;
|
||||
|
||||
private readonly string column;
|
||||
public string Column { get; }
|
||||
public string TweetUrl { get; }
|
||||
public string QuoteUrl { get; }
|
||||
|
||||
private readonly string html;
|
||||
private readonly int characters;
|
||||
private readonly string tweetUrl;
|
||||
private readonly string quoteUrl;
|
||||
private readonly bool isExample;
|
||||
|
||||
public TweetNotification(string column, string html, int characters, string tweetUrl, string quoteUrl) : this(column, html, characters, tweetUrl, quoteUrl, false){}
|
||||
|
||||
private TweetNotification(string column, string html, int characters, string tweetUrl, string quoteUrl, bool isExample){
|
||||
this.column = column;
|
||||
this.Column = column;
|
||||
this.TweetUrl = tweetUrl;
|
||||
this.QuoteUrl = quoteUrl;
|
||||
|
||||
this.html = html;
|
||||
this.tweetUrl = tweetUrl;
|
||||
this.quoteUrl = quoteUrl;
|
||||
this.characters = characters;
|
||||
this.isExample = isExample;
|
||||
}
|
||||
|
2
Core/Other/FormAbout.Designer.cs
generated
2
Core/Other/FormAbout.Designer.cs
generated
@@ -1,4 +1,4 @@
|
||||
namespace TweetDck.Core.Other {
|
||||
namespace TweetDuck.Core.Other {
|
||||
sealed partial class FormAbout {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using System.Windows.Forms;
|
||||
using TweetDck.Core.Utils;
|
||||
using TweetDuck.Core.Utils;
|
||||
|
||||
namespace TweetDck.Core.Other{
|
||||
namespace TweetDuck.Core.Other{
|
||||
sealed partial class FormAbout : Form{
|
||||
private const string TipsLink = "https://github.com/chylex/TweetDuck/wiki";
|
||||
private const string IssuesLink = "https://github.com/chylex/TweetDuck/issues";
|
||||
|
2
Core/Other/FormMessage.Designer.cs
generated
2
Core/Other/FormMessage.Designer.cs
generated
@@ -1,4 +1,4 @@
|
||||
namespace TweetDck.Core.Other {
|
||||
namespace TweetDuck.Core.Other {
|
||||
partial class FormMessage {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
|
@@ -2,7 +2,7 @@
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace TweetDck.Core.Other{
|
||||
namespace TweetDuck.Core.Other{
|
||||
sealed partial class FormMessage : Form{
|
||||
public Button ClickedButton { get; private set; }
|
||||
|
||||
|
8
Core/Other/FormPlugins.Designer.cs
generated
8
Core/Other/FormPlugins.Designer.cs
generated
@@ -1,4 +1,4 @@
|
||||
namespace TweetDck.Core.Other {
|
||||
namespace TweetDuck.Core.Other {
|
||||
partial class FormPlugins {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@@ -26,7 +26,7 @@
|
||||
this.btnClose = new System.Windows.Forms.Button();
|
||||
this.btnReload = new System.Windows.Forms.Button();
|
||||
this.btnOpenFolder = new System.Windows.Forms.Button();
|
||||
this.tabPanelPlugins = new TweetDck.Core.Controls.TabPanel();
|
||||
this.tabPanelPlugins = new TweetDuck.Core.Controls.TabPanel();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// btnClose
|
||||
@@ -87,7 +87,7 @@
|
||||
this.Controls.Add(this.btnOpenFolder);
|
||||
this.Controls.Add(this.btnReload);
|
||||
this.Controls.Add(this.btnClose);
|
||||
this.Icon = global::TweetDck.Properties.Resources.icon;
|
||||
this.Icon = global::TweetDuck.Properties.Resources.icon;
|
||||
this.MinimumSize = new System.Drawing.Size(480, 320);
|
||||
this.Name = "FormPlugins";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
@@ -101,6 +101,6 @@
|
||||
private System.Windows.Forms.Button btnClose;
|
||||
private System.Windows.Forms.Button btnReload;
|
||||
private System.Windows.Forms.Button btnOpenFolder;
|
||||
private TweetDck.Core.Controls.TabPanel tabPanelPlugins;
|
||||
private TweetDuck.Core.Controls.TabPanel tabPanelPlugins;
|
||||
}
|
||||
}
|
@@ -3,13 +3,13 @@ using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using TweetDck.Core.Controls;
|
||||
using TweetDck.Plugins;
|
||||
using TweetDck.Plugins.Controls;
|
||||
using TweetDck.Plugins.Enums;
|
||||
using TweetDck.Plugins.Events;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Plugins;
|
||||
using TweetDuck.Plugins.Controls;
|
||||
using TweetDuck.Plugins.Enums;
|
||||
using TweetDuck.Plugins.Events;
|
||||
|
||||
namespace TweetDck.Core.Other{
|
||||
namespace TweetDuck.Core.Other{
|
||||
sealed partial class FormPlugins : Form{
|
||||
private readonly PluginManager pluginManager;
|
||||
private readonly TabButton tabBtnOfficial, tabBtnCustom;
|
||||
|
6
Core/Other/FormSettings.Designer.cs
generated
6
Core/Other/FormSettings.Designer.cs
generated
@@ -1,4 +1,4 @@
|
||||
namespace TweetDck.Core.Other {
|
||||
namespace TweetDuck.Core.Other {
|
||||
sealed partial class FormSettings {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@@ -25,7 +25,7 @@
|
||||
private void InitializeComponent() {
|
||||
this.btnClose = new System.Windows.Forms.Button();
|
||||
this.labelTip = new System.Windows.Forms.Label();
|
||||
this.tabPanel = new TweetDck.Core.Controls.TabPanel();
|
||||
this.tabPanel = new TweetDuck.Core.Controls.TabPanel();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// btnClose
|
||||
@@ -70,7 +70,7 @@
|
||||
this.Controls.Add(this.btnClose);
|
||||
this.Controls.Add(this.tabPanel);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.Icon = global::TweetDck.Properties.Resources.icon;
|
||||
this.Icon = global::TweetDuck.Properties.Resources.icon;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "FormSettings";
|
||||
|
@@ -2,11 +2,11 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using TweetDck.Core.Other.Settings;
|
||||
using TweetDck.Plugins;
|
||||
using TweetDck.Updates;
|
||||
using TweetDuck.Core.Other.Settings;
|
||||
using TweetDuck.Plugins;
|
||||
using TweetDuck.Updates;
|
||||
|
||||
namespace TweetDck.Core.Other{
|
||||
namespace TweetDuck.Core.Other{
|
||||
sealed partial class FormSettings : Form{
|
||||
public const int TabIndexNotification = 1;
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using System.Windows.Forms;
|
||||
using TweetDck.Configuration;
|
||||
using TweetDuck.Configuration;
|
||||
|
||||
namespace TweetDck.Core.Other.Settings{
|
||||
namespace TweetDuck.Core.Other.Settings{
|
||||
class BaseTabSettings : UserControl{
|
||||
protected static UserConfig Config => Program.UserConfig;
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace TweetDck.Core.Other.Settings.Dialogs {
|
||||
namespace TweetDuck.Core.Other.Settings.Dialogs {
|
||||
partial class DialogSettingsCSS {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
|
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using TweetDck.Core.Controls;
|
||||
using TweetDck.Core.Utils;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Utils;
|
||||
|
||||
namespace TweetDck.Core.Other.Settings.Dialogs{
|
||||
namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
sealed partial class DialogSettingsCSS : Form{
|
||||
public string BrowserCSS => textBoxBrowserCSS.Text;
|
||||
public string NotificationCSS => textBoxNotificationCSS.Text;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace TweetDck.Core.Other.Settings.Dialogs {
|
||||
namespace TweetDuck.Core.Other.Settings.Dialogs {
|
||||
partial class DialogSettingsCefArgs {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
|
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using TweetDck.Core.Controls;
|
||||
using TweetDck.Core.Utils;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Utils;
|
||||
|
||||
namespace TweetDck.Core.Other.Settings.Dialogs{
|
||||
namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
sealed partial class DialogSettingsCefArgs : Form{
|
||||
public string CefArgs => textBoxArgs.Text;
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace TweetDck.Core.Other.Settings.Dialogs {
|
||||
namespace TweetDuck.Core.Other.Settings.Dialogs {
|
||||
partial class DialogSettingsExport {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
|
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using TweetDck.Core.Other.Settings.Export;
|
||||
using TweetDuck.Core.Other.Settings.Export;
|
||||
|
||||
namespace TweetDck.Core.Other.Settings.Dialogs{
|
||||
namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
sealed partial class DialogSettingsExport : Form{
|
||||
public static DialogSettingsExport Import(ExportFileFlags flags){
|
||||
return new DialogSettingsExport(flags);
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace TweetDck.Core.Other.Settings.Dialogs {
|
||||
namespace TweetDuck.Core.Other.Settings.Dialogs {
|
||||
partial class DialogSettingsRestart {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
|
@@ -2,10 +2,10 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using TweetDck.Configuration;
|
||||
using TweetDck.Core.Utils;
|
||||
using TweetDuck.Configuration;
|
||||
using TweetDuck.Core.Utils;
|
||||
|
||||
namespace TweetDck.Core.Other.Settings.Dialogs{
|
||||
namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
sealed partial class DialogSettingsRestart : Form{
|
||||
private const string DefaultLocale = "en-US";
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace TweetDck.Core.Other.Settings.Export{
|
||||
namespace TweetDuck.Core.Other.Settings.Export{
|
||||
class CombinedFileStream : IDisposable{
|
||||
public const char KeySeparator = '|';
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace TweetDck.Core.Other.Settings.Export{
|
||||
namespace TweetDuck.Core.Other.Settings.Export{
|
||||
[Flags]
|
||||
enum ExportFileFlags{
|
||||
None = 0,
|
||||
|
@@ -3,11 +3,11 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using TweetDck.Configuration;
|
||||
using TweetDck.Plugins;
|
||||
using TweetDck.Plugins.Enums;
|
||||
using TweetDuck.Configuration;
|
||||
using TweetDuck.Plugins;
|
||||
using TweetDuck.Plugins.Enums;
|
||||
|
||||
namespace TweetDck.Core.Other.Settings.Export{
|
||||
namespace TweetDuck.Core.Other.Settings.Export{
|
||||
sealed class ExportManager{
|
||||
private static readonly string CookiesPath = Path.Combine(Program.StoragePath, "Cookies");
|
||||
private static readonly string TempCookiesPath = Path.Combine(Program.StoragePath, "CookiesTmp");
|
||||
@@ -27,7 +27,7 @@ namespace TweetDck.Core.Other.Settings.Export{
|
||||
try{
|
||||
using(CombinedFileStream stream = new CombinedFileStream(new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.None))){
|
||||
if (flags.HasFlag(ExportFileFlags.Config)){
|
||||
stream.WriteFile("config", Program.ConfigFilePath);
|
||||
stream.WriteFile("config", Program.UserConfigFilePath);
|
||||
}
|
||||
|
||||
if (flags.HasFlag(ExportFileFlags.PluginData)){
|
||||
@@ -101,7 +101,7 @@ namespace TweetDck.Core.Other.Settings.Export{
|
||||
switch(entry.KeyName){
|
||||
case "config":
|
||||
if (flags.HasFlag(ExportFileFlags.Config)){
|
||||
entry.WriteToFile(Program.ConfigFilePath);
|
||||
entry.WriteToFile(Program.UserConfigFilePath);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace TweetDck.Core.Other.Settings {
|
||||
namespace TweetDuck.Core.Other.Settings {
|
||||
partial class TabSettingsAdvanced {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
|
@@ -1,14 +1,14 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
using TweetDck.Configuration;
|
||||
using TweetDck.Core.Controls;
|
||||
using TweetDck.Core.Other.Settings.Dialogs;
|
||||
using TweetDck.Core.Other.Settings.Export;
|
||||
using TweetDck.Core.Utils;
|
||||
using TweetDck.Plugins;
|
||||
using TweetDuck.Configuration;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Other.Settings.Dialogs;
|
||||
using TweetDuck.Core.Other.Settings.Export;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Plugins;
|
||||
|
||||
namespace TweetDck.Core.Other.Settings{
|
||||
namespace TweetDuck.Core.Other.Settings{
|
||||
partial class TabSettingsAdvanced : BaseTabSettings{
|
||||
private readonly Action<string> reinjectBrowserCSS;
|
||||
private readonly PluginManager plugins;
|
||||
@@ -19,7 +19,13 @@ namespace TweetDck.Core.Other.Settings{
|
||||
this.reinjectBrowserCSS = reinjectBrowserCSS;
|
||||
this.plugins = plugins;
|
||||
|
||||
checkHardwareAcceleration.Checked = HardwareAcceleration.IsEnabled;
|
||||
if (SystemConfig.IsHardwareAccelerationSupported){
|
||||
checkHardwareAcceleration.Checked = Program.SystemConfig.HardwareAcceleration;
|
||||
}
|
||||
else{
|
||||
checkHardwareAcceleration.Enabled = false;
|
||||
checkHardwareAcceleration.Checked = false;
|
||||
}
|
||||
|
||||
BrowserCache.CalculateCacheSize(bytes => this.InvokeSafe(() => {
|
||||
if (bytes == -1L){
|
||||
@@ -56,52 +62,54 @@ namespace TweetDck.Core.Other.Settings{
|
||||
}
|
||||
|
||||
private void checkHardwareAcceleration_CheckedChanged(object sender, EventArgs e){
|
||||
bool succeeded = false;
|
||||
|
||||
if (checkHardwareAcceleration.Checked){
|
||||
if (HardwareAcceleration.CanEnable){
|
||||
succeeded = HardwareAcceleration.Enable();
|
||||
}
|
||||
else{
|
||||
MessageBox.Show("Cannot enable hardware acceleration, the libraries libEGL.dll and libGLESv2.dll could not be restored.", Program.BrandName+" Settings", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
else{
|
||||
succeeded = HardwareAcceleration.Disable();
|
||||
}
|
||||
|
||||
if (succeeded){
|
||||
PromptRestart();
|
||||
}
|
||||
else{
|
||||
checkHardwareAcceleration.CheckedChanged -= checkHardwareAcceleration_CheckedChanged;
|
||||
checkHardwareAcceleration.Checked = HardwareAcceleration.IsEnabled;
|
||||
checkHardwareAcceleration.CheckedChanged += checkHardwareAcceleration_CheckedChanged;
|
||||
}
|
||||
Program.SystemConfig.HardwareAcceleration = checkHardwareAcceleration.Checked;
|
||||
Program.SystemConfig.Save();
|
||||
PromptRestart();
|
||||
}
|
||||
|
||||
private void btnEditCefArgs_Click(object sender, EventArgs e){
|
||||
DialogSettingsCefArgs form = new DialogSettingsCefArgs();
|
||||
|
||||
if (form.ShowDialog(ParentForm) == DialogResult.OK){
|
||||
Config.CustomCefArgs = form.CefArgs;
|
||||
form.Dispose();
|
||||
PromptRestart();
|
||||
}
|
||||
else{
|
||||
form.Dispose();
|
||||
}
|
||||
form.VisibleChanged += (sender2, args2) => {
|
||||
form.MoveToCenter(ParentForm);
|
||||
};
|
||||
|
||||
form.FormClosed += (sender2, args2) => {
|
||||
NativeMethods.SetFormDisabled(ParentForm, false);
|
||||
|
||||
if (form.DialogResult == DialogResult.OK){
|
||||
Config.CustomCefArgs = form.CefArgs;
|
||||
form.Dispose();
|
||||
PromptRestart();
|
||||
}
|
||||
else form.Dispose();
|
||||
};
|
||||
|
||||
form.Show(ParentForm);
|
||||
NativeMethods.SetFormDisabled(ParentForm, true);
|
||||
}
|
||||
|
||||
private void btnEditCSS_Click(object sender, EventArgs e){
|
||||
using(DialogSettingsCSS form = new DialogSettingsCSS(reinjectBrowserCSS)){
|
||||
if (form.ShowDialog(ParentForm) == DialogResult.OK){
|
||||
DialogSettingsCSS form = new DialogSettingsCSS(reinjectBrowserCSS);
|
||||
|
||||
form.VisibleChanged += (sender2, args2) => {
|
||||
form.MoveToCenter(ParentForm);
|
||||
};
|
||||
|
||||
form.FormClosed += (sender2, args2) => {
|
||||
NativeMethods.SetFormDisabled(ParentForm, false);
|
||||
|
||||
if (form.DialogResult == DialogResult.OK){
|
||||
Config.CustomBrowserCSS = form.BrowserCSS;
|
||||
Config.CustomNotificationCSS = form.NotificationCSS;
|
||||
}
|
||||
|
||||
reinjectBrowserCSS(Config.CustomBrowserCSS); // reinject on cancel too, because the CSS is updated while typing
|
||||
}
|
||||
form.Dispose();
|
||||
};
|
||||
|
||||
form.Show(ParentForm);
|
||||
NativeMethods.SetFormDisabled(ParentForm, true);
|
||||
}
|
||||
|
||||
private void btnExport_Click(object sender, EventArgs e){
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace TweetDck.Core.Other.Settings {
|
||||
namespace TweetDuck.Core.Other.Settings {
|
||||
partial class TabSettingsGeneral {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
|
@@ -1,10 +1,10 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using TweetDck.Core.Controls;
|
||||
using TweetDck.Updates;
|
||||
using TweetDck.Updates.Events;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Updates;
|
||||
using TweetDuck.Updates.Events;
|
||||
|
||||
namespace TweetDck.Core.Other.Settings{
|
||||
namespace TweetDuck.Core.Other.Settings{
|
||||
partial class TabSettingsGeneral : BaseTabSettings{
|
||||
private readonly UpdateHandler updates;
|
||||
private int updateCheckEventId = -1;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace TweetDck.Core.Other.Settings {
|
||||
namespace TweetDuck.Core.Other.Settings {
|
||||
partial class TabSettingsNotifications {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@@ -37,9 +37,9 @@
|
||||
this.trackBarEdgeDistance = new System.Windows.Forms.TrackBar();
|
||||
this.groupNotificationDuration = new System.Windows.Forms.GroupBox();
|
||||
this.tableLayoutDurationButtons = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.btnDurationMedium = new TweetDck.Core.Controls.FlatButton();
|
||||
this.btnDurationLong = new TweetDck.Core.Controls.FlatButton();
|
||||
this.btnDurationShort = new TweetDck.Core.Controls.FlatButton();
|
||||
this.btnDurationMedium = new TweetDuck.Core.Controls.FlatButton();
|
||||
this.btnDurationLong = new TweetDuck.Core.Controls.FlatButton();
|
||||
this.btnDurationShort = new TweetDuck.Core.Controls.FlatButton();
|
||||
this.labelDurationValue = new System.Windows.Forms.Label();
|
||||
this.trackBarDuration = new System.Windows.Forms.TrackBar();
|
||||
this.groupUserInterface = new System.Windows.Forms.GroupBox();
|
||||
@@ -440,9 +440,9 @@
|
||||
private System.Windows.Forms.Label labelDurationValue;
|
||||
private System.Windows.Forms.TrackBar trackBarDuration;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutDurationButtons;
|
||||
private TweetDck.Core.Controls.FlatButton btnDurationMedium;
|
||||
private TweetDck.Core.Controls.FlatButton btnDurationLong;
|
||||
private TweetDck.Core.Controls.FlatButton btnDurationShort;
|
||||
private TweetDuck.Core.Controls.FlatButton btnDurationMedium;
|
||||
private TweetDuck.Core.Controls.FlatButton btnDurationLong;
|
||||
private TweetDuck.Core.Controls.FlatButton btnDurationShort;
|
||||
private System.Windows.Forms.CheckBox checkNonIntrusive;
|
||||
private System.Windows.Forms.Label labelIdlePause;
|
||||
private System.Windows.Forms.ComboBox comboBoxIdlePause;
|
||||
|
@@ -1,10 +1,10 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Forms;
|
||||
using TweetDck.Core.Controls;
|
||||
using TweetDck.Core.Notification;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Notification;
|
||||
|
||||
namespace TweetDck.Core.Other.Settings{
|
||||
namespace TweetDuck.Core.Other.Settings{
|
||||
partial class TabSettingsNotifications : BaseTabSettings{
|
||||
private static readonly int[] IdlePauseSeconds = { 0, 30, 60, 120, 300 };
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace TweetDck.Core.Other.Settings {
|
||||
namespace TweetDuck.Core.Other.Settings {
|
||||
partial class TabSettingsSounds {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
|
@@ -2,10 +2,10 @@
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using TweetDck.Core.Notification;
|
||||
using TweetDck.Core.Notification.Sound;
|
||||
using TweetDuck.Core.Notification;
|
||||
using TweetDuck.Core.Notification.Sound;
|
||||
|
||||
namespace TweetDck.Core.Other.Settings{
|
||||
namespace TweetDuck.Core.Other.Settings{
|
||||
partial class TabSettingsSounds : BaseTabSettings{
|
||||
private readonly ISoundNotificationPlayer soundNotification;
|
||||
|
||||
|
2
Core/TrayIcon.Designer.cs
generated
2
Core/TrayIcon.Designer.cs
generated
@@ -1,4 +1,4 @@
|
||||
namespace TweetDck.Core {
|
||||
namespace TweetDuck.Core {
|
||||
partial class TrayIcon {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
|
@@ -2,7 +2,7 @@
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace TweetDck.Core{
|
||||
namespace TweetDuck.Core{
|
||||
partial class TrayIcon : Component{
|
||||
public enum Behavior{ // keep order
|
||||
Disabled, DisplayOnly, MinimizeToTray, CloseToTray, Combined
|
||||
|
@@ -4,7 +4,7 @@ using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System.Linq;
|
||||
|
||||
namespace TweetDck.Core.Utils{
|
||||
namespace TweetDuck.Core.Utils{
|
||||
static class BrowserCache{
|
||||
private static bool ClearOnExit { get; set; }
|
||||
|
||||
|
@@ -8,7 +8,7 @@ using System.Net;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace TweetDck.Core.Utils{
|
||||
namespace TweetDuck.Core.Utils{
|
||||
static class BrowserUtils{
|
||||
public static string HeaderAcceptLanguage{
|
||||
get{
|
||||
@@ -69,17 +69,28 @@ namespace TweetDck.Core.Utils{
|
||||
return ConvertPascalCaseToScreamingSnakeCase(Enum.GetName(typeof(CefErrorCode), code) ?? string.Empty);
|
||||
}
|
||||
|
||||
public static void DownloadFileAsync(string url, string target, Action<Exception> onFailure){
|
||||
public static WebClient DownloadFileAsync(string url, string target, Action onSuccess, Action<Exception> onFailure){
|
||||
WebClient client = new WebClient{ Proxy = null };
|
||||
client.Headers[HttpRequestHeader.UserAgent] = HeaderUserAgent;
|
||||
|
||||
client.DownloadFileCompleted += (sender, args) => {
|
||||
if (args.Error != null){
|
||||
onFailure(args.Error);
|
||||
if (args.Cancelled){
|
||||
try{
|
||||
File.Delete(target);
|
||||
}catch{
|
||||
// didn't want it deleted anyways
|
||||
}
|
||||
}
|
||||
else if (args.Error != null){
|
||||
onFailure?.Invoke(args.Error);
|
||||
}
|
||||
else{
|
||||
onSuccess?.Invoke();
|
||||
}
|
||||
};
|
||||
|
||||
client.DownloadFileAsync(new Uri(url), target);
|
||||
return client;
|
||||
}
|
||||
|
||||
public static void SetZoomLevel(IBrowser browser, int percentage){
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace TweetDck.Core.Utils{
|
||||
namespace TweetDuck.Core.Utils{
|
||||
class CommandLineArgs{
|
||||
public static CommandLineArgs FromStringArray(char entryChar, string[] array){
|
||||
CommandLineArgs args = new CommandLineArgs();
|
||||
|
@@ -1,11 +1,10 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace TweetDck.Core.Utils{
|
||||
namespace TweetDuck.Core.Utils{
|
||||
static class CommandLineArgsParser{
|
||||
private static Regex splitRegex;
|
||||
|
||||
private static Regex SplitRegex => splitRegex ?? (splitRegex = new Regex(@"([^=\s]+(?:=(?:[^ ]*""[^""]*?""[^ ]*|[^ ]*))?)", RegexOptions.Compiled));
|
||||
|
||||
private static readonly Lazy<Regex> SplitRegex = new Lazy<Regex>(() => new Regex(@"([^=\s]+(?:=(?:[^ ]*""[^""]*?""[^ ]*|[^ ]*))?)", RegexOptions.Compiled), false);
|
||||
|
||||
public static CommandLineArgs ReadCefArguments(string argumentString){
|
||||
CommandLineArgs args = new CommandLineArgs();
|
||||
|
||||
@@ -13,7 +12,7 @@ namespace TweetDck.Core.Utils{
|
||||
return args;
|
||||
}
|
||||
|
||||
foreach(Match match in SplitRegex.Matches(argumentString)){
|
||||
foreach(Match match in SplitRegex.Value.Matches(argumentString)){
|
||||
string matchValue = match.Value;
|
||||
|
||||
int indexEquals = matchValue.IndexOf('=');
|
||||
|
@@ -1,51 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace TweetDck.Core.Utils{
|
||||
static class HardwareAcceleration{
|
||||
private static readonly string LibEGL = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "libEGL.dll");
|
||||
private static readonly string LibGLES = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "libGLESv2.dll");
|
||||
|
||||
private static readonly string DisabledLibEGL = LibEGL+".bak";
|
||||
private static readonly string DisabledLibGLES = LibGLES+".bak";
|
||||
|
||||
public static bool IsEnabled => File.Exists(LibEGL) && File.Exists(LibGLES);
|
||||
public static bool CanEnable => File.Exists(DisabledLibEGL) && File.Exists(DisabledLibGLES);
|
||||
|
||||
public static bool Enable(){
|
||||
if (IsEnabled)return false;
|
||||
|
||||
try{
|
||||
File.Move(DisabledLibEGL, LibEGL);
|
||||
File.Move(DisabledLibGLES, LibGLES);
|
||||
return true;
|
||||
}catch{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool Disable(){
|
||||
if (!IsEnabled)return false;
|
||||
|
||||
try{
|
||||
if (File.Exists(DisabledLibEGL)){
|
||||
File.Delete(DisabledLibEGL);
|
||||
}
|
||||
|
||||
if (File.Exists(DisabledLibGLES)){
|
||||
File.Delete(DisabledLibGLES);
|
||||
}
|
||||
}catch{
|
||||
// woops
|
||||
}
|
||||
|
||||
try{
|
||||
File.Move(LibEGL, DisabledLibEGL);
|
||||
File.Move(LibGLES, DisabledLibGLES);
|
||||
return true;
|
||||
}catch{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace TweetDck.Core.Utils{
|
||||
namespace TweetDuck.Core.Utils{
|
||||
class InjectedHTML{
|
||||
public enum Position{
|
||||
Before, After
|
||||
|
@@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace TweetDck.Core.Utils{
|
||||
namespace TweetDuck.Core.Utils{
|
||||
static class NativeCoreAudio{
|
||||
private const int EDATAFLOW_RENDER = 0;
|
||||
private const int EROLE_MULTIMEDIA = 1;
|
||||
|
@@ -4,7 +4,7 @@ using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace TweetDck.Core.Utils{
|
||||
namespace TweetDuck.Core.Utils{
|
||||
[SuppressMessage("ReSharper", "FieldCanBeMadeReadOnly.Local")]
|
||||
[SuppressMessage("ReSharper", "MemberCanBePrivate.Local")]
|
||||
static class NativeMethods{
|
||||
@@ -13,6 +13,8 @@ namespace TweetDck.Core.Utils{
|
||||
|
||||
public const int HWND_TOPMOST = -1;
|
||||
public const uint SWP_NOACTIVATE = 0x0010;
|
||||
public const int WS_DISABLED = 0x08000000;
|
||||
public const int GWL_STYLE = -16;
|
||||
|
||||
public const int SB_HORZ = 0;
|
||||
public const int BCM_SETSHIELD = 0x160C;
|
||||
@@ -83,10 +85,25 @@ namespace TweetDck.Core.Utils{
|
||||
[DllImport("user32.dll")]
|
||||
public static extern IntPtr CallNextHookEx(IntPtr idHook, int nCode, IntPtr wParam, IntPtr lParam);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
|
||||
|
||||
public static void SetFormPos(Form form, int hWndOrder, uint flags){
|
||||
SetWindowPos(form.Handle.ToInt32(), hWndOrder, form.Left, form.Top, form.Width, form.Height, flags);
|
||||
}
|
||||
|
||||
public static void SetFormDisabled(Form form, bool disabled){
|
||||
if (disabled){
|
||||
SetWindowLong(form.Handle, GWL_STYLE, GetWindowLong(form.Handle, GWL_STYLE) | WS_DISABLED);
|
||||
}
|
||||
else{
|
||||
SetWindowLong(form.Handle, GWL_STYLE, GetWindowLong(form.Handle, GWL_STYLE) & ~WS_DISABLED);
|
||||
}
|
||||
}
|
||||
|
||||
public static int GetMouseHookData(IntPtr ptr){
|
||||
return Marshal.PtrToStructure<MSLLHOOKSTRUCT>(ptr).mouseData >> 16;
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace TweetDck.Core.Utils{
|
||||
namespace TweetDuck.Core.Utils{
|
||||
class TwoKeyDictionary<K1, K2, V>{
|
||||
private readonly Dictionary<K1, Dictionary<K2, V>> dict;
|
||||
private readonly int innerCapacity;
|
||||
|
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using TweetDck.Core.Controls;
|
||||
using TweetDuck.Core.Controls;
|
||||
|
||||
namespace TweetDck.Core.Utils{
|
||||
namespace TweetDuck.Core.Utils{
|
||||
[Serializable]
|
||||
class WindowState{
|
||||
private Rectangle rect;
|
||||
|
@@ -6,8 +6,11 @@ using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace TweetDck.Core.Utils{
|
||||
namespace TweetDuck.Core.Utils{
|
||||
static class WindowsUtils{
|
||||
private static readonly Lazy<Regex> RegexStripHtmlStyles = new Lazy<Regex>(() => new Regex(@"\s?(?:style|class)="".*?"""), false);
|
||||
private static readonly Lazy<Regex> RegexOffsetClipboardHtml = new Lazy<Regex>(() => new Regex(@"(?<=EndHTML:|EndFragment:)(\d+)"), false);
|
||||
|
||||
public static bool ShouldAvoidToolWindow { get; }
|
||||
|
||||
static WindowsUtils(){
|
||||
@@ -54,6 +57,21 @@ namespace TweetDck.Core.Utils{
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void TryDeleteFolderWhenAble(string path, int timeout){
|
||||
new Thread(() => {
|
||||
TrySleepUntil(() => {
|
||||
try{
|
||||
Directory.Delete(path, true);
|
||||
return true;
|
||||
}catch(DirectoryNotFoundException){
|
||||
return true;
|
||||
}catch{
|
||||
return false;
|
||||
}
|
||||
}, timeout, 500);
|
||||
}).Start();
|
||||
}
|
||||
|
||||
public static void ClipboardStripHtmlStyles(){
|
||||
if (!Clipboard.ContainsText(TextDataFormat.Html)){
|
||||
return;
|
||||
@@ -62,10 +80,10 @@ namespace TweetDck.Core.Utils{
|
||||
string originalText = Clipboard.GetText(TextDataFormat.UnicodeText);
|
||||
string originalHtml = Clipboard.GetText(TextDataFormat.Html);
|
||||
|
||||
string updatedHtml = ClipboardRegexes.RegexStripHtmlStyles.Replace(originalHtml, string.Empty);
|
||||
string updatedHtml = RegexStripHtmlStyles.Value.Replace(originalHtml, string.Empty);
|
||||
|
||||
int removed = originalHtml.Length-updatedHtml.Length;
|
||||
updatedHtml = ClipboardRegexes.RegexOffsetClipboardHtml.Replace(updatedHtml, match => (int.Parse(match.Value)-removed).ToString().PadLeft(match.Value.Length, '0'));
|
||||
updatedHtml = RegexOffsetClipboardHtml.Value.Replace(updatedHtml, match => (int.Parse(match.Value)-removed).ToString().PadLeft(match.Value.Length, '0'));
|
||||
|
||||
DataObject obj = new DataObject();
|
||||
obj.SetText(originalText, TextDataFormat.UnicodeText);
|
||||
@@ -90,10 +108,5 @@ namespace TweetDck.Core.Utils{
|
||||
Program.Reporter.HandleException("Clipboard Error", Program.BrandName+" could not access the clipboard as it is currently used by another process.", true, e);
|
||||
}
|
||||
}
|
||||
|
||||
private static class ClipboardRegexes{ // delays construction of regular expressions until needed
|
||||
public static readonly Regex RegexStripHtmlStyles = new Regex(@"\s?(?:style|class)="".*?""");
|
||||
public static readonly Regex RegexOffsetClipboardHtml = new Regex(@"(?<=EndHTML:|EndFragment:)(\d+)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
2
Plugins/Controls/PluginControl.Designer.cs
generated
2
Plugins/Controls/PluginControl.Designer.cs
generated
@@ -1,4 +1,4 @@
|
||||
namespace TweetDck.Plugins.Controls {
|
||||
namespace TweetDuck.Plugins.Controls {
|
||||
partial class PluginControl {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
|
@@ -3,9 +3,9 @@ using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using TweetDck.Core.Utils;
|
||||
using TweetDuck.Core.Utils;
|
||||
|
||||
namespace TweetDck.Plugins.Controls{
|
||||
namespace TweetDuck.Plugins.Controls{
|
||||
partial class PluginControl : UserControl{
|
||||
private readonly PluginManager pluginManager;
|
||||
private readonly Plugin plugin;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using System.Windows.Forms;
|
||||
using TweetDck.Core.Utils;
|
||||
using TweetDuck.Core.Utils;
|
||||
|
||||
namespace TweetDck.Plugins.Controls{
|
||||
namespace TweetDuck.Plugins.Controls{
|
||||
sealed class PluginListFlowLayout : FlowLayoutPanel{
|
||||
public PluginListFlowLayout(){
|
||||
FlowDirection = FlowDirection.TopDown;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TweetDck.Plugins.Enums{
|
||||
namespace TweetDuck.Plugins.Enums{
|
||||
[Flags]
|
||||
enum PluginEnvironment{
|
||||
None = 0,
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace TweetDck.Plugins.Enums{
|
||||
namespace TweetDuck.Plugins.Enums{
|
||||
enum PluginFolder{
|
||||
Root, Data
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace TweetDck.Plugins.Enums{
|
||||
namespace TweetDuck.Plugins.Enums{
|
||||
enum PluginGroup{
|
||||
Official, Custom
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace TweetDck.Plugins.Events{
|
||||
namespace TweetDuck.Plugins.Events{
|
||||
class PluginChangedStateEventArgs : EventArgs{
|
||||
public Plugin Plugin { get; }
|
||||
public bool IsEnabled { get; }
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TweetDck.Plugins.Events{
|
||||
namespace TweetDuck.Plugins.Events{
|
||||
class PluginErrorEventArgs : EventArgs{
|
||||
public bool HasErrors => Errors.Count > 0;
|
||||
|
||||
|
@@ -3,9 +3,9 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using TweetDck.Plugins.Enums;
|
||||
using TweetDuck.Plugins.Enums;
|
||||
|
||||
namespace TweetDck.Plugins{
|
||||
namespace TweetDuck.Plugins{
|
||||
class Plugin{
|
||||
public string Identifier { get; }
|
||||
public PluginGroup Group { get; }
|
||||
|
@@ -2,11 +2,11 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using TweetDck.Core.Utils;
|
||||
using TweetDck.Plugins.Enums;
|
||||
using TweetDck.Plugins.Events;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Plugins.Enums;
|
||||
using TweetDuck.Plugins.Events;
|
||||
|
||||
namespace TweetDck.Plugins{
|
||||
namespace TweetDuck.Plugins{
|
||||
class PluginBridge{
|
||||
private static string SanitizeCacheKey(string key){
|
||||
return key.Replace('\\', '/').Trim();
|
||||
|
@@ -2,9 +2,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using TweetDck.Plugins.Events;
|
||||
using TweetDuck.Plugins.Events;
|
||||
|
||||
namespace TweetDck.Plugins{
|
||||
namespace TweetDuck.Plugins{
|
||||
[Serializable]
|
||||
sealed class PluginConfig{
|
||||
[field:NonSerialized]
|
||||
|
@@ -3,11 +3,11 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using TweetDck.Plugins.Enums;
|
||||
using TweetDck.Plugins.Events;
|
||||
using TweetDck.Resources;
|
||||
using TweetDuck.Plugins.Enums;
|
||||
using TweetDuck.Plugins.Events;
|
||||
using TweetDuck.Resources;
|
||||
|
||||
namespace TweetDck.Plugins{
|
||||
namespace TweetDuck.Plugins{
|
||||
sealed class PluginManager{
|
||||
public const string PluginBrowserScriptFile = "plugins.browser.js";
|
||||
public const string PluginNotificationScriptFile = "plugins.notification.js";
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using System.Text;
|
||||
using TweetDck.Plugins.Enums;
|
||||
using TweetDuck.Plugins.Enums;
|
||||
|
||||
namespace TweetDck.Plugins{
|
||||
namespace TweetDuck.Plugins{
|
||||
static class PluginScriptGenerator{
|
||||
public static string GenerateConfig(PluginConfig config){
|
||||
return config.AnyDisabled ? "window.TD_PLUGINS.disabled = [\""+string.Join("\",\"", config.DisabledPlugins)+"\"];" : string.Empty;
|
||||
|
49
Program.cs
49
Program.cs
@@ -5,23 +5,23 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using TweetDck.Configuration;
|
||||
using TweetDck.Core;
|
||||
using TweetDck.Core.Handling;
|
||||
using TweetDck.Core.Other;
|
||||
using TweetDck.Core.Other.Settings.Export;
|
||||
using TweetDck.Core.Utils;
|
||||
using TweetDck.Plugins;
|
||||
using TweetDck.Plugins.Events;
|
||||
using TweetDck.Updates;
|
||||
using TweetDuck.Configuration;
|
||||
using TweetDuck.Core;
|
||||
using TweetDuck.Core.Handling;
|
||||
using TweetDuck.Core.Other;
|
||||
using TweetDuck.Core.Other.Settings.Export;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Plugins;
|
||||
using TweetDuck.Plugins.Events;
|
||||
using TweetDuck.Updates;
|
||||
|
||||
namespace TweetDck{
|
||||
namespace TweetDuck{
|
||||
static class Program{
|
||||
public const string BrandName = "TweetDuck";
|
||||
public const string Website = "https://tweetduck.chylex.com";
|
||||
|
||||
public const string VersionTag = "1.7.3";
|
||||
public const string VersionFull = "1.7.3.0";
|
||||
public const string VersionTag = "1.7.6";
|
||||
public const string VersionFull = "1.7.6.0";
|
||||
|
||||
public static readonly Version Version = new Version(VersionTag);
|
||||
public static readonly bool IsPortable = File.Exists("makeportable");
|
||||
@@ -29,11 +29,13 @@ namespace TweetDck{
|
||||
public static readonly string ProgramPath = AppDomain.CurrentDomain.BaseDirectory;
|
||||
public static readonly string StoragePath = IsPortable ? Path.Combine(ProgramPath, "portable", "storage") : GetDataStoragePath();
|
||||
|
||||
public static readonly string ConfigFilePath = Path.Combine(StoragePath, "TD_UserConfig.cfg");
|
||||
public static readonly string UserConfigFilePath = Path.Combine(StoragePath, "TD_UserConfig.cfg");
|
||||
public static readonly string SystemConfigFilePath = Path.Combine(StoragePath, "TD_SystemConfig.cfg");
|
||||
public static readonly string PluginDataPath = Path.Combine(StoragePath, "TD_Plugins");
|
||||
public static readonly string PluginConfigFilePath = Path.Combine(StoragePath, "TD_PluginConfig.cfg");
|
||||
private static readonly string ErrorLogFilePath = Path.Combine(StoragePath, "TD_Log.txt");
|
||||
private static readonly string ConsoleLogFilePath = Path.Combine(StoragePath, "TD_Console.txt");
|
||||
private static readonly string InstallerPath = Path.Combine(StoragePath, "TD_Updates");
|
||||
|
||||
public static readonly string ScriptPath = Path.Combine(ProgramPath, "scripts");
|
||||
public static readonly string PluginPath = Path.Combine(ProgramPath, "plugins");
|
||||
@@ -44,6 +46,7 @@ namespace TweetDck{
|
||||
private static bool HasCleanedUp;
|
||||
|
||||
public static UserConfig UserConfig { get; private set; }
|
||||
public static SystemConfig SystemConfig { get; private set; }
|
||||
public static Reporter Reporter { get; private set; }
|
||||
|
||||
public static event EventHandler UserConfigReplaced;
|
||||
@@ -122,10 +125,15 @@ namespace TweetDck{
|
||||
}
|
||||
|
||||
ReloadConfig();
|
||||
SystemConfig = SystemConfig.Load(SystemConfigFilePath);
|
||||
|
||||
if (Arguments.HasFlag(Arguments.ArgImportCookies)){
|
||||
ExportManager.ImportCookies();
|
||||
}
|
||||
|
||||
if (Arguments.HasFlag(Arguments.ArgUpdated)){
|
||||
WindowsUtils.TryDeleteFolderWhenAble(InstallerPath, 8000);
|
||||
}
|
||||
|
||||
CefSharpSettings.WcfEnabled = false;
|
||||
|
||||
@@ -133,17 +141,17 @@ namespace TweetDck{
|
||||
AcceptLanguageList = BrowserUtils.HeaderAcceptLanguage,
|
||||
UserAgent = BrowserUtils.HeaderUserAgent,
|
||||
Locale = Arguments.GetValue(Arguments.ArgLocale, string.Empty),
|
||||
BrowserSubprocessPath = BrandName+".Browser.exe",
|
||||
CachePath = StoragePath,
|
||||
LogFile = ConsoleLogFilePath,
|
||||
#if !DEBUG
|
||||
BrowserSubprocessPath = BrandName+".Browser.exe",
|
||||
LogSeverity = Arguments.HasFlag(Arguments.ArgLogging) ? LogSeverity.Info : LogSeverity.Disable
|
||||
#endif
|
||||
};
|
||||
|
||||
CommandLineArgsParser.ReadCefArguments(UserConfig.CustomCefArgs).ToDictionary(settings.CefCommandLineArgs);
|
||||
|
||||
if (!HardwareAcceleration.IsEnabled){
|
||||
if (!SystemConfig.HardwareAcceleration){
|
||||
settings.CefCommandLineArgs["disable-gpu"] = "1";
|
||||
settings.CefCommandLineArgs["disable-gpu-vsync"] = "1";
|
||||
}
|
||||
@@ -163,7 +171,8 @@ namespace TweetDck{
|
||||
|
||||
FormBrowser mainForm = new FormBrowser(plugins, new UpdaterSettings{
|
||||
AllowPreReleases = Arguments.HasFlag(Arguments.ArgDebugUpdates),
|
||||
DismissedUpdate = UserConfig.DismissedUpdate
|
||||
DismissedUpdate = UserConfig.DismissedUpdate,
|
||||
InstallerDownloadFolder = InstallerPath
|
||||
});
|
||||
|
||||
Application.Run(mainForm);
|
||||
@@ -172,7 +181,7 @@ namespace TweetDck{
|
||||
ExitCleanup();
|
||||
|
||||
// ProgramPath has a trailing backslash
|
||||
string updaterArgs = "/SP- /SILENT /CLOSEAPPLICATIONS /UPDATEPATH=\""+ProgramPath+"\" /RUNARGS=\""+Arguments.GetCurrentClean().ToString().Replace("\"", "^\"")+"\""+(IsPortable ? " /PORTABLE=1" : "");
|
||||
string updaterArgs = "/SP- /SILENT /CLOSEAPPLICATIONS /UPDATEPATH=\""+ProgramPath+"\" /RUNARGS=\""+Arguments.GetCurrentForInstallerCmd()+"\""+(IsPortable ? " /PORTABLE=1" : "");
|
||||
bool runElevated = !IsPortable || !WindowsUtils.CheckFolderWritePermission(ProgramPath);
|
||||
|
||||
WindowsUtils.StartProcess(mainForm.UpdateInstallerPath, updaterArgs, runElevated);
|
||||
@@ -213,14 +222,14 @@ namespace TweetDck{
|
||||
}
|
||||
|
||||
public static void ReloadConfig(){
|
||||
UserConfig = UserConfig.Load(ConfigFilePath);
|
||||
UserConfig = UserConfig.Load(UserConfigFilePath);
|
||||
UserConfigReplaced?.Invoke(UserConfig, new EventArgs());
|
||||
}
|
||||
|
||||
public static void ResetConfig(){
|
||||
try{
|
||||
File.Delete(ConfigFilePath);
|
||||
File.Delete(UserConfig.GetBackupFile(ConfigFilePath));
|
||||
File.Delete(UserConfigFilePath);
|
||||
File.Delete(UserConfig.GetBackupFile(UserConfigFilePath));
|
||||
}catch(Exception e){
|
||||
Reporter.HandleException("Configuration Reset Error", "Could not delete configuration files to reset the settings.", true, e);
|
||||
return;
|
||||
|
@@ -2,7 +2,7 @@
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Runtime.InteropServices;
|
||||
using TweetDck;
|
||||
using TweetDuck;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
@@ -37,7 +37,7 @@ using TweetDck;
|
||||
[assembly: AssemblyVersion(Program.VersionFull)]
|
||||
[assembly: AssemblyFileVersion(Program.VersionFull)]
|
||||
|
||||
[assembly: NeutralResourcesLanguageAttribute("en")]
|
||||
[assembly: NeutralResourcesLanguage("en")]
|
||||
|
||||
[assembly: CLSCompliant(false)]
|
||||
|
||||
|
9
Properties/Resources.Designer.cs
generated
9
Properties/Resources.Designer.cs
generated
@@ -8,9 +8,10 @@
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace TweetDck.Properties {
|
||||
|
||||
|
||||
namespace TweetDuck.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
@@ -38,7 +39,7 @@ namespace TweetDck.Properties {
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TweetDck.Properties.Resources", typeof(Resources).Assembly);
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TweetDuck.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
|
@@ -5,9 +5,9 @@ using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using TweetDck.Core.Other;
|
||||
using TweetDuck.Core.Other;
|
||||
|
||||
namespace TweetDck{
|
||||
namespace TweetDuck{
|
||||
class Reporter{
|
||||
private readonly string logFile;
|
||||
|
||||
|
@@ -16,6 +16,7 @@ enabled(){
|
||||
hideTweetActions: true,
|
||||
moveTweetActionsToRight: true,
|
||||
revertReplies: false,
|
||||
themeColorTweaks: true,
|
||||
roundedScrollBars: false,
|
||||
smallComposeTextSize: false,
|
||||
optimizeAnimations: true,
|
||||
@@ -200,6 +201,7 @@ enabled(){
|
||||
setTimeout(function(){
|
||||
TD.settings.setTheme($(this).attr("data-td-theme"));
|
||||
$(document).trigger("uiToggleTheme");
|
||||
me.reinjectAll();
|
||||
}, 1);
|
||||
});
|
||||
}).methods({
|
||||
@@ -228,6 +230,70 @@ enabled(){
|
||||
this.$pluginSettings.requiresPageReload = enable;
|
||||
};
|
||||
|
||||
// animation optimization
|
||||
this.optimizations = null;
|
||||
this.optimizationTimer = null;
|
||||
|
||||
let clearOptimizationTimer = () => {
|
||||
if (this.optimizationTimer){
|
||||
window.clearTimeout(this.optimizationTimer);
|
||||
this.optimizationTimer = null;
|
||||
}
|
||||
};
|
||||
|
||||
let runOptimizationTimer = timeout => {
|
||||
if (!this.optimizationTimer){
|
||||
this.optimizationTimer = window.setTimeout(optimizationTimerFunc, timeout);
|
||||
}
|
||||
};
|
||||
|
||||
let optimizationTimerFunc = () => {
|
||||
this.optimizationTimer = null;
|
||||
|
||||
if (this.config.optimizeAnimations){
|
||||
$TD.getIdleSeconds().then(s => {
|
||||
if (s >= 16){
|
||||
disableOptimizations();
|
||||
runOptimizationTimer(2500);
|
||||
}
|
||||
else{
|
||||
injectOptimizations();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
let injectOptimizations = force => {
|
||||
if (!this.optimizations && (force || document.hasFocus())){
|
||||
this.optimizations = window.TDPF_createCustomStyle(this);
|
||||
this.optimizations.insert(".app-content { will-change: transform }");
|
||||
this.optimizations.insert(".column-holder { will-change: transform }");
|
||||
}
|
||||
|
||||
clearOptimizationTimer();
|
||||
runOptimizationTimer(10000);
|
||||
};
|
||||
|
||||
let disableOptimizations = () => {
|
||||
if (this.optimizations){
|
||||
this.optimizations.remove();
|
||||
this.optimizations = null;
|
||||
}
|
||||
};
|
||||
|
||||
this.onWindowFocusEvent = () => {
|
||||
if (this.config.optimizeAnimations){
|
||||
injectOptimizations(true);
|
||||
}
|
||||
};
|
||||
|
||||
this.onWindowBlurEvent = () => {
|
||||
if (this.config.optimizeAnimations){
|
||||
disableOptimizations();
|
||||
clearOptimizationTimer();
|
||||
}
|
||||
};
|
||||
|
||||
// css and layout injection
|
||||
this.resetDesign = () => {
|
||||
if (this.css){
|
||||
@@ -240,12 +306,36 @@ enabled(){
|
||||
this.reinjectAll = () => {
|
||||
this.resetDesign();
|
||||
|
||||
clearOptimizationTimer();
|
||||
|
||||
if (this.config.optimizeAnimations){
|
||||
injectOptimizations();
|
||||
}
|
||||
else{
|
||||
disableOptimizations();
|
||||
}
|
||||
|
||||
this.css.insert("#general_settings .cf { display: none !important }");
|
||||
this.css.insert("#general_settings .divider-bar::after { display: inline-block; padding-top: 10px; line-height: 17px; content: 'Use the new | Edit layout & design | option in the Settings to modify TweetDeck theme, column width, font size, and other features.' }");
|
||||
|
||||
this.css.insert(".txt-base-smallest:not(.icon), .txt-base-largest:not(.icon) { font-size: "+this.config.fontSize+" !important }");
|
||||
this.css.insert(".avatar { border-radius: "+this.config.avatarRadius+"% !important }");
|
||||
|
||||
if (this.config.themeColorTweaks){
|
||||
switch(TD.settings.getTheme()){
|
||||
case "dark":
|
||||
this.css.insert(".app-content, .app-columns-container { background-color: #444448 }");
|
||||
this.css.insert(".column-drag-handle { opacity: 0.5 }");
|
||||
this.css.insert(".column-drag-handle:hover { opacity: 1 }");
|
||||
break;
|
||||
|
||||
case "light":
|
||||
this.css.insert(".scroll-styled-v::-webkit-scrollbar-thumb, .scroll-styled-h::-webkit-scrollbar-thumb { background-color: #d2d6da }");
|
||||
this.css.insert(".app-columns-container.scroll-styled-h::-webkit-scrollbar-thumb:not(:hover) { background-color: #a5aeb5 }");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.config.hideTweetActions){
|
||||
this.css.insert(".tweet-action { opacity: 0; }");
|
||||
this.css.insert(".is-favorite .tweet-action, .is-retweet .tweet-action { opacity: 0.5; visibility: visible !important }");
|
||||
@@ -269,11 +359,12 @@ enabled(){
|
||||
this.css.insert(".antiscroll-scrollbar { border-radius: 0 }");
|
||||
this.css.insert(".antiscroll-scrollbar-vertical { margin-top: 0 }");
|
||||
this.css.insert(".antiscroll-scrollbar-horizontal { margin-left: 0 }");
|
||||
this.css.insert(".app-columns-container::-webkit-scrollbar { height: 9px !important }");
|
||||
}
|
||||
|
||||
if (this.config.optimizeAnimations){
|
||||
this.css.insert(".app-content { will-change: transform }");
|
||||
this.css.insert(".column-holder { will-change: transform }");
|
||||
if (this.config.revertReplies){
|
||||
this.css.insert(".activity-header + .tweet .tweet-context { margin-left: -35px }");
|
||||
this.css.insert(".activity-header + .tweet .tweet-context .obj-left { margin-right: 5px }");
|
||||
}
|
||||
|
||||
if (this.config.columnWidth[0] === '/'){
|
||||
@@ -312,6 +403,7 @@ enabled(){
|
||||
"<style type='text/css'>",
|
||||
".txt-base-smallest:not(.icon), .txt-base-largest:not(.icon) { font-size: "+this.config.fontSize+" !important }",
|
||||
".avatar { border-radius: "+this.config.avatarRadius+"% !important }",
|
||||
(this.config.revertReplies ? ".activity-header + .tweet .tweet-context { margin-left: -35px } .activity-header + .tweet .tweet-context .obj-left { margin-right: 5px }" : ""),
|
||||
"</style>"
|
||||
].join(""));
|
||||
};
|
||||
@@ -339,6 +431,10 @@ ready(){
|
||||
|
||||
this.onAppReady();
|
||||
|
||||
// optimization events
|
||||
$(window).on("focus", this.onWindowFocusEvent);
|
||||
$(window).on("blur", this.onWindowBlurEvent);
|
||||
|
||||
// layout events
|
||||
$(document).on("uiShowActionsMenu", this.uiShowActionsMenuEvent);
|
||||
|
||||
@@ -352,7 +448,17 @@ disabled(){
|
||||
this.css.remove();
|
||||
}
|
||||
|
||||
if (this.optimizations){
|
||||
this.optimizations.remove();
|
||||
}
|
||||
|
||||
if (this.optimizationTimer){
|
||||
window.clearTimeout(this.optimizationTimer);
|
||||
}
|
||||
|
||||
$(document).off("uiShowActionsMenu", this.uiShowActionsMenuEvent);
|
||||
$(window).off("focus", this.onWindowFocusEvent);
|
||||
$(window).off("blur", this.onWindowBlurEvent);
|
||||
|
||||
$("[data-action='settings-menu']").off("click", this.onSettingsMenuClickedEvent);
|
||||
$("#td-design-plugin-modal").remove();
|
||||
|
@@ -61,6 +61,16 @@
|
||||
<option value="16px">Largest (16px)</option>
|
||||
<option value="custom">Custom</option>
|
||||
</select>
|
||||
|
||||
<!-- ADVANCED -->
|
||||
|
||||
<label class="txt-uppercase touch-larger-label">
|
||||
<b>Advanced</b>
|
||||
</label>
|
||||
<label class="checkbox">
|
||||
<input data-td-key="optimizeAnimations" class="js-theme-checkbox touch-larger-label" type="checkbox">
|
||||
Use more memory for smoother animations
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="l-column mdl-column">
|
||||
@@ -88,6 +98,10 @@
|
||||
<label class="txt-uppercase touch-larger-label">
|
||||
<b>Design</b>
|
||||
</label>
|
||||
<label class="checkbox">
|
||||
<input data-td-key="themeColorTweaks" class="js-theme-checkbox touch-larger-label" type="checkbox">
|
||||
Theme color tweaks
|
||||
</label>
|
||||
<label class="checkbox">
|
||||
<input data-td-key="roundedScrollBars" class="js-theme-checkbox touch-larger-label" type="checkbox">
|
||||
Rounded scroll bars
|
||||
@@ -96,16 +110,6 @@
|
||||
<input data-td-key="smallComposeTextSize" class="js-theme-checkbox touch-larger-label" type="checkbox">
|
||||
Small compose tweet font size
|
||||
</label>
|
||||
|
||||
<!-- ADVANCED -->
|
||||
|
||||
<label class="txt-uppercase touch-larger-label">
|
||||
<b>Advanced</b>
|
||||
</label>
|
||||
<label class="checkbox">
|
||||
<input data-td-key="optimizeAnimations" class="js-theme-checkbox touch-larger-label" type="checkbox">
|
||||
Optimize animations (uses more memory for smoother animations)
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="l-column mdl-column">
|
||||
@@ -153,7 +157,7 @@
|
||||
|
||||
.td-modal-panel {
|
||||
width: 693px;
|
||||
height: 374px;
|
||||
height: 380px;
|
||||
}
|
||||
|
||||
.td-modal-inner-cols {
|
||||
|
@@ -5,7 +5,7 @@ using System.IO;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace TweetDck.Resources{
|
||||
namespace TweetDuck.Resources{
|
||||
static class ScriptLoader{
|
||||
private const string UrlPrefix = "td:";
|
||||
|
||||
|
@@ -62,6 +62,22 @@
|
||||
};
|
||||
};
|
||||
|
||||
//
|
||||
// Function: Returns true if an object has a specified property, otherwise returns false without throwing an error.
|
||||
//
|
||||
var ensurePropertyExists = function(obj, ...chain){
|
||||
for(var index = 0; index < chain.length; index++){
|
||||
if (!obj.hasOwnProperty(chain[index])){
|
||||
$TD.crashDebug("Missing property "+chain[index]+" in chain [obj]."+chain.join("."));
|
||||
return false;
|
||||
}
|
||||
|
||||
obj = obj[chain[index]];
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
//
|
||||
// Function: Retrieves a property of an element with a specified class.
|
||||
//
|
||||
@@ -80,38 +96,76 @@
|
||||
//
|
||||
// Function: Event callback for a new tweet.
|
||||
//
|
||||
var onNewTweet = function(column, tweet){
|
||||
if (column.model.getHasNotification()){
|
||||
let html = $(tweet.render({
|
||||
withFooter: false,
|
||||
withTweetActions: false,
|
||||
withMediaPreview: true,
|
||||
isMediaPreviewOff: true,
|
||||
isMediaPreviewSmall: false,
|
||||
isMediaPreviewLarge: false
|
||||
}));
|
||||
|
||||
html.css("border", "0");
|
||||
html.find("footer").last().remove(); // apparently withTweetActions breaks for certain tweets, nice
|
||||
html.find(".js-media").last().remove(); // and quoted tweets still show media previews, nice nice
|
||||
html.find(".js-quote-detail").removeClass("is-actionable"); // prevent quoted tweets from changing the cursor
|
||||
|
||||
html.find("a[href='#']").each(function(){ // remove <a> tags around links that don't lead anywhere (such as account names the tweet replied to)
|
||||
this.outerHTML = this.innerHTML;
|
||||
});
|
||||
|
||||
let source = tweet.getRelatedTweet();
|
||||
let duration = source ? source.text.length+(source.quotedTweet ? source.quotedTweet.text.length : 0) : tweet.text.length;
|
||||
let tweetUrl = source ? source.getChirpURL() : "";
|
||||
let quoteUrl = source && source.quotedTweet ? source.quotedTweet.getChirpURL() : "";
|
||||
|
||||
$TD.onTweetPopup(columnTypes[column.getColumnType()] || "", html.html(), duration, tweetUrl, quoteUrl);
|
||||
}
|
||||
var onNewTweet = (function(){
|
||||
let recentTweets = new Set();
|
||||
let recentTweetTimer = null;
|
||||
|
||||
if (column.model.getHasSound()){
|
||||
$TD.onTweetSound();
|
||||
}
|
||||
};
|
||||
let startRecentTweetTimer = () => {
|
||||
if (recentTweetTimer){
|
||||
window.clearTimeout(recentTweetTimer);
|
||||
}
|
||||
|
||||
recentTweetTimer = window.setTimeout(() => {
|
||||
recentTweetTimer = null;
|
||||
recentTweets.clear();
|
||||
}, 10000);
|
||||
};
|
||||
|
||||
let checkRecentTweet = id => {
|
||||
if (recentTweets.size > 50){
|
||||
recentTweets.clear();
|
||||
}
|
||||
else if (recentTweets.has(id)){
|
||||
return true;
|
||||
}
|
||||
|
||||
recentTweets.add(id);
|
||||
startRecentTweetTimer();
|
||||
return false;
|
||||
};
|
||||
|
||||
return function(column, tweet){
|
||||
if (checkRecentTweet(tweet.id)){
|
||||
return;
|
||||
}
|
||||
|
||||
if (column.model.getHasNotification()){
|
||||
let html = $(tweet.render({
|
||||
withFooter: false,
|
||||
withTweetActions: false,
|
||||
withMediaPreview: true,
|
||||
isMediaPreviewOff: true,
|
||||
isMediaPreviewSmall: false,
|
||||
isMediaPreviewLarge: false
|
||||
}));
|
||||
|
||||
html.css("border", "0");
|
||||
html.find("footer").last().remove(); // apparently withTweetActions breaks for certain tweets, nice
|
||||
html.find(".js-media").last().remove(); // and quoted tweets still show media previews, nice nice
|
||||
html.find(".js-quote-detail").removeClass("is-actionable"); // prevent quoted tweets from changing the cursor
|
||||
|
||||
html.find("a[href='#']").each(function(){ // remove <a> tags around links that don't lead anywhere (such as account names the tweet replied to)
|
||||
this.outerHTML = this.innerHTML;
|
||||
});
|
||||
|
||||
if (tweet.getChirpType().includes("list_member")){
|
||||
html.find(".activity-header").first().css("margin-top", "2px");
|
||||
html.find(".avatar").first().css("margin-bottom", "0");
|
||||
}
|
||||
|
||||
let source = tweet.getRelatedTweet();
|
||||
let duration = source ? source.text.length+(source.quotedTweet ? source.quotedTweet.text.length : 0) : tweet.text.length;
|
||||
let tweetUrl = source ? source.getChirpURL() : "";
|
||||
let quoteUrl = source && source.quotedTweet ? source.quotedTweet.getChirpURL() : "";
|
||||
|
||||
$TD.onTweetPopup(columnTypes[column.getColumnType()] || "", html.html(), duration, tweetUrl, quoteUrl);
|
||||
}
|
||||
|
||||
if (column.model.getHasSound()){
|
||||
$TD.onTweetSound();
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
//
|
||||
// Function: Retrieves the tags to be put into <head> for notification HTML code.
|
||||
@@ -127,6 +181,8 @@
|
||||
tags.push("body { background: "+getClassStyleProperty("column", "background-color")+" }"); // set background color
|
||||
tags.push("a[data-full-url] { word-break: break-all }"); // break long urls
|
||||
tags.push(".txt-base-smallest .badge-verified:before { height: 13px !important }"); // fix cut off badge icon
|
||||
tags.push(".activity-header { align-items: center !important; margin-bottom: 4px }"); // tweak alignment of avatar and text in notifications
|
||||
tags.push(".activity-header .tweet-timestamp { line-height: unset }"); // fix timestamp position in notifications
|
||||
tags.push("</style>");
|
||||
|
||||
return tags.join("");
|
||||
@@ -148,13 +204,15 @@
|
||||
//
|
||||
// Block: Enable popup notifications.
|
||||
//
|
||||
TD.controller.notifications.hasNotifications = function(){
|
||||
return true;
|
||||
};
|
||||
if (ensurePropertyExists(TD, "controller", "notifications")){
|
||||
TD.controller.notifications.hasNotifications = function(){
|
||||
return true;
|
||||
};
|
||||
|
||||
TD.controller.notifications.isPermissionGranted = function(){
|
||||
return true;
|
||||
};
|
||||
TD.controller.notifications.isPermissionGranted = function(){
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
$.subscribe("/notifications/new", function(obj){
|
||||
for(let index = obj.items.length-1; index >= 0; index--){
|
||||
@@ -498,6 +556,10 @@
|
||||
}
|
||||
});
|
||||
|
||||
if (!ensurePropertyExists(TD, "vo", "Column", "prototype", "clear")){
|
||||
return;
|
||||
}
|
||||
|
||||
TD.vo.Column.prototype.clear = prependToFunction(TD.vo.Column.prototype.clear, function(){
|
||||
window.setTimeout(resetActiveFocus, 0); // unfocuses the Clear button, otherwise it steals keyboard input
|
||||
|
||||
@@ -520,7 +582,11 @@
|
||||
};
|
||||
|
||||
$(".js-drawer[data-drawer='compose']").delegate(".js-account-list > .js-account-item", "click", toggleEventShiftKey);
|
||||
|
||||
|
||||
if (!ensurePropertyExists(TD, "components", "AccountSelector", "prototype", "refreshPostingAccounts")){
|
||||
return;
|
||||
}
|
||||
|
||||
TD.components.AccountSelector.prototype.refreshPostingAccounts = appendToFunction(TD.components.AccountSelector.prototype.refreshPostingAccounts, function(){
|
||||
if (!this.$node.attr("td-account-selector-hook")){
|
||||
this.$node.attr("td-account-selector-hook", "1");
|
||||
@@ -548,18 +614,18 @@
|
||||
styleOfficial.sheet.insertRule(".txt-base-smallest .sprite-verified-mini { width: 13px !important; height: 13px !important; background-position: -223px -99px !important; }", 0); // fix cut off badge icon when zoomed in
|
||||
styleOfficial.sheet.insertRule(".keyboard-shortcut-list { vertical-align: top; }", 0); // fix keyboard navigation alignment
|
||||
styleOfficial.sheet.insertRule(".sprite-logo { background-position: -5px -46px !important; }", 0); // fix TweetDeck logo on certain zoom levels
|
||||
styleOfficial.sheet.insertRule(".app-columns-container::-webkit-scrollbar-track { border-left: 0 }", 0); // remove weird border in the column container scrollbar
|
||||
styleOfficial.sheet.insertRule(".app-navigator .tooltip { display: none !important }", 0); // hide broken tooltips in the menu
|
||||
styleOfficial.sheet.insertRule(".account-inline .username { vertical-align: 10% }", 0); // move usernames a bit higher
|
||||
styleOfficial.sheet.insertRule(".app-navigator .tooltip { display: none !important; }", 0); // hide broken tooltips in the menu
|
||||
styleOfficial.sheet.insertRule(".account-inline .username { vertical-align: 10%; }", 0); // move usernames a bit higher
|
||||
|
||||
styleOfficial.sheet.insertRule(".js-accounts-column-holder { bottom: 4px; }", 0); // fix white bar on the bottom
|
||||
styleOfficial.sheet.insertRule(".drawer[data-drawer='accountSettings'] { background-color: #ccd6dd; }", 0); // fix white bar on the bottom
|
||||
styleOfficial.sheet.insertRule(".activity-header { align-items: center !important; margin-bottom: 4px; }", 0); // tweak alignment of avatar and text in notifications
|
||||
styleOfficial.sheet.insertRule(".activity-header .tweet-timestamp { line-height: unset }", 0); // fix timestamp position in notifications
|
||||
|
||||
styleOfficial.sheet.insertRule(".app-columns-container::-webkit-scrollbar-track { border-left: 0; }", 0); // remove weird border in the column container scrollbar
|
||||
styleOfficial.sheet.insertRule(".app-columns-container { bottom: 0 !important; }", 0); // move column container scrollbar to bottom to fit updated style
|
||||
|
||||
styleOfficial.sheet.insertRule(".is-video a:not([href*='youtu']), .is-gif .js-media-gif-container { cursor: alias; }", 0); // change cursor on unsupported videos
|
||||
styleOfficial.sheet.insertRule(".is-video a:not([href*='youtu']) .icon-bg-dot, .is-gif .icon-bg-dot { color: #bd3d37; }", 0); // change play icon color on unsupported videos
|
||||
|
||||
TD.services.TwitterActionRetweetedRetweet.prototype.iconClass = "icon-retweet icon-retweet-color txt-base-medium"; // fix retweet icon mismatch
|
||||
|
||||
window.TDGF_reinjectCustomCSS = function(styles){
|
||||
$("#tweetduck-custom-css").remove();
|
||||
|
||||
@@ -575,6 +641,10 @@
|
||||
(function(){
|
||||
var cancelModal = false;
|
||||
|
||||
if (!ensurePropertyExists(TD, "components", "MediaGallery", "prototype", "_loadTweet") ||
|
||||
!ensurePropertyExists(TD, "components", "BaseModal", "prototype", "setAndShowContainer") ||
|
||||
!ensurePropertyExists(TD, "ui", "Column", "prototype", "playGifIfNotManuallyPaused"))return;
|
||||
|
||||
TD.components.MediaGallery.prototype._loadTweet = appendToFunction(TD.components.MediaGallery.prototype._loadTweet, function(){
|
||||
var media = this.chirp.getMedia().find(media => media.mediaId === this.clickedMediaEntityId);
|
||||
|
||||
@@ -606,27 +676,53 @@
|
||||
//
|
||||
// Block: Fix youtu.be previews not showing up for https links.
|
||||
//
|
||||
TD.services.TwitterMedia.YOUTUBE_TINY_RE = new RegExp(TD.services.TwitterMedia.YOUTUBE_TINY_RE.source.replace("http:", "https?:"));
|
||||
TD.services.TwitterMedia.YOUTUBE_RE = new RegExp(TD.services.TwitterMedia.YOUTUBE_LONG_RE.source+"|"+TD.services.TwitterMedia.YOUTUBE_TINY_RE.source);
|
||||
TD.services.TwitterMedia.SERVICES["youtube"] = TD.services.TwitterMedia.YOUTUBE_RE;
|
||||
if (ensurePropertyExists(TD, "services", "TwitterMedia")){
|
||||
var media = TD.services.TwitterMedia;
|
||||
|
||||
if (!ensurePropertyExists(media, "YOUTUBE_TINY_RE") ||
|
||||
!ensurePropertyExists(media, "YOUTUBE_LONG_RE") ||
|
||||
!ensurePropertyExists(media, "YOUTUBE_RE") ||
|
||||
!ensurePropertyExists(media, "SERVICES", "youtube"))return;
|
||||
|
||||
media.YOUTUBE_TINY_RE = new RegExp(media.YOUTUBE_TINY_RE.source.replace("http:", "https?:"));
|
||||
media.YOUTUBE_RE = new RegExp(media.YOUTUBE_LONG_RE.source+"|"+media.YOUTUBE_TINY_RE.source);
|
||||
media.SERVICES["youtube"] = media.YOUTUBE_RE;
|
||||
}
|
||||
|
||||
//
|
||||
// Block: Fix DM reply input box not getting focused after opening a conversation.
|
||||
//
|
||||
TD.components.ConversationDetailView.prototype.showChirp = appendToFunction(TD.components.ConversationDetailView.prototype.showChirp, function(){
|
||||
setTimeout(function(){
|
||||
$(".js-reply-tweetbox").first().focus();
|
||||
}, 100);
|
||||
});
|
||||
if (ensurePropertyExists(TD, "components", "ConversationDetailView", "prototype", "showChirp")){
|
||||
TD.components.ConversationDetailView.prototype.showChirp = appendToFunction(TD.components.ConversationDetailView.prototype.showChirp, function(){
|
||||
setTimeout(function(){
|
||||
$(".js-reply-tweetbox").first().focus();
|
||||
}, 100);
|
||||
});
|
||||
}
|
||||
|
||||
//
|
||||
// Block: Fix DM notifications not showing if the conversation is open.
|
||||
//
|
||||
if (ensurePropertyExists(TD, "services", "TwitterConversation", "prototype", "getUnreadChirps")){
|
||||
var prevFunc = TD.services.TwitterConversation.prototype.getUnreadChirps;
|
||||
|
||||
TD.services.TwitterConversation.prototype.getUnreadChirps = function(e){
|
||||
return (e && e.sortIndex && !e.id && !this.notificationsDisabled)
|
||||
? this.messages.filter(t => t.chirpType === TD.services.ChirpBase.MESSAGE && !t.isOwnChirp() && !t.read && !t.belongsBelow(e)) // changed from belongsAbove
|
||||
: prevFunc.apply(this, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
//
|
||||
// Block: Disable TweetDeck metrics.
|
||||
//
|
||||
TD.metrics.inflate = function(){};
|
||||
TD.metrics.inflateMetricTriple = function(){};
|
||||
TD.metrics.log = function(){};
|
||||
TD.metrics.makeKey = function(){};
|
||||
TD.metrics.send = function(){};
|
||||
if (ensurePropertyExists(TD, "metrics")){
|
||||
TD.metrics.inflate = function(){};
|
||||
TD.metrics.inflateMetricTriple = function(){};
|
||||
TD.metrics.log = function(){};
|
||||
TD.metrics.makeKey = function(){};
|
||||
TD.metrics.send = function(){};
|
||||
}
|
||||
|
||||
onAppReady.push(function(){
|
||||
let data = $._data(window);
|
||||
@@ -651,7 +747,9 @@
|
||||
//
|
||||
// Block: Skip the initial pre-login page.
|
||||
//
|
||||
$(document).on("uiLoginFormImpression", function(){
|
||||
location.href = $("a.btn", ".js-login-form").first().attr("href");
|
||||
});
|
||||
if (ensurePropertyExists(TD, "controller", "init", "showLogin")){
|
||||
TD.controller.init.showLogin = function(){
|
||||
location.href = "https://twitter.com/login?hide_message=true&redirect_after_login=https%3A%2F%2Ftweetdeck.twitter.com%2F%3Fvia_twitter_login%3Dtrue";
|
||||
};
|
||||
}
|
||||
})($, $TD, $TDX, TD);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user