index.html 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1" />
  6. <link rel="stylesheet" href="/uwebzh/style.css" type="text/css" />
  7. <title>Javascript and CSS for domains</title>
  8. <script type="text/javascript">
  9. function findLang(){
  10. let href = location.href;
  11. for(let i=href.length-1;i>0;i--){
  12. if('/'==href.charAt(i) && '/'==href.charAt(i-3))
  13. return i;
  14. }
  15. return 0;
  16. }
  17. function nav2(page){
  18. let i = findLang();
  19. location.href = location.href.substring(0,i+1)+page;
  20. }
  21. function nav2Lang(lang){
  22. let i = findLang();
  23. let href = location.href;
  24. location.href = location.href.substring(0,i-2)+lang+location.href.substring(i);
  25. }
  26. </script>
  27. </head>
  28. <body>
  29. <header class='header'>
  30. <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>
  31. <a class="logo" href="javascript:void(0)" onclick="return nav2Lang('zh')">简体中文</a>
  32. <nav>
  33. </nav>
  34. </header>
  35. <br />
  36. <div class="container">
  37. <h1 class="title">Javascript and CSS for domains
  38. <br>
  39. <span class="subtitle"></span>
  40. </h1>
  41. <ul class="tags">
  42. <li><a href="../tags/javascript">javascript</a> </li>
  43. <li><a href="../tags/css">css</a> </li>
  44. </ul>
  45. <p>Javascript (load when page completes, earliest loaded JS should use sitecss).</p>
  46. <ul>
  47. <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>
  48. <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>
  49. <li>Long press the button &quot;settings&quot;, check the option &quot;Run user scripts&quot;.</li>
  50. <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>
  51. </ul>
  52. <p>CSS style and earliest loaded JS</p>
  53. <ul>
  54. <li>Need to be named as &quot;[domain root].css&quot;, such as yahoo.com.css or finance.yahoo.com.css。</li>
  55. <li>Under folder &quot;sitecss&quot;.</li>
  56. <li>&quot;[domain root].js&quot; is loaded at the earlieat time.</li>
  57. <li>Long press the button &quot;settings&quot;, check the option &quot;Apply user styles&quot;.</li>
  58. </ul>
  59. <p>If file &quot;default.css&quot; exists, the style will be applied to all sites without matching [domain root].css.</p>
  60. <p>&quot;sitejs/.js&quot; , &quot;sitecss/.css&quot; and &quot;sitecss/.js&quot; are applied to all non-http urls (file urls etc.).</p>
  61. </div>
  62. </body>
  63. </html>