NanderTGA's fork/branch of prettier-s0urce.
All previous, current, and future versions of prettier-s0urce are licensed under the GNU GPL v3.0 or later.
This fork of prettier aims to merge the multiple existing forks/branches into one awesome prettier, and aims to add more cool features and bugfixes. Right now, it includes all of Xen0o2's and d0t's work, and some of my own. While main prettier (Xen0o2's) and d0t's fork (d0urce) went around copy-pasting each other's changes, I use git's merging features to do it properly and not miss out on any changes or details. That does come with the possibility of a merge accidentally breaking stuff, but I try to be careful. I also aim to rewrite some code that I think could be better; I basically maintain this project now.
Convinced? Alright, welcome to the squad. There are 4 ways to launch prettier (these instructions can apply to any variant):
Use your favorite userscript manager. This solution automatically launches prettier every time you hop on s0urce and automatically checks for updates. When it finds a newer version available, it will ask you if you want to update.
In case you don't have a userscript extension yet, we recommend ViolentMonkey because it is free/libre software, while the popular extension TamperMonkey is not. Do note that it doesn't support mobile firefox at the moment, so you may have to use TamperMonkey instead there.
Browser rant (TLDR ViolentMonkey doesn't support Google Chrome and you should use Firefox instead for multiple reasons)
Do note that ViolentMonkey does not support Google Chrome, but you shouldn't be using that hot piece of garbage browser anyway. It does not support extensions on the mobile version, Google sabotaged ad/content blockers like uBlock Origin with the creation of ManifestV3 and they do not care about protecting your privacy. Instead, you should use a less sketchy browser like Mozilla Firefox, which has support for some extensions on mobile and seems to care more about protecting your privacy. Mozilla is not perfect either though, so there are forks like Librewolf and IronFox that aim to further improve upon their work.
I should probably also mention that other chromium-based browsers are usually less sketchy and some of them do feature support for extensions on mobile, and others like Cromite feature ad blocking and privacy improvements. I recommend Firefox and its forks mainly because of Google's monopoly on the browser market with chromium and the fact that they abused this monopoly by pushing ManifestV3.
Apart from the above browser rant, here are some detailed instructions:
- Install a userscript extension like ViolentMonkey (see above)
- Open one of these links (preferably in a new tab): prettier-n0urce (NanderTGA) or prettier-s0urce (Xen0o2) or prettier-d0urce (d0t)
- If your userscript extension is working, it'll show a screen with some buttons. Click the button that reads
Install. - Go back to s0urce and refresh the tab. After you press play, you should notice prettier launching.
- You can now close the other tabs.
If you don't have a userscript manager and can't install one for whatever reason, but you do have access to devtools, this works fine as well. You do have to manually go copy the code from github every time to then paste it in the console.
Here are some more detailed instructions:
- Open one of these three links in a new tab directly, then press
Ctrl + AandCtrl + Cto copy the entire file: prettier-n0urce (NanderTGA) or prettier-s0urce (Xen0o2) or prettier-d0urce (d0t) - Go back to the s0urce tab, and press F12 or
Ctrl + Shift + I. This will open the developer tools. In the panel or window that appears, click on the console tab somewhere at the top. - In this console tab, click somewhere on the bottom of the window to make sure you can type in there.
- Press
Ctrl + Vto paste the code and press enter to run it. If you're on some chromium-based browser, pasting code may not work. If this happens, typeallow pasting;and press enter, then try pasting again. - If you did everything correctly, you should notice prettier launching. You can now close the github page and the developer tools; the button to close devtools is usually in the top right corner.
A bookmarklet is a bookmark that runs javascript on the current page. Handy, right? If you think this is cool you might want to check out this way cooler bookmarklet the next time you're bored.
So here are the instructions:
- Add one (or multiple) of the following URLs to your bookmarks:
- prettier-n0urce (NanderTGA):
javascript:fetch%28%22https%3A//raw.githubusercontent.com/NanderTGA/prettier-s0urce/main/prettier-s0urce.user.js%22%29.then%28response%20%3D%3E%20response.text%28%29%29.then%28eval%29 - prettier-s0urce (Xen0o2):
javascript:fetch%28%22https%3A//raw.githubusercontent.com/Xen0o2/prettier-s0urce/main/prettier-s0urce.user.js%22%29.then%28response%20%3D%3E%20response.text%28%29%29.then%28eval%29 - prettier-d0urce (d0t):
javascript:fetch%28%22https%3A//raw.githubusercontent.com/d0t3k1/d0t-s0urce-prettier/main/d0urce-prettier.user.js%22%29.then%28response%20%3D%3E%20response.text%28%29%29.then%28eval%29
- prettier-n0urce (NanderTGA):
- Whenever you want to run prettier, click on one of these bookmarks. It doesn't matter whether you do this before or after clicking play. Make sure you're on the s0urce tab when clicking the bookmark though, otherwise nothing will happen. When you click the bookmark, you should notice prettier launching.
This cool method uses a bug in the terminal to run prettier. You can actually run any other javascript code using this method too. I've used this method countless of times myself to run prettier on my school chromebook.
Very big thank you to Nelumbo for finding this very useful bug!
- Start hacking someone
- Paste this snippet in the terminal and press enter:
<a onclick="eval(prompt())"> - Click the white text that appears in the terminal. You'll now get a popup. You can paste any javascript here and click OK to execute it.
- We're gonna load prettier using this, so paste this snippet in the popup and click OK:
fetch("https://raw.githubusercontent.com/NanderTGA/prettier-s0urce/main/prettier-s0urce.user.js").then(response => response.text()).then(eval)- Want to load Xen0o2's prettier instead? Paste this instead in the last step:
fetch("https://raw.githubusercontent.com/Xen0o2/prettier-s0urce/main/prettier-s0urce.user.js").then(response => response.text()).then(eval) - Want to load d0t's prettier instead? Paste this instead in the last step:
fetch("https://raw.githubusercontent.com/d0t3k1/d0t-s0urce-prettier/main/d0urce-prettier.user.js").then(response => response.text()).then(eval)
- Want to load Xen0o2's prettier instead? Paste this instead in the last step:
- You should now notice prettier launching. MISSION POSSIBLE!
Branches:
mainbranch: where the end result ends up; this the only one you really need to worry aboutd0urce-mainbranch: points to the main branch on d0t's prettier repositoryd0urce-renamed-main-filebranch: this is the main branch of d0t's fork but with one extra commit that renamesd0urce-prettier.user.jstoprettier-s0urce.user.jsso git merge can work
Remotes:
upstream: Xen0o2's prettier repositoryorigin: this repositoryd0urce: d0t's prettier repository
To merge from Xen0o2's prettier repository, I merge from the upstream remote into the main branch.
To merge from d0t's prettier repository, I first pull those commits into d0urce-main, then merge one commit into d0urce-renamed-main-file.
I then merge d0urce-renamed-main-file into main, this is also when I deal with merge conflicts.
If there's more commits to be merged, I proceed to merge another commit into d0urce-renamed-main-file and repeat the process.
I usually merge commits one-by-one so I can more easily deal with merge conflicts. Giant unclear diffs are a pain, especially when git is not aware that I have moved a lot of code around in my own branch and the line numbers differ greatly. Also, I would not advise using vscode's 3-way merge editor, as it takes ages to load to then find out it decided to resolve some conflicts behind your back in some wrong way.
Concretely, merging looks something like this:
git checkout d0urce-main
git pull
git checkout d0urce-renamed-main-file
git merge <hash from a commit the d0urce-main branch>
git checkout main
git merge d0urce-renamed-main-filePro tip: use git bash, it has all the usual commands you're used to on linux and has a more useful prompt than powershell.
It doesn't save your history properly though, so when you close vscode all the session's history will be lost unless you run history -w first.
(Not an issue on zsh, seriously though, you should try it.)
I encounter obsolete commits every once in a while because I wrote a competing feature or they manually merge something from a different fork. The way I deal with them is pretty straightforward. You might be thinking oh hey maybe he's cherry picking commits to only merge specific stuff, but no, I'm not. Turns out those can cause issues down the line. So I just merge without skipping commits (git doesn't really let you skip commits in case you didn't realize) and then revert the change afterwards. Often such a change (like d0t's original "open padlet" button) will cause a merge conflict too and so I try to put the code in a place that makes sense, although it doesn't really matter as I revert it right after.
I've noticed multiple times that assets loaded from external websites tend to break over time and it's a bit annoying having to deal with that. Some examples of links breaking are the spinning rat gif and the hammer symbol used in the evil staff features. To add insult to injury, this decreases the general stability of prettier-s0urce too! This especially is a problem because it can go unmaintained for long periods of time; Take the other repositories in the fork network as an example, this is the only maintained one left right now.
To prevent any more headaches due to links breaking and to increase stability, I aim to vendor all external assets used in this repository and change the links to point to their vendored versions here. This does not apply to s0urce assets or reputable CDNs (notable mention: twemoji's readme promoted loading it using MaxCDN, but a while ago that company disappeared off the internet and a bunch of twemoji cdn links broke as a result).
- setup eslint
- commit "new command system" line 1758
removed inventory index numbersre-add using an option/setting (disabled by default ig)- No idea what this actually did, since the inventory index numbers are still there; should look into it sometime
- Add an option to hide those numbers
- Add an option to change the spinning rat gif to something else or turn it off
- Dot added some css/setting that changes some colors used inside windows/tabs/whatever-they're-called, and it doesn't work in this fork how I intended it I think, idk I need to look into it sometime.
- The command bar hack command seems to break on higher latency networks, I guess it's trying to click a hack or port button that's not there yet
- Tweak URL linkifying so d0t's description triggers it too
- Add ability to customize alt-nav keybinds
- Search all of github and greasyfork for other forks or userscripts for s0urce 2