You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by so...@apache.org on 2017/03/02 03:31:24 UTC

[09/14] incubator-weex git commit: * [doc] auto switch language only on the landing page.

* [doc] auto switch language only on the landing page.


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/83bfe648
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/83bfe648
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/83bfe648

Branch: refs/heads/dev
Commit: 83bfe6481d0309b412343fff831a5f25603ee719
Parents: 5529bb1
Author: Yun Dong <yu...@gmail.com>
Authored: Wed Mar 1 10:32:03 2017 +0800
Committer: Yun Dong <yu...@gmail.com>
Committed: Wed Mar 1 10:32:03 2017 +0800

----------------------------------------------------------------------
 doc/source/cn/guide/index.md                  | 35 ++++++++-
 doc/source/cn/references/modules/websocket.md | 75 ++++++++----------
 doc/source/guide/index.md                     | 34 +++++++-
 doc/source/references/modules/websocket.md    | 91 ++++++++++------------
 doc/themes/weex/languages/cn.yml              |  2 +-
 doc/themes/weex/languages/en.yml              |  2 +-
 doc/themes/weex/layout/_partial/footer.ejs    |  2 +-
 doc/themes/weex/layout/_partial/head.ejs      | 43 ----------
 doc/themes/weex/layout/index.ejs              | 29 ++++++-
 doc/themes/weex/source/css/index.scss         |  4 +-
 doc/themes/weex/source/js/common.js           | 33 ++++----
 11 files changed, 190 insertions(+), 160 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/83bfe648/doc/source/cn/guide/index.md
----------------------------------------------------------------------
diff --git a/doc/source/cn/guide/index.md b/doc/source/cn/guide/index.md
index 1fdc4ce..e2d43e4 100644
--- a/doc/source/cn/guide/index.md
+++ b/doc/source/cn/guide/index.md
@@ -12,7 +12,7 @@ Weex \u662f\u4e00\u5957\u7b80\u5355\u6613\u7528\u7684\u8de8\u5e73\u53f0\u5f00\u53d1\u65b9\u6848\uff0c\u80fd\u4ee5 web \u7684\u5f00\u53d1\u4f53\u9a8c
 
 ## Vue \u662f\u4ec0\u4e48\uff1f
 
-Vue.js \u662f Evan You \u5f00\u53d1\u7684\u6e10\u8fdb\u5f0f JavaScript \u6846\u67b6\uff0c\u5728\u6613\u7528\u6027\u3001\u7075\u6d3b\u6027\u548c\u6027\u80fd\u7b49\u65b9\u9762\u90fd\u975e\u5e38\u4f18\u79c0\u3002\u5f00\u53d1\u8005\u80fd\u591f\u901a\u8fc7\u64b0\u5199 `*.vue` \u6587\u4ef6\uff0c\u57fa\u4e8e `<template>`, `<style>`, `<script>` \u5feb\u901f\u6784\u5efa\u7ec4\u4ef6\u5316\u7684 web \u5e94\u7528\u3002
+Vue.js \u662f Evan You \u5f00\u53d1\u7684\u6e10\u8fdb\u5f0f JavaScript \u6846\u67b6\u3002\u5f00\u53d1\u8005\u80fd\u591f\u901a\u8fc7\u64b0\u5199 `*.vue` \u6587\u4ef6\uff0c\u57fa\u4e8e `<template>`, `<style>`, `<script>` \u5feb\u901f\u6784\u5efa\u7ec4\u4ef6\u5316\u7684 web \u5e94\u7528\u3002
 
 ## Hello World
 
@@ -21,13 +21,44 @@ Vue.js \u662f Evan You \u5f00\u53d1\u7684\u6e10\u8fdb\u5f0f JavaScript \u6846\u67b6\uff0c\u5728\u6613\u7528\u6027\u3001\u7075\u6d3b
 - \u4e3a\u4f60\u7684\u624b\u673a\u5b89\u88c5 [Playground App](https://alibaba.github.io/weex/download.html)\uff0c\u5f53\u7136\uff0cWeex \u662f\u8de8\u5e73\u53f0\u7684\u6846\u67b6\uff0c\u4f60\u4f9d\u7136\u53ef\u4ee5\u4f7f\u7528\u6d4f\u89c8\u5668\u8fdb\u884c\u9884\u89c8\uff0c\u53ea\u662f\u8fd9\u6837\u4f60\u5c31\u65e0\u6cd5\u611f\u53d7\u5230 native \u4f18\u79c0\u7684\u4f53\u9a8c\u4e86\u3002
 - \u5728\u65b0\u6807\u7b7e\u9875\u4e2d\u6253\u5f00 [Hello World](http://dotwe.org/vue/4d5a0471ece3daabd4681bc6d703c4c1) \u4f8b\u5b50\uff0c\u70b9\u51fb\u9884\u89c8\uff0c\u7136\u540e\u7528  Playground \u626b\u7801\u5373\u53ef\u3002
 
+\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u770b\u5230\u4e86\u719f\u6089\u7684 HTML \u8bed\u4e49\u5316\u6807\u7b7e\u3001CSS \u6837\u5f0f\u548c Javascript \u4ee3\u7801\u3002\u8fd9\u662f\u4e00\u4e2a\u6700\u7b80\u5355\u7684 Weex \u793a\u4f8b\uff0c\u5b83\u5728\u9875\u9762\u4e2d\u6e32\u67d3\u4e86\u4e00\u4e2a \u201cHello World\u201d\u3002\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e0d\u662f\u4e00\u4e2a H5 \u9875\u9762\uff0c\u800c\u662f native \u7684\u3002
 
 ![mobile_preview](https://img.alicdn.com/tps/TB1Ymw3OpXXXXcvXpXXXXXXXXXX-500-1013.jpg)
 
-\u5f88\u7b80\u5355\uff0c\u6211\u4eec\u53ef\u4ee5\u770b\u5230\u8bed\u6cd5\u5c31\u662f\u6211\u4eec\u719f\u6089\u7684 Vue\u3002\u4f60\u53ef\u4ee5\u4fee\u6539\u8fd9\u4e2a\u4f8b\u5b50\uff0c\u518d\u6b21\u626b\u7801\u5c1d\u8bd5\u3002
+### \u53d1\u751f\u4e86\u4ec0\u4e48\uff1f
+
+\u5c31\u5982\u793a\u4f8b\u4ee3\u7801\u6240\u793a\uff1a
+
+```html
+<template>
+  <div>
+    <text class="text">{{text}}</text>
+  </div>
+</template>
+
+<style>
+  .text {
+    font-size: 50;
+  }
+</style>
+
+<script>
+  export default {
+    data () {
+      return {
+        text: 'Hello World.'
+      }
+    }
+  }
+</script>
+```
+
+\u6211\u4eec\u6682\u65f6\u4e0d\u53bb\u5173\u5fc3 Weex \u7684\u6280\u672f\u7ec6\u8282\uff0c\u4ec5\u770b\u5927\u81f4\u7684\u4ee3\u7801\u7ed3\u6784\uff0c\u6211\u4eec\u53ef\u4ee5\u770b\u5230\u8bed\u6cd5\u5c31\u662f\u6211\u4eec\u719f\u6089\u7684 Vue\u3002\u4f60\u53ef\u4ee5\u4fee\u6539\u8fd9\u4e2a\u4f8b\u5b50\uff0c\u518d\u6b21\u626b\u7801\u5c1d\u8bd5\u3002
 
 ## \u642d\u5efa\u5f00\u53d1\u73af\u5883
 
+\u4f7f\u7528 dotWe \u5bf9 Weex \u5c1d\u9c9c\u662f\u4e00\u4e2a\u4e0d\u9519\u7684\u9009\u62e9\uff0c\u4f46\u5982\u679c\u4f60\u60f3\u66f4\u4e13\u4e1a\u7684\u5f00\u53d1 Weex\uff0c dotWe \u5c31\u4e0d\u600e\u4e48\u591f\u7528\u4e86\u3002\u672c\u8282\u4f1a\u6559\u4f60\u5982\u4f55\u642d\u5efa\u672c\u5730\u5f00\u53d1\u73af\u5883\u8fdb\u884c Weex \u5f00\u53d1\u3002
+
 ### \u7b2c\u4e00\u6b65\uff1a\u5b89\u88c5\u4f9d\u8d56
 
 Weex \u5b98\u65b9\u63d0\u4f9b\u4e86 weex-toolkit \u7684\u811a\u624b\u67b6\u5de5\u5177\u6765\u8f85\u52a9\u5f00\u53d1\u548c\u8c03\u8bd5\u3002\u9996\u5148\uff0c\u4f60\u9700\u8981 Node.js \u548c weex-toolkit\u3002

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/83bfe648/doc/source/cn/references/modules/websocket.md
----------------------------------------------------------------------
diff --git a/doc/source/cn/references/modules/websocket.md b/doc/source/cn/references/modules/websocket.md
index 4835e8e..8efaaa6 100644
--- a/doc/source/cn/references/modules/websocket.md
+++ b/doc/source/cn/references/modules/websocket.md
@@ -90,7 +90,7 @@ WebSockets \u662f\u4e00\u79cd\u5148\u8fdb\u7684\u6280\u672f, \u8fd9\u4f7f\u5f97\u5728\u7528\u6237\u7684 H5/iOS/Android \u548c\u4e00
   <scroller>
     <div>
       <div style="background-color: #286090">
-        <text class="title" style="height: 80px ;padding: 20px;color: white">websocket</text>
+        <text class="title" style="height: 80 ;padding: 20;color: #FFFFFF">websocket</text>
       </div>
       <input
               type="text"
@@ -107,64 +107,54 @@ WebSockets \u662f\u4e00\u79cd\u5148\u8fdb\u7684\u6280\u672f, \u8fd9\u4f7f\u5f97\u5728\u7528\u6237\u7684 H5/iOS/Android \u548c\u4e00
         <text class="button" onclick="{{send}}">send</text>
         <text class="button" onclick="{{close}}">close</text>
       </div>
-
-      <div style="background-color: lightgray">
-        <text class="title" style="height: 80px ;padding: 20px;color: black">method = send</text>
+      <div style="background-color: #D3D3D3;margin-top: 20">
+        <text class="title" style="height: 80 ;padding: 20;color: #000000">method = send</text>
       </div>
-      <text style="color: black;height: 80px">{{sendinfo}}</text>
-
-
-      <div style="background-color: lightgray">
-        <text class="title" style="height: 80px ;padding: 20px;color: black">method = onopen</text>
+      <text style="color: #000000;height: 80">{{sendinfo}}</text>
+      <div style="background-color: #D3D3D3">
+        <text class="title" style="height: 80 ;padding: 20;color: #000000">method = onopen</text>
       </div>
-      <text style="color: black;height: 80px">{{onopeninfo}}</text>
-
-      <div style="background-color: lightgray">
-        <text class="title" style="height: 80px ;padding: 20px;color: black">method = onmessage</text>
+      <text style="color: #000000;height: 80">{{onopeninfo}}</text>
+      <div style="background-color: #D3D3D3">
+        <text class="title" style="height: 80 ;padding: 20;color: #000000">method = onmessage</text>
       </div>
-      <text style="color: black;height: 400px">{{onmessage}}</text>
-
-      <div style="background-color: lightgray">
-        <text class="title" style="height: 80px ;padding: 20px;color: black">method = onclose</text>
+      <text style="color: #000000;height: 100">{{onmessage}}</text>
+      <div style="background-color: #D3D3D3">
+        <text class="title" style="height: 80 ;padding: 20;color: #000000">method = onclose</text>
       </div>
-      <text style="color: black;height: 80px">{{oncloseinfo}}</text>
-
-      <div style="background-color: lightgray">
-        <text class="title" style="height: 80px ;padding: 20px;color: black">method = onerror</text>
+      <text style="color: #000000;height: 80">{{oncloseinfo}}</text>
+      <div style="background-color: #D3D3D3">
+        <text class="title" style="height: 80 ;padding: 20;color: #000000">method = onerror</text>
       </div>
-      <text style="color: black;height: 80px">{{onerrorinfo}}</text>
-
-      <div style="background-color: lightgray">
-        <text class="title" style="height: 80px ;padding: 20px;color: black">method = close</text>
+      <text style="color: #000000;height: 80">{{onerrorinfo}}</text>
+      <div style="background-color: #D3D3D3">
+        <text class="title" style="height: 80 ;padding: 20;color: #000000">method = close</text>
       </div>
-      <text style="color: black;height: 80px">{{closeinfo}}</text>
-
+      <text style="color: #000000;height: 80">{{closeinfo}}</text>
     </div>
     </div>
   </scroller>
 </template>
-
 <style>
   .input {
-    font-size: 40px;
-    height: 80px;
-    width: 600px;
+    font-size: 40;
+    height: 80;
+    width: 600;
   }
   .button {
-    font-size: 36px;
-    width: 150px;
+    font-size: 36;
+    width: 150;
     color: #41B883;
     text-align: center;
-    padding-top: 25px;
-    padding-bottom: 25px;
-    border-width: 2px;
+    padding-top: 10;
+    padding-bottom: 10;
+    border-width: 2;
     border-style: solid;
-    margin-right: 20px;
+    margin-right: 20;
     border-color: rgb(162, 217, 192);
     background-color: rgba(162, 217, 192, 0.2);
   }
 </style>
-
 <script>
   var websocket = require('@weex-module/webSocket');
   module.exports = {
@@ -184,11 +174,12 @@ WebSockets \u662f\u4e00\u79cd\u5148\u8fdb\u7684\u6280\u672f, \u8fd9\u4f7f\u5f97\u5728\u7528\u6237\u7684 H5/iOS/Android \u548c\u4e00
     },
     methods: {
       connect:function() {
-        websocket.WebSocket('ws://115.29.193.48:8088','');
+        websocket.WebSocket('ws://echo.websocket.org','');
         var self = this;
+        self.onopeninfo = 'connecting...'
         websocket.onopen = function(e)
         {
-          self.onopeninfo = JSON.stringify(e);
+          self.onopeninfo = 'websocket open';
         }
         websocket.onmessage = function(e)
         {
@@ -200,6 +191,7 @@ WebSockets \u662f\u4e00\u79cd\u5148\u8fdb\u7684\u6280\u672f, \u8fd9\u4f7f\u5f97\u5728\u7528\u6237\u7684 H5/iOS/Android \u548c\u4e00
         }
         websocket.onclose = function(e)
         {
+          self.onopeninfo = '';
           self.onerrorinfo = e.code;
         }
       },
@@ -208,7 +200,6 @@ WebSockets \u662f\u4e00\u79cd\u5148\u8fdb\u7684\u6280\u672f, \u8fd9\u4f7f\u5f97\u5728\u7528\u6237\u7684 H5/iOS/Android \u548c\u4e00
         input.blur();
         websocket.send(this.txtInput);
         this.sendinfo = this.txtInput;
-
       },
       oninput: function(event) {
         this.txtInput = event.value;
@@ -221,4 +212,4 @@ WebSockets \u662f\u4e00\u79cd\u5148\u8fdb\u7684\u6280\u672f, \u8fd9\u4f7f\u5f97\u5728\u7528\u6237\u7684 H5/iOS/Android \u548c\u4e00
 </script>
 ```
 
-[Have a try](http://dotwe.org/weex/993f33173a712fecfb61c1c4b03bcb70)
+[Have a try](http://dotwe.org/weex/0256bbfc448f0fdbe8b10ba311c947b4)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/83bfe648/doc/source/guide/index.md
----------------------------------------------------------------------
diff --git a/doc/source/guide/index.md b/doc/source/guide/index.md
index 0abde32..6c11d54 100644
--- a/doc/source/guide/index.md
+++ b/doc/source/guide/index.md
@@ -12,7 +12,7 @@ Weex is a framework for building Mobile cross-platform high performance UI. Deve
 
 ## What is Vue?
 
-[Vue.js](https://vuejs.org/) is an excellent progressive JavaScript framework written by [Evan You](https://twitter.com/youyuxi) which is very ease and flexible to use. Developers can write `*.vue` files with friendly `<template>`, `<style>`, `<script>` tags to build componentized web app. Now Weex and Vue has supported each other officially. Weex put Vue 2.x as its built-in JS Framework, and Vue has already been able to develop native mobile app.
+[Vue.js](https://vuejs.org/) is an excellent progressive JavaScript framework written by [Evan You](https://twitter.com/youyuxi). Now Weex and Vue has supported each other officially. Weex put Vue 2.x as its built-in JS Framework, and Vue has already been able to develop native mobile app.
 
 ## Hello world
 
@@ -21,16 +21,46 @@ The easiest way to try Weex is to use the [Playground App](../playground.html) a
 - Install the [Playground App](../playground.html) for your phone.
 - Open [the Hello World example](http://dotwe.org/vue/4d5a0471ece3daabd4681bc6d703c4c1) in a new tab, click run, and then use the Playground App to scan the QR code.
 
-Nailed it!
+Nailed it! In this case, We can see HTML semantic tags, CSS styles and Javascript code. This is one of the simplest Weex examples. It rendered a "Hello World" in the page. Please note that this is not a Web page.
 
 ![mobile_preview](https://img.alicdn.com/tps/TB1Ymw3OpXXXXcvXpXXXXXXXXXX-500-1013.jpg)
 
+### What happened?
+
+As shown in the following code\uff1a
+
+```html
+<template>
+  <div>
+    <text class="text">{{text}}</text>
+  </div>
+</template>
+
+<style>
+  .text {
+    font-size: 50;
+  }
+</style>
+
+<script>
+  export default {
+    data () {
+      return {
+        text: 'Hello World.'
+      }
+    }
+  }
+</script>
+```
+
 It's too easy\uff0cright? Let's focus on the syntax, obviously this is vue.
 
 You can try to modify the Hello World, then generate a new QR code to scan.
 
 ## Set up development environment 
 
+Use dotWe is a good choice, But if you want to develop locally on your own machine, you will set up your development environment.
+
 You will need Node.js and the Weex CLi.
 
 You can installing Node using [nvm](https://github.com/creationix/nvm) (Simple bash script to manage multiple active node.js versions). Run the following commands in a Terminal after installing nvm:

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/83bfe648/doc/source/references/modules/websocket.md
----------------------------------------------------------------------
diff --git a/doc/source/references/modules/websocket.md b/doc/source/references/modules/websocket.md
index 7868903..b2752f4 100644
--- a/doc/source/references/modules/websocket.md
+++ b/doc/source/references/modules/websocket.md
@@ -89,81 +89,71 @@ An event listener to be called when an error occurs.
   <scroller>
     <div>
       <div style="background-color: #286090">
-        <text class="title" style="height: 80px ;padding: 20px;color: white">websocket</text>
+        <text class="title" style="height: 80 ;padding: 20;color: #FFFFFF">websocket</text>
       </div>
       <input
-        type="text"
-        placeholder="please input message to send"
-        class="input"
-        autofocus="false"
-        value=""
-        onchange="onchange"
-        oninput="oninput"
-        id = "input"
+              type="text"
+              placeholder="please input message to send"
+              class="input"
+              autofocus="false"
+              value=""
+              onchange="onchange"
+              oninput="oninput"
+              id = "input"
       />
       <div style="flex-direction: row; justify-content: center;">
         <text class="button" onclick="{{connect}}">connect</text>
         <text class="button" onclick="{{send}}">send</text>
         <text class="button" onclick="{{close}}">close</text>
       </div>
-
-      <div style="background-color: lightgray">
-        <text class="title" style="height: 80px ;padding: 20px;color: black">method = send</text>
+      <div style="background-color: #D3D3D3;margin-top: 20">
+        <text class="title" style="height: 80 ;padding: 20;color: #000000">method = send</text>
       </div>
-      <text style="color: black;height: 80px">{{sendinfo}}</text>
-
-
-      <div style="background-color: lightgray">
-        <text class="title" style="height: 80px ;padding: 20px;color: black">method = onopen</text>
+      <text style="color: #000000;height: 80">{{sendinfo}}</text>
+      <div style="background-color: #D3D3D3">
+        <text class="title" style="height: 80 ;padding: 20;color: #000000">method = onopen</text>
       </div>
-      <text style="color: black;height: 80px">{{onopeninfo}}</text>
-
-      <div style="background-color: lightgray">
-        <text class="title" style="height: 80px ;padding: 20px;color: black">method = onmessage</text>
+      <text style="color: #000000;height: 80">{{onopeninfo}}</text>
+      <div style="background-color: #D3D3D3">
+        <text class="title" style="height: 80 ;padding: 20;color: #000000">method = onmessage</text>
       </div>
-      <text style="color: black;height: 400px">{{onmessage}}</text>
-
-      <div style="background-color: lightgray">
-        <text class="title" style="height: 80px ;padding: 20px;color: black">method = onclose</text>
+      <text style="color: #000000;height: 100">{{onmessage}}</text>
+      <div style="background-color: #D3D3D3">
+        <text class="title" style="height: 80 ;padding: 20;color: #000000">method = onclose</text>
       </div>
-      <text style="color: black;height: 80px">{{oncloseinfo}}</text>
-
-      <div style="background-color: lightgray">
-        <text class="title" style="height: 80px ;padding: 20px;color: black">method = onerror</text>
+      <text style="color: #000000;height: 80">{{oncloseinfo}}</text>
+      <div style="background-color: #D3D3D3">
+        <text class="title" style="height: 80 ;padding: 20;color: #000000">method = onerror</text>
       </div>
-      <text style="color: black;height: 80px">{{onerrorinfo}}</text>
-
-      <div style="background-color: lightgray">
-        <text class="title" style="height: 80px ;padding: 20px;color: black">method = close</text>
+      <text style="color: #000000;height: 80">{{onerrorinfo}}</text>
+      <div style="background-color: #D3D3D3">
+        <text class="title" style="height: 80 ;padding: 20;color: #000000">method = close</text>
       </div>
-      <text style="color: black;height: 80px">{{closeinfo}}</text>
-
+      <text style="color: #000000;height: 80">{{closeinfo}}</text>
     </div>
     </div>
   </scroller>
 </template>
-
 <style>
   .input {
-    font-size: 40px;
-    height: 80px;
-    width: 600px;
+    font-size: 40;
+    height: 80;
+    width: 600;
   }
   .button {
-    font-size: 36px;
-    width: 150px;
+    font-size: 36;
+    width: 150;
     color: #41B883;
     text-align: center;
-    padding-top: 25px;
-    padding-bottom: 25px;
-    border-width: 2px;
+    padding-top: 10;
+    padding-bottom: 10;
+    border-width: 2;
     border-style: solid;
-    margin-right: 20px;
+    margin-right: 20;
     border-color: rgb(162, 217, 192);
     background-color: rgba(162, 217, 192, 0.2);
   }
 </style>
-
 <script>
   var websocket = require('@weex-module/webSocket');
   module.exports = {
@@ -183,11 +173,12 @@ An event listener to be called when an error occurs.
     },
     methods: {
       connect:function() {
-        websocket.WebSocket('ws://115.29.193.48:8088','');
+        websocket.WebSocket('ws://echo.websocket.org','');
         var self = this;
+        self.onopeninfo = 'connecting...'
         websocket.onopen = function(e)
         {
-          self.onopeninfo = JSON.stringify(e);
+          self.onopeninfo = 'websocket open';
         }
         websocket.onmessage = function(e)
         {
@@ -199,6 +190,7 @@ An event listener to be called when an error occurs.
         }
         websocket.onclose = function(e)
         {
+          self.onopeninfo = '';
           self.onerrorinfo = e.code;
         }
       },
@@ -207,7 +199,6 @@ An event listener to be called when an error occurs.
         input.blur();
         websocket.send(this.txtInput);
         this.sendinfo = this.txtInput;
-
       },
       oninput: function(event) {
         this.txtInput = event.value;
@@ -220,4 +211,4 @@ An event listener to be called when an error occurs.
 </script>
 ```
 
-[Have a try](http://dotwe.org/weex/993f33173a712fecfb61c1c4b03bcb70)
+[Have a try](http://dotwe.org/weex/0256bbfc448f0fdbe8b10ba311c947b4)

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/83bfe648/doc/themes/weex/languages/cn.yml
----------------------------------------------------------------------
diff --git a/doc/themes/weex/languages/cn.yml b/doc/themes/weex/languages/cn.yml
index b158e53..67f72e6 100644
--- a/doc/themes/weex/languages/cn.yml
+++ b/doc/themes/weex/languages/cn.yml
@@ -79,7 +79,7 @@ menu:
   advanced: \u9ad8\u9636\u77e5\u8bc6
   baichuan: \u963f\u91cc\u767e\u5ddd
   github: GitHub
-  legacy: \u65e7\u6587\u6863
+  legacy: \u65e7\u8bed\u6cd5\u6587\u6863
 playground:
   content: Weex Native \u8fd0\u884c\u65f6\u5b9e\u4f8b & Weex \u6587\u4ef6\u9884\u89c8\u5de5\u5177\u3002
 categories: Categories

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/83bfe648/doc/themes/weex/languages/en.yml
----------------------------------------------------------------------
diff --git a/doc/themes/weex/languages/en.yml b/doc/themes/weex/languages/en.yml
index d5a0015..47ca0ec 100644
--- a/doc/themes/weex/languages/en.yml
+++ b/doc/themes/weex/languages/en.yml
@@ -80,7 +80,7 @@ menu:
   advanced: Advanced
   baichuan: AliBaichuan
   github: GitHub
-  legacy: Legacy
+  legacy: Old Syntax Doc
 playground:
   content: Weex Native Runtime showcase & Weex we file preview.
 categories: Categories

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/83bfe648/doc/themes/weex/layout/_partial/footer.ejs
----------------------------------------------------------------------
diff --git a/doc/themes/weex/layout/_partial/footer.ejs b/doc/themes/weex/layout/_partial/footer.ejs
index 8e36aec..80fdc14 100644
--- a/doc/themes/weex/layout/_partial/footer.ejs
+++ b/doc/themes/weex/layout/_partial/footer.ejs
@@ -13,7 +13,7 @@
           <a href="<%= pick_lang('en') %>" data-lang="en">English</a>
         </li>
         <li>
-          <a href="<%= pick_lang('cn') %>" data-lang="cn">\u4e2d\u6587</a>
+          <a href="<%= pick_lang('cn') %>" data-lang="zh-cn">\u4e2d\u6587</a>
         </li>
       </ul>
     </div>

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/83bfe648/doc/themes/weex/layout/_partial/head.ejs
----------------------------------------------------------------------
diff --git a/doc/themes/weex/layout/_partial/head.ejs b/doc/themes/weex/layout/_partial/head.ejs
index f3d428c..e3f7962 100644
--- a/doc/themes/weex/layout/_partial/head.ejs
+++ b/doc/themes/weex/layout/_partial/head.ejs
@@ -21,49 +21,6 @@
   %>
   <title><% if (title){ %><%= title %> | <% } %><%= config.title %></title>
   <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
-  <script>
-  ;(function(){
-    var currentOrigin = location.origin,
-        currentPathname = location.pathname,
-        currentLang = navigator.language,
-        selectedLang = '';
-
-    if (!currentLang) {
-      currentLang = navigator.browserLanguage;
-    }
-
-    if (window.sessionStorage) {
-      selectedLang = window.sessionStorage.getItem('lang')
-    }
-
-    if (!selectedLang) {
-      if (currentLang.indexOf('zh') >= 0 && currentPathname.indexOf('/cn/') != 0) {
-        location.href = getUrl('cn', currentOrigin, currentPathname);
-      } else if (currentLang.indexOf('en') >= 0 && currentPathname.indexOf('/cn/') == 0) {
-        location.href = getUrl('en', currentOrigin, currentPathname);
-      }
-    }
-
-    function getUrl (lang, origin, path) {
-      if (lang == 'en') {
-        if (path.indexOf('/cn/') == 0) {
-          return origin + path.substr(3)
-        } else {
-          return origin + path
-        }
-      } else {
-        var langPath = '/' + lang + '/'
-        var pathStart = path.indexOf(langPath)
-
-        if (pathStart == 0) {
-          return origin + path
-        } else {
-          return origin + langPath + path.substr(1)
-        }
-      }
-    }
-  })();
-  </script>
   <%- open_graph({twitter_id: theme.twitter, google_plus: theme.google_plus, fb_admins: theme.fb_admins, fb_app_id: theme.fb_app_id}) %>
   <% if (theme.rss){ %>
     <link rel="alternate" href="<%- theme.rss %>" title="<%= config.title %>" type="application/atom+xml">

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/83bfe648/doc/themes/weex/layout/index.ejs
----------------------------------------------------------------------
diff --git a/doc/themes/weex/layout/index.ejs b/doc/themes/weex/layout/index.ejs
index d112ba7..01c964a 100644
--- a/doc/themes/weex/layout/index.ejs
+++ b/doc/themes/weex/layout/index.ejs
@@ -1,3 +1,30 @@
+<script>
+  ;(function(){
+    var currentOrigin = location.origin || 'https://weex-project.io',
+        currentPathname = location.pathname,
+        currentLang = navigator.language || navigator.browserLanguage || 'en',
+        selectedLang = '';
+
+    if (window.localStorage) {
+      selectedLang = window.localStorage.getItem('lang')
+      currentLang = selectedLang ? selectedLang : currentLang
+    }
+
+    if (/zh|cn/i.test(currentLang)) { // Chinese
+      if (currentPathname.indexOf('/cn/') != 0) {
+        location.href = currentOrigin + '/cn/'
+      }
+    } else if (/en/i.test(currentLang)) { // English
+      if (!/^\/$|^\/index/.test(currentPathname)) {
+        location.href = currentOrigin
+      }
+    } else { // Other
+      if (!/^\/$|^\/index/.test(currentPathname)) {
+        location.href = currentOrigin
+      }
+    }
+  })();
+</script>
 <div class="scene header" style="background: #00BDFF;">
   <div class="scene-container">
     <div class="galaxy left">
@@ -206,6 +233,6 @@ var swiper = new Swiper('.swiper-container', {
   loop: false,
   autoplay: false,
   autoplayDisableOnInteraction: false
-})
+});
 </script>
     
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/83bfe648/doc/themes/weex/source/css/index.scss
----------------------------------------------------------------------
diff --git a/doc/themes/weex/source/css/index.scss b/doc/themes/weex/source/css/index.scss
index a11852c..8eb4e76 100644
--- a/doc/themes/weex/source/css/index.scss
+++ b/doc/themes/weex/source/css/index.scss
@@ -13,12 +13,12 @@
   height: 100%;
   height: calc(100% - 72px);
 
-  &:nth-child(odd) {
+  &:nth-child(even) {
     background: $bg-gray;
     color: $text-blue;
   }
 
-  &:nth-child(even) {
+  &:nth-child(odd) {
     background: $bg-blue; 
     color: $text-white;
   }

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/83bfe648/doc/themes/weex/source/js/common.js
----------------------------------------------------------------------
diff --git a/doc/themes/weex/source/js/common.js b/doc/themes/weex/source/js/common.js
index 1eddfc6..70dc2dc 100644
--- a/doc/themes/weex/source/js/common.js
+++ b/doc/themes/weex/source/js/common.js
@@ -73,34 +73,37 @@
   initSidebar()
 
   /**
-   * Pick lang
+   * Switch language
    */
   function initPickLang () {
-    var pick = document.querySelector('.pick-lang')
-    var elements = document.querySelectorAll('.pick-lang a')
+    document.addEventListener('DOMContentLoaded', function (e) {
+      var pick = document.querySelector('.pick-lang')
+      var elements = document.querySelectorAll('.pick-lang a')
 
-    pick.addEventListener('click', function (e) {
-      e.preventDefault()
-      e.stopPropagation()
+      pick.addEventListener('click', function (e) {
+        e.preventDefault()
+        e.stopPropagation()
 
-      var target = e.target;
-      if (pick.contains(target)) {
-        var lang = target.getAttribute('data-lang')
+        var target = e.target;
+        if (pick.contains(target)) {
+          var lang = target.getAttribute('data-lang')
 
-        if (window.sessionStorage) {
-          window.sessionStorage.setItem('lang', lang)
-        }
+          if (window.localStorage) {
+            window.localStorage.setItem('lang', lang)
+          }
 
-        location.href = target.href
-      }
+          location.href = target.href
+        }
+      })
     })
   }
+
   initPickLang()
 
   /**
    *  Search
    */
-  function initSearch() {
+  function initSearch () {
     var form = document.querySelector('.search-form')
     var inputElements = document.querySelectorAll('.search-input')