mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-09-14 01:32:10 +02:00
Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
1bf9e7fb56 | |||
ca69554f37 | |||
cf7029037e | |||
418388b0ab | |||
a0f8689d4f | |||
95007bdd26 | |||
ab91540deb |
3
.github/FUNDING.yml
vendored
3
.github/FUNDING.yml
vendored
@@ -1,4 +1,3 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: chylex
|
||||
patreon: chylex
|
||||
ko_fi: chylex
|
||||
|
@@ -2,7 +2,7 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Controls;
|
||||
using TweetLib.Core.Features.Updates;
|
||||
using TweetLib.Core.Systems.Updates;
|
||||
|
||||
namespace TweetDuck.Browser.Bridge{
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Global")]
|
||||
|
@@ -20,7 +20,7 @@ using TweetDuck.Updates;
|
||||
using TweetDuck.Utils;
|
||||
using TweetLib.Core.Features.Plugins;
|
||||
using TweetLib.Core.Features.Plugins.Events;
|
||||
using TweetLib.Core.Features.Updates;
|
||||
using TweetLib.Core.Systems.Updates;
|
||||
|
||||
namespace TweetDuck.Browser{
|
||||
sealed partial class FormBrowser : Form, AnalyticsFile.IProvider{
|
||||
|
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using TweetDuck.Browser.Data;
|
||||
using TweetLib.Core.Features.Configuration;
|
||||
using TweetLib.Core.Features.Plugins.Config;
|
||||
using TweetLib.Core.Serialization.Converters;
|
||||
using TweetLib.Core.Systems.Configuration;
|
||||
using TweetLib.Core.Utils;
|
||||
|
||||
namespace TweetDuck.Configuration{
|
||||
|
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TweetLib.Core.Features.Configuration;
|
||||
using TweetLib.Core.Features.Plugins;
|
||||
using TweetLib.Core.Features.Plugins.Config;
|
||||
using TweetLib.Core.Features.Plugins.Events;
|
||||
using TweetLib.Core.Systems.Configuration;
|
||||
|
||||
namespace TweetDuck.Configuration{
|
||||
sealed class PluginConfig : BaseConfig, IPluginConfig{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
using TweetLib.Core.Features.Configuration;
|
||||
using TweetLib.Core.Systems.Configuration;
|
||||
|
||||
namespace TweetDuck.Configuration{
|
||||
sealed class SystemConfig : BaseConfig{
|
||||
|
@@ -3,9 +3,9 @@ using System.Drawing;
|
||||
using TweetDuck.Browser;
|
||||
using TweetDuck.Browser.Data;
|
||||
using TweetDuck.Controls;
|
||||
using TweetLib.Core.Features.Configuration;
|
||||
using TweetLib.Core.Features.Notifications;
|
||||
using TweetLib.Core.Features.Twitter;
|
||||
using TweetLib.Core.Systems.Configuration;
|
||||
|
||||
namespace TweetDuck.Configuration{
|
||||
sealed class UserConfig : BaseConfig{
|
||||
|
@@ -12,7 +12,7 @@ using TweetDuck.Management;
|
||||
using TweetDuck.Management.Analytics;
|
||||
using TweetDuck.Utils;
|
||||
using TweetLib.Core.Features.Plugins;
|
||||
using TweetLib.Core.Features.Updates;
|
||||
using TweetLib.Core.Systems.Updates;
|
||||
|
||||
namespace TweetDuck.Dialogs{
|
||||
sealed partial class FormSettings : Form, FormManager.IAppDialog{
|
||||
|
@@ -5,7 +5,7 @@ using System.Windows.Forms;
|
||||
using TweetDuck.Browser.Handling.General;
|
||||
using TweetDuck.Controls;
|
||||
using TweetDuck.Utils;
|
||||
using TweetLib.Core.Features.Updates;
|
||||
using TweetLib.Core.Systems.Updates;
|
||||
using TweetLib.Core.Utils;
|
||||
|
||||
namespace TweetDuck.Dialogs.Settings{
|
||||
|
@@ -14,8 +14,8 @@ using TweetDuck.Management;
|
||||
using TweetDuck.Resources;
|
||||
using TweetDuck.Utils;
|
||||
using TweetLib.Core;
|
||||
using TweetLib.Core.Application.Helpers;
|
||||
using TweetLib.Core.Collections;
|
||||
using TweetLib.Core.Systems.Startup;
|
||||
using TweetLib.Core.Utils;
|
||||
using Win = System.Windows.Forms;
|
||||
|
||||
|
@@ -871,8 +871,6 @@
|
||||
}
|
||||
|
||||
uploader.addFilesToUpload([ item.getAsFile() ]);
|
||||
|
||||
$(".js-compose-text", ".js-docked-compose").focus();
|
||||
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.
|
||||
//
|
||||
|
@@ -68,22 +68,13 @@ button[type='submit'] {
|
||||
/* General per-page styling */
|
||||
/****************************/
|
||||
|
||||
html[mobile][login] div[tweetduck-login-wrapper] {
|
||||
html[login] div[tweetduck-login-wrapper] {
|
||||
/* vertically center page & fix colors */
|
||||
margin-top: calc(50vh - 200px);
|
||||
padding: 26px 1.1vw;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
html[mobile][login] #tweetduck-helper:hover {
|
||||
html[login] #tweetduck-helper:hover {
|
||||
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;
|
||||
}
|
||||
|
@@ -1,7 +1,6 @@
|
||||
(function(){
|
||||
const isLogin = location.pathname === "/login";
|
||||
const isLogout = location.pathname === "/logout";
|
||||
const isMobile = location.host === "mobile.twitter.com";
|
||||
|
||||
//
|
||||
// Function: Inject custom CSS into the page.
|
||||
@@ -24,13 +23,6 @@
|
||||
else if (isLogout){
|
||||
document.documentElement.setAttribute("logout", "");
|
||||
}
|
||||
|
||||
if (isMobile){
|
||||
document.documentElement.setAttribute("mobile", "");
|
||||
}
|
||||
else{
|
||||
document.documentElement.setAttribute("desktop", "");
|
||||
}
|
||||
};
|
||||
|
||||
setTimeout(injectCSS, 1);
|
||||
@@ -53,84 +45,57 @@
|
||||
//
|
||||
if (isLogin){
|
||||
document.addEventListener("DOMContentLoaded", function(){
|
||||
if (isMobile){
|
||||
triggerWhenExists("main h1", function(heading){
|
||||
heading.parentNode.setAttribute("tweetduck-login-wrapper", "");
|
||||
return true;
|
||||
});
|
||||
triggerWhenExists("main h1", function(heading){
|
||||
heading.parentNode.setAttribute("tweetduck-login-wrapper", "");
|
||||
return true;
|
||||
});
|
||||
|
||||
triggerWhenExists("a[href='/i/flow/signup']", function(texts){
|
||||
texts = texts.parentNode;
|
||||
|
||||
triggerWhenExists("a[href='/i/flow/signup']", function(texts){
|
||||
texts = texts.parentNode;
|
||||
|
||||
let link = texts.childNodes[0];
|
||||
let separator = texts.childNodes[1];
|
||||
|
||||
if (link && separator){
|
||||
texts.classList.add("tweetduck-login-links");
|
||||
|
||||
link = link.cloneNode(false);
|
||||
link.id = "tweetduck-helper";
|
||||
link.href = "#";
|
||||
link.innerText = "Import TweetDuck profile";
|
||||
|
||||
texts.appendChild(separator.cloneNode(true));
|
||||
texts.appendChild(link);
|
||||
|
||||
link.addEventListener("click", function(){
|
||||
$TD.openProfileImport();
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
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();
|
||||
};
|
||||
let link = texts.childNodes[0];
|
||||
let separator = texts.childNodes[1];
|
||||
|
||||
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>`);
|
||||
if (link && separator){
|
||||
texts.classList.add("tweetduck-login-links");
|
||||
|
||||
texts.querySelector("#tweetduck-helper > a").addEventListener("click", function(){
|
||||
link = link.cloneNode(false);
|
||||
link.id = "tweetduck-helper";
|
||||
link.href = "#";
|
||||
link.innerText = "Import TweetDuck profile";
|
||||
|
||||
texts.appendChild(separator.cloneNode(true));
|
||||
texts.appendChild(link);
|
||||
|
||||
link.addEventListener("click", function(){
|
||||
$TD.openProfileImport();
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
//
|
||||
// Block: Hide cookie crap.
|
||||
//
|
||||
if (isMobile){
|
||||
document.addEventListener("DOMContentLoaded", function(){
|
||||
triggerWhenExists("a[href^='https://help.twitter.com/rules-and-policies/twitter-cookies']", function(cookie){
|
||||
while(!!cookie){
|
||||
if (cookie.offsetHeight > 30){
|
||||
cookie.remove();
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
cookie = cookie.parentNode;
|
||||
}
|
||||
document.addEventListener("DOMContentLoaded", function(){
|
||||
triggerWhenExists("a[href^='https://help.twitter.com/rules-and-policies/twitter-cookies']", function(cookie){
|
||||
while(!!cookie){
|
||||
if (cookie.offsetHeight > 30){
|
||||
cookie.remove();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
else{
|
||||
cookie = cookie.parentNode;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using TweetLib.Core.Features.Updates;
|
||||
using TweetLib.Core.Systems.Updates;
|
||||
|
||||
namespace TweetDuck.Updates{
|
||||
sealed partial class FormUpdateDownload : Form{
|
||||
|
@@ -6,7 +6,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Script.Serialization;
|
||||
using TweetDuck.Utils;
|
||||
using TweetLib.Core.Features.Updates;
|
||||
using TweetLib.Core.Systems.Updates;
|
||||
using TweetLib.Core.Utils;
|
||||
using JsonObject = System.Collections.Generic.IDictionary<string, object>;
|
||||
|
||||
|
@@ -6,6 +6,6 @@ using Version = TweetDuck.Version;
|
||||
|
||||
namespace TweetDuck{
|
||||
internal static class Version{
|
||||
public const string Tag = "1.18.5";
|
||||
public const string Tag = "1.18.6";
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using TweetLib.Core.Features.Configuration;
|
||||
using TweetLib.Core.Systems.Configuration;
|
||||
|
||||
namespace TweetLib.Core.Features.Plugins.Config{
|
||||
public sealed class PluginConfigInstance<T> : IConfigInstance<T> where T : BaseConfig, IPluginConfig{
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TweetLib.Core.Features.Configuration{
|
||||
namespace TweetLib.Core.Systems.Configuration{
|
||||
public abstract class BaseConfig{
|
||||
private readonly IConfigManager configManager;
|
||||
|
@@ -2,7 +2,7 @@
|
||||
using System.IO;
|
||||
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 T Instance { get; }
|
||||
public FileSerializer<T> Serializer { get; }
|
@@ -1,4 +1,4 @@
|
||||
namespace TweetLib.Core.Features.Configuration{
|
||||
namespace TweetLib.Core.Systems.Configuration{
|
||||
public interface IConfigInstance<out T>{
|
||||
T Instance { get; }
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace TweetLib.Core.Features.Configuration{
|
||||
namespace TweetLib.Core.Systems.Configuration{
|
||||
public interface IConfigManager{
|
||||
void TriggerProgramRestartRequested();
|
||||
IConfigInstance<BaseConfig> GetInstanceInfo(BaseConfig instance);
|
@@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
|
||||
namespace TweetLib.Core.Application.Helpers{
|
||||
namespace TweetLib.Core.Systems.Startup{
|
||||
public sealed class LockManager{
|
||||
private const int RetryDelay = 250;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TweetLib.Core.Features.Updates{
|
||||
namespace TweetLib.Core.Systems.Updates{
|
||||
public interface IUpdateCheckClient{
|
||||
bool CanCheck { get; }
|
||||
Task<UpdateInfo> Check();
|
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using TweetLib.Core.Data;
|
||||
|
||||
namespace TweetLib.Core.Features.Updates{
|
||||
namespace TweetLib.Core.Systems.Updates{
|
||||
public sealed class UpdateCheckEventArgs : EventArgs{
|
||||
public int EventId { get; }
|
||||
public Result<UpdateInfo> Result { get; }
|
@@ -1,4 +1,4 @@
|
||||
namespace TweetLib.Core.Features.Updates{
|
||||
namespace TweetLib.Core.Systems.Updates{
|
||||
public enum UpdateDownloadStatus{
|
||||
None = 0,
|
||||
InProgress,
|
@@ -5,7 +5,7 @@ using System.Timers;
|
||||
using TweetLib.Core.Data;
|
||||
using Timer = System.Timers.Timer;
|
||||
|
||||
namespace TweetLib.Core.Features.Updates{
|
||||
namespace TweetLib.Core.Systems.Updates{
|
||||
public sealed class UpdateHandler : IDisposable{
|
||||
public const int CheckCodeUpdatesDisabled = -1;
|
||||
|
@@ -3,7 +3,7 @@ using System.IO;
|
||||
using System.Net;
|
||||
using TweetLib.Core.Utils;
|
||||
|
||||
namespace TweetLib.Core.Features.Updates{
|
||||
namespace TweetLib.Core.Systems.Updates{
|
||||
public sealed class UpdateInfo{
|
||||
public string VersionTag { get; }
|
||||
public string ReleaseNotes { get; }
|
Reference in New Issue
Block a user