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

Compare commits

..

7 Commits

27 changed files with 92 additions and 112 deletions

3
.github/FUNDING.yml vendored
View File

@@ -1,4 +1,3 @@
# These are supported funding model platforms github: chylex
patreon: chylex patreon: chylex
ko_fi: chylex ko_fi: chylex

View File

@@ -2,7 +2,7 @@
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.Windows.Forms; using System.Windows.Forms;
using TweetDuck.Controls; using TweetDuck.Controls;
using TweetLib.Core.Features.Updates; using TweetLib.Core.Systems.Updates;
namespace TweetDuck.Browser.Bridge{ namespace TweetDuck.Browser.Bridge{
[SuppressMessage("ReSharper", "UnusedMember.Global")] [SuppressMessage("ReSharper", "UnusedMember.Global")]

View File

@@ -20,7 +20,7 @@ using TweetDuck.Updates;
using TweetDuck.Utils; using TweetDuck.Utils;
using TweetLib.Core.Features.Plugins; using TweetLib.Core.Features.Plugins;
using TweetLib.Core.Features.Plugins.Events; using TweetLib.Core.Features.Plugins.Events;
using TweetLib.Core.Features.Updates; using TweetLib.Core.Systems.Updates;
namespace TweetDuck.Browser{ namespace TweetDuck.Browser{
sealed partial class FormBrowser : Form, AnalyticsFile.IProvider{ sealed partial class FormBrowser : Form, AnalyticsFile.IProvider{

View File

@@ -1,9 +1,9 @@
using System; using System;
using System.Drawing; using System.Drawing;
using TweetDuck.Browser.Data; using TweetDuck.Browser.Data;
using TweetLib.Core.Features.Configuration;
using TweetLib.Core.Features.Plugins.Config; using TweetLib.Core.Features.Plugins.Config;
using TweetLib.Core.Serialization.Converters; using TweetLib.Core.Serialization.Converters;
using TweetLib.Core.Systems.Configuration;
using TweetLib.Core.Utils; using TweetLib.Core.Utils;
namespace TweetDuck.Configuration{ namespace TweetDuck.Configuration{

View File

@@ -1,9 +1,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using TweetLib.Core.Features.Configuration;
using TweetLib.Core.Features.Plugins; using TweetLib.Core.Features.Plugins;
using TweetLib.Core.Features.Plugins.Config; using TweetLib.Core.Features.Plugins.Config;
using TweetLib.Core.Features.Plugins.Events; using TweetLib.Core.Features.Plugins.Events;
using TweetLib.Core.Systems.Configuration;
namespace TweetDuck.Configuration{ namespace TweetDuck.Configuration{
sealed class PluginConfig : BaseConfig, IPluginConfig{ sealed class PluginConfig : BaseConfig, IPluginConfig{

View File

@@ -1,4 +1,4 @@
using TweetLib.Core.Features.Configuration; using TweetLib.Core.Systems.Configuration;
namespace TweetDuck.Configuration{ namespace TweetDuck.Configuration{
sealed class SystemConfig : BaseConfig{ sealed class SystemConfig : BaseConfig{

View File

@@ -3,9 +3,9 @@ using System.Drawing;
using TweetDuck.Browser; using TweetDuck.Browser;
using TweetDuck.Browser.Data; using TweetDuck.Browser.Data;
using TweetDuck.Controls; using TweetDuck.Controls;
using TweetLib.Core.Features.Configuration;
using TweetLib.Core.Features.Notifications; using TweetLib.Core.Features.Notifications;
using TweetLib.Core.Features.Twitter; using TweetLib.Core.Features.Twitter;
using TweetLib.Core.Systems.Configuration;
namespace TweetDuck.Configuration{ namespace TweetDuck.Configuration{
sealed class UserConfig : BaseConfig{ sealed class UserConfig : BaseConfig{

View File

@@ -12,7 +12,7 @@ using TweetDuck.Management;
using TweetDuck.Management.Analytics; using TweetDuck.Management.Analytics;
using TweetDuck.Utils; using TweetDuck.Utils;
using TweetLib.Core.Features.Plugins; using TweetLib.Core.Features.Plugins;
using TweetLib.Core.Features.Updates; using TweetLib.Core.Systems.Updates;
namespace TweetDuck.Dialogs{ namespace TweetDuck.Dialogs{
sealed partial class FormSettings : Form, FormManager.IAppDialog{ sealed partial class FormSettings : Form, FormManager.IAppDialog{

View File

@@ -5,7 +5,7 @@ using System.Windows.Forms;
using TweetDuck.Browser.Handling.General; using TweetDuck.Browser.Handling.General;
using TweetDuck.Controls; using TweetDuck.Controls;
using TweetDuck.Utils; using TweetDuck.Utils;
using TweetLib.Core.Features.Updates; using TweetLib.Core.Systems.Updates;
using TweetLib.Core.Utils; using TweetLib.Core.Utils;
namespace TweetDuck.Dialogs.Settings{ namespace TweetDuck.Dialogs.Settings{

View File

@@ -14,8 +14,8 @@ using TweetDuck.Management;
using TweetDuck.Resources; using TweetDuck.Resources;
using TweetDuck.Utils; using TweetDuck.Utils;
using TweetLib.Core; using TweetLib.Core;
using TweetLib.Core.Application.Helpers;
using TweetLib.Core.Collections; using TweetLib.Core.Collections;
using TweetLib.Core.Systems.Startup;
using TweetLib.Core.Utils; using TweetLib.Core.Utils;
using Win = System.Windows.Forms; using Win = System.Windows.Forms;

View File

@@ -871,8 +871,6 @@
} }
uploader.addFilesToUpload([ item.getAsFile() ]); uploader.addFilesToUpload([ item.getAsFile() ]);
$(".js-compose-text", ".js-docked-compose").focus();
break; break;
} }
} }
@@ -1068,6 +1066,33 @@
}); });
}); });
//
// Block: Fix docked composer not re-focusing after Alt+Tab & image upload.
//
onAppReady.push(function fixDockedComposerRefocus(){
$(document).on("tduckOldComposerActive", function(e){
const ele = $$(".js-compose-text", ".js-docked-compose");
const node = ele[0];
let cancelBlur = false;
ele.on("blur", function(e){
cancelBlur = true;
setTimeout(function(){ cancelBlur = false; }, 0);
});
window.TDGF_prioritizeNewestEvent(node, "blur");
node.blur = prependToFunction(node.blur, function(){
return cancelBlur;
});
});
$(document).on("uiComposeImageAdded", function(){
$(".js-compose-text", ".js-docked-compose").focus();
});
});
// //
// Block: Refocus the textbox after switching accounts. // Block: Refocus the textbox after switching accounts.
// //

View File

@@ -68,22 +68,13 @@ button[type='submit'] {
/* General per-page styling */ /* General per-page styling */
/****************************/ /****************************/
html[mobile][login] div[tweetduck-login-wrapper] { html[login] div[tweetduck-login-wrapper] {
/* vertically center page & fix colors */ /* vertically center page & fix colors */
margin-top: calc(50vh - 200px); margin-top: calc(50vh - 200px);
padding: 26px 1.1vw; padding: 26px 1.1vw;
background-color: white; background-color: white;
} }
html[mobile][login] #tweetduck-helper:hover { html[login] #tweetduck-helper:hover {
text-decoration: underline; text-decoration: underline;
} }
html[desktop][login] #tweetduck-helper {
margin-top: 15px !important;
font-weight: bold !important;
}
html[mobile][logout] div[role="button"] {
border: 1px solid rgba(0, 0, 0, 0.3) !important;
}

View File

@@ -1,7 +1,6 @@
(function(){ (function(){
const isLogin = location.pathname === "/login"; const isLogin = location.pathname === "/login";
const isLogout = location.pathname === "/logout"; const isLogout = location.pathname === "/logout";
const isMobile = location.host === "mobile.twitter.com";
// //
// Function: Inject custom CSS into the page. // Function: Inject custom CSS into the page.
@@ -24,13 +23,6 @@
else if (isLogout){ else if (isLogout){
document.documentElement.setAttribute("logout", ""); document.documentElement.setAttribute("logout", "");
} }
if (isMobile){
document.documentElement.setAttribute("mobile", "");
}
else{
document.documentElement.setAttribute("desktop", "");
}
}; };
setTimeout(injectCSS, 1); setTimeout(injectCSS, 1);
@@ -53,7 +45,6 @@
// //
if (isLogin){ if (isLogin){
document.addEventListener("DOMContentLoaded", function(){ document.addEventListener("DOMContentLoaded", function(){
if (isMobile){
triggerWhenExists("main h1", function(heading){ triggerWhenExists("main h1", function(heading){
heading.parentNode.setAttribute("tweetduck-login-wrapper", ""); heading.parentNode.setAttribute("tweetduck-login-wrapper", "");
return true; return true;
@@ -86,37 +77,12 @@
return false; return false;
} }
}); });
}
else{
const openLinkExternally = function(e){
let href = e.currentTarget.getAttribute("href");
$TD.openBrowser(href[0] === '/' ? location.origin+href : href);
e.preventDefault();
e.stopPropagation();
};
for(let link of document.getElementsByTagName("A")){
link.addEventListener("click", openLinkExternally);
}
let texts = document.querySelector(".page-canvas > div:last-child");
if (texts){
texts.insertAdjacentHTML("beforeend", `<p id="tweetduck-helper">Used the TweetDuck app before? <a href="#">Import your profile »</a></p>`);
texts.querySelector("#tweetduck-helper > a").addEventListener("click", function(){
$TD.openProfileImport();
});
}
}
}); });
} }
// //
// Block: Hide cookie crap. // Block: Hide cookie crap.
// //
if (isMobile){
document.addEventListener("DOMContentLoaded", function(){ document.addEventListener("DOMContentLoaded", function(){
triggerWhenExists("a[href^='https://help.twitter.com/rules-and-policies/twitter-cookies']", function(cookie){ triggerWhenExists("a[href^='https://help.twitter.com/rules-and-policies/twitter-cookies']", function(cookie){
while(!!cookie){ while(!!cookie){
@@ -132,5 +98,4 @@
return false; return false;
}); });
}); });
}
})(); })();

View File

@@ -1,6 +1,6 @@
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
using TweetLib.Core.Features.Updates; using TweetLib.Core.Systems.Updates;
namespace TweetDuck.Updates{ namespace TweetDuck.Updates{
sealed partial class FormUpdateDownload : Form{ sealed partial class FormUpdateDownload : Form{

View File

@@ -6,7 +6,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Web.Script.Serialization; using System.Web.Script.Serialization;
using TweetDuck.Utils; using TweetDuck.Utils;
using TweetLib.Core.Features.Updates; using TweetLib.Core.Systems.Updates;
using TweetLib.Core.Utils; using TweetLib.Core.Utils;
using JsonObject = System.Collections.Generic.IDictionary<string, object>; using JsonObject = System.Collections.Generic.IDictionary<string, object>;

View File

@@ -6,6 +6,6 @@ using Version = TweetDuck.Version;
namespace TweetDuck{ namespace TweetDuck{
internal static class Version{ internal static class Version{
public const string Tag = "1.18.5"; public const string Tag = "1.18.6";
} }
} }

View File

@@ -2,7 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text; using System.Text;
using TweetLib.Core.Features.Configuration; using TweetLib.Core.Systems.Configuration;
namespace TweetLib.Core.Features.Plugins.Config{ namespace TweetLib.Core.Features.Plugins.Config{
public sealed class PluginConfigInstance<T> : IConfigInstance<T> where T : BaseConfig, IPluginConfig{ public sealed class PluginConfigInstance<T> : IConfigInstance<T> where T : BaseConfig, IPluginConfig{

View File

@@ -1,7 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace TweetLib.Core.Features.Configuration{ namespace TweetLib.Core.Systems.Configuration{
public abstract class BaseConfig{ public abstract class BaseConfig{
private readonly IConfigManager configManager; private readonly IConfigManager configManager;

View File

@@ -2,7 +2,7 @@
using System.IO; using System.IO;
using TweetLib.Core.Serialization; using TweetLib.Core.Serialization;
namespace TweetLib.Core.Features.Configuration{ namespace TweetLib.Core.Systems.Configuration{
public sealed class FileConfigInstance<T> : IConfigInstance<T> where T : BaseConfig{ public sealed class FileConfigInstance<T> : IConfigInstance<T> where T : BaseConfig{
public T Instance { get; } public T Instance { get; }
public FileSerializer<T> Serializer { get; } public FileSerializer<T> Serializer { get; }

View File

@@ -1,4 +1,4 @@
namespace TweetLib.Core.Features.Configuration{ namespace TweetLib.Core.Systems.Configuration{
public interface IConfigInstance<out T>{ public interface IConfigInstance<out T>{
T Instance { get; } T Instance { get; }

View File

@@ -1,4 +1,4 @@
namespace TweetLib.Core.Features.Configuration{ namespace TweetLib.Core.Systems.Configuration{
public interface IConfigManager{ public interface IConfigManager{
void TriggerProgramRestartRequested(); void TriggerProgramRestartRequested();
IConfigInstance<BaseConfig> GetInstanceInfo(BaseConfig instance); IConfigInstance<BaseConfig> GetInstanceInfo(BaseConfig instance);

View File

@@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
namespace TweetLib.Core.Application.Helpers{ namespace TweetLib.Core.Systems.Startup{
public sealed class LockManager{ public sealed class LockManager{
private const int RetryDelay = 250; private const int RetryDelay = 250;

View File

@@ -1,6 +1,6 @@
using System.Threading.Tasks; using System.Threading.Tasks;
namespace TweetLib.Core.Features.Updates{ namespace TweetLib.Core.Systems.Updates{
public interface IUpdateCheckClient{ public interface IUpdateCheckClient{
bool CanCheck { get; } bool CanCheck { get; }
Task<UpdateInfo> Check(); Task<UpdateInfo> Check();

View File

@@ -1,7 +1,7 @@
using System; using System;
using TweetLib.Core.Data; using TweetLib.Core.Data;
namespace TweetLib.Core.Features.Updates{ namespace TweetLib.Core.Systems.Updates{
public sealed class UpdateCheckEventArgs : EventArgs{ public sealed class UpdateCheckEventArgs : EventArgs{
public int EventId { get; } public int EventId { get; }
public Result<UpdateInfo> Result { get; } public Result<UpdateInfo> Result { get; }

View File

@@ -1,4 +1,4 @@
namespace TweetLib.Core.Features.Updates{ namespace TweetLib.Core.Systems.Updates{
public enum UpdateDownloadStatus{ public enum UpdateDownloadStatus{
None = 0, None = 0,
InProgress, InProgress,

View File

@@ -5,7 +5,7 @@ using System.Timers;
using TweetLib.Core.Data; using TweetLib.Core.Data;
using Timer = System.Timers.Timer; using Timer = System.Timers.Timer;
namespace TweetLib.Core.Features.Updates{ namespace TweetLib.Core.Systems.Updates{
public sealed class UpdateHandler : IDisposable{ public sealed class UpdateHandler : IDisposable{
public const int CheckCodeUpdatesDisabled = -1; public const int CheckCodeUpdatesDisabled = -1;

View File

@@ -3,7 +3,7 @@ using System.IO;
using System.Net; using System.Net;
using TweetLib.Core.Utils; using TweetLib.Core.Utils;
namespace TweetLib.Core.Features.Updates{ namespace TweetLib.Core.Systems.Updates{
public sealed class UpdateInfo{ public sealed class UpdateInfo{
public string VersionTag { get; } public string VersionTag { get; }
public string ReleaseNotes { get; } public string ReleaseNotes { get; }