TuxedoTako / 4chan-xt

Adds various features to anonymous imageboards.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

4chan XT

Originally forked from 4chan X for this PR, this fork started getting some features on its own. See the releases.

The 4chan XT project 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.

Install

This fork is distributed trough GitHub releases and Greasy Fork. There are known issues with updating user script trough 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.

Build from source

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.

TODO

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
  • 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

Other notes

  • 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 choses for optional chaining
  • @violentmonkey/types was chosen over @types/greasemonkey because @types/greasemonkey only declares the GM object, and not GM_ functions

commits since this was forked

Click to expand
  • 944b04210c119aedf8da1a8bcabaca9b80312118 Update archive list.
    • 59ee8c57792d0f82491756a077e25f506fd62994 Desuarchive removes /gif/
    • 402679e33a06dfbe0dc39ceba5c24fed761b6a19 desuarchive removes /wsg/ files
    • 86071184aa39b3585f06c1a4e2921c411ad8cf10 archived.moe adds /pw/ search, tokyochronos has hosting issues
    • 8a6392b1cf721ddfae6d8f4e3ec2566f15755370 add Eientei
    • 451a06f54b878ce433b0775858affefc71927fc7 alice.al domain change
  • 2a8bf2adb0737ce7bb1e21f6b959e4c6e1de1bc7 Disable Javascript Whitelist on captcha iframe. #3292
  • e9c1529da7844a42a1b40458c2c77b77e23ca537 Make QR post more like original form post. #3330
  • d16062a8fac5c092c34310c7704ac3980494b6ef Merge remote-tracking branch '4chenz/master'
    • 8795b1c56dbdfb52a32ddb3ea80b549f0048dc7b Add Google Lens image search url
  • f3f03f5e79fb5f26c0fd4406b2ab6796851ea471 Replace Google image search link with Google Lens.
  • aef984da1a6af4d0003b51e7f03bce252ac71dff Remove empty space from ads if they don't load. https://kissu.moe/b/res/7155#11052
  • 19268975ea2d49a753624315b0928f27496aac02 Update Randomize Filename to match current 4chan format. https://boards.4channel.org/g/thread/91737566#p91784238
  • 2a47dfd8ba724b17f5bc5f9214bea8ce8b469398 Catch errors due to "Restricted" selection. #2905
  • 27957c25af5d182adc38f1e67a098ab338631ccd Release 4chan X v1.14.22.2.
  • eb25d6e797a1673fd7cddb257fce04055383ec9b Update chrome-webstore-upload.
  • 14e67e9a958633e37b4e4a6293cfa3a921c1eab0 Release 4chan X v1.14.22.3.
  • 7295b21b73eb13ec53fdc61767ada341c2e13144 Avoid breaking sauce settings of people with links to original Google Images and Google Lens, provided they didn't already update to v1.14.22.3.
  • 71873cd7b22a565c2a41fa24f63f7504152683eb Recognize JPEG files with .jfif extensions as images for purposes of Image Hover etc.; also recognize .avif and .jxl files as images.
  • ea2462ecc47327c6f0c31348d95fd2b1b6447cb3 Release 4chan X v1.14.22.4.
  • e31438f9a9907078508912fd4c4d44bf21ac773c Fix youtube /live embeds

Original readme:

screenshot

4chan X

4chan X is a script that adds various features to anonymous imageboards. It was originally developed for 4chan but has no affiliation with it.

It was previously developed by aeosynth, Mayhem, ihavenoface, Zixaphir, Seaweed, and Spittie, with contributions from many others.

If you're looking for a maintained fork of OneeChan (a style script used in addition to 4chan X), try https://github.com/KevinParnell/OneeChan.

Please note

Uninstalling: 4chan X disables the native extension, so if you uninstall 4chan X, 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 X 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 X by resetting your settings.

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 4chan X's privacy documentation.

Install

Firefox

Install Violentmonkey, Tampermonkey, or Greasemonkey (issues since v4: #2526, #2576), then click here to install 4chan X.

Ports of Greasemonkey are available for SeaMonkey and Pale Moon.

Chromium

Userscript: Install Violentmonkey or Tampermonkey, then click here to install 4chan X.

Chrome extension: 4chan X is also available as a standalone Chrome extension. The Chrome extension has the additional feature of being able to sync your settings and data with other devices via Chrome Sync. But there is an issue when the script updates: Whenever the Chrome extension is updated, until you hard refresh (F5) the tab, 4chan X is unable to save any data (such as posts marked as yours and settings changes). The userscript version above does not have this problem when 4chan X updates, only when Violentmonkey / Tampermonkey is updated. To install as a Chrome extension:

  • Chromium, Vivaldi: Download 4chan X, then open chrome://extensions and drag the downloaded file onto the page. Alternatively, you can install 4chan X from the Chrome store.
  • Opera: Click to install 4chan X, then follow the prompts to activate it in your extension manager.
  • Chrome: Install 4chan X from the Chrome store.

Note: This version of 4chan X does not work with Opera 12. If you need Opera 12 support, try loadletter's fork instead.

Safari

Install the Userscripts extension. Enable it by pressing ⌘,, navigating to the extensions pane and checking Userscripts checkbox. Now open the Userscripts editor by clicking on the </> button in the taskbar. Then click on the + button and select the New Javascript option. Replace the default text with the contents of the 4chan X script. Finally save it by pressing ⌘s.

WebKitGTK+ / QtWebKit / QtWebEngine

Several minimal browsers have support for userscripts and can run 4chan X. Due to the lack of the cross-site GM_* API, and lack of support for userscripts in iframes, not all features will work. You may experience crashes when repeatedly solving the default image-based captchas. You can avoid this problem by enabling Use Recaptcha v1 in your settings.

  • dwb: Install the userscripts extension, then save the script to the $XDG_CONFIG_HOME/dwb/greasemonkey or $HOME/.config/dwb/greasemonkey directory (creating it if necessary):

    dwbem -N -i userscripts
    wget -P ${XDG_CONFIG_HOME:-$HOME/.config}/dwb/greasemonkey https://www.4chan-x.net/builds/4chan-X.user.js
    
  • Midori: Enable User addons in your preferences, under the Extensions tab. In the Privacy tab, check Enable HTML5 local storage support. Optionally, if you want 4chan X to be able to open new tabs when you start or reply to a thread, you will need to check Allow scripts to open popups under the Behavior tab. Then click the link to the script to install it.

  • Luakit: Navigate to the script, then type the command :usi to install it.

  • uzbl: Install the script from https://github.com/singpolyma/singpolyma/blob/master/uzbl/data/scripts/userscript.sh, enable it in your config file, and then save 4chan X to $XDG_DATA_HOME/uzbl/userscripts (or $HOME/.local/share/uzbl/userscripts). The commands below assume you have run uzbl at least once to create its config file.

    wget -P "${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/scripts" https://raw.githubusercontent.com/singpolyma/singpolyma/master/uzbl/data/scripts/userscript.sh
    chmod +x "${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/scripts/userscript.sh"
    echo '@on_event LOAD_COMMIT spawn @scripts_dir/userscript.sh document-start' >> "${XDG_CONFIG_HOME:-$HOME/.config}/uzbl/config"
    echo '@on_event LOAD_FINISH spawn @scripts_dir/userscript.sh document-end'   >> "${XDG_CONFIG_HOME:-$HOME/.config}/uzbl/config"
    wget -P "${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/userscripts" https://www.4chan-x.net/builds/4chan-X.user.js
    
  • qutebrowser: Save the script to the $XDG_DATA_HOME/qutebrowser/greasemonkey or $HOME/.local/share/qutebrowser/greasemonkey directory:

    wget -P ${XDG_DATA_HOME:-$HOME/.local/share}/qutebrowser/greasemonkey https://www.4chan-x.net/builds/4chan-X.user.js
    

MS Edge

Install Tampermonkey, then click here to install 4chan X.

Other browsers

4chan X can be used in some browsers that do not support userscripts using a local proxy. Not all features will work.

Beta version

New features and non-urgent bugfixes are released on the beta channel for further testing before they are moved the stable version. Please report any issues you find, and be sure to mention which version you're using. You should back up your settings regularly to prevent them from being lost due to bugs.

To install the beta version and get updates whenever there's a new beta version:

To install the current beta version but get updates from the stable channel (for example, if just you want a particular recent feature):

Troubleshooting

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 changelog.

More information

About

Adds various features to anonymous imageboards.

License:Other


Languages

Language:JavaScript 82.1%Language:TypeScript 14.6%Language:CSS 2.4%Language:HTML 0.9%Language:Shell 0.0%