mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-04-22 18:15:47 +02:00
Fix broken forced redirect from plain twitter.com to TweetDeck
This commit is contained in:
parent
a7a5723c4b
commit
5f60852fbb
Resources/Content
.all.js
TweetDuck.csprojapi
login
tweetdeck
bypass_t.co_links.jsconfigure_language_for_translations.jsfix_dm_input_box_focus.jsfix_horizontal_scrolling_of_column_container.jsfix_media_preview_urls.jsfix_missing_bing_translator_languages.jsfocus_composer_after_alt_tab.jshook_theme_settings.jslimit_loaded_dm_count.jsmake_retweets_lowercase.jsrestore_cleared_column.jssetup_desktop_notifications.jssetup_sound_notifications.jssetup_tweetduck_account_bamboozle.jssetup_video_player.jsskip_pre_login_page.js
@ -6,6 +6,7 @@
|
||||
|
||||
import introduction from "./introduction/introduction.js";
|
||||
import hide_cookie_bar from "./login/hide_cookie_bar.js";
|
||||
import redirect_plain_twitter_com from "./login/redirect_plain_twitter_com";
|
||||
import setup_document_attributes from "./login/setup_document_attributes.js";
|
||||
import add_skip_button from "./notification/add_skip_button.js";
|
||||
import disable_clipboard_formatting_notification from "./notification/disable_clipboard_formatting.js";
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { crashDebug } from "../../api/utils.js";
|
||||
import { crashDebug } from "./utils.js";
|
||||
|
||||
/**
|
||||
* @callback FunctionReplacementCallback
|
23
Resources/Content/login/redirect_plain_twitter_com.js
Normal file
23
Resources/Content/login/redirect_plain_twitter_com.js
Normal file
@ -0,0 +1,23 @@
|
||||
import { replaceFunction } from "../api/patch.js";
|
||||
|
||||
function redirectToTweetDeck() {
|
||||
location.href = "https://tweetdeck.twitter.com";
|
||||
}
|
||||
|
||||
function hookHistoryStateFunction(func, args) {
|
||||
debugger;
|
||||
if (args[2] === "/") {
|
||||
redirectToTweetDeck();
|
||||
}
|
||||
else {
|
||||
func.apply(this, args);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirects plain twitter.com to TweetDeck, so that users cannot accidentally land on twitter.com login.
|
||||
*/
|
||||
export default function() {
|
||||
replaceFunction(window.history, "pushState", hookHistoryStateFunction);
|
||||
replaceFunction(window.history, "replaceState", hookHistoryStateFunction);
|
||||
};
|
@ -1,3 +1,6 @@
|
||||
/**
|
||||
* Sets up attributes on the <html> element for styling login/logout pages.
|
||||
*/
|
||||
export default function() {
|
||||
if (location.pathname === "/login") {
|
||||
document.documentElement.setAttribute("login", "");
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { $TD } from "../api/bridge.js";
|
||||
import { replaceFunction } from "../api/patch.js";
|
||||
import { TD } from "../api/td.js";
|
||||
import { checkPropertyExists } from "../api/utils.js";
|
||||
import { replaceFunction } from "./globals/patch_functions.js";
|
||||
|
||||
/**
|
||||
* @property {string[]} eventNames
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { $TDX } from "../api/bridge.js";
|
||||
import { replaceFunction } from "../api/patch.js";
|
||||
import { TD } from "../api/td.js";
|
||||
import { ensurePropertyExists } from "../api/utils.js";
|
||||
import { replaceFunction } from "./globals/patch_functions.js";
|
||||
|
||||
/**
|
||||
* Sets language for automatic translations.
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { $TDX } from "../api/bridge.js";
|
||||
import { runAfterFunction } from "../api/patch.js";
|
||||
import { TD } from "../api/td.js";
|
||||
import { ensurePropertyExists } from "../api/utils.js";
|
||||
import { runAfterFunction } from "./globals/patch_functions.js";
|
||||
|
||||
function focusDmInput() {
|
||||
document.querySelector(".js-reply-tweetbox").focus();
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { $ } from "../api/jquery.js";
|
||||
import { runAfterFunction } from "../api/patch.js";
|
||||
import { TD } from "../api/td.js";
|
||||
import { ensurePropertyExists } from "../api/utils.js";
|
||||
import { runAfterFunction } from "./globals/patch_functions.js";
|
||||
import { prioritizeNewestEvent } from "./globals/prioritize_newest_event.js";
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { replaceFunction } from "../api/patch.js";
|
||||
import { TD } from "../api/td.js";
|
||||
import { ensurePropertyExists } from "../api/utils.js";
|
||||
import { replaceFunction } from "./globals/patch_functions.js";
|
||||
|
||||
const formatRegex = /\?.*format=(\w+)/;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { replaceFunction } from "../api/patch.js";
|
||||
import { TD } from "../api/td.js";
|
||||
import { ensurePropertyExists } from "../api/utils.js";
|
||||
import { replaceFunction } from "./globals/patch_functions.js";
|
||||
|
||||
/**
|
||||
* Adds missing languages for Bing Translator (Bengali, Icelandic, Tagalog, Tamil, Telugu, Urdu).
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { $ } from "../api/jquery.js";
|
||||
import { replaceFunction } from "../api/patch.js";
|
||||
import { onAppReady } from "../api/ready.js";
|
||||
import { replaceFunction } from "./globals/patch_functions.js";
|
||||
import { prioritizeNewestEvent } from "./globals/prioritize_newest_event.js";
|
||||
|
||||
/**
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { $TD } from "../api/bridge.js";
|
||||
import { runAfterFunction } from "../api/patch.js";
|
||||
import { onAppReady } from "../api/ready.js";
|
||||
import { TD } from "../api/td.js";
|
||||
import { ensurePropertyExists } from "../api/utils.js";
|
||||
import { getClassStyleProperty } from "./globals/get_class_style_property.js";
|
||||
import { runAfterFunction } from "./globals/patch_functions.js";
|
||||
|
||||
function refreshSettings() {
|
||||
const fontSizeName = TD.settings.getFontSize();
|
||||
|
@ -1,8 +1,8 @@
|
||||
// noinspection JSUnusedGlobalSymbols
|
||||
|
||||
import { replaceFunction } from "../api/patch.js";
|
||||
import { TD } from "../api/td.js";
|
||||
import { ensurePropertyExists } from "../api/utils.js";
|
||||
import { replaceFunction } from "./globals/patch_functions.js";
|
||||
|
||||
/**
|
||||
* Limits amount of loaded DMs to avoid massive lag from re-opening them several times.
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { runAfterFunction } from "../api/patch.js";
|
||||
import { TD } from "../api/td.js";
|
||||
import { checkPropertyExists } from "../api/utils.js";
|
||||
import { injectMustache } from "./globals/inject_mustache.js";
|
||||
import { runAfterFunction } from "./globals/patch_functions.js";
|
||||
|
||||
/**
|
||||
* Makes texts saying 'Retweet' lowercase.
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { $ } from "../api/jquery.js";
|
||||
import { replaceFunction } from "../api/patch.js";
|
||||
import { TD } from "../api/td.js";
|
||||
import { checkPropertyExists } from "../api/utils.js";
|
||||
import { replaceFunction } from "./globals/patch_functions.js";
|
||||
|
||||
/**
|
||||
* Allows restoring cleared columns by holding Shift.
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { $TD, $TDX } from "../api/bridge.js";
|
||||
import { $ } from "../api/jquery.js";
|
||||
import { replaceFunction } from "../api/patch.js";
|
||||
import { TD } from "../api/td.js";
|
||||
import { checkPropertyExists, ensurePropertyExists } from "../api/utils.js";
|
||||
import { getColumnName } from "./globals/get_column_name.js";
|
||||
import { replaceFunction } from "./globals/patch_functions.js";
|
||||
|
||||
/**
|
||||
* Event callback for a new tweet.
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { $TDX } from "../api/bridge.js";
|
||||
import { replaceFunction } from "../api/patch.js";
|
||||
import { isAppReady } from "../api/ready.js";
|
||||
import { replaceFunction } from "./globals/patch_functions.js";
|
||||
|
||||
/**
|
||||
* Adds support for sound notification settings.
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { replaceFunction } from "../api/patch.js";
|
||||
import { TD } from "../api/td.js";
|
||||
import { checkPropertyExists } from "../api/utils.js";
|
||||
import { replaceFunction } from "./globals/patch_functions.js";
|
||||
|
||||
/**
|
||||
* Replaces displayed name and avatar of the official TweetDuck account.
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { $TD } from "../api/bridge.js";
|
||||
import { replaceFunction, runAfterFunction } from "../api/patch.js";
|
||||
import { TD } from "../api/td.js";
|
||||
import { checkPropertyExists, noop } from "../api/utils.js";
|
||||
import { getHoveredTweet } from "./globals/get_hovered_tweet.js";
|
||||
import { injectMustache } from "./globals/inject_mustache.js";
|
||||
import { replaceFunction, runAfterFunction } from "./globals/patch_functions.js";
|
||||
|
||||
/**
|
||||
* @param {HTMLElement} ele
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { replaceFunction } from "../api/patch.js";
|
||||
import { TD } from "../api/td.js";
|
||||
import { ensurePropertyExists } from "../api/utils.js";
|
||||
import { replaceFunction } from "./globals/patch_functions.js";
|
||||
|
||||
/**
|
||||
* Skips the pre-login page so that users immediately see the login page.
|
||||
|
@ -389,6 +389,7 @@
|
||||
<Content Include="Resources\Content\.all.js" />
|
||||
<Content Include="Resources\Content\api\bridge.js" />
|
||||
<Content Include="Resources\Content\api\jquery.js" />
|
||||
<Content Include="Resources\Content\api\patch.js" />
|
||||
<Content Include="Resources\Content\api\ready.js" />
|
||||
<Content Include="Resources\Content\api\td.js" />
|
||||
<Content Include="Resources\Content\api\utils.js" />
|
||||
@ -398,6 +399,7 @@
|
||||
<Content Include="Resources\Content\load.js" />
|
||||
<Content Include="Resources\Content\login\hide_cookie_bar.js" />
|
||||
<Content Include="Resources\Content\login\login.css" />
|
||||
<Content Include="Resources\Content\login\redirect_plain_twitter_com.js" />
|
||||
<Content Include="Resources\Content\login\setup_document_attributes.js" />
|
||||
<Content Include="Resources\Content\notification\add_skip_button.js" />
|
||||
<Content Include="Resources\Content\notification\disable_clipboard_formatting.js" />
|
||||
@ -436,7 +438,6 @@
|
||||
<Content Include="Resources\Content\tweetdeck\globals\get_hovered_column.js" />
|
||||
<Content Include="Resources\Content\tweetdeck\globals\get_hovered_tweet.js" />
|
||||
<Content Include="Resources\Content\tweetdeck\globals\inject_mustache.js" />
|
||||
<Content Include="Resources\Content\tweetdeck\globals\patch_functions.js" />
|
||||
<Content Include="Resources\Content\tweetdeck\globals\prioritize_newest_event.js" />
|
||||
<Content Include="Resources\Content\tweetdeck\globals\reload_browser.js" />
|
||||
<Content Include="Resources\Content\tweetdeck\globals\reload_columns.js" />
|
||||
|
Loading…
Reference in New Issue
Block a user