Browse Source

Info for firefox

main
Holly 1 year ago
parent
commit
f9fcf19afa
4 changed files with 43 additions and 24 deletions
  1. +2
    -1
      README.md
  2. +30
    -10
      index.html
  3. +1
    -5
      scripts.js
  4. +10
    -8
      style.css

+ 2
- 1
README.md View File

@ -23,6 +23,7 @@ For the same reason as the last question. That's how the `@match` directives are
## TODO
- ~~Figure out why it doesn't work on Firefox~~
- It's because the `@run-at context-menu` header only works in Chrome based browsers. The context menu item *appears* in Firefox but doesn't do anything. Find a workaraound
- ~~It's because the `@run-at context-menu` header only works in Chrome based browsers. The context menu item *appears* in Firefox but doesn't do anything. Find a workaraound~~
- It's actually because of something extremely different and much, much weirder. `@run-at context-menu` actually does exist in Firefox now, but there's a bizarre CSP enforcement bug that causes Firefox issues. Details on the installation page
- Don't rely on parsing human-readable text, won't work in other languages
- There's no good API or anything for this, going to need to parse the document structure

+ 30
- 10
index.html View File

@ -4,21 +4,23 @@
<meta charset="utf-8">
<title>Remote Instance Actions</title>
<link rel="stylesheet" type="text/css" href="style.css">
<script src="install_form.js"></script>
<script src="scripts.js"></script>
</head>
<body>
<body id="top">
<h1>Remote Instance Actions</h1>
<figure><img src="ria.png" alt="The userscript in action, suspending badfaith.instance." /><figcaption>Quickly suspend or silence remote instances from the Mastodon frontend</figure>
<div id="prereqs"><h2>Prerequisites</h2>
<p>Ensure Tampermonkey is installed: <a href="https://www.tampermonkey.net/">Tampermonkey Home Page</a> <a href="https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo">Chrome Extension</a> <s><a href="https://addons.mozilla.org/en-US/firefox/addon/tampermonkey/">Firefox Add-On</a></s></p>
<p>Ensure Tampermonkey is installed: <a href="https://www.tampermonkey.net/">Tampermonkey Home Page</a> <a href="https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo">Chrome Extension</a> <a href="https://addons.mozilla.org/en-US/firefox/addon/tampermonkey/">Firefox Add-On</a></p>
<p>At time of writing, the script doesn't work in Firefox and I'm not sure how to fix it. Looking for a workaround.</p></div>
<p><a id="firefoxnote-link" href="#firefoxnote"><strong>Extremely important note for Firefox users! Read this or the script WILL NOT WORK!</strong></a></p></div>
<hr>
<div id="installation"><h2>Installation Form</h2>
<h5 id="whyformlink"><a href="#whyform">Why?</a></h5>
<h5><a href="#whyform">Why?</a></h5>
<form id="install-form" action="remote_instance_actions.user.js" method="get">
<p>Enter each instance you wish to use the script on. This should be just "domain.tld", no extra formatting. One domain per line.</p>
@ -30,7 +32,7 @@
<div id="faq"><h2>FAQ</h2>
<h3>What's this?</h2>
<div id="whatsthis"><h3>What's this?</h2>
<p>Remote Instance Actions is a userscript I've written to aid in Mastodon moderation.</p>
@ -44,7 +46,7 @@
<p>A userscript is sort of like a browser extension, but smaller! Just a little bit of Javascript code that gets run on certain pages to enhance the experience.</p>
<p>Of course, most browsers do actually need a browser extension to run userscripts. The most popular and feature-complete one by far (as well as the one this userscript was tested with!) is Tampermonkey.</p>
<p>Of course, most browsers do actually need a browser extension to run userscripts. The most popular and feature-complete one by far (as well as the one this userscript was tested with!) is Tampermonkey.</p></div>
<div id="whyform"><h3>It's just a userscript? Why the complex installation process?</h3>
@ -58,15 +60,33 @@
<p>*This is not technically true, you can also match URLs with regular expressions. But anything that would match any Mastodon instance is going to have a lot of false positives, and I believe Tampermonkey throws up a big scary warning if you do this anyway.</p></div>
<h3>Can I see the source code?</h3>
<div id="source"><h3>Can I see the source code?</h3>
<p>Well, your browser will show you the code before installing, but if you want to inspect it it's available on <a href="https://git.hollymcfarland.com/monorail/remote_instance_actions">my gitea instance</a>.
<p>Well, your browser will show you the code before installing, but if you want to inspect it it's available on <a href="https://git.hollymcfarland.com/monorail/remote_instance_actions">my gitea instance</a>.</div>
<h3>How can I contact you?</h3>
<div id="contact"><h3>How can I contact you?</h3>
<p>If you're on the fediverse, I can be found at <a href="https://glaceon.social/@monorail">@monorail@glaceon.social</a>.</p>
<p>If you aren't... How exactly did you get here?</p></div>
<hr>
<div id="firefoxnote"><h2>Note For Firefox Users</h2>
<p>There's currently an extremely weird bug somewhere in the intersection of Tampermonkey and Firefox. I've managed to find a few reports of it occuring for other people, but only in the context of other issues that have since been closed. I have no idea what causes it, but there is a workaround.</p>
<p>Simply, your web browser has some security features built in to prevent any code that's not "supposed to be there" from executing. Tampermonkey is supposed to still be able to execute despite this, but something super weird and beyond my understanding is getting in its way. But for whatever reason, reloading the page <em>without your cache</em> fixes it. I can't explain why, but I can explain how to do it.</p>
<h4>At any point before using the script, press Ctrl+F5 to "hard refresh", reloading the page without using the cache. When you do, the script will work until the next time the page is loaded.</h4>
<p>Hopefully this issue is solved in the future, and this workaround stops being needed.</p>
<p>There is a way to work around the bug in a more permanent way, but it comes with some security risks. In fact, it's dangerous enough that I don't feel comfortable explaining how to do it here. But if you know what you're doing: Disabling CSP enforcement should allow the script to work.</p></div></div>
<hr>
<h4><a id="top-link" href="#top">Back to top</a></h4>
</body>
</html>

install_form.js → scripts.js View File

@ -12,11 +12,7 @@ function updateForm() {
}
}
function faqHighlight() {
document.getElementById("whyform").style.backgroundColor = "#ffffee";
}
document.addEventListener("DOMContentLoaded", function() {
document.getElementById("install-button").addEventListener("click", updateForm);
document.getElementById("whyformlink").addEventListener("click", faqHighlight);
});

+ 10
- 8
style.css View File

@ -1,6 +1,6 @@
body {
width: inherit;
margin: 0 22.5%;
padding: 0 22.5%;
font-family: Sans-Serif;
background-color: #D0D0D0;
font-size: 14pt;
@ -19,12 +19,6 @@ body {
text-align: center;
}
footer {
padding: 0 4em;
font-size: 10pt;
text-align: center;
}
form {
text-align: center;
}
@ -46,7 +40,7 @@ img {
margin-right: auto;
}
h1, h2, h5 {
h1, h2, h4, h5 {
text-align: center;
margin-bottom: 0;
}
@ -64,3 +58,11 @@ input[type=submit] {
width: 10em;
height: 4em;
}
div:target {
background-color: #ffffee;
}
#top-link {
padding: 2em;
}

Loading…
Cancel
Save