1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-05-30 05:34:06 +02:00

Fix twitter login page after it was migrated and broke detection

This commit is contained in:
chylex 2020-05-16 18:02:37 +02:00
parent 418388b0ab
commit cf7029037e
2 changed files with 41 additions and 85 deletions
Resources/Scripts

View File

@ -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;
}

View File

@ -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,7 +45,6 @@
//
if (isLogin){
document.addEventListener("DOMContentLoaded", function(){
if (isMobile){
triggerWhenExists("main h1", function(heading){
heading.parentNode.setAttribute("tweetduck-login-wrapper", "");
return true;
@ -86,37 +77,12 @@
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.
//
if (isMobile){
document.addEventListener("DOMContentLoaded", function(){
triggerWhenExists("a[href^='https://help.twitter.com/rules-and-policies/twitter-cookies']", function(cookie){
while(!!cookie){
@ -132,5 +98,4 @@
return false;
});
});
}
})();