Execute javascript codes

javascript for domains
Earliest loaded global javascript files locates in the subfolder "css" of app private folder.

Global javascript files locates in the subfolder "js" of app private folder. Long press button [☰] to configure. Click the following links to install:
<a target=_self" href="i:0hjs/savePassword.js:../../zh/searchurl/txt/passwdsave.js">Save password
Instant page

large size javascript code can be installed to the folder "bookmarklet" (long pressing button "js" to popup menu):
Eruda
Performance

Note: Bookmarklets whose names begin with "!" are allowed to load remote js on CSP (Content Security Policy) sites.

Remote javascript is defined in default.rjs. Click the following link to install. (Force exit and re-launch the app, then long press the "search" button to popup the menu.):

Selection to sentence:;let g='sentence';getSelection().modify('move','forward',g);getSelection().modify('extend','backward',g);

Selection to line:;let g='line';getSelection().modify('move','forward',g);getSelection().modify('extend','backward',g);

Selection to paragraph:;let g='paragraph';getSelection().modify('move','forward',g);getSelection().modify('extend','backward',g);

markdown:['https://cdn.jsdelivr.net/npm/showdown/dist/showdown.min.js'];var d=document;var md=d.querySelector('pre').innerText;var c=new showdown.Converter({emoji:true,underline:true,});c.setFlavor('github');d.body.innerHTML=c.makeHtml(md);d.title=d.title||d.body.firstElementChild.innerText.trim();

mermaid:;loadModuleJS(import mermaid from 'https://unpkg.com/mermaid/dist/mermaid.esm.min.mjs';mermaid.initialize({startOnLoad:true});)

mathjax:['https://fastly.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js']

New tab to open links:;let d=document;b=d.createElement('base');b.setAttribute('target','_blank');d.head.appendChild(b)

Site search:;open('i:15site:' + location.hostname)

Spell check:;let t=document.getElementsByTagName('textarea');let v=t[0].spellcheck;if(v==null)v=false;t[0].spellcheck=!v

Google translate

Google translate to English

Remote script configuration file "default.rjs" whose lines have the following format:
[script name]:[javascript code to return url arrays]

Activated scripts

Activate either local (bookmarklets) or remote js to execute the code on the similar sites with option "Activate user script".

Since activated scripts use internal mechanism of "i:0m" urls, the script itself cannot have 'H', '?' or '/' as its very first character.

Allow remote js on CSP (Content Security Policy) sites

All remote js (default.rjs) are allowed to execute on CSP sites. Local js files without remote resource access work fine when under the folder "bookmarklet", others needs to be refered in default.rjs as http urls such as "https://local/..." (html5 or offline cache) .

Last Modified: 29 April 2023
bookmarklets to support CSP sites