5 <meta name=
"viewport" content=
"width=device-width, initial-scale=1" />
6 <link rel=
"canonical" href=
"https://jamesfengcao.gitlab.io/uweb/zh/rjs/" />
8 <link rel=
"stylesheet" href=
"../style.css#" type=
"text/css" />
9 <title>运行javascript脚本
</title>
12 let href
= location
.href
;
13 for(let i
=href
.length
-1;i
>0;i
--){
14 if('/'==href
.charAt(i
) && '/'==href
.charAt(i
-3))
21 location
.href
= location
.href
.substring(0,i
+1)+page
;
23 function nav2Lang(lang
){
25 let href
= location
.href
;
26 location
.href
= location
.href
.substring(0,i
-2)+lang
+location
.href
.substring(i
);
31 <header class='header'
>
32 <a class=
"logo" href=
"javascript:void(0)" onclick=
"return nav2('index.html#')">首页
</a> <a class=
"logo" href=
"javascript:void(0)" onclick=
"return nav2('tags/index.html#')">标签
</a>
35 <a class=
"logo" href=
"javascript:void(0)" onclick=
"return nav2Lang('en')">English
</a>
43 <div class=
"container">
44 <h1 class=
"title">运行javascript脚本
46 <span class=
"subtitle"></span>
51 <p><a href=
"../sitejs/index.html#">特定网址用户脚本
</a></p>
52 <p><b>全局脚本
</b>位于js子目录, 长按[☰]按钮配置。点击以下链
<br>
54 <a target=
"_self" href=
"i:0hjs/记住密码.js:../searchurl/txt/passwdsave.js">记住密码
</a><br>
55 <a target=
"_self" href=
"i:0hjs/极速网页.js:https://fastly.jsdelivr.net/npm/instant.page">极速网页
</a></p>
56 <p><b>大型脚本
</b>可安装到
"bookmarklet
"目录下(长按js按钮):
<br>
57 <a target=
"_self" href='i:
0hbookmarklet/eruda.js:https://fastly.jsdelivr.net/npm/eruda:%
0Aeruda.init()'
>Eruda
</a></p>
58 <p><a target=
"_self" href=
"i:0hbookmarklet/performance.js:https://fastly.jsdelivr.net/gh/micmro/performance-bookmarklet/dist/performanceBookmarklet.min.js">Performance
</a><br>
59 <a target=
"_self" href=
"i:0hbookmarklet/移除覆盖物.js:../searchurl/bml/content/rmo.js">移除覆盖物
</a></p>
60 <p><b>远程脚本
</b>配置文件default.rjs样列如下,点击以下链接自动安装 (清空后台重启浏览器,长按搜索按钮,则弹出远程脚本菜单):
</p>
61 <p><a href=
"i:04Selection to sentence:;let g='sentence';getSelection().modify('move','forward',g);getSelection().modify('extend','backward',g);">Selection to sentence:;let g='sentence';getSelection().modify('move','forward',g);getSelection().modify('extend','backward',g);
</a></p>
62 <p><a href=
"i:04Selection to line:;let g='line';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);
</a></p>
63 <p><a href=
"i:04Selection to paragraph:;let g='paragraph';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);
</a></p>
64 <p><a href=
"i:04显示数学公式:['https://fastly.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js']">显示数学公式:['https://fastly.jsdelivr.net/npm/mathjax@
3/es5/tex-svg.js']
</a></p>
65 <p><a href=
"i:04新窗口打开链接:;let d=document;b=d.createElement('base');b.setAttribute('target','_blank');d.head.appendChild(b)">新窗口打开链接:;let d=document;b=d.createElement('base');b.setAttribute('target','_blank');d.head.appendChild(b)
</a></p>
66 <p><a href=
"i:04站内搜索:;open('i:15site:' + location.hostname)">站内搜索:;open('i:
15site:' + location.hostname)
</a></p>
67 <p><a href=
"i:04编辑器拼写检查:;let t=document.getElementsByTagName('textarea');let v=t[0].spellcheck;if(v==null)v=false;t[0].spellcheck=!v">编辑器拼写检查:;let t=document.getElementsByTagName('textarea');let v=t[
0].spellcheck;if(v==null)v=false;t[
0].spellcheck=!v
</a></p>
68 <p>远程及小型脚本可安装到default.rjs文件中。远程脚本对CSP网站仍然有效。:
<br>
69 <a target=
"_self" href=
"i:0gdefault.rjs:../searchurl/txt/rjs.cfg">点击安装背景图等
</a></p>
70 <p>远程脚本配置文件default.rjs每行格式如下 (url部分支持js代码运算):
<br>
71 [远程脚本名]:[返回url数组的javascript代码]
</p>
72 <p>其中url可以为本地http脚本地址。譬如'https://local/...' (
<a href=
"../html5/index.html#">本地html5应用
</a>或
<a href=
"../offlinecache/index.html#">离线缓存
</a>)。此时,js脚本也可使用
<a href=
"../links/index.html#">.link文件
</a>方式调用。
</p>
75 <p>Last Modified:
25 October
2024<br>
76 markdown rjs to use marked
<br>
81 src='https://giscus.app/client.js'
82 data-repo=
"torappinfo/uweb"
83 data-repo-id=
"MDEwOlJlcG9zaXRvcnkzMDIyMDU3MjE="
84 data-category=
"Announcements"
85 data-category-id=
"DIC_kwDOEgNLGc4CQjsh"
88 data-reactions-enabled=
"1"
89 data-emit-metadata=
"0"
90 data-input-position=
"top"
94 crossorigin=
"anonymous" async
>
97 <footer class=
"site-footer">
98 <div class=
"container">
99 © 2018-
2025 Richard H. Cao
102 <!-- This document is licensed under the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is available at <https://www.gnu.org/licenses/>. -->