uweb/en/sitejs/index.html

108 lines
4.6 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 08:23:07 +01:00
2024-04-01 15:51:55 +02:00
<link rel="stylesheet" href="../style.css#" type="text/css" />
<title>JS/CSS/HTML/preprocessing for domains</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'>
2024-04-02 07:42:43 +02:00
<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>
<nav>
</nav>
</header>
<br />
<div class="container">
<h1 class="title">JS/CSS/HTML/preprocessing for domains
<br>
<span class="subtitle"></span>
</h1>
<ul class="tags">
2024-04-01 15:51:55 +02:00
<li><a href="../tags/javascript/index.html#">javascript</a> </li>
2024-04-01 15:51:55 +02:00
<li><a href="../tags/css/index.html#">css</a> </li>
</ul>
2022-10-07 04:39:52 +02:00
<h3 id="javascript-load-when-page-completes-earliest-loaded-js-should-use-sitecss">Javascript (load when page completes, earliest loaded JS should use sitecss).</h3>
<ul>
<li>Need to be named as &quot;[domain root].js&quot;, such as &quot;yahoo.com.js&quot; or &quot;finance.yahoo.com.js&quot;. The script will be loaded on the whole domain tree sites. If several files matches the domain, then the script with longest file name is loaded.</li>
<li>Script must be put under the folder &quot;sitejs&quot; or &quot;/data/data/info.torapp.uweb/files/sitejs&quot;. The later folder has the priority.</li>
<li>Long press the button &quot;settings&quot;, check the option &quot;Run user scripts&quot;.</li>
<li>Support 2/3-segment domains. If the length of the last 2-segments of domain is less than 7 (ex. &quot;com.pl&quot;), then it is treated as one segment.</li>
</ul>
2022-10-07 04:39:52 +02:00
<h3 id="css-style-and-earliest-loaded-js">CSS style and earliest loaded JS</h3>
<ul>
<li>Need to be named as &quot;[domain root].css&quot;, such as yahoo.com.css or finance.yahoo.com.css。</li>
<li>Under folder &quot;sitecss&quot;.</li>
<li>&quot;[domain root].js&quot; is loaded at the earliest time.</li>
<li>Long press the button &quot;settings&quot;, check the option &quot;Apply user styles&quot;.</li>
</ul>
<p>If file &quot;default.css&quot; exists, the style will be applied to all sites not matching [domain root].css.</p>
<h3 id="extra-html-and-preprocessing">Extra html and preprocessing</h3>
2022-10-07 04:39:52 +02:00
<ul>
<li>Need to be named as &quot;[domain].html&quot;. Notice: the file name stem here is &quot;[full domain]&quot; not &quot;[domain root]&quot;.</li>
2022-10-07 04:39:52 +02:00
<li>Under folder &quot;siteextra&quot;.</li>
<li>Long press the button &quot;settings&quot;, check the option &quot;Apply user extra&quot;.</li>
</ul>
2023-01-29 12:19:15 +01:00
<p>An open tag as the last tag in the last 50 bytes of the user extra html expects more content to follow, thus the extra html is placed before the site html. Ex. when the extra html ends with &quot;&lt;textarea&gt;&quot; or &quot;&lt;plaintext&gt;&quot;, the site source html appears as the value of the textarea/plaintext element, thus the extra html can further process the the site source html before rendering. A self closed tag such as &quot;&lt;br&gt;&quot; acts like open tags, also makes the site source follow the extra html.</p>
<p>&quot;sitejs/.js&quot;, &quot;sitecss/.css&quot;, &quot;sitecss/.js&quot; and &quot;siteextra/.html&quot; are applied to all non-http urls (file urls etc.).</p>
</div>
2024-04-02 07:42:43 +02:00
<p>Last Modified: 2 April 2024<br>
support .js files under &#39;css&#39; folder<br>
2023-03-07 03:07:05 +01:00
<pre></pre>
</p>
2024-03-21 02:04:37 +01:00
2023-05-06 03:56:44 +02: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 04:49:29 +02:00
data-mapping="title"
2023-05-06 03:56:44 +02: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 04:49:29 +02:00
crossorigin="anonymous" async>
2023-05-06 03:40:28 +02:00
</script>
2024-04-03 03:47:35 +02:00
<footer class="site-footer">
<div class="container">
&copy; 2024 Richard H. Cao
</div>
</footer>
</body>
</html>