mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-09-14 19:32:10 +02:00
Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
aba156cb3b | |||
cd4e4d7095 | |||
8fbb639430 | |||
d5bf8ec558 | |||
b6cff40f1e | |||
833e42f455 | |||
8134843dad | |||
1f92d5e633 | |||
dc51c0ae85 | |||
45c79643d6 | |||
9041bfc627 | |||
0b3b3dd0be | |||
89e92dab59 | |||
8c168c9ad7 | |||
9f63357a92 |
@@ -42,7 +42,6 @@ namespace TweetDuck.Configuration{
|
|||||||
public WindowState PluginsWindow { get; set; } = new WindowState();
|
public WindowState PluginsWindow { get; set; } = new WindowState();
|
||||||
|
|
||||||
public bool ExpandLinksOnHover { get; set; } = true;
|
public bool ExpandLinksOnHover { get; set; } = true;
|
||||||
public bool SwitchAccountSelectors { get; set; } = true;
|
|
||||||
public bool OpenSearchInFirstColumn { get; set; } = true;
|
public bool OpenSearchInFirstColumn { get; set; } = true;
|
||||||
public bool KeepLikeFollowDialogsOpen { get; set; } = true;
|
public bool KeepLikeFollowDialogsOpen { get; set; } = true;
|
||||||
public bool BestImageQuality { get; set; } = true;
|
public bool BestImageQuality { get; set; } = true;
|
||||||
|
@@ -15,7 +15,6 @@ namespace TweetDuck.Core.Bridge{
|
|||||||
build.Append("x.expandLinksOnHover=").Append(Bool(Program.UserConfig.ExpandLinksOnHover));
|
build.Append("x.expandLinksOnHover=").Append(Bool(Program.UserConfig.ExpandLinksOnHover));
|
||||||
|
|
||||||
if (environment == Environment.Browser){
|
if (environment == Environment.Browser){
|
||||||
build.Append("x.switchAccountSelectors=").Append(Bool(Program.UserConfig.SwitchAccountSelectors));
|
|
||||||
build.Append("x.openSearchInFirstColumn=").Append(Bool(Program.UserConfig.OpenSearchInFirstColumn));
|
build.Append("x.openSearchInFirstColumn=").Append(Bool(Program.UserConfig.OpenSearchInFirstColumn));
|
||||||
build.Append("x.keepLikeFollowDialogsOpen=").Append(Bool(Program.UserConfig.KeepLikeFollowDialogsOpen));
|
build.Append("x.keepLikeFollowDialogsOpen=").Append(Bool(Program.UserConfig.KeepLikeFollowDialogsOpen));
|
||||||
build.Append("x.muteNotifications=").Append(Bool(Program.UserConfig.MuteNotifications));
|
build.Append("x.muteNotifications=").Append(Bool(Program.UserConfig.MuteNotifications));
|
||||||
|
@@ -3,7 +3,7 @@ using System.Text;
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using CefSharp;
|
using CefSharp;
|
||||||
using TweetDuck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDuck.Core.Handling;
|
using TweetDuck.Core.Management;
|
||||||
using TweetDuck.Core.Notification;
|
using TweetDuck.Core.Notification;
|
||||||
using TweetDuck.Core.Other;
|
using TweetDuck.Core.Other;
|
||||||
using TweetDuck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
@@ -13,20 +13,12 @@ namespace TweetDuck.Core.Bridge{
|
|||||||
class TweetDeckBridge{
|
class TweetDeckBridge{
|
||||||
public static string FontSize { get; private set; }
|
public static string FontSize { get; private set; }
|
||||||
public static string NotificationHeadLayout { get; private set; }
|
public static string NotificationHeadLayout { get; private set; }
|
||||||
|
public static readonly ContextInfo ContextInfo = new ContextInfo();
|
||||||
public static string LastHighlightedTweetUrl = string.Empty;
|
|
||||||
public static string LastHighlightedQuoteUrl = string.Empty;
|
|
||||||
private static string LastHighlightedTweetAuthors = string.Empty;
|
|
||||||
private static string LastHighlightedTweetImages = string.Empty;
|
|
||||||
|
|
||||||
public static string[] LastHighlightedTweetAuthorsArray => LastHighlightedTweetAuthors.Split(';');
|
|
||||||
public static string[] LastHighlightedTweetImagesArray => LastHighlightedTweetImages.Split(';');
|
|
||||||
|
|
||||||
private static readonly Dictionary<string, string> SessionData = new Dictionary<string, string>(2);
|
private static readonly Dictionary<string, string> SessionData = new Dictionary<string, string>(2);
|
||||||
|
|
||||||
public static void ResetStaticProperties(){
|
public static void ResetStaticProperties(){
|
||||||
FontSize = NotificationHeadLayout = null;
|
FontSize = NotificationHeadLayout = null;
|
||||||
LastHighlightedTweetUrl = LastHighlightedQuoteUrl = LastHighlightedTweetAuthors = LastHighlightedTweetImages = string.Empty;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void RestoreSessionData(IFrame frame){
|
public static void RestoreSessionData(IFrame frame){
|
||||||
@@ -72,13 +64,8 @@ namespace TweetDuck.Core.Bridge{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetLastHighlightedTweet(string tweetUrl, string quoteUrl, string authors, string imageList){
|
public void SetRightClickedChirp(string tweetUrl, string quoteUrl, string chirpAuthors, string chirpImages){
|
||||||
form.InvokeAsyncSafe(() => {
|
ContextInfo.SetChirp(tweetUrl, quoteUrl, chirpAuthors, chirpImages);
|
||||||
LastHighlightedTweetUrl = tweetUrl;
|
|
||||||
LastHighlightedQuoteUrl = quoteUrl;
|
|
||||||
LastHighlightedTweetAuthors = authors;
|
|
||||||
LastHighlightedTweetImages = imageList;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DisplayTooltip(string text){
|
public void DisplayTooltip(string text){
|
||||||
@@ -112,8 +99,8 @@ namespace TweetDuck.Core.Bridge{
|
|||||||
|
|
||||||
// Global
|
// Global
|
||||||
|
|
||||||
public void SetLastRightClickInfo(string type, string link){
|
public void SetLastRightClickInfo(string type, string url){
|
||||||
form.InvokeAsyncSafe(() => ContextMenuBase.SetContextInfo(type, link));
|
ContextInfo.SetLink(type, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnTweetPopup(string columnId, string chirpId, string columnName, string tweetHtml, int tweetCharacters, string tweetUrl, string quoteUrl){
|
public void OnTweetPopup(string columnId, string chirpId, string columnName, string tweetHtml, int tweetCharacters, string tweetUrl, string quoteUrl){
|
||||||
|
@@ -3,11 +3,10 @@ using System.IO;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using CefSharp;
|
using CefSharp;
|
||||||
using TweetDuck.Core.Bridge;
|
|
||||||
using TweetDuck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDuck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using TweetDuck.Core.Bridge;
|
||||||
using TweetDuck.Core.Management;
|
using TweetDuck.Core.Management;
|
||||||
using TweetDuck.Core.Notification;
|
using TweetDuck.Core.Notification;
|
||||||
using TweetDuck.Core.Other;
|
using TweetDuck.Core.Other;
|
||||||
@@ -19,19 +18,6 @@ namespace TweetDuck.Core.Handling{
|
|||||||
|
|
||||||
private static TwitterUtils.ImageQuality ImageQuality => Program.UserConfig.TwitterImageQuality;
|
private static TwitterUtils.ImageQuality ImageQuality => Program.UserConfig.TwitterImageQuality;
|
||||||
|
|
||||||
private static KeyValuePair<string, string> ContextInfo;
|
|
||||||
private static bool IsLink => ContextInfo.Key == "link";
|
|
||||||
private static bool IsImage => ContextInfo.Key == "image";
|
|
||||||
private static bool IsVideo => ContextInfo.Key == "video";
|
|
||||||
|
|
||||||
public static void SetContextInfo(string type, string link){
|
|
||||||
ContextInfo = new KeyValuePair<string, string>(string.IsNullOrEmpty(link) ? null : type, link);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string GetMediaLink(IContextMenuParams parameters){
|
|
||||||
return IsImage || IsVideo ? ContextInfo.Value : parameters.SourceUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
private const CefMenuCommand MenuOpenLinkUrl = (CefMenuCommand)26500;
|
private const CefMenuCommand MenuOpenLinkUrl = (CefMenuCommand)26500;
|
||||||
private const CefMenuCommand MenuCopyLinkUrl = (CefMenuCommand)26501;
|
private const CefMenuCommand MenuCopyLinkUrl = (CefMenuCommand)26501;
|
||||||
private const CefMenuCommand MenuCopyUsername = (CefMenuCommand)26502;
|
private const CefMenuCommand MenuCopyUsername = (CefMenuCommand)26502;
|
||||||
@@ -42,8 +28,8 @@ namespace TweetDuck.Core.Handling{
|
|||||||
private const CefMenuCommand MenuSaveTweetImages = (CefMenuCommand)26507;
|
private const CefMenuCommand MenuSaveTweetImages = (CefMenuCommand)26507;
|
||||||
private const CefMenuCommand MenuOpenDevTools = (CefMenuCommand)26599;
|
private const CefMenuCommand MenuOpenDevTools = (CefMenuCommand)26599;
|
||||||
|
|
||||||
private string[] lastHighlightedTweetAuthors;
|
protected ContextInfo.LinkInfo LastLink { get; private set; }
|
||||||
private string[] lastHighlightedTweetImageList;
|
protected ContextInfo.ChirpInfo LastChirp { get; private set; }
|
||||||
|
|
||||||
private readonly AnalyticsFile.IProvider analytics;
|
private readonly AnalyticsFile.IProvider analytics;
|
||||||
|
|
||||||
@@ -51,19 +37,23 @@ namespace TweetDuck.Core.Handling{
|
|||||||
this.analytics = analytics;
|
this.analytics = analytics;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ResetContextInfo(){
|
||||||
|
LastLink = default(ContextInfo.LinkInfo);
|
||||||
|
LastChirp = default(ContextInfo.ChirpInfo);
|
||||||
|
TweetDeckBridge.ContextInfo.Reset();
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model){
|
public virtual void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model){
|
||||||
if (!TwitterUtils.IsTweetDeckWebsite(frame) || browser.IsLoading){
|
if (!TwitterUtils.IsTweetDeckWebsite(frame) || browser.IsLoading){
|
||||||
lastHighlightedTweetAuthors = StringUtils.EmptyArray;
|
ResetContextInfo();
|
||||||
lastHighlightedTweetImageList = StringUtils.EmptyArray;
|
|
||||||
ContextInfo = default(KeyValuePair<string, string>);
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
lastHighlightedTweetAuthors = TweetDeckBridge.LastHighlightedTweetAuthorsArray;
|
LastLink = TweetDeckBridge.ContextInfo.Link;
|
||||||
lastHighlightedTweetImageList = TweetDeckBridge.LastHighlightedTweetImagesArray;
|
LastChirp = TweetDeckBridge.ContextInfo.Chirp;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasTweetImage = IsImage;
|
bool hasTweetImage = LastLink.IsImage;
|
||||||
bool hasTweetVideo = IsVideo;
|
bool hasTweetVideo = LastLink.IsVideo;
|
||||||
|
|
||||||
string TextOpen(string name) => "Open "+name+" in browser";
|
string TextOpen(string name) => "Open "+name+" in browser";
|
||||||
string TextCopy(string name) => "Copy "+name+" address";
|
string TextCopy(string name) => "Copy "+name+" address";
|
||||||
@@ -95,7 +85,7 @@ namespace TweetDuck.Core.Handling{
|
|||||||
model.AddItem(MenuCopyMediaUrl, TextCopy("image"));
|
model.AddItem(MenuCopyMediaUrl, TextCopy("image"));
|
||||||
model.AddItem(MenuSaveMedia, TextSave("image"));
|
model.AddItem(MenuSaveMedia, TextSave("image"));
|
||||||
|
|
||||||
if (lastHighlightedTweetImageList.Length > 1){
|
if (LastChirp.Images.Length > 1){
|
||||||
model.AddItem(MenuSaveTweetImages, TextSave("all images"));
|
model.AddItem(MenuSaveTweetImages, TextSave("all images"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,11 +98,11 @@ namespace TweetDuck.Core.Handling{
|
|||||||
|
|
||||||
switch(commandId){
|
switch(commandId){
|
||||||
case MenuOpenLinkUrl:
|
case MenuOpenLinkUrl:
|
||||||
OpenBrowser(control, IsLink ? ContextInfo.Value : parameters.LinkUrl);
|
OpenBrowser(control, LastLink.GetUrl(parameters, true));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MenuCopyLinkUrl:
|
case MenuCopyLinkUrl:
|
||||||
SetClipboardText(control, IsLink ? ContextInfo.Value : parameters.UnfilteredLinkUrl);
|
SetClipboardText(control, LastLink.GetUrl(parameters, false));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MenuCopyUsername:
|
case MenuCopyUsername:
|
||||||
@@ -122,35 +112,37 @@ namespace TweetDuck.Core.Handling{
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MenuOpenMediaUrl:
|
case MenuOpenMediaUrl:
|
||||||
OpenBrowser(control, TwitterUtils.GetMediaLink(GetMediaLink(parameters), ImageQuality));
|
OpenBrowser(control, TwitterUtils.GetMediaLink(LastLink.GetMediaSource(parameters), ImageQuality));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MenuCopyMediaUrl:
|
case MenuCopyMediaUrl:
|
||||||
SetClipboardText(control, TwitterUtils.GetMediaLink(GetMediaLink(parameters), ImageQuality));
|
SetClipboardText(control, TwitterUtils.GetMediaLink(LastLink.GetMediaSource(parameters), ImageQuality));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MenuViewImage:
|
case MenuViewImage:
|
||||||
string url = GetMediaLink(parameters);
|
void ViewImage(string path){
|
||||||
string file = Path.Combine(BrowserCache.CacheFolder, TwitterUtils.GetImageFileName(url));
|
string ext = Path.GetExtension(path);
|
||||||
|
|
||||||
void ViewFile(){
|
|
||||||
string ext = Path.GetExtension(file);
|
|
||||||
|
|
||||||
if (TwitterUtils.ValidImageExtensions.Contains(ext)){
|
if (TwitterUtils.ValidImageExtensions.Contains(ext)){
|
||||||
WindowsUtils.OpenAssociatedProgram(file);
|
WindowsUtils.OpenAssociatedProgram(path);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
FormMessage.Error("Image Download", "Invalid file extension "+ext, FormMessage.OK);
|
FormMessage.Error("Image Download", "Invalid file extension "+ext, FormMessage.OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string url = LastLink.GetMediaSource(parameters);
|
||||||
|
string file = Path.Combine(BrowserCache.CacheFolder, TwitterUtils.GetImageFileName(url));
|
||||||
|
|
||||||
if (File.Exists(file)){
|
if (File.Exists(file)){
|
||||||
ViewFile();
|
ViewImage(file);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
control.InvokeAsyncSafe(analytics.AnalyticsFile.ViewedImages.Trigger);
|
control.InvokeAsyncSafe(analytics.AnalyticsFile.ViewedImages.Trigger);
|
||||||
|
|
||||||
BrowserUtils.DownloadFileAsync(TwitterUtils.GetMediaLink(url, ImageQuality), file, ViewFile, ex => {
|
BrowserUtils.DownloadFileAsync(TwitterUtils.GetMediaLink(url, ImageQuality), file, () => {
|
||||||
|
ViewImage(file);
|
||||||
|
}, ex => {
|
||||||
FormMessage.Error("Image Download", "An error occurred while downloading the image: "+ex.Message, FormMessage.OK);
|
FormMessage.Error("Image Download", "An error occurred while downloading the image: "+ex.Message, FormMessage.OK);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -158,20 +150,20 @@ namespace TweetDuck.Core.Handling{
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MenuSaveMedia:
|
case MenuSaveMedia:
|
||||||
if (IsVideo){
|
if (LastLink.IsVideo){
|
||||||
control.InvokeAsyncSafe(analytics.AnalyticsFile.DownloadedVideos.Trigger);
|
control.InvokeAsyncSafe(analytics.AnalyticsFile.DownloadedVideos.Trigger);
|
||||||
TwitterUtils.DownloadVideo(GetMediaLink(parameters), lastHighlightedTweetAuthors.LastOrDefault());
|
TwitterUtils.DownloadVideo(LastLink.GetMediaSource(parameters), LastChirp.Authors.LastOrDefault());
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
control.InvokeAsyncSafe(analytics.AnalyticsFile.DownloadedImages.Trigger);
|
control.InvokeAsyncSafe(analytics.AnalyticsFile.DownloadedImages.Trigger);
|
||||||
TwitterUtils.DownloadImage(GetMediaLink(parameters), lastHighlightedTweetAuthors.LastOrDefault(), ImageQuality);
|
TwitterUtils.DownloadImage(LastLink.GetMediaSource(parameters), LastChirp.Authors.LastOrDefault(), ImageQuality);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MenuSaveTweetImages:
|
case MenuSaveTweetImages:
|
||||||
control.InvokeAsyncSafe(analytics.AnalyticsFile.DownloadedImages.Trigger);
|
control.InvokeAsyncSafe(analytics.AnalyticsFile.DownloadedImages.Trigger);
|
||||||
TwitterUtils.DownloadImages(lastHighlightedTweetImageList, lastHighlightedTweetAuthors.LastOrDefault(), ImageQuality);
|
TwitterUtils.DownloadImages(LastChirp.Images, LastChirp.Authors.LastOrDefault(), ImageQuality);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MenuOpenDevTools:
|
case MenuOpenDevTools:
|
||||||
@@ -183,7 +175,7 @@ namespace TweetDuck.Core.Handling{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public virtual void OnContextMenuDismissed(IWebBrowser browserControl, IBrowser browser, IFrame frame){
|
public virtual void OnContextMenuDismissed(IWebBrowser browserControl, IBrowser browser, IFrame frame){
|
||||||
ContextInfo = default(KeyValuePair<string, string>);
|
ResetContextInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool RunContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model, IRunContextMenuCallback callback){
|
public virtual bool RunContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model, IRunContextMenuCallback callback){
|
||||||
|
@@ -1,8 +1,6 @@
|
|||||||
using CefSharp;
|
using CefSharp;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDuck.Core.Bridge;
|
|
||||||
using TweetDuck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDuck.Core.Utils;
|
|
||||||
|
|
||||||
namespace TweetDuck.Core.Handling{
|
namespace TweetDuck.Core.Handling{
|
||||||
sealed class ContextMenuBrowser : ContextMenuBase{
|
sealed class ContextMenuBrowser : ContextMenuBase{
|
||||||
@@ -27,9 +25,6 @@ namespace TweetDuck.Core.Handling{
|
|||||||
|
|
||||||
private readonly FormBrowser form;
|
private readonly FormBrowser form;
|
||||||
|
|
||||||
private string lastHighlightedTweetUrl;
|
|
||||||
private string lastHighlightedQuoteUrl;
|
|
||||||
|
|
||||||
public ContextMenuBrowser(FormBrowser form) : base(form){
|
public ContextMenuBrowser(FormBrowser form) : base(form){
|
||||||
this.form = form;
|
this.form = form;
|
||||||
}
|
}
|
||||||
@@ -52,20 +47,12 @@ namespace TweetDuck.Core.Handling{
|
|||||||
|
|
||||||
base.OnBeforeContextMenu(browserControl, browser, frame, parameters, model);
|
base.OnBeforeContextMenu(browserControl, browser, frame, parameters, model);
|
||||||
|
|
||||||
lastHighlightedTweetUrl = TweetDeckBridge.LastHighlightedTweetUrl;
|
if (!string.IsNullOrEmpty(LastChirp.TweetUrl) && (parameters.TypeFlags & (ContextMenuType.Editable | ContextMenuType.Selection)) == 0){
|
||||||
lastHighlightedQuoteUrl = TweetDeckBridge.LastHighlightedQuoteUrl;
|
|
||||||
|
|
||||||
if (!TwitterUtils.IsTweetDeckWebsite(frame) || browser.IsLoading){
|
|
||||||
lastHighlightedTweetUrl = string.Empty;
|
|
||||||
lastHighlightedQuoteUrl = string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(lastHighlightedTweetUrl) && (parameters.TypeFlags & (ContextMenuType.Editable | ContextMenuType.Selection)) == 0){
|
|
||||||
model.AddItem(MenuOpenTweetUrl, "Open tweet in browser");
|
model.AddItem(MenuOpenTweetUrl, "Open tweet in browser");
|
||||||
model.AddItem(MenuCopyTweetUrl, "Copy tweet address");
|
model.AddItem(MenuCopyTweetUrl, "Copy tweet address");
|
||||||
model.AddItem(MenuScreenshotTweet, "Screenshot tweet to clipboard");
|
model.AddItem(MenuScreenshotTweet, "Screenshot tweet to clipboard");
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(lastHighlightedQuoteUrl)){
|
if (!string.IsNullOrEmpty(LastChirp.QuoteUrl)){
|
||||||
model.AddSeparator();
|
model.AddSeparator();
|
||||||
model.AddItem(MenuOpenQuotedTweetUrl, "Open quoted tweet in browser");
|
model.AddItem(MenuOpenQuotedTweetUrl, "Open quoted tweet in browser");
|
||||||
model.AddItem(MenuCopyQuotedTweetUrl, "Copy quoted tweet address");
|
model.AddItem(MenuCopyQuotedTweetUrl, "Copy quoted tweet address");
|
||||||
@@ -126,11 +113,11 @@ namespace TweetDuck.Core.Handling{
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
case MenuOpenTweetUrl:
|
case MenuOpenTweetUrl:
|
||||||
OpenBrowser(form, lastHighlightedTweetUrl);
|
OpenBrowser(form, LastChirp.TweetUrl);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case MenuCopyTweetUrl:
|
case MenuCopyTweetUrl:
|
||||||
SetClipboardText(form, lastHighlightedTweetUrl);
|
SetClipboardText(form, LastChirp.TweetUrl);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case MenuScreenshotTweet:
|
case MenuScreenshotTweet:
|
||||||
@@ -138,11 +125,11 @@ namespace TweetDuck.Core.Handling{
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
case MenuOpenQuotedTweetUrl:
|
case MenuOpenQuotedTweetUrl:
|
||||||
OpenBrowser(form, lastHighlightedQuoteUrl);
|
OpenBrowser(form, LastChirp.QuoteUrl);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case MenuCopyQuotedTweetUrl:
|
case MenuCopyQuotedTweetUrl:
|
||||||
SetClipboardText(form, lastHighlightedQuoteUrl);
|
SetClipboardText(form, LastChirp.QuoteUrl);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case MenuInputApplyROT13:
|
case MenuInputApplyROT13:
|
||||||
|
@@ -3,6 +3,8 @@ using CefSharp;
|
|||||||
|
|
||||||
namespace TweetDuck.Core{
|
namespace TweetDuck.Core{
|
||||||
interface ITweetDeckBrowser{
|
interface ITweetDeckBrowser{
|
||||||
|
bool IsTweetDeckWebsite { get; }
|
||||||
|
|
||||||
void RegisterBridge(string name, object obj);
|
void RegisterBridge(string name, object obj);
|
||||||
void OnFrameLoaded(Action<IFrame> callback);
|
void OnFrameLoaded(Action<IFrame> callback);
|
||||||
void ExecuteFunction(string name, params object[] args);
|
void ExecuteFunction(string name, params object[] args);
|
||||||
|
68
Core/Management/ContextInfo.cs
Normal file
68
Core/Management/ContextInfo.cs
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
using CefSharp;
|
||||||
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
|
namespace TweetDuck.Core.Management{
|
||||||
|
sealed class ContextInfo{
|
||||||
|
public LinkInfo Link { get; private set; }
|
||||||
|
public ChirpInfo Chirp { get; private set; }
|
||||||
|
|
||||||
|
public ContextInfo(){
|
||||||
|
Reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetLink(string type, string url){
|
||||||
|
Link = new LinkInfo(string.IsNullOrEmpty(url) ? null : type, url);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetChirp(string tweetUrl, string quoteUrl, string chirpAuthors, string chirpImages){
|
||||||
|
Chirp = new ChirpInfo(tweetUrl, quoteUrl, chirpAuthors, chirpImages);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Reset(){
|
||||||
|
Link = new LinkInfo();
|
||||||
|
Chirp = new ChirpInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Data structures
|
||||||
|
|
||||||
|
public struct LinkInfo{
|
||||||
|
public bool IsLink => type == "link";
|
||||||
|
public bool IsImage => type == "image";
|
||||||
|
public bool IsVideo => type == "video";
|
||||||
|
|
||||||
|
public string GetUrl(IContextMenuParams parameters, bool safe){
|
||||||
|
return IsLink ? url : (safe ? parameters.LinkUrl : parameters.UnfilteredLinkUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetMediaSource(IContextMenuParams parameters){
|
||||||
|
return IsImage || IsVideo ? url : parameters.SourceUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly string type;
|
||||||
|
private readonly string url;
|
||||||
|
|
||||||
|
public LinkInfo(string type, string url){
|
||||||
|
this.type = type;
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public struct ChirpInfo{
|
||||||
|
public string TweetUrl { get; }
|
||||||
|
public string QuoteUrl { get; }
|
||||||
|
|
||||||
|
public string[] Authors => chirpAuthors?.Split(';') ?? StringUtils.EmptyArray;
|
||||||
|
public string[] Images => chirpImages?.Split(';') ?? StringUtils.EmptyArray;
|
||||||
|
|
||||||
|
private readonly string chirpAuthors;
|
||||||
|
private readonly string chirpImages;
|
||||||
|
|
||||||
|
public ChirpInfo(string tweetUrl, string quoteUrl, string chirpAuthors, string chirpImages){
|
||||||
|
this.TweetUrl = tweetUrl;
|
||||||
|
this.QuoteUrl = quoteUrl;
|
||||||
|
this.chirpAuthors = chirpAuthors;
|
||||||
|
this.chirpImages = chirpImages;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -135,12 +135,6 @@ namespace TweetDuck.Core.Notification{
|
|||||||
this.browser.ClientSize = ClientSize;
|
this.browser.ClientSize = ClientSize;
|
||||||
this.browser.IsBrowserInitializedChanged += browser_IsBrowserInitializedChanged;
|
this.browser.IsBrowserInitializedChanged += browser_IsBrowserInitializedChanged;
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
this.browser.ConsoleMessage += BrowserUtils.HandleConsoleMessage;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
DpiScale = this.GetDPIScale();
|
|
||||||
|
|
||||||
browser.SetupResourceHandler(TwitterUtils.TweetDeckURL, this.resourceHandler);
|
browser.SetupResourceHandler(TwitterUtils.TweetDeckURL, this.resourceHandler);
|
||||||
browser.SetupResourceHandler(TweetNotification.AppLogo);
|
browser.SetupResourceHandler(TweetNotification.AppLogo);
|
||||||
|
|
||||||
@@ -151,6 +145,8 @@ namespace TweetDuck.Core.Notification{
|
|||||||
this.owner.FormClosed -= owner_FormClosed;
|
this.owner.FormClosed -= owner_FormClosed;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
DpiScale = this.GetDPIScale();
|
||||||
|
|
||||||
// ReSharper disable once VirtualMemberCallInContructor
|
// ReSharper disable once VirtualMemberCallInContructor
|
||||||
UpdateTitle();
|
UpdateTitle();
|
||||||
}
|
}
|
||||||
|
@@ -92,6 +92,10 @@ namespace TweetDuck.Core.Notification{
|
|||||||
Disposed += (sender, args) => StopMouseHook(true);
|
Disposed += (sender, args) => StopMouseHook(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// implementation of ITweetDeckBrowser
|
||||||
|
|
||||||
|
bool ITweetDeckBrowser.IsTweetDeckWebsite => IsNotificationVisible;
|
||||||
|
|
||||||
void ITweetDeckBrowser.RegisterBridge(string name, object obj){
|
void ITweetDeckBrowser.RegisterBridge(string name, object obj){
|
||||||
browser.RegisterAsyncJsObject(name, obj);
|
browser.RegisterAsyncJsObject(name, obj);
|
||||||
}
|
}
|
||||||
|
@@ -42,7 +42,7 @@ namespace TweetDuck.Core.Other.Analytics{
|
|||||||
{ "Clear Cache Threshold" , Exact(SysConfig.ClearCacheThreshold) },
|
{ "Clear Cache Threshold" , Exact(SysConfig.ClearCacheThreshold) },
|
||||||
0,
|
0,
|
||||||
{ "Expand Links" , Bool(UserConfig.ExpandLinksOnHover) },
|
{ "Expand Links" , Bool(UserConfig.ExpandLinksOnHover) },
|
||||||
{ "Switch Account Selectors" , Bool(UserConfig.SwitchAccountSelectors) },
|
{ "Switch Account Selectors" , Bool(false) }, // TODO remove in next major update
|
||||||
{ "Search In First Column" , Bool(UserConfig.OpenSearchInFirstColumn) },
|
{ "Search In First Column" , Bool(UserConfig.OpenSearchInFirstColumn) },
|
||||||
{ "Keep Like Follow Dialogs Open" , Bool(UserConfig.KeepLikeFollowDialogsOpen) },
|
{ "Keep Like Follow Dialogs Open" , Bool(UserConfig.KeepLikeFollowDialogsOpen) },
|
||||||
{ "Best Image Quality" , Bool(UserConfig.BestImageQuality) },
|
{ "Best Image Quality" , Bool(UserConfig.BestImageQuality) },
|
||||||
|
44
Core/Other/Settings/TabSettingsGeneral.Designer.cs
generated
44
Core/Other/Settings/TabSettingsGeneral.Designer.cs
generated
@@ -29,7 +29,6 @@
|
|||||||
this.checkUpdateNotifications = new System.Windows.Forms.CheckBox();
|
this.checkUpdateNotifications = new System.Windows.Forms.CheckBox();
|
||||||
this.btnCheckUpdates = new System.Windows.Forms.Button();
|
this.btnCheckUpdates = new System.Windows.Forms.Button();
|
||||||
this.labelZoomValue = new System.Windows.Forms.Label();
|
this.labelZoomValue = new System.Windows.Forms.Label();
|
||||||
this.checkSwitchAccountSelectors = new System.Windows.Forms.CheckBox();
|
|
||||||
this.checkBestImageQuality = new System.Windows.Forms.CheckBox();
|
this.checkBestImageQuality = new System.Windows.Forms.CheckBox();
|
||||||
this.checkOpenSearchInFirstColumn = new System.Windows.Forms.CheckBox();
|
this.checkOpenSearchInFirstColumn = new System.Windows.Forms.CheckBox();
|
||||||
this.trackBarZoom = new System.Windows.Forms.TrackBar();
|
this.trackBarZoom = new System.Windows.Forms.TrackBar();
|
||||||
@@ -64,7 +63,7 @@
|
|||||||
// checkUpdateNotifications
|
// checkUpdateNotifications
|
||||||
//
|
//
|
||||||
this.checkUpdateNotifications.AutoSize = true;
|
this.checkUpdateNotifications.AutoSize = true;
|
||||||
this.checkUpdateNotifications.Location = new System.Drawing.Point(6, 386);
|
this.checkUpdateNotifications.Location = new System.Drawing.Point(6, 363);
|
||||||
this.checkUpdateNotifications.Margin = new System.Windows.Forms.Padding(6, 6, 3, 3);
|
this.checkUpdateNotifications.Margin = new System.Windows.Forms.Padding(6, 6, 3, 3);
|
||||||
this.checkUpdateNotifications.Name = "checkUpdateNotifications";
|
this.checkUpdateNotifications.Name = "checkUpdateNotifications";
|
||||||
this.checkUpdateNotifications.Size = new System.Drawing.Size(165, 17);
|
this.checkUpdateNotifications.Size = new System.Drawing.Size(165, 17);
|
||||||
@@ -74,7 +73,7 @@
|
|||||||
//
|
//
|
||||||
// btnCheckUpdates
|
// btnCheckUpdates
|
||||||
//
|
//
|
||||||
this.btnCheckUpdates.Location = new System.Drawing.Point(5, 409);
|
this.btnCheckUpdates.Location = new System.Drawing.Point(5, 386);
|
||||||
this.btnCheckUpdates.Margin = new System.Windows.Forms.Padding(5, 3, 3, 3);
|
this.btnCheckUpdates.Margin = new System.Windows.Forms.Padding(5, 3, 3, 3);
|
||||||
this.btnCheckUpdates.Name = "btnCheckUpdates";
|
this.btnCheckUpdates.Name = "btnCheckUpdates";
|
||||||
this.btnCheckUpdates.Size = new System.Drawing.Size(144, 23);
|
this.btnCheckUpdates.Size = new System.Drawing.Size(144, 23);
|
||||||
@@ -93,21 +92,10 @@
|
|||||||
this.labelZoomValue.Text = "100%";
|
this.labelZoomValue.Text = "100%";
|
||||||
this.labelZoomValue.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
this.labelZoomValue.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||||
//
|
//
|
||||||
// checkSwitchAccountSelectors
|
|
||||||
//
|
|
||||||
this.checkSwitchAccountSelectors.AutoSize = true;
|
|
||||||
this.checkSwitchAccountSelectors.Location = new System.Drawing.Point(6, 49);
|
|
||||||
this.checkSwitchAccountSelectors.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
|
|
||||||
this.checkSwitchAccountSelectors.Name = "checkSwitchAccountSelectors";
|
|
||||||
this.checkSwitchAccountSelectors.Size = new System.Drawing.Size(172, 17);
|
|
||||||
this.checkSwitchAccountSelectors.TabIndex = 2;
|
|
||||||
this.checkSwitchAccountSelectors.Text = "Shift Selects Multiple Accounts";
|
|
||||||
this.checkSwitchAccountSelectors.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// checkBestImageQuality
|
// checkBestImageQuality
|
||||||
//
|
//
|
||||||
this.checkBestImageQuality.AutoSize = true;
|
this.checkBestImageQuality.AutoSize = true;
|
||||||
this.checkBestImageQuality.Location = new System.Drawing.Point(6, 118);
|
this.checkBestImageQuality.Location = new System.Drawing.Point(6, 95);
|
||||||
this.checkBestImageQuality.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
|
this.checkBestImageQuality.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
|
||||||
this.checkBestImageQuality.Name = "checkBestImageQuality";
|
this.checkBestImageQuality.Name = "checkBestImageQuality";
|
||||||
this.checkBestImageQuality.Size = new System.Drawing.Size(114, 17);
|
this.checkBestImageQuality.Size = new System.Drawing.Size(114, 17);
|
||||||
@@ -118,7 +106,7 @@
|
|||||||
// checkOpenSearchInFirstColumn
|
// checkOpenSearchInFirstColumn
|
||||||
//
|
//
|
||||||
this.checkOpenSearchInFirstColumn.AutoSize = true;
|
this.checkOpenSearchInFirstColumn.AutoSize = true;
|
||||||
this.checkOpenSearchInFirstColumn.Location = new System.Drawing.Point(6, 72);
|
this.checkOpenSearchInFirstColumn.Location = new System.Drawing.Point(6, 49);
|
||||||
this.checkOpenSearchInFirstColumn.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
|
this.checkOpenSearchInFirstColumn.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
|
||||||
this.checkOpenSearchInFirstColumn.Name = "checkOpenSearchInFirstColumn";
|
this.checkOpenSearchInFirstColumn.Name = "checkOpenSearchInFirstColumn";
|
||||||
this.checkOpenSearchInFirstColumn.Size = new System.Drawing.Size(219, 17);
|
this.checkOpenSearchInFirstColumn.Size = new System.Drawing.Size(219, 17);
|
||||||
@@ -144,7 +132,7 @@
|
|||||||
// labelZoom
|
// labelZoom
|
||||||
//
|
//
|
||||||
this.labelZoom.AutoSize = true;
|
this.labelZoom.AutoSize = true;
|
||||||
this.labelZoom.Location = new System.Drawing.Point(3, 291);
|
this.labelZoom.Location = new System.Drawing.Point(3, 268);
|
||||||
this.labelZoom.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
this.labelZoom.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||||
this.labelZoom.Name = "labelZoom";
|
this.labelZoom.Name = "labelZoom";
|
||||||
this.labelZoom.Size = new System.Drawing.Size(34, 13);
|
this.labelZoom.Size = new System.Drawing.Size(34, 13);
|
||||||
@@ -172,7 +160,7 @@
|
|||||||
this.panelZoom.Anchor = System.Windows.Forms.AnchorStyles.Top;
|
this.panelZoom.Anchor = System.Windows.Forms.AnchorStyles.Top;
|
||||||
this.panelZoom.Controls.Add(this.trackBarZoom);
|
this.panelZoom.Controls.Add(this.trackBarZoom);
|
||||||
this.panelZoom.Controls.Add(this.labelZoomValue);
|
this.panelZoom.Controls.Add(this.labelZoomValue);
|
||||||
this.panelZoom.Location = new System.Drawing.Point(0, 304);
|
this.panelZoom.Location = new System.Drawing.Point(0, 281);
|
||||||
this.panelZoom.Margin = new System.Windows.Forms.Padding(0);
|
this.panelZoom.Margin = new System.Windows.Forms.Padding(0);
|
||||||
this.panelZoom.Name = "panelZoom";
|
this.panelZoom.Name = "panelZoom";
|
||||||
this.panelZoom.Size = new System.Drawing.Size(322, 36);
|
this.panelZoom.Size = new System.Drawing.Size(322, 36);
|
||||||
@@ -181,7 +169,7 @@
|
|||||||
// checkAnimatedAvatars
|
// checkAnimatedAvatars
|
||||||
//
|
//
|
||||||
this.checkAnimatedAvatars.AutoSize = true;
|
this.checkAnimatedAvatars.AutoSize = true;
|
||||||
this.checkAnimatedAvatars.Location = new System.Drawing.Point(6, 141);
|
this.checkAnimatedAvatars.Location = new System.Drawing.Point(6, 118);
|
||||||
this.checkAnimatedAvatars.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
|
this.checkAnimatedAvatars.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
|
||||||
this.checkAnimatedAvatars.Name = "checkAnimatedAvatars";
|
this.checkAnimatedAvatars.Name = "checkAnimatedAvatars";
|
||||||
this.checkAnimatedAvatars.Size = new System.Drawing.Size(145, 17);
|
this.checkAnimatedAvatars.Size = new System.Drawing.Size(145, 17);
|
||||||
@@ -193,7 +181,7 @@
|
|||||||
//
|
//
|
||||||
this.labelUpdates.AutoSize = true;
|
this.labelUpdates.AutoSize = true;
|
||||||
this.labelUpdates.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
this.labelUpdates.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||||
this.labelUpdates.Location = new System.Drawing.Point(0, 360);
|
this.labelUpdates.Location = new System.Drawing.Point(0, 337);
|
||||||
this.labelUpdates.Margin = new System.Windows.Forms.Padding(0, 20, 0, 0);
|
this.labelUpdates.Margin = new System.Windows.Forms.Padding(0, 20, 0, 0);
|
||||||
this.labelUpdates.Name = "labelUpdates";
|
this.labelUpdates.Name = "labelUpdates";
|
||||||
this.labelUpdates.Size = new System.Drawing.Size(70, 20);
|
this.labelUpdates.Size = new System.Drawing.Size(70, 20);
|
||||||
@@ -207,7 +195,6 @@
|
|||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.flowPanel.Controls.Add(this.labelUI);
|
this.flowPanel.Controls.Add(this.labelUI);
|
||||||
this.flowPanel.Controls.Add(this.checkExpandLinks);
|
this.flowPanel.Controls.Add(this.checkExpandLinks);
|
||||||
this.flowPanel.Controls.Add(this.checkSwitchAccountSelectors);
|
|
||||||
this.flowPanel.Controls.Add(this.checkOpenSearchInFirstColumn);
|
this.flowPanel.Controls.Add(this.checkOpenSearchInFirstColumn);
|
||||||
this.flowPanel.Controls.Add(this.checkKeepLikeFollowDialogsOpen);
|
this.flowPanel.Controls.Add(this.checkKeepLikeFollowDialogsOpen);
|
||||||
this.flowPanel.Controls.Add(this.checkBestImageQuality);
|
this.flowPanel.Controls.Add(this.checkBestImageQuality);
|
||||||
@@ -224,14 +211,14 @@
|
|||||||
this.flowPanel.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
this.flowPanel.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
||||||
this.flowPanel.Location = new System.Drawing.Point(9, 9);
|
this.flowPanel.Location = new System.Drawing.Point(9, 9);
|
||||||
this.flowPanel.Name = "flowPanel";
|
this.flowPanel.Name = "flowPanel";
|
||||||
this.flowPanel.Size = new System.Drawing.Size(322, 438);
|
this.flowPanel.Size = new System.Drawing.Size(322, 415);
|
||||||
this.flowPanel.TabIndex = 0;
|
this.flowPanel.TabIndex = 0;
|
||||||
this.flowPanel.WrapContents = false;
|
this.flowPanel.WrapContents = false;
|
||||||
//
|
//
|
||||||
// checkKeepLikeFollowDialogsOpen
|
// checkKeepLikeFollowDialogsOpen
|
||||||
//
|
//
|
||||||
this.checkKeepLikeFollowDialogsOpen.AutoSize = true;
|
this.checkKeepLikeFollowDialogsOpen.AutoSize = true;
|
||||||
this.checkKeepLikeFollowDialogsOpen.Location = new System.Drawing.Point(6, 95);
|
this.checkKeepLikeFollowDialogsOpen.Location = new System.Drawing.Point(6, 72);
|
||||||
this.checkKeepLikeFollowDialogsOpen.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
|
this.checkKeepLikeFollowDialogsOpen.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
|
||||||
this.checkKeepLikeFollowDialogsOpen.Name = "checkKeepLikeFollowDialogsOpen";
|
this.checkKeepLikeFollowDialogsOpen.Name = "checkKeepLikeFollowDialogsOpen";
|
||||||
this.checkKeepLikeFollowDialogsOpen.Size = new System.Drawing.Size(176, 17);
|
this.checkKeepLikeFollowDialogsOpen.Size = new System.Drawing.Size(176, 17);
|
||||||
@@ -243,7 +230,7 @@
|
|||||||
//
|
//
|
||||||
this.labelBrowserSettings.AutoSize = true;
|
this.labelBrowserSettings.AutoSize = true;
|
||||||
this.labelBrowserSettings.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
this.labelBrowserSettings.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||||
this.labelBrowserSettings.Location = new System.Drawing.Point(0, 181);
|
this.labelBrowserSettings.Location = new System.Drawing.Point(0, 158);
|
||||||
this.labelBrowserSettings.Margin = new System.Windows.Forms.Padding(0, 20, 0, 0);
|
this.labelBrowserSettings.Margin = new System.Windows.Forms.Padding(0, 20, 0, 0);
|
||||||
this.labelBrowserSettings.Name = "labelBrowserSettings";
|
this.labelBrowserSettings.Name = "labelBrowserSettings";
|
||||||
this.labelBrowserSettings.Size = new System.Drawing.Size(130, 20);
|
this.labelBrowserSettings.Size = new System.Drawing.Size(130, 20);
|
||||||
@@ -253,7 +240,7 @@
|
|||||||
// checkSmoothScrolling
|
// checkSmoothScrolling
|
||||||
//
|
//
|
||||||
this.checkSmoothScrolling.AutoSize = true;
|
this.checkSmoothScrolling.AutoSize = true;
|
||||||
this.checkSmoothScrolling.Location = new System.Drawing.Point(6, 207);
|
this.checkSmoothScrolling.Location = new System.Drawing.Point(6, 184);
|
||||||
this.checkSmoothScrolling.Margin = new System.Windows.Forms.Padding(6, 6, 3, 3);
|
this.checkSmoothScrolling.Margin = new System.Windows.Forms.Padding(6, 6, 3, 3);
|
||||||
this.checkSmoothScrolling.Name = "checkSmoothScrolling";
|
this.checkSmoothScrolling.Name = "checkSmoothScrolling";
|
||||||
this.checkSmoothScrolling.Size = new System.Drawing.Size(105, 17);
|
this.checkSmoothScrolling.Size = new System.Drawing.Size(105, 17);
|
||||||
@@ -264,7 +251,7 @@
|
|||||||
// labelBrowserPath
|
// labelBrowserPath
|
||||||
//
|
//
|
||||||
this.labelBrowserPath.AutoSize = true;
|
this.labelBrowserPath.AutoSize = true;
|
||||||
this.labelBrowserPath.Location = new System.Drawing.Point(3, 239);
|
this.labelBrowserPath.Location = new System.Drawing.Point(3, 216);
|
||||||
this.labelBrowserPath.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
this.labelBrowserPath.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||||
this.labelBrowserPath.Name = "labelBrowserPath";
|
this.labelBrowserPath.Name = "labelBrowserPath";
|
||||||
this.labelBrowserPath.Size = new System.Drawing.Size(95, 13);
|
this.labelBrowserPath.Size = new System.Drawing.Size(95, 13);
|
||||||
@@ -275,7 +262,7 @@
|
|||||||
//
|
//
|
||||||
this.comboBoxBrowserPath.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
this.comboBoxBrowserPath.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
this.comboBoxBrowserPath.FormattingEnabled = true;
|
this.comboBoxBrowserPath.FormattingEnabled = true;
|
||||||
this.comboBoxBrowserPath.Location = new System.Drawing.Point(5, 255);
|
this.comboBoxBrowserPath.Location = new System.Drawing.Point(5, 232);
|
||||||
this.comboBoxBrowserPath.Margin = new System.Windows.Forms.Padding(5, 3, 3, 3);
|
this.comboBoxBrowserPath.Margin = new System.Windows.Forms.Padding(5, 3, 3, 3);
|
||||||
this.comboBoxBrowserPath.Name = "comboBoxBrowserPath";
|
this.comboBoxBrowserPath.Name = "comboBoxBrowserPath";
|
||||||
this.comboBoxBrowserPath.Size = new System.Drawing.Size(173, 21);
|
this.comboBoxBrowserPath.Size = new System.Drawing.Size(173, 21);
|
||||||
@@ -287,7 +274,7 @@
|
|||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.Controls.Add(this.flowPanel);
|
this.Controls.Add(this.flowPanel);
|
||||||
this.Name = "TabSettingsGeneral";
|
this.Name = "TabSettingsGeneral";
|
||||||
this.Size = new System.Drawing.Size(340, 456);
|
this.Size = new System.Drawing.Size(340, 433);
|
||||||
((System.ComponentModel.ISupportInitialize)(this.trackBarZoom)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.trackBarZoom)).EndInit();
|
||||||
this.panelZoom.ResumeLayout(false);
|
this.panelZoom.ResumeLayout(false);
|
||||||
this.flowPanel.ResumeLayout(false);
|
this.flowPanel.ResumeLayout(false);
|
||||||
@@ -306,7 +293,6 @@
|
|||||||
private System.Windows.Forms.Label labelZoomValue;
|
private System.Windows.Forms.Label labelZoomValue;
|
||||||
private System.Windows.Forms.TrackBar trackBarZoom;
|
private System.Windows.Forms.TrackBar trackBarZoom;
|
||||||
private System.Windows.Forms.Timer zoomUpdateTimer;
|
private System.Windows.Forms.Timer zoomUpdateTimer;
|
||||||
private System.Windows.Forms.CheckBox checkSwitchAccountSelectors;
|
|
||||||
private System.Windows.Forms.Label labelUI;
|
private System.Windows.Forms.Label labelUI;
|
||||||
private System.Windows.Forms.Panel panelZoom;
|
private System.Windows.Forms.Panel panelZoom;
|
||||||
private System.Windows.Forms.Label labelUpdates;
|
private System.Windows.Forms.Label labelUpdates;
|
||||||
|
@@ -26,7 +26,6 @@ namespace TweetDuck.Core.Other.Settings{
|
|||||||
Disposed += (sender, args) => this.updates.CheckFinished -= updates_CheckFinished;
|
Disposed += (sender, args) => this.updates.CheckFinished -= updates_CheckFinished;
|
||||||
|
|
||||||
toolTip.SetToolTip(checkExpandLinks, "Expands links inside the tweets. If disabled,\r\nthe full links show up in a tooltip instead.");
|
toolTip.SetToolTip(checkExpandLinks, "Expands links inside the tweets. If disabled,\r\nthe full links show up in a tooltip instead.");
|
||||||
toolTip.SetToolTip(checkSwitchAccountSelectors, "When (re)tweeting, click to select a single account or hold Shift to\r\nselect multiple accounts, instead of TweetDeck\'s default behavior.");
|
|
||||||
toolTip.SetToolTip(checkOpenSearchInFirstColumn, "By default, TweetDeck adds Search columns at the end.\r\nThis option makes them appear before the first column instead.");
|
toolTip.SetToolTip(checkOpenSearchInFirstColumn, "By default, TweetDeck adds Search columns at the end.\r\nThis option makes them appear before the first column instead.");
|
||||||
toolTip.SetToolTip(checkKeepLikeFollowDialogsOpen, "Allows liking and following from multiple accounts at once,\r\ninstead of automatically closing the dialog after taking an action.");
|
toolTip.SetToolTip(checkKeepLikeFollowDialogsOpen, "Allows liking and following from multiple accounts at once,\r\ninstead of automatically closing the dialog after taking an action.");
|
||||||
toolTip.SetToolTip(checkBestImageQuality, "When right-clicking a tweet image, the context menu options\r\nwill use links to the original image size (:orig in the URL).");
|
toolTip.SetToolTip(checkBestImageQuality, "When right-clicking a tweet image, the context menu options\r\nwill use links to the original image size (:orig in the URL).");
|
||||||
@@ -41,7 +40,6 @@ namespace TweetDuck.Core.Other.Settings{
|
|||||||
toolTip.SetToolTip(btnCheckUpdates, "Forces an update check, even for updates that had been dismissed.");
|
toolTip.SetToolTip(btnCheckUpdates, "Forces an update check, even for updates that had been dismissed.");
|
||||||
|
|
||||||
checkExpandLinks.Checked = Config.ExpandLinksOnHover;
|
checkExpandLinks.Checked = Config.ExpandLinksOnHover;
|
||||||
checkSwitchAccountSelectors.Checked = Config.SwitchAccountSelectors;
|
|
||||||
checkOpenSearchInFirstColumn.Checked = Config.OpenSearchInFirstColumn;
|
checkOpenSearchInFirstColumn.Checked = Config.OpenSearchInFirstColumn;
|
||||||
checkKeepLikeFollowDialogsOpen.Checked = Config.KeepLikeFollowDialogsOpen;
|
checkKeepLikeFollowDialogsOpen.Checked = Config.KeepLikeFollowDialogsOpen;
|
||||||
checkBestImageQuality.Checked = Config.BestImageQuality;
|
checkBestImageQuality.Checked = Config.BestImageQuality;
|
||||||
@@ -65,7 +63,6 @@ namespace TweetDuck.Core.Other.Settings{
|
|||||||
|
|
||||||
public override void OnReady(){
|
public override void OnReady(){
|
||||||
checkExpandLinks.CheckedChanged += checkExpandLinks_CheckedChanged;
|
checkExpandLinks.CheckedChanged += checkExpandLinks_CheckedChanged;
|
||||||
checkSwitchAccountSelectors.CheckedChanged += checkSwitchAccountSelectors_CheckedChanged;
|
|
||||||
checkOpenSearchInFirstColumn.CheckedChanged += checkOpenSearchInFirstColumn_CheckedChanged;
|
checkOpenSearchInFirstColumn.CheckedChanged += checkOpenSearchInFirstColumn_CheckedChanged;
|
||||||
checkKeepLikeFollowDialogsOpen.CheckedChanged += checkKeepLikeFollowDialogsOpen_CheckedChanged;
|
checkKeepLikeFollowDialogsOpen.CheckedChanged += checkKeepLikeFollowDialogsOpen_CheckedChanged;
|
||||||
checkBestImageQuality.CheckedChanged += checkBestImageQuality_CheckedChanged;
|
checkBestImageQuality.CheckedChanged += checkBestImageQuality_CheckedChanged;
|
||||||
@@ -87,10 +84,6 @@ namespace TweetDuck.Core.Other.Settings{
|
|||||||
Config.ExpandLinksOnHover = checkExpandLinks.Checked;
|
Config.ExpandLinksOnHover = checkExpandLinks.Checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkSwitchAccountSelectors_CheckedChanged(object sender, EventArgs e){
|
|
||||||
Config.SwitchAccountSelectors = checkSwitchAccountSelectors.Checked;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkOpenSearchInFirstColumn_CheckedChanged(object sender, EventArgs e){
|
private void checkOpenSearchInFirstColumn_CheckedChanged(object sender, EventArgs e){
|
||||||
Config.OpenSearchInFirstColumn = checkOpenSearchInFirstColumn.Checked;
|
Config.OpenSearchInFirstColumn = checkOpenSearchInFirstColumn.Checked;
|
||||||
}
|
}
|
||||||
@@ -170,6 +163,11 @@ namespace TweetDuck.Core.Other.Settings{
|
|||||||
|
|
||||||
btnCheckUpdates.Enabled = false;
|
btnCheckUpdates.Enabled = false;
|
||||||
updateCheckEventId = updates.Check(true);
|
updateCheckEventId = updates.Check(true);
|
||||||
|
|
||||||
|
if (updateCheckEventId == UpdateHandler.CheckCodeNotOnTweetDeck){
|
||||||
|
FormMessage.Error("Update Check", "Updates can only be checked once TweetDeck is fully loaded.", FormMessage.OK);
|
||||||
|
btnCheckUpdates.Enabled = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updates_CheckFinished(object sender, UpdateEventArgs e){
|
private void updates_CheckFinished(object sender, UpdateEventArgs e){
|
||||||
|
@@ -22,6 +22,10 @@ namespace TweetDuck.Core{
|
|||||||
|
|
||||||
public bool IsTweetDeckWebsite{
|
public bool IsTweetDeckWebsite{
|
||||||
get{
|
get{
|
||||||
|
if (!Ready){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
using(IFrame frame = browser.GetBrowser().MainFrame){
|
using(IFrame frame = browser.GetBrowser().MainFrame){
|
||||||
return TwitterUtils.IsTweetDeckWebsite(frame);
|
return TwitterUtils.IsTweetDeckWebsite(frame);
|
||||||
}
|
}
|
||||||
@@ -43,10 +47,6 @@ namespace TweetDuck.Core{
|
|||||||
RequestHandler = new RequestHandlerBrowser()
|
RequestHandler = new RequestHandlerBrowser()
|
||||||
};
|
};
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
this.browser.ConsoleMessage += BrowserUtils.HandleConsoleMessage;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
this.browser.LoadingStateChanged += browser_LoadingStateChanged;
|
this.browser.LoadingStateChanged += browser_LoadingStateChanged;
|
||||||
this.browser.FrameLoadStart += browser_FrameLoadStart;
|
this.browser.FrameLoadStart += browser_FrameLoadStart;
|
||||||
this.browser.FrameLoadEnd += browser_FrameLoadEnd;
|
this.browser.FrameLoadEnd += browser_FrameLoadEnd;
|
||||||
@@ -122,14 +122,18 @@ namespace TweetDuck.Core{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void browser_FrameLoadStart(object sender, FrameLoadStartEventArgs e){
|
private void browser_FrameLoadStart(object sender, FrameLoadStartEventArgs e){
|
||||||
if (e.Frame.IsMain){
|
IFrame frame = e.Frame;
|
||||||
|
|
||||||
|
if (frame.IsMain){
|
||||||
if (Program.UserConfig.ZoomLevel != 100){
|
if (Program.UserConfig.ZoomLevel != 100){
|
||||||
BrowserUtils.SetZoomLevel(browser.GetBrowser(), Program.UserConfig.ZoomLevel);
|
BrowserUtils.SetZoomLevel(browser.GetBrowser(), Program.UserConfig.ZoomLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TwitterUtils.IsTwitterWebsite(e.Frame)){
|
if (TwitterUtils.IsTwitterWebsite(frame)){
|
||||||
ScriptLoader.ExecuteFile(e.Frame, "twitter.js");
|
ScriptLoader.ExecuteFile(frame, "twitter.js");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
frame.ExecuteJavaScriptAsync(TwitterUtils.BackgroundColorOverride);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,8 +141,6 @@ namespace TweetDuck.Core{
|
|||||||
IFrame frame = e.Frame;
|
IFrame frame = e.Frame;
|
||||||
|
|
||||||
if (frame.IsMain && TwitterUtils.IsTweetDeckWebsite(frame)){
|
if (frame.IsMain && TwitterUtils.IsTweetDeckWebsite(frame)){
|
||||||
frame.ExecuteJavaScriptAsync(TwitterUtils.BackgroundColorOverride);
|
|
||||||
|
|
||||||
UpdateProperties();
|
UpdateProperties();
|
||||||
TweetDeckBridge.RestoreSessionData(frame);
|
TweetDeckBridge.RestoreSessionData(frame);
|
||||||
ScriptLoader.ExecuteFile(frame, "code.js");
|
ScriptLoader.ExecuteFile(frame, "code.js");
|
||||||
|
@@ -137,6 +137,8 @@ namespace TweetDuck.Core.Utils{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static WebClient CreateWebClient(){
|
public static WebClient CreateWebClient(){
|
||||||
|
WindowsUtils.EnsureTLS12();
|
||||||
|
|
||||||
WebClient client = new WebClient{ Proxy = null };
|
WebClient client = new WebClient{ Proxy = null };
|
||||||
client.Headers[HttpRequestHeader.UserAgent] = HeaderUserAgent;
|
client.Headers[HttpRequestHeader.UserAgent] = HeaderUserAgent;
|
||||||
return client;
|
return client;
|
||||||
@@ -172,11 +174,5 @@ namespace TweetDuck.Core.Utils{
|
|||||||
public static void SetZoomLevel(IBrowser browser, int percentage){
|
public static void SetZoomLevel(IBrowser browser, int percentage){
|
||||||
browser.GetHost().SetZoomLevel(Math.Log(percentage/100.0, 1.2));
|
browser.GetHost().SetZoomLevel(Math.Log(percentage/100.0, 1.2));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
public static void HandleConsoleMessage(object sender, ConsoleMessageEventArgs e){
|
|
||||||
Debug.WriteLine("[Console] {0} ({1}:{2})", e.Message, e.Source, e.Line);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -13,11 +13,11 @@ namespace TweetDuck.Core.Utils{
|
|||||||
public const string TweetDeckURL = "https://tweetdeck.twitter.com";
|
public const string TweetDeckURL = "https://tweetdeck.twitter.com";
|
||||||
|
|
||||||
public static readonly Color BackgroundColor = Color.FromArgb(28, 99, 153);
|
public static readonly Color BackgroundColor = Color.FromArgb(28, 99, 153);
|
||||||
public const string BackgroundColorOverride = "let e=document.createElement('style');document.head.appendChild(e);e.innerHTML='body,body::before{background:#1c6399!important}'";
|
public const string BackgroundColorOverride = "setTimeout(function f(){let h=document.head;if(!h){setTimeout(f,5);return;}let e=document.createElement('style');e.innerHTML='body,body::before{background:#1c6399!important}';h.appendChild(e);},1)";
|
||||||
|
|
||||||
public static readonly ResourceLink LoadingSpinner = new ResourceLink("https://ton.twimg.com/tduck/spinner", ResourceHandler.FromByteArray(Properties.Resources.spinner, "image/apng"));
|
public static readonly ResourceLink LoadingSpinner = new ResourceLink("https://ton.twimg.com/tduck/spinner", ResourceHandler.FromByteArray(Properties.Resources.spinner, "image/apng"));
|
||||||
|
|
||||||
private static readonly Lazy<Regex> RegexAccountLazy = new Lazy<Regex>(() => new Regex(@"^https?://twitter\.com/(?!signup$|tos$|privacy$)([^/]+)/?$", RegexOptions.Compiled), false);
|
private static readonly Lazy<Regex> RegexAccountLazy = new Lazy<Regex>(() => new Regex(@"^https?://twitter\.com/(?!signup$|tos$|privacy$|search$|search-)([^/?]+)/?$", RegexOptions.Compiled), false);
|
||||||
public static Regex RegexAccount => RegexAccountLazy.Value;
|
public static Regex RegexAccount => RegexAccountLazy.Value;
|
||||||
|
|
||||||
public static readonly string[] DictionaryWords = {
|
public static readonly string[] DictionaryWords = {
|
||||||
@@ -41,8 +41,8 @@ namespace TweetDuck.Core.Utils{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static string ExtractMediaBaseLink(string url){
|
private static string ExtractMediaBaseLink(string url){
|
||||||
int dot = url.LastIndexOf('/');
|
int slash = url.LastIndexOf('/');
|
||||||
return dot == -1 ? url : StringUtils.ExtractBefore(url, ':', dot);
|
return slash == -1 ? url : StringUtils.ExtractBefore(url, ':', slash);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetMediaLink(string url, ImageQuality quality){
|
public static string GetMediaLink(string url, ImageQuality quality){
|
||||||
@@ -91,7 +91,7 @@ namespace TweetDuck.Core.Utils{
|
|||||||
AutoUpgradeEnabled = true,
|
AutoUpgradeEnabled = true,
|
||||||
OverwritePrompt = urls.Length == 1,
|
OverwritePrompt = urls.Length == 1,
|
||||||
Title = "Save Image",
|
Title = "Save Image",
|
||||||
FileName = $"{string.Join(" ", fileNameParts.Where(part => part.Length > 0))}{ext}",
|
FileName = $"{string.Join(" ", fileNameParts.Where(part => !string.IsNullOrEmpty(part)))}{ext}",
|
||||||
Filter = (urls.Length == 1 ? "Image" : "Images")+(string.IsNullOrEmpty(ext) ? " (unknown)|*.*" : $" (*{ext})|*{ext}")
|
Filter = (urls.Length == 1 ? "Image" : "Images")+(string.IsNullOrEmpty(ext) ? " (unknown)|*.*" : $" (*{ext})|*{ext}")
|
||||||
}){
|
}){
|
||||||
if (dialog.ShowDialog() == DialogResult.OK){
|
if (dialog.ShowDialog() == DialogResult.OK){
|
||||||
|
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Net;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@@ -17,6 +18,8 @@ namespace TweetDuck.Core.Utils{
|
|||||||
public static int CurrentProcessID { get; }
|
public static int CurrentProcessID { get; }
|
||||||
public static bool ShouldAvoidToolWindow { get; }
|
public static bool ShouldAvoidToolWindow { get; }
|
||||||
|
|
||||||
|
private static bool HasMicrosoftBeenBroughtTo2008Yet;
|
||||||
|
|
||||||
static WindowsUtils(){
|
static WindowsUtils(){
|
||||||
using(Process me = Process.GetCurrentProcess()){
|
using(Process me = Process.GetCurrentProcess()){
|
||||||
CurrentProcessID = me.Id;
|
CurrentProcessID = me.Id;
|
||||||
@@ -26,6 +29,14 @@ namespace TweetDuck.Core.Utils{
|
|||||||
ShouldAvoidToolWindow = ver.Major == 6 && ver.Minor == 2; // windows 8/10
|
ShouldAvoidToolWindow = ver.Major == 6 && ver.Minor == 2; // windows 8/10
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void EnsureTLS12(){
|
||||||
|
if (!HasMicrosoftBeenBroughtTo2008Yet){
|
||||||
|
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;
|
||||||
|
ServicePointManager.SecurityProtocol &= ~(SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11);
|
||||||
|
HasMicrosoftBeenBroughtTo2008Yet = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void CreateDirectoryForFile(string file){
|
public static void CreateDirectoryForFile(string file){
|
||||||
string dir = Path.GetDirectoryName(file);
|
string dir = Path.GetDirectoryName(file);
|
||||||
|
|
||||||
|
@@ -9,7 +9,7 @@ Emoji keyboard
|
|||||||
chylex
|
chylex
|
||||||
|
|
||||||
[version]
|
[version]
|
||||||
1.4.2
|
1.4.3
|
||||||
|
|
||||||
[website]
|
[website]
|
||||||
https://tweetduck.chylex.com
|
https://tweetduck.chylex.com
|
||||||
|
@@ -32,6 +32,7 @@ enabled(){
|
|||||||
|
|
||||||
this.css = window.TDPF_createCustomStyle(this);
|
this.css = window.TDPF_createCustomStyle(this);
|
||||||
this.css.insert(".emoji-keyboard { position: absolute; width: 15.35em; background-color: white; border-radius: 1px; font-size: 24px; z-index: 9999 }");
|
this.css.insert(".emoji-keyboard { position: absolute; width: 15.35em; background-color: white; border-radius: 1px; font-size: 24px; z-index: 9999 }");
|
||||||
|
this.css.insert(".emoji-keyboard-popup-btn .icon { vertical-align: -4px !important }");
|
||||||
|
|
||||||
this.css.insert(".emoji-keyboard-list { height: 10.14em; padding: 0.1em; box-sizing: border-box; overflow-y: auto }");
|
this.css.insert(".emoji-keyboard-list { height: 10.14em; padding: 0.1em; box-sizing: border-box; overflow-y: auto }");
|
||||||
this.css.insert(".emoji-keyboard-list .separator { height: 26px }");
|
this.css.insert(".emoji-keyboard-list .separator { height: 26px }");
|
||||||
@@ -49,7 +50,7 @@ enabled(){
|
|||||||
|
|
||||||
// layout
|
// layout
|
||||||
|
|
||||||
var buttonHTML = '<button class="needsclick btn btn-on-blue txt-left padding-v--9 emoji-keyboard-popup-btn"><i class="icon icon-heart"></i></button>';
|
var buttonHTML = '<button class="needsclick btn btn-on-blue txt-left padding-v--6 padding-h--8 emoji-keyboard-popup-btn"><i class="icon icon-heart"></i></button>';
|
||||||
|
|
||||||
this.prevComposeMustache = TD.mustaches["compose/docked_compose.mustache"];
|
this.prevComposeMustache = TD.mustaches["compose/docked_compose.mustache"];
|
||||||
TD.mustaches["compose/docked_compose.mustache"] = TD.mustaches["compose/docked_compose.mustache"].replace('<div class="cf margin-t--12 margin-b--30">', '<div class="cf margin-t--12 margin-b--30">'+buttonHTML);
|
TD.mustaches["compose/docked_compose.mustache"] = TD.mustaches["compose/docked_compose.mustache"].replace('<div class="cf margin-t--12 margin-b--30">', '<div class="cf margin-t--12 margin-b--30">'+buttonHTML);
|
||||||
|
@@ -542,7 +542,8 @@
|
|||||||
let me = $(this)[0];
|
let me = $(this)[0];
|
||||||
|
|
||||||
if (me.classList.contains("js-media-image-link") && highlightedTweetObj){
|
if (me.classList.contains("js-media-image-link") && highlightedTweetObj){
|
||||||
let media = (highlightedTweetObj.quotedTweet || highlightedTweetObj).getMedia().find(media => media.mediaId === me.getAttribute("data-media-entity-id"));
|
let tweet = highlightedTweetObj.hasMedia() ? highlightedTweetObj : highlightedTweetObj.quotedTweet;
|
||||||
|
let media = tweet.getMedia().find(media => media.mediaId === me.getAttribute("data-media-entity-id"));
|
||||||
|
|
||||||
if ((media.isVideo && media.service === "twitter") || media.isAnimatedGif){
|
if ((media.isVideo && media.service === "twitter") || media.isAnimatedGif){
|
||||||
$TD.setLastRightClickInfo("video", media.chooseVideoVariant().url);
|
$TD.setLastRightClickInfo("video", media.chooseVideoVariant().url);
|
||||||
@@ -594,22 +595,15 @@
|
|||||||
// Block: Update highlighted column and tweet for context menu and other functionality.
|
// Block: Update highlighted column and tweet for context menu and other functionality.
|
||||||
//
|
//
|
||||||
(function(){
|
(function(){
|
||||||
var lastTweet = "";
|
|
||||||
|
|
||||||
const updateHighlightedColumn = function(ele){
|
const updateHighlightedColumn = function(ele){
|
||||||
highlightedColumnEle = ele;
|
highlightedColumnEle = ele;
|
||||||
highlightedColumnObj = ele ? TD.controller.columnManager.get(ele.attr("data-column")) : null;
|
highlightedColumnObj = ele ? TD.controller.columnManager.get(ele.attr("data-column")) : null;
|
||||||
return !!highlightedColumnObj;
|
return !!highlightedColumnObj;
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateHighlightedTweet = function(ele, obj, tweetUrl, quoteUrl, authors, imageList){
|
const updateHighlightedTweet = function(ele, obj){
|
||||||
highlightedTweetEle = ele;
|
highlightedTweetEle = ele;
|
||||||
highlightedTweetObj = obj;
|
highlightedTweetObj = obj;
|
||||||
|
|
||||||
if (lastTweet !== tweetUrl){
|
|
||||||
$TD.setLastHighlightedTweet(tweetUrl, quoteUrl, authors, imageList);
|
|
||||||
lastTweet = tweetUrl;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const processMedia = function(chirp){
|
const processMedia = function(chirp){
|
||||||
@@ -625,6 +619,19 @@
|
|||||||
|
|
||||||
mouseleave: function(){
|
mouseleave: function(){
|
||||||
updateHighlightedColumn(null);
|
updateHighlightedColumn(null);
|
||||||
|
},
|
||||||
|
|
||||||
|
contextmenu: function(){
|
||||||
|
let tweet = highlightedTweetObj;
|
||||||
|
|
||||||
|
if (tweet && tweet.chirpType === TD.services.ChirpBase.TWEET){
|
||||||
|
let tweetUrl = tweet.getChirpURL();
|
||||||
|
let quoteUrl = tweet.quotedTweet ? tweet.quotedTweet.getChirpURL() : "";
|
||||||
|
let chirpAuthors = tweet.quotedTweet ? [ tweet.getMainUser().screenName, tweet.quotedTweet.getMainUser().screenName ].join(";") : tweet.getMainUser().screenName;
|
||||||
|
let chirpImages = tweet.hasImage() ? processMedia(tweet) : tweet.quotedTweet && tweet.quotedTweet.hasImage() ? processMedia(tweet.quotedTweet) : "";
|
||||||
|
|
||||||
|
$TD.setRightClickedChirp(tweetUrl || "", quoteUrl || "", chirpAuthors, chirpImages);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -636,21 +643,11 @@
|
|||||||
let tweet = highlightedColumnObj.findChirp(me.attr("data-tweet-id")) || highlightedColumnObj.findChirp(me.attr("data-key"));
|
let tweet = highlightedColumnObj.findChirp(me.attr("data-tweet-id")) || highlightedColumnObj.findChirp(me.attr("data-key"));
|
||||||
return if !tweet;
|
return if !tweet;
|
||||||
|
|
||||||
if (tweet.chirpType === TD.services.ChirpBase.TWEET){
|
updateHighlightedTweet(me, tweet);
|
||||||
let tweetUrl = tweet.getChirpURL();
|
|
||||||
let quoteUrl = tweet.quotedTweet ? tweet.quotedTweet.getChirpURL() : "";
|
|
||||||
let authors = tweet.quotedTweet ? [ tweet.getMainUser().screenName, tweet.quotedTweet.getMainUser().screenName ].join(";") : tweet.getMainUser().screenName;
|
|
||||||
let imageList = tweet.quotedTweet && tweet.quotedTweet.hasImage() ? processMedia(tweet.quotedTweet) : tweet.hasImage() ? processMedia(tweet) : "";
|
|
||||||
|
|
||||||
updateHighlightedTweet(me, tweet, tweetUrl || "", quoteUrl || "", authors, imageList);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
updateHighlightedTweet(me, tweet, "", "", "", "");
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
mouseleave: function(){
|
mouseleave: function(){
|
||||||
updateHighlightedTweet(null, null, "", "", "", "");
|
updateHighlightedTweet(null, null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
@@ -928,26 +925,15 @@
|
|||||||
})();
|
})();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Block: Swap shift key functionality for selecting accounts, and refocus the textbox afterwards.
|
// Block: Refocus the textbox after switching accounts.
|
||||||
//
|
//
|
||||||
onAppReady.push(function(){
|
onAppReady.push(function(){
|
||||||
const onAccountClick = function(e){
|
const refocusInput = function(){
|
||||||
if ($TDX.switchAccountSelectors){
|
|
||||||
e.shiftKey = !e.shiftKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
$(".js-compose-text", ".js-docked-compose").focus();
|
$(".js-compose-text", ".js-docked-compose").focus();
|
||||||
};
|
};
|
||||||
|
|
||||||
$(".js-account-list", ".js-docked-compose").delegate(".js-account-item", "click", onAccountClick);
|
$(".js-account-list", ".js-docked-compose").delegate(".js-account-item", "click", function(e){
|
||||||
|
setTimeout(refocusInput, 0);
|
||||||
return if !ensurePropertyExists(TD, "components", "AccountSelector", "prototype", "refreshPostingAccounts");
|
|
||||||
|
|
||||||
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");
|
|
||||||
this.$node.delegate(".js-account-item", "click", onAccountClick);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -14,22 +14,29 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Block: Hook into links to bypass default open function and t.co.
|
// Block: Hook into links to bypass default open function and t.co, and handle skipping notification when opening links.
|
||||||
//
|
//
|
||||||
addEventListener(links, "click", function(e){
|
(function(){
|
||||||
let ele = e.currentTarget;
|
const onLinkClick = function(e){
|
||||||
|
if (e.button === 0 || e.button === 1){
|
||||||
|
let ele = e.currentTarget;
|
||||||
|
|
||||||
$TD.openBrowser(ele.hasAttribute("data-full-url") ? ele.getAttribute("data-full-url") : ele.getAttribute("href"));
|
$TD.openBrowser(ele.hasAttribute("data-full-url") ? ele.getAttribute("data-full-url") : ele.getAttribute("href"));
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if ($TDX.skipOnLinkClick){
|
if ($TDX.skipOnLinkClick){
|
||||||
let parentClasses = ele.parentNode.classList;
|
let parentClasses = ele.parentNode.classList;
|
||||||
|
|
||||||
if (parentClasses.contains("js-tweet-text") || parentClasses.contains("js-quoted-tweet-text") || parentClasses.contains("js-timestamp")){
|
if (parentClasses.contains("js-tweet-text") || parentClasses.contains("js-quoted-tweet-text") || parentClasses.contains("js-timestamp")){
|
||||||
$TD.loadNextNotification();
|
$TD.loadNextNotification();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
});
|
|
||||||
|
addEventListener(links, "click", onLinkClick);
|
||||||
|
addEventListener(links, "auxclick", onLinkClick);
|
||||||
|
})();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Block: Allow bypassing of t.co in context menus.
|
// Block: Allow bypassing of t.co in context menus.
|
||||||
|
@@ -67,9 +67,13 @@ button {
|
|||||||
border-color: #2B7BB9 !important;
|
border-color: #2B7BB9 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
#tduck .js-compose-scroller button > i {
|
#tduck .js-compose-scroller button.full-width {
|
||||||
|
padding: 7px 10px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
#tduck .js-compose-scroller button.full-width > i {
|
||||||
font-size: 20px !important;
|
font-size: 20px !important;
|
||||||
vertical-align: -4px !important;
|
vertical-align: -5px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.js-show-drawer {
|
.js-show-drawer {
|
||||||
@@ -84,6 +88,14 @@ button {
|
|||||||
content: "New ";
|
content: "New ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#tduck .app-header .search-input-control input {
|
||||||
|
font-size: 13px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
#tduck .app-header .search-input-perform-search {
|
||||||
|
right: 8px !important;
|
||||||
|
}
|
||||||
|
|
||||||
.js-account-safeguard-checkbox, .js-account-safeguard-checkbox label {
|
.js-account-safeguard-checkbox, .js-account-safeguard-checkbox label {
|
||||||
margin-bottom: 0 !important;
|
margin-bottom: 0 !important;
|
||||||
}
|
}
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
//
|
//
|
||||||
var injectCSS = function(){
|
var injectCSS = function(){
|
||||||
if (!document.head){
|
if (!document.head){
|
||||||
setTimeout(injectCSS, 25);
|
setTimeout(injectCSS, 5);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
style.sheet.insertRule(rule, 0);
|
style.sheet.insertRule(rule, 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
addRule("body { overflow: hidden !important; background-color: #1c6399 !important; }"); // remove scrollbar and change background
|
addRule("body { overflow: hidden !important; }"); // remove scrollbar
|
||||||
addRule(".page-canvas { box-shadow: 0 0 150px rgba(255, 255, 255, 0.3) !important; }"); // change page box shadow
|
addRule(".page-canvas { box-shadow: 0 0 150px rgba(255, 255, 255, 0.3) !important; }"); // change page box shadow
|
||||||
addRule(".topbar { display: none !important; }"); // hide top bar
|
addRule(".topbar { display: none !important; }"); // hide top bar
|
||||||
|
|
||||||
|
@@ -300,6 +300,13 @@
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// Block: Check updates on startup.
|
||||||
|
//
|
||||||
|
$(document).one("TD.ready", function(){
|
||||||
|
$TDU.triggerUpdateCheck();
|
||||||
|
});
|
||||||
|
|
||||||
//
|
//
|
||||||
// Block: Setup global functions.
|
// Block: Setup global functions.
|
||||||
//
|
//
|
||||||
|
@@ -108,6 +108,7 @@
|
|||||||
<Compile Include="Core\Handling\RequestHandlerBrowser.cs" />
|
<Compile Include="Core\Handling\RequestHandlerBrowser.cs" />
|
||||||
<Compile Include="Core\Handling\ResourceHandlerNotification.cs" />
|
<Compile Include="Core\Handling\ResourceHandlerNotification.cs" />
|
||||||
<Compile Include="Core\ITweetDeckBrowser.cs" />
|
<Compile Include="Core\ITweetDeckBrowser.cs" />
|
||||||
|
<Compile Include="Core\Management\ContextInfo.cs" />
|
||||||
<Compile Include="Core\Notification\Example\FormNotificationExample.cs">
|
<Compile Include="Core\Notification\Example\FormNotificationExample.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
@@ -8,6 +8,9 @@ using TweetDuck.Resources;
|
|||||||
|
|
||||||
namespace TweetDuck.Updates{
|
namespace TweetDuck.Updates{
|
||||||
sealed class UpdateHandler{
|
sealed class UpdateHandler{
|
||||||
|
public const int CheckCodeUpdatesDisabled = -1;
|
||||||
|
public const int CheckCodeNotOnTweetDeck = -2;
|
||||||
|
|
||||||
private readonly ITweetDeckBrowser browser;
|
private readonly ITweetDeckBrowser browser;
|
||||||
private readonly UpdaterSettings settings;
|
private readonly UpdaterSettings settings;
|
||||||
|
|
||||||
@@ -15,7 +18,7 @@ namespace TweetDuck.Updates{
|
|||||||
public event EventHandler<UpdateEventArgs> UpdateDismissed;
|
public event EventHandler<UpdateEventArgs> UpdateDismissed;
|
||||||
public event EventHandler<UpdateEventArgs> CheckFinished;
|
public event EventHandler<UpdateEventArgs> CheckFinished;
|
||||||
|
|
||||||
private int lastEventId;
|
private ushort lastEventId;
|
||||||
private UpdateInfo lastUpdateInfo;
|
private UpdateInfo lastUpdateInfo;
|
||||||
|
|
||||||
public UpdateHandler(ITweetDeckBrowser browser, UpdaterSettings settings){
|
public UpdateHandler(ITweetDeckBrowser browser, UpdaterSettings settings){
|
||||||
@@ -28,7 +31,6 @@ namespace TweetDuck.Updates{
|
|||||||
|
|
||||||
private void OnFrameLoaded(IFrame frame){
|
private void OnFrameLoaded(IFrame frame){
|
||||||
ScriptLoader.ExecuteFile(frame, "update.js");
|
ScriptLoader.ExecuteFile(frame, "update.js");
|
||||||
Check(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Check(bool force){
|
public int Check(bool force){
|
||||||
@@ -37,11 +39,15 @@ namespace TweetDuck.Updates{
|
|||||||
settings.DismissedUpdate = null;
|
settings.DismissedUpdate = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
browser.ExecuteFunction("TDUF_runUpdateCheck", ++lastEventId, Program.VersionTag, settings.DismissedUpdate ?? string.Empty, settings.AllowPreReleases);
|
if (!browser.IsTweetDeckWebsite){
|
||||||
|
return CheckCodeNotOnTweetDeck;
|
||||||
|
}
|
||||||
|
|
||||||
|
browser.ExecuteFunction("TDUF_runUpdateCheck", (int)unchecked(++lastEventId), Program.VersionTag, settings.DismissedUpdate ?? string.Empty, settings.AllowPreReleases);
|
||||||
return lastEventId;
|
return lastEventId;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return CheckCodeUpdatesDisabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void BeginUpdateDownload(Form ownerForm, UpdateInfo updateInfo, Action<UpdateInfo> onSuccess){
|
public void BeginUpdateDownload(Form ownerForm, UpdateInfo updateInfo, Action<UpdateInfo> onSuccess){
|
||||||
|
@@ -106,6 +106,15 @@ begin
|
|||||||
Result := (PageID = wpSelectDir) and (UpdatePath <> '')
|
Result := (PageID = wpSelectDir) and (UpdatePath <> '')
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ Check the desktop icon task if not updating. }
|
||||||
|
procedure CurPageChanged(CurPageID: Integer);
|
||||||
|
begin
|
||||||
|
if CurPageID = wpSelectTasks then
|
||||||
|
begin
|
||||||
|
WizardForm.TasksList.Checked[WizardForm.TasksList.Items.Count-1] := (UpdatePath = '');
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{ Install VC++ if downloaded. }
|
{ Install VC++ if downloaded. }
|
||||||
procedure CurStepChanged(CurStep: TSetupStep);
|
procedure CurStepChanged(CurStep: TSetupStep);
|
||||||
begin
|
begin
|
||||||
|
@@ -21,7 +21,19 @@ namespace UnitTests.Core{
|
|||||||
Assert.IsFalse(TwitterUtils.RegexAccount.IsMatch("http://twitter.com/"));
|
Assert.IsFalse(TwitterUtils.RegexAccount.IsMatch("http://twitter.com/"));
|
||||||
Assert.IsFalse(TwitterUtils.RegexAccount.IsMatch("http://twitter.com/chylexmc/status"));
|
Assert.IsFalse(TwitterUtils.RegexAccount.IsMatch("http://twitter.com/chylexmc/status"));
|
||||||
Assert.IsFalse(TwitterUtils.RegexAccount.IsMatch("http://nottwitter.com/chylexmc"));
|
Assert.IsFalse(TwitterUtils.RegexAccount.IsMatch("http://nottwitter.com/chylexmc"));
|
||||||
|
Assert.IsFalse(TwitterUtils.RegexAccount.IsMatch("https://twitter.com/chylexmc?"));
|
||||||
Assert.IsFalse(TwitterUtils.RegexAccount.IsMatch("www.twitter.com/chylexmc"));
|
Assert.IsFalse(TwitterUtils.RegexAccount.IsMatch("www.twitter.com/chylexmc"));
|
||||||
|
|
||||||
|
Assert.IsFalse(TwitterUtils.RegexAccount.IsMatch("https://twitter.com/signup"));
|
||||||
|
Assert.IsFalse(TwitterUtils.RegexAccount.IsMatch("https://twitter.com/tos"));
|
||||||
|
Assert.IsFalse(TwitterUtils.RegexAccount.IsMatch("https://twitter.com/privacy"));
|
||||||
|
Assert.IsFalse(TwitterUtils.RegexAccount.IsMatch("https://twitter.com/search"));
|
||||||
|
Assert.IsFalse(TwitterUtils.RegexAccount.IsMatch("https://twitter.com/search?query"));
|
||||||
|
Assert.IsFalse(TwitterUtils.RegexAccount.IsMatch("https://twitter.com/search-home"));
|
||||||
|
Assert.IsFalse(TwitterUtils.RegexAccount.IsMatch("https://twitter.com/search-advanced"));
|
||||||
|
|
||||||
|
Assert.IsTrue(TwitterUtils.RegexAccount.IsMatch("https://twitter.com/tosser"));
|
||||||
|
Assert.IsTrue(TwitterUtils.RegexAccount.IsMatch("https://twitter.com/searching"));
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
Reference in New Issue
Block a user