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

Compare commits

..

13 Commits

18 changed files with 120 additions and 37 deletions

View File

@@ -64,6 +64,10 @@ namespace TweetDuck.Core.Bridge{
});
}
public void SetRightClickedLink(string type, string url){
ContextInfo.SetLink(type, url);
}
public void SetRightClickedChirp(string tweetUrl, string quoteUrl, string chirpAuthors, string chirpImages){
ContextInfo.SetChirp(tweetUrl, quoteUrl, chirpAuthors, chirpImages);
}
@@ -99,10 +103,6 @@ namespace TweetDuck.Core.Bridge{
// Global
public void SetLastRightClickInfo(string type, string url){
ContextInfo.SetLink(type, url);
}
public void OnTweetPopup(string columnId, string chirpId, string columnName, string tweetHtml, int tweetCharacters, string tweetUrl, string quoteUrl){
notification.InvokeAsyncSafe(() => {
form.OnTweetNotification();

View File

@@ -39,17 +39,17 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = TweetDuck.Core.Utils.TwitterUtils.BackgroundColor;
this.ClientSize = new System.Drawing.Size(400, 386);
this.ClientSize = new System.Drawing.Size(1008, 730);
this.Icon = Properties.Resources.icon;
this.Location = TweetDuck.Core.Controls.ControlExtensions.InvisibleLocation;
this.MinimumSize = new System.Drawing.Size(416, 424);
this.MinimumSize = new System.Drawing.Size(348, 424);
this.Name = "FormBrowser";
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Activated += new System.EventHandler(this.FormBrowser_Activated);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormBrowser_FormClosing);
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FormBrowser_FormClosed);
this.LocationChanged += new System.EventHandler(this.FormBrowser_LocationChanged);
this.ResizeEnd += new System.EventHandler(this.FormBrowser_ResizeEnd);
this.LocationChanged += new System.EventHandler(this.FormBrowser_LocationChanged);
this.Resize += new System.EventHandler(this.FormBrowser_Resize);
this.ResumeLayout(false);

View File

@@ -4,11 +4,19 @@ using CefSharp.Enums;
namespace TweetDuck.Core.Handling{
sealed class DragHandlerBrowser : IDragHandler{
private readonly RequestHandlerBrowser requestHandler;
public DragHandlerBrowser(RequestHandlerBrowser requestHandler){
this.requestHandler = requestHandler;
}
public bool OnDragEnter(IWebBrowser browserControl, IBrowser browser, IDragData dragData, DragOperationsMask mask){
void TriggerDragStart(string type, string data = null){
browserControl.ExecuteScriptAsync("window.TDGF_onGlobalDragStart", type, data);
}
requestHandler.BlockNextUserNavUrl = dragData.LinkUrl; // empty if not a link
if (dragData.IsLink){
TriggerDragStart("link", dragData.LinkUrl);
}

View File

@@ -5,6 +5,12 @@ using TweetDuck.Core.Handling.General;
namespace TweetDuck.Core.Handling{
class RequestHandlerBase : DefaultRequestHandler{
private readonly bool autoReload;
public RequestHandlerBase(bool autoReload){
this.autoReload = autoReload;
}
public override bool OnOpenUrlFromTab(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, WindowOpenDisposition targetDisposition, bool userGesture){
return LifeSpanHandler.HandleLinkClick(browserControl, targetDisposition, targetUrl);
}
@@ -18,5 +24,11 @@ namespace TweetDuck.Core.Handling{
return base.OnBeforeResourceLoad(browserControl, browser, frame, request, callback);
}
public override void OnRenderProcessTerminated(IWebBrowser browserControl, IBrowser browser, CefTerminationStatus status){
if (autoReload){
browser.Reload();
}
}
}
}

View File

@@ -3,9 +3,9 @@ using TweetDuck.Core.Utils;
namespace TweetDuck.Core.Handling{
sealed class RequestHandlerBrowser : RequestHandlerBase{
public override void OnRenderProcessTerminated(IWebBrowser browserControl, IBrowser browser, CefTerminationStatus status){
browser.Reload();
}
public string BlockNextUserNavUrl { get; set; }
public RequestHandlerBrowser() : base(true){}
public override CefReturnValue OnBeforeResourceLoad(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IRequestCallback callback){
if (request.ResourceType == ResourceType.Script && request.Url.Contains("analytics.")){
@@ -16,6 +16,16 @@ namespace TweetDuck.Core.Handling{
return base.OnBeforeResourceLoad(browserControl, browser, frame, request, callback);
}
public override bool OnBeforeBrowse(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, bool userGesture, bool isRedirect){
if (userGesture && request.TransitionType == TransitionType.LinkClicked){
bool block = request.Url == BlockNextUserNavUrl;
BlockNextUserNavUrl = string.Empty;
return block;
}
return base.OnBeforeBrowse(browserControl, browser, frame, request, userGesture, isRedirect);
}
public override bool OnResourceResponse(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response){
if (request.ResourceType == ResourceType.Image && request.Url.Contains("backgrounds/spinner_blue")){
request.Url = TwitterUtils.LoadingSpinner.Url;

View File

@@ -124,7 +124,7 @@ namespace TweetDuck.Core.Notification{
MenuHandler = new ContextMenuNotification(this, enableContextMenu),
JsDialogHandler = new JavaScriptDialogHandler(),
LifeSpanHandler = new LifeSpanHandler(),
RequestHandler = new RequestHandlerBase()
RequestHandler = new RequestHandlerBase(false)
};
this.browser.Dock = DockStyle.None;

View File

@@ -69,7 +69,7 @@ namespace TweetDuck.Core.Other{
MenuHandler = new ContextMenuGuide(owner),
JsDialogHandler = new JavaScriptDialogHandler(),
LifeSpanHandler = new LifeSpanHandler(),
RequestHandler = new RequestHandlerBrowser()
RequestHandler = new RequestHandlerBase(true)
};
browser.LoadingStateChanged += browser_LoadingStateChanged;

View File

@@ -40,14 +40,16 @@ namespace TweetDuck.Core{
private string prevSoundNotificationPath = null;
public TweetDeckBrowser(FormBrowser owner, TweetDeckBridge bridge){
RequestHandlerBrowser requestHandler = new RequestHandlerBrowser();
this.browser = new ChromiumWebBrowser(TwitterUtils.TweetDeckURL){
DialogHandler = new FileDialogHandler(),
DragHandler = new DragHandlerBrowser(),
DragHandler = new DragHandlerBrowser(requestHandler),
MenuHandler = new ContextMenuBrowser(owner),
JsDialogHandler = new JavaScriptDialogHandler(),
KeyboardHandler = new KeyboardHandlerBrowser(owner),
LifeSpanHandler = new LifeSpanHandler(),
RequestHandler = new RequestHandlerBrowser()
RequestHandler = requestHandler
};
this.browser.LoadingStateChanged += browser_LoadingStateChanged;

View File

@@ -19,7 +19,7 @@ namespace TweetDuck{
public const string BrandName = "TweetDuck";
public const string Website = "https://tweetduck.chylex.com";
public const string VersionTag = "1.14.2.1";
public const string VersionTag = "1.14.3";
public static readonly string ProgramPath = AppDomain.CurrentDomain.BaseDirectory;
public static readonly bool IsPortable = File.Exists(Path.Combine(ProgramPath, "makeportable"));

Binary file not shown.

View File

@@ -396,8 +396,10 @@ enabled(){
switch(currentTheme){
case "black":
this.css.insert(".app-content, .app-columns-container { background-color: #444448 !important }");
this.css.insert(".column-header-temp { background-color: transparent !important }");
this.css.insert(".column-drag-handle { opacity: 0.5 !important }");
this.css.insert(".column-drag-handle:hover { opacity: 1 !important }");
this.css.insert(".column-message.is-actionable span:hover > .icon-small-valigned { filter: saturate(20) }");
this.css.insert(".scroll-styled-v:not(.scroll-alt)::-webkit-scrollbar-thumb:not(:hover), .scroll-styled-h:not(.scroll-alt)::-webkit-scrollbar-thumb:not(:hover) { background-color: #666 !important }");
notificationScrollbarColor = "666";
break;
@@ -561,7 +563,7 @@ ${iconData.map(entry => `#tduck .icon-${entry[0]}:before{content:\"\\f0${entry[1
if (this.config.columnWidth[0] === '/'){
let cols = this.config.columnWidth.slice(1);
this.css.insert(".column { width: calc((100vw - 205px) / "+cols+" - 6px) !important }");
this.css.insert(".column { width: calc((100vw - 205px) / "+cols+" - 6px) !important; min-width: 160px }");
this.css.insert(".is-condensed .column { width: calc((100vw - 55px) / "+cols+" - 6px) !important }");
}
else{

View File

@@ -44,6 +44,8 @@
</optgroup>
<option disabled></option>
<optgroup label="Dynamic width">
<option value="/1">1 column on screen</option>
<option value="/2">2 columns on screen</option>
<option value="/3">3 columns on screen</option>
<option value="/4">4 columns on screen</option>
<option value="/5">5 columns on screen</option>

View File

@@ -51,7 +51,7 @@ enabled(){
this.css.insert(".manage-templates-btn.active { color: #fff; box-shadow: 0 0 2px 3px #50a5e6; outline: 0; }");
this.css.insert("#templates-modal-wrap { width: 100%; height: 100%; padding: 49px; position: absolute; z-index: 999; box-sizing: border-box; background-color: rgba(0, 0, 0, 0.5); }");
this.css.insert("#templates-modal { width: 100%; height: 100%; background-color: #fff; display: flex; }");
this.css.insert("#templates-modal { width: 100%; height: 100%; min-width: 500px; background-color: #fff; display: flex; }");
this.css.insert("#templates-modal > div { display: flex; flex-direction: column; }");
this.css.insert(".templates-modal-bottom { flex: 0 0 auto; padding: 16px; }");
@@ -68,7 +68,7 @@ enabled(){
this.css.insert("#template-list li .icon:hover { opacity: 1; }");
this.css.insert("#template-list li .template-actions { float: right; }");
this.css.insert("#template-editor { height: 100%; flex: 0 0 auto; width: 25vw; min-width: 150px; max-width: 400px; background-color: #485865; }");
this.css.insert("#template-editor { height: 100%; flex: 0 0 auto; width: 25vw; min-width: 225px; max-width: 400px; background-color: #485865; }");
this.css.insert(".template-editor-form { flex: 1 1 auto; padding: 12px 16px; font-size: 14px; overflow-y: auto; }");
this.css.insert(".template-editor-form .compose-text-title { margin: 24px 0 9px; }");
this.css.insert(".template-editor-form .compose-text-title:first-child { margin-top: 0; }");
@@ -261,7 +261,7 @@ enabled(){
$(".manage-templates-btn").addClass("active");
let html = `
<div id="templates-modal-wrap">
<div id="templates-modal-wrap" class="scroll-v scroll-styled-v">
<div id="templates-modal">
<div id="template-list">
<ul></ul>

View File

@@ -197,6 +197,10 @@
html.find(".js-media").remove();
}
html.find("a[data-full-url]").each(function(){ // bypass t.co on all links
this.href = this.getAttribute("data-full-url");
});
html.find("a[href='#']").each(function(){ // remove <a> tags around links that don't lead anywhere (such as account names the tweet replied to)
this.outerHTML = this.innerHTML;
});
@@ -558,17 +562,17 @@
let media = tweet.getMedia().find(media => media.mediaId === me.getAttribute("data-media-entity-id"));
if ((media.isVideo && media.service === "twitter") || media.isAnimatedGif){
$TD.setLastRightClickInfo("video", media.chooseVideoVariant().url);
$TD.setRightClickedLink("video", media.chooseVideoVariant().url);
}
else{
$TD.setLastRightClickInfo("image", media.large());
$TD.setRightClickedLink("image", media.large());
}
}
else if (me.classList.contains("js-gif-play")){
$TD.setLastRightClickInfo("video", $(this).closest(".js-media-gif-container").find("video").attr("src"));
$TD.setRightClickedLink("video", $(this).closest(".js-media-gif-container").find("video").attr("src"));
}
else{
$TD.setLastRightClickInfo("link", me.getAttribute("data-full-url"));
$TD.setRightClickedLink("link", me.getAttribute("data-full-url"));
}
});

View File

@@ -3,12 +3,13 @@
let css = $(`
<style>
#td-introduction-modal {
display: block;
display: flex;
}
#td-introduction-modal .mdl {
width: 90%;
max-width: 830px;
min-width: 515px;
max-width: 835px;
height: 328px;
}
@@ -73,7 +74,7 @@
</style>`).appendTo(document.head);
let ele = $(`
<div id="td-introduction-modal" class="ovl">
<div id="td-introduction-modal" class="ovl scroll-v scroll-styled-v">
<div class="mdl is-inverted-dark">
<header class="mdl-header">
<h3 class="mdl-header-title">Welcome to TweetDuck</h3>

View File

@@ -14,14 +14,14 @@
};
//
// Block: Hook into links to bypass default open function and t.co, and handle skipping notification when opening links.
// Block: Hook into links to bypass default open function, and handle skipping notification when opening links.
//
(function(){
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.href);
e.preventDefault();
if ($TDX.skipOnLinkClick){
@@ -38,13 +38,6 @@
addEventListener(links, "auxclick", onLinkClick);
})();
//
// Block: Allow bypassing of t.co in context menus.
//
addEventListener(links, "contextmenu", function(e){
$TD.setLastRightClickInfo("link", e.currentTarget.getAttribute("data-full-url"));
});
//
// Block: Expand shortened links on hover or display tooltip.
//

View File

@@ -244,6 +244,27 @@ a[data-full-url] {
min-width: 86px;
}
/************************************************************/
/* Fix modal dialogs breaking when window size is too small */
/************************************************************/
.ovl:before, .overlay:before {
display: none !important;
}
.ovl, .overlay {
flex-direction: column;
justify-content: center;
}
.ovl[style="display: block;"] {
display: flex !important;
}
#tduck .overlay {
display: flex;
}
/*******************************************/
/* Fix general visual issues or annoyances */
/*******************************************/
@@ -278,6 +299,12 @@ a[data-full-url] {
height: calc(1em + 8px) !important;
}
.column-header-temp:not(.js-column-header) {
/* fix missing column header padding in Edit List dialog */
padding-left: 10px;
padding-right: 10px;
}
.js-column-options .btn-options-tray {
/* fix underline on buttons in column options */
text-decoration: none !important;
@@ -290,7 +317,7 @@ a[data-full-url] {
}
html[data-td-font='smallest'] .sprite-verified-mini {
/* fix cut off badge when zoomed in */
/* fix cut off badge in timelines */
width: 13px !important;
height: 13px !important;
background-position: -223px -99px !important;
@@ -310,11 +337,21 @@ html[data-td-font='smallest'] .tweet-detail-wrapper .badge-verified:before {
background-position: -223px -97px !important;
}
html[data-td-font='smallest'] .fullname-badged:before, html[data-td-font='small'] .fullname-badged:before {
/* fix cut off badge in follow chirps */
margin-top: -7px !important;
}
.keyboard-shortcut-list {
/* fix keyboard navigation alignment */
vertical-align: top !important;
}
.column-message.is-actionable span:hover > .icon-small-valigned {
/* add a visual response when hovering individual filter icons; black theme uses a value of 20 */
filter: saturate(10);
}
.tweet-detail-wrapper .js-media-gif-container {
/* GIFs in detail view don't trigger the pointer cursor */
cursor: pointer;

View File

@@ -61,13 +61,25 @@ a[data-full-url] {
/* Fix general visual issues or annoyances */
/*******************************************/
html[data-td-font='smallest'] .sprite-verified-mini {
/* fix cut off badge in timelines */
width: 13px !important;
height: 13px !important;
background-position: -223px -99px !important;
}
html[data-td-font='smallest'] .badge-verified:before {
/* fix cut off badge icon */
/* fix cut off badge in notifications */
width: 13px !important;
height: 13px !important;
background-position: -223px -98px !important;
}
html[data-td-font='smallest'] .fullname-badged:before, html[data-td-font='small'] .fullname-badged:before {
/* fix cut off badge in follow chirps */
margin-top: -7px !important;
}
.account-inline .username {
vertical-align: 10% !important;
}