4chan XT is a script that adds various features to anonymous imageboards. It was originally developed for 4chan but has no affiliation with it.
4chan XT was originally forked from 4chan X for this PR, It is a migration of 4chan X from coffeescript to TypeScript/JavaScript. It is named XT both as a continuation of eXTended, and a T for TypeScript. The goals of this project is to first get a working bundle from js/ts files, and then gradually convert js files to ts and add types as needed.
New features since the fork include:
- Fetching the thread from an external archive and inserting deleted posts
- Basic audio posts support
- Automatically converting unsupported image files to png
- Automatically JPG'ing image files above the size limit
- Having both relative time and a timestamp on a post at the same time
- Counting poster ID's as a replacement of the deleted IP counter
- Hiding all posts from a poster ID in a thread
- A manifest v3 version for chromium browsers dropping support for v2
- A button to un-randomize a filename in the quick reply
- Showing the reason a post was filtered in the stub
4chan X was previously developed by ccd0, aeosynth, Mayhem, ihavenoface, Zixaphir, Seaweed, and Spittie, with contributions from many others.
Uninstalling: 4chan XT disables the native extension, so if you uninstall 4chan XT, you'll need to re-enable it.
To do this, click the [Settings]
link in the top right corner, uncheck "Disable the native extension
" in the panel
that appears, and click the "Save Settings
" button. If you don't see a "Save Settings
" button, it may be being
hidden by your ad blocker.
Private browsing: By default, 4chan XT remembers your last read post in a thread and which posts were made by you,
even if you are in private browsing / incognito mode. If you want to turn this off, uncheck the
Remember Last Read Post
and Remember Your Posts
options in the settings panel. You can clear all 4chan browsing
history saved by 4chan XT by resetting your settings. This fork also includes an option to export settings without
exporting your history.
Use of the "Link Title" feature to fetch titles of Youtube links is subject to Youtube's Terms of Service and Privacy Policy. For more details on what information is sent to Youtube and other sites, and how to turn it off if you don't want the feature, see upstream 4chan X's privacy documentation.
To run an user script, you need an user script manager like Violentmonkey (Chrome, Firefox, Edge), or tampermonkey (Chrome, Firefox, Edge, Safari).
This fork is distributed through GitHub releases and Greasy Fork. There are known issues with updating user scripts through GitHub: #34 violentmonkey#1673, but Greasy Fork doesn't allow the minified version. Automatic updates are supported for the user script version, but not the Chrome extension.
The simplest build is as easy as npm install
npm run build
, but there are some options:
-min
: Minified output.-platform=userscript
,-platform=crx
: Only builds for one platform, and removes code related to only the other. Note that without this, the code is only build once without this optimization for both.-no-format
Skips some formatting like switching the indent from the TypeScript output back from 4 to 2, and removing the decaffeinate suggestions comments. Might speed up the build, but the result is larger.-test
Include tests in build.
If you encounter a bug, try the steps here, then report it to the issue tracker. If the bug seems to be caused by a script update, you can install a old version from the GitHub releases or from Greasy Fork.
- Changelog
- Frequently Asked Questions for this fork
- Frequently Asked Questions for upstream, most should still apply
- Report Bugs
- Contributing
Click to expand
- find alternative for
<% if (
- made html templates jsx/txt functions
- this uses the typescript compiler to compile the jsx
- render code is in src/globals/jsx.ts
- binary files are included as base64 in the bundle step, they do need explicit imports
-
<% if (readJSON('/.tests_enabled')) { %>
- replaced by
// #region tests_enabled
// #endregion
- replaced by
- made html templates jsx/txt functions
- build script
- userscript
- .crx extension
- crx directory that can be loaded as an unpacked extension is created
- port updates made to 4chan-X made since this was forked
- Clean up circular dependencies
Click to expand
- A lot of files have circular dependencies, but rollup can handle that
- but for some scripts that add to the same object I had to merge them, like Posting/QR and site/SW.yotsuba.js
- sometimes something might not be initialized before use, for example,
$.dict()
and$.SECONDS
- I moved these to a new file called helpers.ts, which shouldn't have dependencies itself
- tsconfig.json has
"checkJs": true,
, and a lot of js files report type errors when opened because of unknown properties on objects and reassigning variables with different types. These errors don't block the bundle at this moment. - the es 2020 target was chosen for optional chaining
- @violentmonkey/types was chosen over @types/greasemonkey because @types/greasemonkey only declares the GM object, and not GM_ functions