Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

UserScript and DevTools supports for Chromium based and WebView based browsers

License

NotificationsYou must be signed in to change notification settings

JingMatrix/ChromeXt

Repository files navigation

BuildDownloadTotal

Add UserScript and DevTools supports to Chromium based and WebView based browsers using Xposed framework.

How does it work?

We hook theonUpdateUrl function inUserScript.kt,add URL comparison there and evaluate JavaScript using the#"auto">Chromium based browsers,such asEgde,Bromite,Samsung Internet,andBrave, are fully supported.

Most WebView based browsers are also supported, if not, please report it.Note for WebView based browsers users: youonly need to enable this module for the browser application you wish to use,not for any possible WebView applications,neither for the Android system.

Usage

ChromeXt requiresXposed framework.

For root users, installLSPosed first,pick up the latest built APK from my repo'sGitHub Actions and install it.

For non-root users,I modify a bitLSPatch to supportChromeXt; here is how to use it:

  1. Download the latestlspatch-release from myGitHub Actions.
  2. Download the latestChromeXt.apk from myGitHub Actions.
  3. Extract previously downloaded files to get fileslspatch.jar (with some suffix) andChromeXt-signed.apk.
  4. Patch your APK (takingarm64_ChromePublic.apk as example) using the following command:java -jar lspatch.jar arm64_ChromePublic.apk -d -v -m ChromeXt-signed.apk --force --injectdex. Ifjava environment is not available, please consider using the providedmanager APK (and check theInject loader dex option).
  5. Install the patched APK, which might require you to first uninstall the one on your devices.

Notes: currentlyto download files fromGitHub Actions, one needs to log in GitHub.

The author uploads releases toXposed-Modules-Repo when needed, but not that frequently.

You can then install UserScripts from popular sources: URLs that ends with.user.js.

Supported API

Currently, ChromeXt supports almost allTampermonkey APIs:

  1. @name (colons not allowed), @namespace, @description and so on
  2. @match (conform to theChrome Standard, supportsregular expressions)
  3. @include = @match, @exclude
  4. @run-at: document-start, document-end, document-idle (the default and fallback value)
  5. @grant: GM_addStyle, GM_addElement, GM_xmlhttpRequest, GM_openInTab, GM_registerMenuCommand (shown in theResources panel of eruda), GM_unregisterMenuCommand, GM_download, unsafeWindow (= window)
  6. @grant: GM_setValue, GM_getValue (less powerful than GM.getValue), GM_listValues, GM_addValueChangeListener, GM_removeValueChangeListener, GM_setClipboard, GM_cookie, GM_notification, window.close
  7. @require, @resource (withoutSubresource Integrity)
  8. @inject-into, @sandox: by default, imported scripts using@require can define/overwrite global JavaScript objects; one can set@inject-into content or@sandbox DOM to disable this behavior
  9. @noframes: note that, to load UserScripts for frames, there must be a script with@grant frames on the main page

These APIs are implemented differently from the official ones, please refer to the source filesLocal.kt andGM.js if you have doubts or questions.

Moreover, there is the powerful (also dangerous)GM.ChromeXt API, which must be declared by@grant GM.ChromeXt tounlock its usage.It is locked by default so that the users are protected from malicious UserScripts exploiting ChromeXt.This API allows scripts to use the JavaScript methodChromeXt.dispatch(action, payload), which is fundamental to implement other APIs. (Hence, one can find usage examples inGM.js).Dispatchedaction andpayload are handled byListener.kt.

UserScripts manager front end

To manage scripts installed byChromeXt, here are a simple front end hosted ongithub.io and two mirrors of it (in case that you have connection issues):onrender.com,netlify.app.

Edit scripts before installing them

If you cancel the prompt of installing a new UserScript, then you can edit it directly in Chrome.Use theInstall UserScript page menu to install your modified UserScript.

DevTools for developers

From the three dots page menu, ChromeXt offers you the

  1. Developer tools menu for the UserScript manager front end,
  2. Eruda console menu for other pages.

ForEdge browser, these menus are moved to the page info menu,which locates at the left corner inside the URL input bar.

For WebView based browsers andSamsung Internet, these menu items are presented in the context menu.

Bonus

Since WebView based browsers have no unified designs, the followingfirst four features are not supported for them.(By the same reason, they are neither supported forSamsung Internet.)

Open in Chrome

The applicationChromeXt is able to

  1. received shared texts to search them usingGoogle,
  2. open JavaScript files to install them as UserScripts.

The reversed priority order of opening which Chromium based browsers is given inAndroidManifest.xml.

Solution of system gesture conflicts

By default, the history forward gesture of Chrome is available near the vertical center of screen.On other areas, only the system gesture is available.One can disable this behavior through theDeveloper options menu.(Tap seven times on the Chrome version from the Chrome settings, you will see theDeveloper options menu.)(InVivaldi browsers,Developer options menu is removed by its developers.)

Enable reader mode manually

ChromeXt adds a book icon in the page menu to enable reader (distiller) mode manually.

Export browser bookmarks

Bookmarks can be exported in HTML format through theDeveloper options menu.

AD Blocker solution

For blocking network requests, I recommend to useAdAway or any proxy AD Blocker such asclash.

A content cosmetic blocker is embedded into ChromeXt with the help of eruda.To use it, first open theEruda console.In theElements panel, one can use thepointer icon to select elements on the page.After clicking thedelete icon for a selected element, a corresponding filter will be saved to theResources panel,where one can manage previous added filters.These filters are saved in the browser even after clearing the site's data.

Another way to block ADs is using theContent-Security-Policy to block some scripts from loading.

User-Agent spoofing

One can edit the User-Agent from theInfo panel ofEruda console.A valid User-Agent should contain only ASCII characters.Currently, ChromeXt only changes theUser-Agent HTTP header, whichworks well but isdeprecated.

For Chromium based browsers, when the User-Agent spoofing is not taking effects, refresh the page using the reload button in the page menu.(By contrast, a swipe refresh might be insufficient.)

Note that the DevTools can also change User-Agent.

Contribute to this project

Before you submit your pull-requests, please ensure that the command./gradlew build orgradlew.bat build produces no warnings and no errors.

Here are corresponding files you might want / need to change:

  1. Front end:manager.vue
  2. Tampermonkey API:Local.ktandGM.js
  3. Eruda configuration:eruda.js
  4. Support more WebView based browsers:WebView.kt

Development plans

  • Make it possible to pass intents to Chrome withfile scheme
  • Fix encoding problem for Chrome downloaded JavaScript files
  • Inject module resource into Chrome
  • Implement developer tools
  • Use local versions oferuda
  • Improve eruda incorporation with Chrome
  • Add more information in the preference screen
  • Support moreTampermonkey APIs
  • Find elegant way to support DevTools for Android 11-
  • Add cosmetic AdBlocker using eruda
  • Find way to get current interactive tab
  • Remove AndroidX Room dependency to reduce app size
  • Support non-split version of Android Chrome
  • Solve the menu hook problem for non-split versions
  • Handle multiple Tab Model
  • Forward DevTools server socket
  • A mobile friendly DevTools front end
  • Allow user to trigger reader mode
  • Support @resource API
  • Make GestureNav Fix optional
  • Add an open source License
  • Support mocking User-Agent
  • SupporturlFilter syntax
  • ImproveOpen in Chrome function
  • Implement fullyGM_info
  • Eruda fails due toInjection Sinks
  • Hide page_info panel automatically
  • Fix page menu injection position
  • UseChrome DevTools Protocol as UserScript engine
  • Useadb forward to support non-root users
  • Fully support WebView based browsers
  • FixLSPatch for isolated process issue
  • Implement UserScript storage
  • Re-implement GM_xmlhttpRequest
  • Convert exported bookmarks to HTML format
  • Show executed scripts on current page
  • Make a YouTube presentation video
  • Support Samsung Internet browser
  • Implement GM_cookie
  • Improve valid UserScripts Url detection
  • Save and present script errors andGM_log logs
  • Useiframe and local server to run generalWebExtensions
  • Bypassstyle-src rule foreruda, such as Mastodon
  • Support importing UserScripts from Tampermonkey exports
  • Support backup and restore
  • Add recommended UserScripts to the front end manager
  • Addchrome devtools front-end for Edge, seedevtools_http_handler.cc as reference.
  • Hide inserted menu for non-page

[8]ページ先頭

©2009-2025 Movatter.jp