1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-09-14 19:32:10 +02:00

Compare commits

..

14 Commits
1.3.1 ... 1.3.2

Author SHA1 Message Date
45bdd95dc8 Release 1.3.2 2016-08-13 13:20:13 +02:00
569fdec380 Fix middle-clicking on certain user links opening the page in TweetDuck window 2016-08-13 03:26:00 +02:00
3f15ff1c06 Fix missing default value for NotificationDurationValue causing crash with fresh install 2016-08-13 03:16:28 +02:00
506cd52255 Change the Reload context menu action to return to TD website 2016-08-12 22:30:36 +02:00
300c0c6195 Minor TweetDeck UI fixes (cut off account names and verified badge icons) 2016-08-10 17:16:39 +02:00
7689fe97b0 Fix unimplemented cache param in plugin bridge and clear cache on plugin reload 2016-08-10 16:53:26 +02:00
99ed077dbc Fix missing url word break in notifications 2016-08-10 15:48:50 +02:00
65aeb6656f Add a very basic setting for custom CSS in browser and notifications 2016-08-10 15:45:56 +02:00
e4f5766ffb Change font and check for null in CEF argument dialog 2016-08-10 15:03:15 +02:00
353ac7c76b Add setting for CEF command line args
Closes #52
2016-08-10 14:46:24 +02:00
8073fa206b Add a safety net to track bar value setting in case the config file is faulty 2016-08-10 12:47:56 +02:00
1a1cfa2220 Force visibility for fav/rt tweet actions in design-revert in detail view 2016-08-10 01:27:38 +02:00
5e93d866ad Fix missing fav/rt indicators in design-revert plugin
Closes #51
2016-08-10 01:17:26 +02:00
f29e03e250 Release 1.3.1 2016-08-06 03:35:59 +02:00
20 changed files with 603 additions and 28 deletions

View File

@@ -44,6 +44,10 @@ namespace TweetDck.Configuration{
public PluginConfig Plugins { get; private set; } public PluginConfig Plugins { get; private set; }
public WindowState PluginsWindow { get; set; } public WindowState PluginsWindow { get; set; }
public string CustomCefArgs { get; set; }
public string CustomBrowserCSS { get; set; }
public string CustomNotificationCSS { get; set; }
public bool IsCustomNotificationPositionSet{ public bool IsCustomNotificationPositionSet{
get{ get{
return CustomNotificationPosition.X != -32000 && CustomNotificationPosition.X != 32000; return CustomNotificationPosition.X != -32000 && CustomNotificationPosition.X != 32000;
@@ -106,6 +110,7 @@ namespace TweetDck.Configuration{
NotificationPosition = TweetNotification.Position.TopRight; NotificationPosition = TweetNotification.Position.TopRight;
CustomNotificationPosition = new Point(-32000,-32000); CustomNotificationPosition = new Point(-32000,-32000);
NotificationEdgeDistance = 8; NotificationEdgeDistance = 8;
NotificationDurationValue = 25;
EnableUpdateCheck = true; EnableUpdateCheck = true;
ExpandLinksOnHover = true; ExpandLinksOnHover = true;
EnableTrayHighlight = true; EnableTrayHighlight = true;

View File

@@ -28,5 +28,11 @@ namespace TweetDck.Core.Controls{
bar.Value = value; bar.Value = value;
} }
} }
public static void SetValueSafe(this TrackBar trackBar, int value){
if (value >= trackBar.Minimum && value <= trackBar.Maximum){
trackBar.Value = value;
}
}
} }
} }

View File

@@ -181,7 +181,7 @@ namespace TweetDck.Core{
} }
private void plugins_Reloaded(object sender, PluginLoadEventArgs e){ private void plugins_Reloaded(object sender, PluginLoadEventArgs e){
browser.ExecuteScriptAsync("window.location.reload()"); ReloadBrowser();
} }
private void plugins_PluginChangedState(object sender, PluginChangedStateEventArgs e){ private void plugins_PluginChangedState(object sender, PluginChangedStateEventArgs e){
@@ -296,5 +296,9 @@ namespace TweetDck.Core{
public void OnImagePastedFinish(){ public void OnImagePastedFinish(){
browser.ExecuteScriptAsync("TDGF_tryPasteImageFinish",new object[0]); browser.ExecuteScriptAsync("TDGF_tryPasteImageFinish",new object[0]);
} }
public void ReloadBrowser(){
browser.ExecuteScriptAsync("window.location.reload()");
}
} }
} }

View File

@@ -57,6 +57,10 @@ namespace TweetDck.Core.Handling{
} }
switch((int)commandId){ switch((int)commandId){
case (int)CefMenuCommand.Reload:
frame.ExecuteJavaScriptAsync("window.location.href = 'https://tweetdeck.twitter.com'");
return true;
case MenuSettings: case MenuSettings:
form.InvokeSafe(form.OpenSettings); form.InvokeSafe(form.OpenSettings);
return true; return true;

View File

@@ -41,6 +41,18 @@ namespace TweetDck.Core.Handling{
} }
} }
public bool HasCustomBrowserCSS{
get{
return !string.IsNullOrEmpty(Program.UserConfig.CustomBrowserCSS);
}
}
public string CustomBrowserCSS{
get{
return Program.UserConfig.CustomBrowserCSS;
}
}
public TweetDeckBridge(FormBrowser form, FormNotification notification){ public TweetDeckBridge(FormBrowser form, FormNotification notification){
this.form = form; this.form = form;
this.notification = notification; this.notification = notification;

View File

@@ -20,7 +20,7 @@ namespace TweetDck.Core.Handling{
private static string CustomCSS{ private static string CustomCSS{
get{ get{
return @".scroll-styled-v::-webkit-scrollbar{width:8px}.scroll-styled-v::-webkit-scrollbar-thumb{border-radius:0}"; return @".scroll-styled-v::-webkit-scrollbar{width:8px}.scroll-styled-v::-webkit-scrollbar-thumb{border-radius:0}a[data-full-url]{word-break:break-all}";
} }
} }
@@ -94,7 +94,13 @@ namespace TweetDck.Core.Handling{
StringBuilder build = new StringBuilder(); StringBuilder build = new StringBuilder();
build.Append("<!DOCTYPE html>"); build.Append("<!DOCTYPE html>");
build.Append("<html class='os-windows txt-base-").Append(FontSizeClass ?? DefaultFontSizeClass).Append("'>"); build.Append("<html class='os-windows txt-base-").Append(FontSizeClass ?? DefaultFontSizeClass).Append("'>");
build.Append("<head>").Append(HeadTag ?? DefaultHeadTag).Append("<style type='text/css'>").Append(CustomCSS).Append("</style></head>"); build.Append("<head>").Append(HeadTag ?? DefaultHeadTag).Append("<style type='text/css'>").Append(CustomCSS).Append("</style>");
if (!string.IsNullOrEmpty(Program.UserConfig.CustomNotificationCSS)){
build.Append("<style type='text/css'>").Append(Program.UserConfig.CustomNotificationCSS).Append("</style>");
}
build.Append("</head>");
build.Append("<body class='hearty'><div class='app-columns-container'><div class='column scroll-styled-v' style='width:100%;overflow-y:auto'>"); build.Append("<body class='hearty'><div class='app-columns-container'><div class='column scroll-styled-v' style='width:100%;overflow-y:auto'>");
build.Append(html); build.Append(html);
build.Append("</div></div></body>"); build.Append("</div></div></body>");

View File

@@ -19,7 +19,7 @@ namespace TweetDck.Core.Other{
this.tabPanel.AddButton("General",SelectTab<TabSettingsGeneral>); this.tabPanel.AddButton("General",SelectTab<TabSettingsGeneral>);
this.tabPanel.AddButton("Notifications",() => SelectTab(() => new TabSettingsNotifications(browserForm.CreateNotificationForm(false)))); this.tabPanel.AddButton("Notifications",() => SelectTab(() => new TabSettingsNotifications(browserForm.CreateNotificationForm(false))));
this.tabPanel.AddButton("Updates",() => SelectTab(() => new TabSettingsUpdates(updates))); this.tabPanel.AddButton("Updates",() => SelectTab(() => new TabSettingsUpdates(updates)));
this.tabPanel.AddButton("Advanced",SelectTab<TabSettingsAdvanced>); this.tabPanel.AddButton("Advanced",() => SelectTab(() => new TabSettingsAdvanced(browserForm.ReloadBrowser)));
this.tabPanel.SelectTab(tabPanel.Buttons.First()); this.tabPanel.SelectTab(tabPanel.Buttons.First());
} }

View File

@@ -0,0 +1,181 @@
namespace TweetDck.Core.Other.Settings.Dialogs {
partial class DialogSettingsCSS {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.textBoxBrowserCSS = new System.Windows.Forms.TextBox();
this.btnCancel = new System.Windows.Forms.Button();
this.btnApply = new System.Windows.Forms.Button();
this.splitContainer = new System.Windows.Forms.SplitContainer();
this.labelBrowser = new System.Windows.Forms.Label();
this.labelNotification = new System.Windows.Forms.Label();
this.textBoxNotificationCSS = new System.Windows.Forms.TextBox();
this.labelWarning = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
this.splitContainer.Panel1.SuspendLayout();
this.splitContainer.Panel2.SuspendLayout();
this.splitContainer.SuspendLayout();
this.SuspendLayout();
//
// textBoxBrowserCSS
//
this.textBoxBrowserCSS.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textBoxBrowserCSS.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.textBoxBrowserCSS.Location = new System.Drawing.Point(0, 16);
this.textBoxBrowserCSS.Margin = new System.Windows.Forms.Padding(0, 3, 0, 0);
this.textBoxBrowserCSS.Multiline = true;
this.textBoxBrowserCSS.Name = "textBoxBrowserCSS";
this.textBoxBrowserCSS.Size = new System.Drawing.Size(226, 193);
this.textBoxBrowserCSS.TabIndex = 0;
this.textBoxBrowserCSS.WordWrap = false;
//
// btnCancel
//
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.Location = new System.Drawing.Point(354, 227);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.btnCancel.Size = new System.Drawing.Size(56, 23);
this.btnCancel.TabIndex = 1;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnApply
//
this.btnApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnApply.Location = new System.Drawing.Point(416, 227);
this.btnApply.Name = "btnApply";
this.btnApply.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.btnApply.Size = new System.Drawing.Size(56, 23);
this.btnApply.TabIndex = 2;
this.btnApply.Text = "Apply";
this.btnApply.UseVisualStyleBackColor = true;
this.btnApply.Click += new System.EventHandler(this.btnApply_Click);
//
// splitContainer
//
this.splitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.splitContainer.Location = new System.Drawing.Point(12, 12);
this.splitContainer.Name = "splitContainer";
//
// splitContainer.Panel1
//
this.splitContainer.Panel1.Controls.Add(this.labelBrowser);
this.splitContainer.Panel1.Controls.Add(this.textBoxBrowserCSS);
this.splitContainer.Panel1MinSize = 64;
//
// splitContainer.Panel2
//
this.splitContainer.Panel2.Controls.Add(this.labelNotification);
this.splitContainer.Panel2.Controls.Add(this.textBoxNotificationCSS);
this.splitContainer.Panel2MinSize = 64;
this.splitContainer.Size = new System.Drawing.Size(460, 209);
this.splitContainer.SplitterDistance = 226;
this.splitContainer.SplitterWidth = 5;
this.splitContainer.TabIndex = 5;
//
// labelBrowser
//
this.labelBrowser.AutoSize = true;
this.labelBrowser.Location = new System.Drawing.Point(-3, 0);
this.labelBrowser.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
this.labelBrowser.Name = "labelBrowser";
this.labelBrowser.Size = new System.Drawing.Size(45, 13);
this.labelBrowser.TabIndex = 1;
this.labelBrowser.Text = "Browser";
//
// labelNotification
//
this.labelNotification.AutoSize = true;
this.labelNotification.Location = new System.Drawing.Point(-3, 0);
this.labelNotification.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
this.labelNotification.Name = "labelNotification";
this.labelNotification.Size = new System.Drawing.Size(60, 13);
this.labelNotification.TabIndex = 2;
this.labelNotification.Text = "Notification";
//
// textBoxNotificationCSS
//
this.textBoxNotificationCSS.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textBoxNotificationCSS.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.textBoxNotificationCSS.Location = new System.Drawing.Point(0, 16);
this.textBoxNotificationCSS.Margin = new System.Windows.Forms.Padding(0, 3, 0, 0);
this.textBoxNotificationCSS.Multiline = true;
this.textBoxNotificationCSS.Name = "textBoxNotificationCSS";
this.textBoxNotificationCSS.Size = new System.Drawing.Size(227, 193);
this.textBoxNotificationCSS.TabIndex = 1;
this.textBoxNotificationCSS.WordWrap = false;
//
// labelWarning
//
this.labelWarning.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.labelWarning.AutoSize = true;
this.labelWarning.Location = new System.Drawing.Point(9, 232);
this.labelWarning.Name = "labelWarning";
this.labelWarning.Size = new System.Drawing.Size(341, 13);
this.labelWarning.TabIndex = 6;
this.labelWarning.Text = "The code is not validated, please make sure there are no syntax errors.";
//
// DialogSettingsCSS
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(484, 262);
this.Controls.Add(this.labelWarning);
this.Controls.Add(this.splitContainer);
this.Controls.Add(this.btnApply);
this.Controls.Add(this.btnCancel);
this.MinimumSize = new System.Drawing.Size(500, 160);
this.Name = "DialogSettingsCSS";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.splitContainer.Panel1.ResumeLayout(false);
this.splitContainer.Panel1.PerformLayout();
this.splitContainer.Panel2.ResumeLayout(false);
this.splitContainer.Panel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
this.splitContainer.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox textBoxBrowserCSS;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnApply;
private System.Windows.Forms.SplitContainer splitContainer;
private System.Windows.Forms.TextBox textBoxNotificationCSS;
private System.Windows.Forms.Label labelBrowser;
private System.Windows.Forms.Label labelNotification;
private System.Windows.Forms.Label labelWarning;
}
}

View File

@@ -0,0 +1,37 @@
using System;
using System.Windows.Forms;
namespace TweetDck.Core.Other.Settings.Dialogs{
sealed partial class DialogSettingsCSS : Form{
public string BrowserCSS{
get{
return textBoxBrowserCSS.Text;
}
}
public string NotificationCSS{
get{
return textBoxNotificationCSS.Text;
}
}
public DialogSettingsCSS(){
InitializeComponent();
Text = Program.BrandName+" Settings - CSS";
textBoxBrowserCSS.Text = Program.UserConfig.CustomBrowserCSS ?? "";
textBoxNotificationCSS.Text = Program.UserConfig.CustomNotificationCSS ?? "";
}
private void btnApply_Click(object sender, EventArgs e){
DialogResult = DialogResult.OK;
Close();
}
private void btnCancel_Click(object sender, EventArgs e){
DialogResult = DialogResult.Cancel;
Close();
}
}
}

View File

@@ -0,0 +1,120 @@
namespace TweetDck.Core.Other.Settings.Dialogs {
partial class DialogSettingsCefArgs {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.textBoxArgs = new System.Windows.Forms.TextBox();
this.btnCancel = new System.Windows.Forms.Button();
this.btnApply = new System.Windows.Forms.Button();
this.btnHelp = new System.Windows.Forms.Button();
this.labelWarning = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// textBoxArgs
//
this.textBoxArgs.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textBoxArgs.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.textBoxArgs.Location = new System.Drawing.Point(12, 28);
this.textBoxArgs.Multiline = true;
this.textBoxArgs.Name = "textBoxArgs";
this.textBoxArgs.Size = new System.Drawing.Size(460, 193);
this.textBoxArgs.TabIndex = 0;
//
// btnCancel
//
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.Location = new System.Drawing.Point(354, 227);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.btnCancel.Size = new System.Drawing.Size(56, 23);
this.btnCancel.TabIndex = 1;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnApply
//
this.btnApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnApply.Location = new System.Drawing.Point(416, 227);
this.btnApply.Name = "btnApply";
this.btnApply.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.btnApply.Size = new System.Drawing.Size(56, 23);
this.btnApply.TabIndex = 2;
this.btnApply.Text = "Apply";
this.btnApply.UseVisualStyleBackColor = true;
this.btnApply.Click += new System.EventHandler(this.btnApply_Click);
//
// btnHelp
//
this.btnHelp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnHelp.AutoSize = true;
this.btnHelp.Location = new System.Drawing.Point(12, 227);
this.btnHelp.Name = "btnHelp";
this.btnHelp.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.btnHelp.Size = new System.Drawing.Size(124, 23);
this.btnHelp.TabIndex = 3;
this.btnHelp.Text = "List of Chromium Args";
this.btnHelp.UseVisualStyleBackColor = true;
this.btnHelp.Click += new System.EventHandler(this.btnHelp_Click);
//
// labelWarning
//
this.labelWarning.AutoSize = true;
this.labelWarning.Location = new System.Drawing.Point(12, 9);
this.labelWarning.Margin = new System.Windows.Forms.Padding(3, 0, 3, 3);
this.labelWarning.Name = "labelWarning";
this.labelWarning.Size = new System.Drawing.Size(423, 13);
this.labelWarning.TabIndex = 4;
this.labelWarning.Text = "Warning: Some arguments may cause the program to stop working, edit at your own r" +
"isk.";
//
// DialogSettingsCefArgs
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(484, 262);
this.Controls.Add(this.labelWarning);
this.Controls.Add(this.btnHelp);
this.Controls.Add(this.btnApply);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.textBoxArgs);
this.MinimumSize = new System.Drawing.Size(500, 160);
this.Name = "DialogSettingsCefArgs";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox textBoxArgs;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnApply;
private System.Windows.Forms.Button btnHelp;
private System.Windows.Forms.Label labelWarning;
}
}

View File

@@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using TweetDck.Core.Utils;
namespace TweetDck.Core.Other.Settings.Dialogs{
sealed partial class DialogSettingsCefArgs : Form{
public string CefArgs{
get{
return textBoxArgs.Text;
}
}
public DialogSettingsCefArgs(){
InitializeComponent();
Text = Program.BrandName+" Settings - CEF Arguments";
textBoxArgs.Text = Program.UserConfig.CustomCefArgs ?? "";
textBoxArgs.Select(textBoxArgs.Text.Length,0);
}
private void btnHelp_Click(object sender, EventArgs e){
BrowserUtils.OpenExternalBrowser("http://peter.sh/experiments/chromium-command-line-switches/");
}
private void btnApply_Click(object sender, EventArgs e){
string prevArgs = Program.UserConfig.CustomCefArgs;
if (CefArgs == prevArgs){
DialogResult = DialogResult.Cancel;
Close();
return;
}
int count = CommandLineArgsParser.AddToDictionary(CefArgs,new Dictionary<string,string>());
string prompt = count == 0 && !string.IsNullOrWhiteSpace(prevArgs) ? "All arguments will be removed from the settings. Continue?" : count+(count == 1 ? " argument" : " arguments")+" will be added to the settings. Continue?";
if (MessageBox.Show(prompt,"Confirm CEF Arguments",MessageBoxButtons.OKCancel,MessageBoxIcon.Question,MessageBoxDefaultButton.Button2) == DialogResult.OK){
DialogResult = DialogResult.OK;
Close();
}
}
private void btnCancel_Click(object sender, EventArgs e){
DialogResult = DialogResult.Cancel;
Close();
}
}
}

View File

@@ -27,11 +27,15 @@
this.btnClearCache = new System.Windows.Forms.Button(); this.btnClearCache = new System.Windows.Forms.Button();
this.checkHardwareAcceleration = new System.Windows.Forms.CheckBox(); this.checkHardwareAcceleration = new System.Windows.Forms.CheckBox();
this.toolTip = new System.Windows.Forms.ToolTip(this.components); this.toolTip = new System.Windows.Forms.ToolTip(this.components);
this.btnEditCefArgs = new System.Windows.Forms.Button();
this.btnReset = new System.Windows.Forms.Button(); this.btnReset = new System.Windows.Forms.Button();
this.btnImport = new System.Windows.Forms.Button(); this.btnImport = new System.Windows.Forms.Button();
this.btnExport = new System.Windows.Forms.Button(); this.btnExport = new System.Windows.Forms.Button();
this.groupPerformance = new System.Windows.Forms.GroupBox(); this.groupPerformance = new System.Windows.Forms.GroupBox();
this.groupConfiguration = new System.Windows.Forms.GroupBox();
this.btnEditCSS = new System.Windows.Forms.Button();
this.groupPerformance.SuspendLayout(); this.groupPerformance.SuspendLayout();
this.groupConfiguration.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// btnClearCache // btnClearCache
@@ -60,6 +64,17 @@
this.checkHardwareAcceleration.UseVisualStyleBackColor = true; this.checkHardwareAcceleration.UseVisualStyleBackColor = true;
this.checkHardwareAcceleration.CheckedChanged += new System.EventHandler(this.checkHardwareAcceleration_CheckedChanged); this.checkHardwareAcceleration.CheckedChanged += new System.EventHandler(this.checkHardwareAcceleration_CheckedChanged);
// //
// btnEditCefArgs
//
this.btnEditCefArgs.Location = new System.Drawing.Point(6, 19);
this.btnEditCefArgs.Name = "btnEditCefArgs";
this.btnEditCefArgs.Size = new System.Drawing.Size(171, 23);
this.btnEditCefArgs.TabIndex = 15;
this.btnEditCefArgs.Text = "Edit CEF Arguments";
this.toolTip.SetToolTip(this.btnEditCefArgs, "Set custom command line arguments for Chromium Embedded Framework.");
this.btnEditCefArgs.UseVisualStyleBackColor = true;
this.btnEditCefArgs.Click += new System.EventHandler(this.btnEditCefArgs_Click);
//
// btnReset // btnReset
// //
this.btnReset.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.btnReset.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
@@ -110,10 +125,33 @@
this.groupPerformance.TabStop = false; this.groupPerformance.TabStop = false;
this.groupPerformance.Text = "Performance"; this.groupPerformance.Text = "Performance";
// //
// groupConfiguration
//
this.groupConfiguration.Controls.Add(this.btnEditCSS);
this.groupConfiguration.Controls.Add(this.btnEditCefArgs);
this.groupConfiguration.Location = new System.Drawing.Point(9, 89);
this.groupConfiguration.Name = "groupConfiguration";
this.groupConfiguration.Size = new System.Drawing.Size(183, 77);
this.groupConfiguration.TabIndex = 19;
this.groupConfiguration.TabStop = false;
this.groupConfiguration.Text = "Configuration";
//
// btnEditCSS
//
this.btnEditCSS.Location = new System.Drawing.Point(6, 48);
this.btnEditCSS.Name = "btnEditCSS";
this.btnEditCSS.Size = new System.Drawing.Size(171, 23);
this.btnEditCSS.TabIndex = 16;
this.btnEditCSS.Text = "Edit CSS";
this.toolTip.SetToolTip(this.btnEditCSS, "Set custom CSS for browser and notification windows.");
this.btnEditCSS.UseVisualStyleBackColor = true;
this.btnEditCSS.Click += new System.EventHandler(this.btnEditCSS_Click);
//
// TabSettingsAdvanced // TabSettingsAdvanced
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.groupConfiguration);
this.Controls.Add(this.groupPerformance); this.Controls.Add(this.groupPerformance);
this.Controls.Add(this.btnReset); this.Controls.Add(this.btnReset);
this.Controls.Add(this.btnImport); this.Controls.Add(this.btnImport);
@@ -122,6 +160,7 @@
this.Size = new System.Drawing.Size(478, 282); this.Size = new System.Drawing.Size(478, 282);
this.groupPerformance.ResumeLayout(false); this.groupPerformance.ResumeLayout(false);
this.groupPerformance.PerformLayout(); this.groupPerformance.PerformLayout();
this.groupConfiguration.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@@ -136,5 +175,8 @@
private System.Windows.Forms.Button btnImport; private System.Windows.Forms.Button btnImport;
private System.Windows.Forms.Button btnExport; private System.Windows.Forms.Button btnExport;
private System.Windows.Forms.GroupBox groupPerformance; private System.Windows.Forms.GroupBox groupPerformance;
private System.Windows.Forms.GroupBox groupConfiguration;
private System.Windows.Forms.Button btnEditCefArgs;
private System.Windows.Forms.Button btnEditCSS;
} }
} }

View File

@@ -2,14 +2,19 @@
using System.Diagnostics; using System.Diagnostics;
using System.Windows.Forms; using System.Windows.Forms;
using TweetDck.Core.Controls; using TweetDck.Core.Controls;
using TweetDck.Core.Other.Settings.Dialogs;
using TweetDck.Core.Other.Settings.Export; using TweetDck.Core.Other.Settings.Export;
using TweetDck.Core.Utils; using TweetDck.Core.Utils;
namespace TweetDck.Core.Other.Settings{ namespace TweetDck.Core.Other.Settings{
partial class TabSettingsAdvanced : BaseTabSettings{ partial class TabSettingsAdvanced : BaseTabSettings{
public TabSettingsAdvanced(){ private readonly Action browserReloadAction;
public TabSettingsAdvanced(Action browserReloadAction){
InitializeComponent(); InitializeComponent();
this.browserReloadAction = browserReloadAction;
checkHardwareAcceleration.Checked = HardwareAcceleration.IsEnabled; checkHardwareAcceleration.Checked = HardwareAcceleration.IsEnabled;
BrowserCache.CalculateCacheSize(bytes => this.InvokeSafe(() => { BrowserCache.CalculateCacheSize(bytes => this.InvokeSafe(() => {
@@ -48,17 +53,40 @@ namespace TweetDck.Core.Other.Settings{
succeeded = HardwareAcceleration.Disable(); succeeded = HardwareAcceleration.Disable();
} }
if (succeeded && MessageBox.Show("The application must restart for the setting to take place. Do you want to restart now?",Program.BrandName+" Settings",MessageBoxButtons.YesNo,MessageBoxIcon.Information) == DialogResult.Yes){ // TODO if (succeeded){
Process.Start(Application.ExecutablePath,"-restart"); PromptRestart();
Application.Exit();
} }
else if (!succeeded){ else{
checkHardwareAcceleration.CheckedChanged -= checkHardwareAcceleration_CheckedChanged; checkHardwareAcceleration.CheckedChanged -= checkHardwareAcceleration_CheckedChanged;
checkHardwareAcceleration.Checked = HardwareAcceleration.IsEnabled; checkHardwareAcceleration.Checked = HardwareAcceleration.IsEnabled;
checkHardwareAcceleration.CheckedChanged += checkHardwareAcceleration_CheckedChanged; checkHardwareAcceleration.CheckedChanged += checkHardwareAcceleration_CheckedChanged;
} }
} }
private void btnEditCefArgs_Click(object sender, EventArgs e){
DialogSettingsCefArgs form = new DialogSettingsCefArgs();
if (form.ShowDialog(ParentForm) == DialogResult.OK){
Config.CustomCefArgs = form.CefArgs;
PromptRestart();
}
}
private void btnEditCSS_Click(object sender, EventArgs e){
DialogSettingsCSS form = new DialogSettingsCSS();
if (form.ShowDialog(ParentForm) == DialogResult.OK){
bool hasChangedBrowser = form.BrowserCSS != Config.CustomBrowserCSS;
Config.CustomBrowserCSS = form.BrowserCSS;
Config.CustomNotificationCSS = form.NotificationCSS;
if (hasChangedBrowser && MessageBox.Show("The browser CSS has changed, do you want to reload it?","Browser CSS Changed",MessageBoxButtons.YesNo,MessageBoxIcon.Question,MessageBoxDefaultButton.Button2) == DialogResult.Yes){
browserReloadAction();
}
}
}
private void btnExport_Click(object sender, EventArgs e){ private void btnExport_Click(object sender, EventArgs e){
DialogResult resultSaveCredentials = MessageBox.Show("Do you want to include your login session? This will not save your password into the file, but it will allow anyone with the file to login into TweetDeck as you.","Export "+Program.BrandName+" Settings",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Question,MessageBoxDefaultButton.Button3); DialogResult resultSaveCredentials = MessageBox.Show("Do you want to include your login session? This will not save your password into the file, but it will allow anyone with the file to login into TweetDeck as you.","Export "+Program.BrandName+" Settings",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Question,MessageBoxDefaultButton.Button3);
if (resultSaveCredentials == DialogResult.Cancel)return; if (resultSaveCredentials == DialogResult.Cancel)return;
@@ -119,5 +147,12 @@ namespace TweetDck.Core.Other.Settings{
((FormSettings)ParentForm).ReloadUI(); ((FormSettings)ParentForm).ReloadUI();
} }
} }
private static void PromptRestart(){
if (MessageBox.Show("The application must restart for the setting to take place. Do you want to restart now?",Program.BrandName+" Settings",MessageBoxButtons.YesNo,MessageBoxIcon.Information) == DialogResult.Yes){
Process.Start(Application.ExecutablePath,"-restart");
Application.Exit();
}
}
} }
} }

View File

@@ -34,7 +34,7 @@ namespace TweetDck.Core.Other.Settings{
case TweetNotification.Position.Custom: radioLocCustom.Checked = true; break; case TweetNotification.Position.Custom: radioLocCustom.Checked = true; break;
} }
trackBarDuration.Value = Config.NotificationDurationValue; trackBarDuration.SetValueSafe(Config.NotificationDurationValue);
labelDurationValue.Text = Config.NotificationDurationValue+" ms/c"; labelDurationValue.Text = Config.NotificationDurationValue+" ms/c";
comboBoxDisplay.Items.Add("(Same As "+Program.BrandName+")"); comboBoxDisplay.Items.Add("(Same As "+Program.BrandName+")");
@@ -50,7 +50,7 @@ namespace TweetDck.Core.Other.Settings{
checkTimerCountDown.Checked = Config.NotificationTimerCountDown; checkTimerCountDown.Checked = Config.NotificationTimerCountDown;
checkLegacyLoad.Checked = Config.NotificationLegacyLoad; checkLegacyLoad.Checked = Config.NotificationLegacyLoad;
trackBarEdgeDistance.Value = Config.NotificationEdgeDistance; trackBarEdgeDistance.SetValueSafe(Config.NotificationEdgeDistance);
labelEdgeDistanceValue.Text = trackBarEdgeDistance.Value.ToString(CultureInfo.InvariantCulture)+" px"; labelEdgeDistanceValue.Text = trackBarEdgeDistance.Value.ToString(CultureInfo.InvariantCulture)+" px";
Disposed += (sender, args) => this.notification.Dispose(); Disposed += (sender, args) => this.notification.Dispose();

View File

@@ -0,0 +1,45 @@
using System.Collections.Generic;
using System.Text.RegularExpressions;
namespace TweetDck.Core.Utils{
static class CommandLineArgsParser{
private static Regex splitRegex;
private static Regex SplitRegex{
get{
return splitRegex ?? (splitRegex = new Regex(@"([^=\s]+(?:=(?:""[^""]*?""|[^ ]*))?)",RegexOptions.Compiled));
}
}
public static int AddToDictionary(string args, IDictionary<string,string> dictionary){
if (string.IsNullOrWhiteSpace(args)){
return 0;
}
int count = 0;
foreach(Match match in SplitRegex.Matches(args)){
string matchValue = match.Value;
int indexEquals = matchValue.IndexOf('=');
string key, value;
if (indexEquals == -1){
key = matchValue.TrimStart('-');
value = "1";
}
else{
key = matchValue.Substring(0,indexEquals).TrimStart('-');
value = matchValue.Substring(indexEquals+1).Trim('"');
}
if (key != string.Empty){
dictionary[key] = value;
++count;
}
}
return count;
}
}
}

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text; using System.Text;
using TweetDck.Plugins.Events;
namespace TweetDck.Plugins{ namespace TweetDck.Plugins{
class PluginBridge{ class PluginBridge{
@@ -10,6 +11,11 @@ namespace TweetDck.Plugins{
public PluginBridge(PluginManager manager){ public PluginBridge(PluginManager manager){
this.manager = manager; this.manager = manager;
this.manager.Reloaded += manager_Reloaded;
}
private void manager_Reloaded(object sender, PluginLoadEventArgs e){
fileCache.Clear();
} }
private string GetFullPathIfSafe(int token, string path){ private string GetFullPathIfSafe(int token, string path){
@@ -54,10 +60,6 @@ namespace TweetDck.Plugins{
fileCache[fullPath] = contents; fileCache[fullPath] = contents;
} }
public string ReadFile(int token, string path){
return ReadFile(token,path,true);
}
public string ReadFile(int token, string path, bool cache){ public string ReadFile(int token, string path, bool cache){
string fullPath = GetFullPathIfSafe(token,path); string fullPath = GetFullPathIfSafe(token,path);
@@ -67,7 +69,7 @@ namespace TweetDck.Plugins{
string cachedContents; string cachedContents;
if (fileCache.TryGetValue(fullPath,out cachedContents)){ if (cache && fileCache.TryGetValue(fullPath,out cachedContents)){
return cachedContents; return cachedContents;
} }

View File

@@ -28,8 +28,8 @@ namespace TweetDck{
public const string BrowserSubprocess = BrandName+".Browser.exe"; public const string BrowserSubprocess = BrandName+".Browser.exe";
public const string VersionTag = "1.3"; public const string VersionTag = "1.3.2";
public const string VersionFull = "1.3.0.0"; public const string VersionFull = "1.3.2.0";
public static readonly Version Version = new Version(VersionTag); public static readonly Version Version = new Version(VersionTag);
@@ -115,7 +115,7 @@ namespace TweetDck{
} }
}; };
Cef.Initialize(new CefSettings{ CefSettings settings = new CefSettings{
AcceptLanguageList = BrowserUtils.HeaderAcceptLanguage, AcceptLanguageList = BrowserUtils.HeaderAcceptLanguage,
UserAgent = BrowserUtils.HeaderUserAgent, UserAgent = BrowserUtils.HeaderUserAgent,
Locale = CultureInfo.CurrentCulture.TwoLetterISOLanguageName, Locale = CultureInfo.CurrentCulture.TwoLetterISOLanguageName,
@@ -124,7 +124,11 @@ namespace TweetDck{
#if !DEBUG #if !DEBUG
LogSeverity = programArguments.Contains("-log") ? LogSeverity.Info : LogSeverity.Disable LogSeverity = programArguments.Contains("-log") ? LogSeverity.Info : LogSeverity.Disable
#endif #endif
}); };
CommandLineArgsParser.AddToDictionary(UserConfig.CustomCefArgs,settings.CefCommandLineArgs);
Cef.Initialize(settings);
AppDomain.CurrentDomain.UnhandledException += (sender, args) => { AppDomain.CurrentDomain.UnhandledException += (sender, args) => {
Exception ex = args.ExceptionObject as Exception; Exception ex = args.ExceptionObject as Exception;

View File

@@ -5,8 +5,10 @@ enabled(){
document.head.appendChild(style); document.head.appendChild(style);
var sheet = style.sheet; var sheet = style.sheet;
sheet.insertRule(".tweet-actions { float: right !important; width: auto !important; visibility: hidden; }",0); sheet.insertRule(".tweet-actions { float: right !important; width: auto !important; }",0);
sheet.insertRule(".tweet-actions:hover { visibility: visible; }",0); sheet.insertRule(".tweet-action { opacity: 0; }",0);
sheet.insertRule(".is-favorite .tweet-action, .is-retweet .tweet-action { opacity: 0.5; visibility: visible !important; }",0);
sheet.insertRule(".tweet:hover .tweet-action, .is-favorite .tweet-action[rel='favorite'], .is-retweet .tweet-action[rel='retweet'] { opacity: 1; visibility: visible !important; }",0);
sheet.insertRule(".tweet-actions > li:nth-child(4) { margin-right: 2px !important; }",0); sheet.insertRule(".tweet-actions > li:nth-child(4) { margin-right: 2px !important; }",0);
// revert small links around the tweet // revert small links around the tweet

View File

@@ -53,11 +53,13 @@
} }
}); });
// Setup video element replacement // Setup video element replacement and fix missing target in user links
new MutationObserver(function(){ new MutationObserver(function(){
$("video").each(function(){ $("video").each(function(){
$(this).parent().replaceWith("<a href='"+$(this).attr("src")+"' rel='url' target='_blank' style='display:block; border:1px solid #555; padding:3px 6px'>&#9658; Open video in browser</a>"); $(this).parent().replaceWith("<a href='"+$(this).attr("src")+"' rel='url' target='_blank' style='display:block; border:1px solid #555; padding:3px 6px'>&#9658; Open video in browser</a>");
}); });
$("a[rel='user']").attr("target","_blank");
}).observe($(".js-app-columns")[0],{ }).observe($(".js-app-columns")[0],{
childList: true, childList: true,
subtree: true subtree: true
@@ -399,12 +401,17 @@
// Block: Inject custom CSS and layout into the page. // Block: Inject custom CSS and layout into the page.
// //
(function(){ (function(){
var style = document.createElement("style"); var styleOfficial = document.createElement("style");
document.head.appendChild(style); document.head.appendChild(styleOfficial);
var sheet = style.sheet; styleOfficial.sheet.insertRule("a[data-full-url] { word-break: break-all; }",0); // break long urls
styleOfficial.sheet.insertRule(".column-nav-link .attribution { position: absolute; }",0); // fix cut off account names
styleOfficial.sheet.insertRule(".txt-base-smallest .badge-verified:before { height: 13px !important; }",0); // fix cut off badge icon
// break long urls if ($TD.hasCustomBrowserCSS){
sheet.insertRule("a[data-full-url] { word-break: break-all; }",0); var styleCustom = document.createElement("style");
styleCustom.innerHTML = $TD.customBrowserCSS;
document.head.appendChild(styleCustom);
}
})(); })();
})($,$TD,TD); })($,$TD,TD);

View File

@@ -129,6 +129,18 @@
<Compile Include="Core\Other\FormPlugins.Designer.cs"> <Compile Include="Core\Other\FormPlugins.Designer.cs">
<DependentUpon>FormPlugins.cs</DependentUpon> <DependentUpon>FormPlugins.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Core\Other\Settings\Dialogs\DialogSettingsCSS.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Core\Other\Settings\Dialogs\DialogSettingsCSS.Designer.cs">
<DependentUpon>DialogSettingsCSS.cs</DependentUpon>
</Compile>
<Compile Include="Core\Other\Settings\Dialogs\DialogSettingsCefArgs.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Core\Other\Settings\Dialogs\DialogSettingsCefArgs.Designer.cs">
<DependentUpon>DialogSettingsCefArgs.cs</DependentUpon>
</Compile>
<Compile Include="Core\Other\Settings\Export\CombinedFileStream.cs" /> <Compile Include="Core\Other\Settings\Export\CombinedFileStream.cs" />
<Compile Include="Core\Other\Settings\Export\ExportManager.cs" /> <Compile Include="Core\Other\Settings\Export\ExportManager.cs" />
<Compile Include="Core\Other\Settings\TabSettingsAdvanced.cs"> <Compile Include="Core\Other\Settings\TabSettingsAdvanced.cs">
@@ -161,6 +173,7 @@
<Compile Include="Core\Other\Settings\TabSettingsUpdates.Designer.cs"> <Compile Include="Core\Other\Settings\TabSettingsUpdates.Designer.cs">
<DependentUpon>TabSettingsUpdates.cs</DependentUpon> <DependentUpon>TabSettingsUpdates.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Core\Utils\CommandLineArgsParser.cs" />
<Compile Include="Core\Utils\WindowState.cs" /> <Compile Include="Core\Utils\WindowState.cs" />
<Compile Include="Migration\FormBackgroundWork.cs"> <Compile Include="Migration\FormBackgroundWork.cs">
<SubType>Form</SubType> <SubType>Form</SubType>