* [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/master Commit: 83bfe6481d0309b412343fff831a5f25603ee719 Parents: 5529bb1 Author: Yun Dong <[email protected]> Authored: Wed Mar 1 10:32:03 2017 +0800 Committer: Yun Dong <[email protected]> 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 æ¯ä¸å¥ç®åæç¨ç跨平å°å¼åæ¹æ¡ï¼è½ä»¥ web çå¼åä½éª ## Vue æ¯ä»ä¹ï¼ -Vue.js æ¯ Evan You å¼åçæ¸è¿å¼ JavaScript æ¡æ¶ï¼å¨æç¨æ§ãçµæ´»æ§åæ§è½çæ¹é¢é½é常ä¼ç§ãå¼åè è½å¤éè¿æ°å `*.vue` æä»¶ï¼åºäº `<template>`, `<style>`, `<script>` å¿«éæå»ºç»ä»¶åç web åºç¨ã +Vue.js æ¯ Evan You å¼åçæ¸è¿å¼ JavaScript æ¡æ¶ãå¼åè è½å¤éè¿æ°å `*.vue` æä»¶ï¼åºäº `<template>`, `<style>`, `<script>` å¿«éæå»ºç»ä»¶åç web åºç¨ã ## Hello World @@ -21,13 +21,44 @@ Vue.js æ¯ Evan You å¼åçæ¸è¿å¼ JavaScript æ¡æ¶ï¼å¨æç¨æ§ãçµæ´» - ä¸ºä½ çææºå®è£ [Playground App](https://alibaba.github.io/weex/download.html)ï¼å½ç¶ï¼Weex æ¯è·¨å¹³å°çæ¡æ¶ï¼ä½ ä¾ç¶å¯ä»¥ä½¿ç¨æµè§å¨è¿è¡é¢è§ï¼åªæ¯è¿æ ·ä½ å°±æ æ³æåå° native ä¼ç§çä½éªäºã - 卿°æ ç¾é¡µä¸æå¼ [Hello World](http://dotwe.org/vue/4d5a0471ece3daabd4681bc6d703c4c1) ä¾åï¼ç¹å»é¢è§ï¼ç¶åç¨ Playground æ«ç å³å¯ã +å¨è¿ä¸ªä¾åä¸ï¼æä»¬çå°äºçæç HTML è¯ä¹åæ ç¾ãCSS æ ·å¼å Javascript 代ç ãè¿æ¯ä¸ä¸ªæç®åç Weex 示ä¾ï¼å®å¨é¡µé¢ä¸æ¸²æäºä¸ä¸ª âHello Worldâã请注æï¼è¿ä¸æ¯ä¸ä¸ª H5 页é¢ï¼èæ¯ native çã  -å¾ç®åï¼æä»¬å¯ä»¥çå°è¯æ³å°±æ¯æä»¬çæç Vueãä½ å¯ä»¥ä¿®æ¹è¿ä¸ªä¾åï¼å次æ«ç å°è¯ã +### åçäºä»ä¹ï¼ + +å°±å¦ç¤ºä¾ä»£ç æç¤ºï¼ + +```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> +``` + +æä»¬ææ¶ä¸å»å ³å¿ Weex çææ¯ç»èï¼ä» ç大è´ç代ç ç»æï¼æä»¬å¯ä»¥çå°è¯æ³å°±æ¯æä»¬çæç Vueãä½ å¯ä»¥ä¿®æ¹è¿ä¸ªä¾åï¼å次æ«ç å°è¯ã ## æå»ºå¼åç¯å¢ +ä½¿ç¨ dotWe 对 Weex å°é²æ¯ä¸ä¸ªä¸éçéæ©ï¼ä½å¦æä½ æ³æ´ä¸ä¸çå¼å Weexï¼ dotWe 就䏿ä¹å¤ç¨äºãæ¬èä¼æä½ å¦ä½æå»ºæ¬å°å¼åç¯å¢è¿è¡ Weex å¼åã + ### ç¬¬ä¸æ¥ï¼å®è£ ä¾èµ Weex 宿¹æä¾äº weex-toolkit çèææ¶å·¥å ·æ¥è¾ å©å¼ååè°è¯ãé¦å ï¼ä½ éè¦ Node.js å weex-toolkitã 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 æ¯ä¸ç§å è¿çææ¯, è¿ä½¿å¾å¨ç¨æ·ç H5/iOS/Android åä¸ <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 æ¯ä¸ç§å è¿çææ¯, è¿ä½¿å¾å¨ç¨æ·ç H5/iOS/Android åä¸ <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 æ¯ä¸ç§å è¿çææ¯, è¿ä½¿å¾å¨ç¨æ·ç H5/iOS/Android åä¸ }, 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 æ¯ä¸ç§å è¿çææ¯, è¿ä½¿å¾å¨ç¨æ·ç H5/iOS/Android åä¸ } websocket.onclose = function(e) { + self.onopeninfo = ''; self.onerrorinfo = e.code; } }, @@ -208,7 +200,6 @@ WebSockets æ¯ä¸ç§å è¿çææ¯, è¿ä½¿å¾å¨ç¨æ·ç H5/iOS/Android åä¸ input.blur(); websocket.send(this.txtInput); this.sendinfo = this.txtInput; - }, oninput: function(event) { this.txtInput = event.value; @@ -221,4 +212,4 @@ WebSockets æ¯ä¸ç§å è¿çææ¯, è¿ä½¿å¾å¨ç¨æ·ç H5/iOS/Android åä¸ </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.  +### What happened? + +As shown in the following codeï¼ + +```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ï¼right? 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: é«é¶ç¥è¯ baichuan: é¿éç¾å· github: GitHub - legacy: æ§ææ¡£ + legacy: æ§è¯æ³ææ¡£ playground: content: Weex Native è¿è¡æ¶å®ä¾ & Weex æä»¶é¢è§å·¥å ·ã 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">䏿</a> + <a href="<%= pick_lang('cn') %>" data-lang="zh-cn">䏿</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')
