Skip to content

Commit

Permalink
use a fixed div for fediact running + go home button (easier to maint…
Browse files Browse the repository at this point in the history
…ain and does not mess up the header)
  • Loading branch information
lartsch committed Dec 19, 2022
1 parent a26c0d2 commit 69041ec
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 21 deletions.
14 changes: 1 addition & 13 deletions src/inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -574,18 +574,7 @@ function showModal(settings) {

function addFediElements() {
if (!$(".fediactrunning").length) {
if ($("div.ui__header").is(":visible")) {
$("a.ui__header__logo").remove()
$("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 a.brand").remove()
$("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>")
}
$("body").append("<div class='fediactrunning'><span>FediAct running</span> - <a target='" + settings.fediact_target + "' href='https://" + settings.fediact_homeinstance + "'>Go home</a></div>")
}
}

Expand Down Expand Up @@ -1419,7 +1408,6 @@ 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
Expand Down
Loading

0 comments on commit 69041ec

Please sign in to comment.