Add "Go home" button for v3 + v4

pull/21/head
lartsch 2022-12-19 06:36:55 -05:00
rodzic 348e5d1a05
commit 3ae11ff11d
4 zmienionych plików z 12 dodań i 4 usunięć

Wyświetl plik

@ -575,10 +575,13 @@ function showModal(settings) {
function addFediElements() {
if (!$(".fediactrunning").length) {
if ($("div.ui__header").is(":visible")) {
$("div.ui__header__links").prepend("<span class='fediactrunning'>FediAct running&nbsp;&nbsp;</span>")
$("div.ui__header__links").prepend("<span class='fediactrunning'>FediAct running</span>")
$("div.ui__header__links").append("<a target='" + settings.fediact_target + "' href='https://" + settings.fediact_homeinstance + "' class='button button-tertiary fediactgohome'><span>Go home</span></a>")
} else if ($("nav.header").length) {
$("nav.header div.nav-right").prepend("<span class='fediactrunning'>FediAct running&nbsp;&nbsp;</span>")
$("nav.header div.nav-right").prepend("<span class='fediactrunning fediv3'>FediAct running</span>")
$("nav.header div.nav-right").append("<a target='" + settings.fediact_target + "' class='webapp-btn nav-link nav-button fediactgohome' href='https://" + settings.fediact_homeinstance + "'>Go home</a>")
} else if ($("div.sign-in-banner").length) {
$("div.sign-in-banner").append("<a target='" + settings.fediact_target + "' href='https://" + settings.fediact_homeinstance + "' class='button button--block button-tertiary fediactgohome'><span>Go home</span></a>")
$("div.sign-in-banner").append("<span class='fediactrunning'>FediAct running</p>")
}
}
@ -1414,6 +1417,7 @@ async function backgroundProcessor() {
tmpSettings.processedFollow = []
tmpSettings.isProcessing = []
$(".fediactrunning").remove()
$(".fediactgohome").remove()
// rerun getSettings to keep mutes/blocks up to date while not reloading the page
if (!await getSettings()) {
// but reload if settings are invalid

2
src/inject.min.js vendored

File diff suppressed because one or more lines are too long

Wyświetl plik

@ -77,6 +77,10 @@
color: green;
}
.fediactrunning.fediv3 {
padding-right: 10px;
}
/*
We insert these styles for the DOMNodeAppeared function as separate stylesheet (see manifest) to fix

2
src/styles.min.css vendored
Wyświetl plik

@ -1 +1 @@
.fediactmodal{position:fixed;z-index:99999;left:0;top:0;width:100%;height:100%;overflow:auto;background-color:rgba(0,0,0,0.4);margin:0;padding:0}.fediactmodalinner{background-color:#494949;border:1px solid #888;width:50%;max-width:300px;left:50%;top:50%;transform:translate(-50%,-50%);position:absolute;margin:0;padding:0}.fediactmodallist{width:100%;margin:0;padding:0}.fediactmodalitem{cursor:pointer;width:100%;padding:5px 10px;box-sizing:border-box}.fediactmodallink{font-size:16px;cursor:pointer;text-decoration:none;color:white}.fediactprocessing{color:white;padding-right:10px;padding-left:10px}.fediactunresolved{color:orange;padding-right:10px;padding-left:10px}.fediactvoted{font-style:italic}.fediactvoted>a{font-weight:bold;color:orange}.fediactrunning{height:100%;display:flex;align-items:center;justify-content:center;color:green}@-moz-keyframes nodeInserted{from{opacity:1}to{opacity:1}}@-webkit-keyframes nodeInserted{from{opacity:1}to{opacity:1}}@-ms-keyframes nodeInserted{from{opacity:1}to{opacity:1}}@-o-keyframes nodeInserted{from{opacity:1}to{opacity:1}}@keyframes nodeInserted{from{opacity:1}to{opacity:1}}div.status,div.detailed-status,div.detailed-status__action-bar,div.account__header button.logo-button,div.account__header button.button--follow,div.public-account-header a.logo-button,div.account-card a.logo-button,div.directory-card a.icon-button,div.detailed-status a.logo-button,button.remote-button,script#initial-state{-webkit-animation-name:nodeInserted !important;-webkit-animation-duration:.001s !important;-ms-animation-name:nodeInserted !important;-ms-animation-duration:.001s !important;-moz-animation-name:nodeInserted !important;-moz-animation-duration:.001s !important;-o-animation-name:nodeInserted !important;-o-animation-duration:.001s !important;animation-name:nodeInserted !important;animation-duration:.001s !important}
.fediactmodal{position:fixed;z-index:99999;left:0;top:0;width:100%;height:100%;overflow:auto;background-color:rgba(0,0,0,0.4);margin:0;padding:0}.fediactmodalinner{background-color:#494949;border:1px solid #888;width:50%;max-width:300px;left:50%;top:50%;transform:translate(-50%,-50%);position:absolute;margin:0;padding:0}.fediactmodallist{width:100%;margin:0;padding:0}.fediactmodalitem{cursor:pointer;width:100%;padding:5px 10px;box-sizing:border-box}.fediactmodallink{font-size:16px;cursor:pointer;text-decoration:none;color:white}.fediactprocessing{color:white;padding-right:10px;padding-left:10px}.fediactunresolved{color:orange;padding-right:10px;padding-left:10px}.fediactvoted{font-style:italic}.fediactvoted>a{font-weight:bold;color:orange}.fediactrunning{height:100%;display:flex;align-items:center;justify-content:center;color:green}.fediactrunning.fediv3{padding-right:10px}@-moz-keyframes nodeInserted{from{opacity:1}to{opacity:1}}@-webkit-keyframes nodeInserted{from{opacity:1}to{opacity:1}}@-ms-keyframes nodeInserted{from{opacity:1}to{opacity:1}}@-o-keyframes nodeInserted{from{opacity:1}to{opacity:1}}@keyframes nodeInserted{from{opacity:1}to{opacity:1}}div.status,div.detailed-status,div.detailed-status__action-bar,div.account__header button.logo-button,div.account__header button.button--follow,div.public-account-header a.logo-button,div.account-card a.logo-button,div.directory-card a.icon-button,div.detailed-status a.logo-button,button.remote-button,script#initial-state{-webkit-animation-name:nodeInserted !important;-webkit-animation-duration:.001s !important;-ms-animation-name:nodeInserted !important;-ms-animation-duration:.001s !important;-moz-animation-name:nodeInserted !important;-moz-animation-duration:.001s !important;-o-animation-name:nodeInserted !important;-o-animation-duration:.001s !important;animation-name:nodeInserted !important;animation-duration:.001s !important}