uweb/zh/sitejs/index.html
James Feng Cao 7ebb517e24 version 1042
2024-04-04 21:28:55 +08:00

113 lines
4.9 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="../style.css#" type="text/css" />
<title>特定网址脚本、样式、额外html及预处理</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('en')">English</a>
<nav>
</nav>
</header>
<br />
<div class="container">
<h1 class="title">特定网址脚本、样式、额外html及预处理
<br>
<span class="subtitle"></span>
</h1>
<ul class="tags">
<li><a href="../tags/javascript/index.html#">javascript</a> </li>
<li><a href="../tags/css/index.html#">css</a> </li>
</ul>
<p>技巧等级:中级</p>
<h3 id="脚本-第一时间装载js脚本见下面sitecss条目">脚本 (第一时间装载js脚本见下面sitecss条目)</h3>
<ul>
<li>脚本需命名为 &quot;[根域名].js&quot;譬如baidu.com.js 或tieba.baidu.com.js 。此脚本将自动作用于所有相同根域名的网址上。如有多个脚本满足条件,以最长文件名为准。</li>
<li>这些脚本需放到/data/data/info.torapp.uweb/files/sitejs目录下数量没有限制上百万都不成问题。</li>
<li>长按窗口按钮,勾选“执行网址用户脚本”。</li>
<li>脚本执行对浏览器无性能影响,即使有百万脚本存在。</li>
<li>目前支持两段、三段及少数四段域名最后两段不超过6字如com.cn的域名可取四段。所以脚本请不要以很长的域名来命名。</li>
</ul>
<h3 id="样式及第一时间装载js脚本">样式及第一时间装载js脚本</h3>
<ul>
<li>与此类似,用户样式需命名为 &quot;[根域名].css&quot;譬如baidu.com.css 或tieba.baidu.com.css。</li>
<li>样式文件需放到sitecss目录下。</li>
<li>sitecss目录下&quot;[根域名].js&quot;文件会在第一时间装载。</li>
<li>长按窗口按钮,勾选“使用网址用户样式”。</li>
<li>如果文件“default.css”存在访问网址时如果没有与域名匹配的css文件则使用此默认样式文件。</li>
<li>default.css可作为夜间模式来使用此时default.css为夜间模式css而黑色主题类网址对应的域名为空文件。此种设定情况下仅白色主题网页会使用夜间模式css。</li>
</ul>
<h3 id="额外html及预处理">额外html及预处理</h3>
<ul>
<li>需命名为 &quot;[域名].html&quot;譬如baidu.com.html。注意此处与sitejs, sitecss不同不再是&quot;[根域名]&quot;</li>
<li>文件需放到siteextra目录下。</li>
<li>长按窗口按钮,勾选“网址附加内容”。</li>
</ul>
<p>额外html可以以&quot;&lt;textarea&gt;&quot;&quot;&lt;div&gt;&lt;textarea&gt;&quot;等结尾此时超微算法自动判定用户欲对网址html源代码进行处理并将网址html源码附加在用户html后面从而成为textarea元素的内容供用户进行预处理。</p>
<p>文件&quot;sitejs/.js&quot;,&quot;sitecss/.css&quot;,&quot;sitecss/.js&quot;&quot;siteextra/.html&quot;可作用于一切非http url本地文件浏览器界面等</p>
</div>
<p>Last Modified: 2 April 2024<br>
minor changes for zh<br>
<pre></pre>
</p>
<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"
data-mapping="title"
data-strict="0"
data-reactions-enabled="1"
data-emit-metadata="0"
data-input-position="top"
data-theme="light"
data-lang="en"
data-loading="lazy"
crossorigin="anonymous" async>
</script>
<footer class="site-footer">
<div class="container">
&copy; 2018-2024 Richard H. Cao
</div>
</footer>
<!-- 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/>. -->
</body>
</html>