2022-07-03 08:33:23 +00:00
<!doctype html>
< html >
< head >
< meta charset = "utf-8" >
< meta name = "viewport" content = "width=device-width, initial-scale=1" / >
< link rel = "stylesheet" href = "/uwebzh/style.css" type = "text/css" / >
< title > Javascript and CSS for domains< / title >
< script type = "text/javascript" >
2022-07-12 02:24:02 +00:00
function findLang(){
2022-07-03 08:33:23 +00:00
let href = location.href;
for(let i=href.length-1;i>0;i--){
if('/'==href.charAt(i) & & '/'==href.charAt(i-3))
2022-07-12 02:24:02 +00:00
return i;
2022-07-03 08:33:23 +00:00
}
2022-07-12 02:24:02 +00:00
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);
2022-07-03 08:33:23 +00:00
}
< / 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 >
2022-07-12 02:24:02 +00:00
< a class = "logo" href = "javascript:void(0)" onclick = "return nav2Lang('zh')" > 简体中文< / a >
2022-07-03 08:33:23 +00:00
< nav >
< / nav >
< / header >
< br / >
< div class = "container" >
< h1 class = "title" > Javascript and CSS for domains
< br >
< span class = "subtitle" > < / span >
< / h1 >
< ul class = "tags" >
< li > < a href = "../tags/javascript" > javascript< / a > < / li >
< li > < a href = "../tags/css" > css< / a > < / li >
< / ul >
2022-10-07 02:39:52 +00: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 >
2022-07-03 08:33:23 +00:00
< ul >
< li > Need to be named as " [domain root].js" , such as " yahoo.com.js" or " finance.yahoo.com.js" . 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 >
2022-07-09 00:45:17 +00:00
< li > Script must be put under the folder " sitejs" or " /data/data/info.torapp.uweb/files/sitejs" . The later folder has the priority.< / li >
2022-07-03 08:33:23 +00:00
< li > Long press the button " settings" , check the option " Run user scripts" .< / li >
< li > Support 2/3-segment domains. If the length of the last 2-segments of domain is less than 7 (ex. " com.pl" ), then it is treated as one segment.< / li >
< / ul >
2022-10-07 02:39:52 +00:00
< h3 id = "css-style-and-earliest-loaded-js" > CSS style and earliest loaded JS< / h3 >
2022-07-03 08:33:23 +00:00
< ul >
< li > Need to be named as " [domain root].css" , such as yahoo.com.css or finance.yahoo.com.css。< / li >
2022-07-09 00:45:17 +00:00
< li > Under folder " sitecss" .< / li >
2022-07-03 08:33:23 +00:00
< li > " [domain root].js" is loaded at the earlieat time.< / li >
< li > Long press the button " settings" , check the option " Apply user styles" .< / li >
< / ul >
2022-07-09 00:45:17 +00:00
< p > If file " default.css" exists, the style will be applied to all sites without matching [domain root].css.< / p >
2022-10-07 02:39:52 +00:00
< h3 id = "extra-html-experimental" > Extra html (experimental)< / h3 >
< ul >
< li > Need to be named as " [domain].html" .< / li >
< li > Under folder " siteextra" .< / li >
< li > Long press the button " settings" , check the option " Apply user extra" .< / li >
< li > May have issues with some redirected urls.< / li >
< / ul >
2022-07-03 08:33:23 +00:00
< p > " sitejs/.js" , " sitecss/.css" and " sitecss/.js" are applied to all non-http urls (file urls etc.).< / p >
< / div >
< / body >
< / html >