uweb/en/rjs/index.html

115 lines
7.9 KiB
HTML
Raw Normal View History

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
2023-12-11 07:23:07 +00:00
<link rel="stylesheet" href="../style.css" type="text/css" />
<title>Execute javascript codes</title>
<script type="text/javascript">
function findLang(){
let href = location.href;
for(let i=href.length-1;i>0;i--){
if('/'==href.charAt(i) && '/'==href.charAt(i-3))
return i;
}
return 0;
}
function nav2(page){
let i = findLang();
location.href = location.href.substring(0,i+1)+page;
}
function nav2Lang(lang){
let i = findLang();
let href = location.href;
location.href = location.href.substring(0,i-2)+lang+location.href.substring(i);
}
</script>
</head>
<body>
<header class='header'>
<a class="logo" href="javascript:void(0)" onclick="return nav2('index.html')">Home</a> <a class="logo" href="javascript:void(0)" onclick="return nav2('tags/index.html')">Tags</a>
<a class="logo" href="javascript:void(0)" onclick="return nav2Lang('zh')">简体中文</a>
2023-12-11 07:23:07 +00:00
<nav>
</nav>
</header>
<br />
<div class="container">
<h1 class="title">Execute javascript codes
<br>
<span class="subtitle"></span>
</h1>
<ul class="tags">
</ul>
<p><a href="../sitejs/index.html">javascript for domains</a><br>
<a href="../globalcss/index.html">Earliest loaded global javascript</a> files locates in the subfolder &quot;css&quot; of app private folder.</p>
<p><b>Global javascript</b> files locates in the subfolder &quot;js&quot; of app private folder. Long press button [☰] to configure. Click the following links to install:<br>
2023-02-20 14:03:43 +00:00
&lt;a target=_self&quot; href=&quot;i:0hjs/savePassword.js:../../zh/searchurl/txt/passwdsave.js&quot;&gt;Save password</a><br>
<a target="_self" href="i:0hjs/instantPage.js:https://fastly.jsdelivr.net/npm/instant.page">Instant page</a></p>
<p><b>large size javascript code</b> can be installed to the folder &quot;bookmarklet&quot; (long pressing button &quot;js&quot; to popup menu):<br>
2023-04-29 13:12:12 +00:00
<a target="_self" href="i:0hbookmarklet/!googleTranslate.js:https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit:%0A{let d=document,b=d.body,v=d.createElement('div');v.id='google_translate_element';v.style='position:fixed;bottom:10px;right:10px;cursor:pointer;z-index:9999';b.insertBefore(v,b.firstChild);function googleTranslateElementInit(){new google.translate.TranslateElement({layout:google.translate.TranslateElement.InlineLayout.SIMPLE,multilanguagePage:true,pageLanguage:'auto',includedLanguages:'zh-CN,zh-TW,en,ko,ja'},'google_translate_element');}}">google translation</a></p>
<p><a target="_self" href='i:0hbookmarklet/eruda.js:https://fastly.jsdelivr.net/npm/eruda:%0Aeruda.init()'>Eruda</a><br>
<a target="_self" href="i:0hbookmarklet/performance.js:https://fastly.jsdelivr.net/gh/micmro/performance-bookmarklet/dist/performanceBookmarklet.min.js">Performance</a></p>
<p>Note: Bookmarklets whose names begin with &quot;!&quot; are allowed to load remote js on CSP (Content Security Policy) sites.</p>
<p><b>Remote javascript</b> is defined in default.rjs. Click the following link to install. (<b>Force exit and re-launch the app</b>, then long press the &quot;search&quot; button to popup the menu.)</p>
<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>
<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>
<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>
<p><a href="i:04markdown:['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();">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();</a></p>
2023-02-20 14:03:43 +00:00
<p><a href="i:04mermaid:;loadModuleJS(`import mermaid from 'https://unpkg.com/mermaid/dist/mermaid.esm.min.mjs';mermaid.initialize({startOnLoad:true});`)">mermaid:;loadModuleJS(<code>import mermaid from 'https://unpkg.com/mermaid/dist/mermaid.esm.min.mjs';mermaid.initialize({startOnLoad:true});</code>)</a></p>
<p><a href="i:04mathjax:['https://fastly.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js']">mathjax:['https://fastly.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js']</a></p>
<p><a href="i:04New tab to open links:;let d=document;b=d.createElement('base');b.setAttribute('target','_blank');d.head.appendChild(b)">New tab to open links:;let d=document;b=d.createElement('base');b.setAttribute('target','_blank');d.head.appendChild(b)</a></p>
<p><a href="i:04Site search:;open('i:15site:' + location.hostname)">Site search:;open('i:15site:' + location.hostname)</a></p>
<p><a href="i:04Spell check:;let t=document.getElementsByTagName('textarea');let v=t[0].spellcheck;if(v==null)v=false;t[0].spellcheck=!v">Spell check:;let t=document.getElementsByTagName('textarea');let v=t[0].spellcheck;if(v==null)v=false;t[0].spellcheck=!v</a></p>
<p>Remote script configuration file &quot;default.rjs&quot; whose lines have the following format:<br>
[script name]:[javascript code to return url arrays]</p>
<h4 id="activated-scripts">Activated scripts</h4>
<p>Activate either local (bookmarklets) or remote js to execute the code on the similar sites with option &quot;Activate user script&quot;.</p>
<p>Since activated scripts use internal mechanism of <a href="../links/index.html">&quot;i:0m&quot; urls</a>, the script itself cannot have <span style="color:red">'H', '?' or '/'</span> as its very first character.</p>
2022-10-26 14:43:36 +00:00
<h4 id="allow-remote-js-on-csp-content-security-policy-sites">Allow remote js on CSP (Content Security Policy) sites</h4>
<p>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 &quot;bookmarklet&quot;, others needs to be refered in default.rjs as http urls such as &quot;https://local/...&quot; (<a href="../html5/index.html">html5</a> or <a href="../offlinecache/index.html">offline cache</a>) .</p>
</div>
2023-04-29 05:37:17 +00:00
<p>Last Modified: 29 April 2023<br>
2023-04-29 13:48:40 +00:00
add google translate in rjs.py<br>
2023-03-07 02:07:05 +00:00
<pre></pre>
</p>
2023-05-09 03:11:05 +00:00
<script>
if(location.href.indexOf("/zh/")>0){
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "../../js/gissues.js";
script.setAttribute("repo","jamesfengcao/uweb");
script.setAttribute("issue-term","title");
script.setAttribute("theme","github-light");
script.async = true;
document.body.appendChild(script);
}
</script>
2023-05-06 01:56:44 +00:00
<script id='jsgiscus'
src='https://giscus.app/client.js'
data-repo="torappinfo/uweb"
data-repo-id="MDEwOlJlcG9zaXRvcnkzMDIyMDU3MjE="
data-category="Announcements"
data-category-id="DIC_kwDOEgNLGc4CQjsh"
2023-05-06 02:49:29 +00:00
data-mapping="title"
2023-05-06 01:56:44 +00:00
data-strict="0"
data-reactions-enabled="1"
data-emit-metadata="0"
data-input-position="top"
data-theme="light"
data-lang="en"
data-loading="lazy"
2023-05-06 02:49:29 +00:00
crossorigin="anonymous" async>
2023-05-06 01:40:28 +00:00
</script>
</body>
</html>