From 83bfe6481d0309b412343fff831a5f25603ee719 Mon Sep 17 00:00:00 2001 From: Yun Dong Date: Wed, 1 Mar 2017 10:32:03 +0800 Subject: [PATCH 1/4] * [doc] auto switch language only on the landing page. --- 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(-) diff --git a/doc/source/cn/guide/index.md b/doc/source/cn/guide/index.md index 1fdc4ceec6..e2d43e41e1 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` 文件,基于 ` - - ``` -[Have a try](http://dotwe.org/weex/993f33173a712fecfb61c1c4b03bcb70) +[Have a try](http://dotwe.org/weex/0256bbfc448f0fdbe8b10ba311c947b4) \ No newline at end of file diff --git a/doc/source/guide/index.md b/doc/source/guide/index.md index 0abde32d40..6c11d544b0 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 ` - - ``` -[Have a try](http://dotwe.org/weex/993f33173a712fecfb61c1c4b03bcb70) +[Have a try](http://dotwe.org/weex/0256bbfc448f0fdbe8b10ba311c947b4) diff --git a/doc/themes/weex/languages/cn.yml b/doc/themes/weex/languages/cn.yml index b158e53e07..67f72e698c 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 diff --git a/doc/themes/weex/languages/en.yml b/doc/themes/weex/languages/en.yml index d5a0015f19..47ca0ecb7a 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 diff --git a/doc/themes/weex/layout/_partial/footer.ejs b/doc/themes/weex/layout/_partial/footer.ejs index 8e36aecdca..80fdc14d36 100644 --- a/doc/themes/weex/layout/_partial/footer.ejs +++ b/doc/themes/weex/layout/_partial/footer.ejs @@ -13,7 +13,7 @@ English
  • - 中文 + 中文
  • diff --git a/doc/themes/weex/layout/_partial/head.ejs b/doc/themes/weex/layout/_partial/head.ejs index f3d428c5cb..e3f7962901 100644 --- a/doc/themes/weex/layout/_partial/head.ejs +++ b/doc/themes/weex/layout/_partial/head.ejs @@ -21,49 +21,6 @@ %> <% if (title){ %><%= title %> | <% } %><%= config.title %> - <%- 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){ %> diff --git a/doc/themes/weex/layout/index.ejs b/doc/themes/weex/layout/index.ejs index d112ba7823..01c964a272 100644 --- a/doc/themes/weex/layout/index.ejs +++ b/doc/themes/weex/layout/index.ejs @@ -1,3 +1,30 @@ +
    @@ -206,6 +233,6 @@ var swiper = new Swiper('.swiper-container', { loop: false, autoplay: false, autoplayDisableOnInteraction: false -}) +}); \ No newline at end of file diff --git a/doc/themes/weex/source/css/index.scss b/doc/themes/weex/source/css/index.scss index a11852cc25..8eb4e76552 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; } diff --git a/doc/themes/weex/source/js/common.js b/doc/themes/weex/source/js/common.js index 1eddfc647d..70dc2dc58d 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') From 6e72a2429e26b48159933a2415c29451f1c25c3d Mon Sep 17 00:00:00 2001 From: Yun Dong Date: Wed, 1 Mar 2017 16:37:43 +0800 Subject: [PATCH 2/4] * [doc] add language selector on the header. --- doc/source/cn/references/modules/index.md | 31 +++++++----------- doc/source/references/modules/index.md | 31 +++++++----------- doc/themes/weex/layout/_partial/header.ejs | 16 ++++++++++ .../weex/layout/_partial/search-form.ejs | 2 +- doc/themes/weex/layout/_partial/sidebar.ejs | 2 +- doc/themes/weex/source/css/media-queries.scss | 3 ++ .../weex/source/css/partial/footer.scss | 1 + .../weex/source/css/partial/header.scss | 32 ++++++++++++++++--- .../weex/source/css/partial/search-form.scss | 3 -- .../weex/source/css/partial/sidebar.scss | 1 + doc/themes/weex/source/js/common.js | 28 +++++++++------- 11 files changed, 89 insertions(+), 61 deletions(-) diff --git a/doc/source/cn/references/modules/index.md b/doc/source/cn/references/modules/index.md index 8171de2b82..543b9d21f2 100644 --- a/doc/source/cn/references/modules/index.md +++ b/doc/source/cn/references/modules/index.md @@ -8,23 +8,14 @@ version: 2.1 # 内建模块 -## 如何使用 - -你可以简单的通过类似 `weex.requireModule('name')` 这样的语法获取一个模块的 API,比如: - -```html - -``` +- [animation](./animation.html) +- [WebSocket](./websocket.html) +- [picker](./picker.html) +- [clipboard](./clipboard.html) +- [dom](./dom.html) +- [modal](./modal.html) +- [navigator](./navigator.html) +- [storage](./storage.html) +- [stream](./stream.html) +- [webview](./webview.html) +- [globalEvent](./globalevent.html) diff --git a/doc/source/references/modules/index.md b/doc/source/references/modules/index.md index ec3b4a028c..444ec818cf 100644 --- a/doc/source/references/modules/index.md +++ b/doc/source/references/modules/index.md @@ -7,23 +7,14 @@ version: 2.1 # Built-in Modules -## How to use - -You can use a simply way like `requireModule('name')` to access the apis of module. e.g. - -```html - -``` \ No newline at end of file +- [animation](./animation.html) +- [WebSocket](./websocket.html) +- [picker](./picker.html) +- [clipboard](./clipboard.html) +- [dom](./dom.html) +- [modal](./modal.html) +- [navigator](./navigator.html) +- [storage](./storage.html) +- [stream](./stream.html) +- [webview](./webview.html) +- [globalEvent](./globalevent.html) diff --git a/doc/themes/weex/layout/_partial/header.ejs b/doc/themes/weex/layout/_partial/header.ejs index a1d42cdefc..9b2cdb6000 100644 --- a/doc/themes/weex/layout/_partial/header.ejs +++ b/doc/themes/weex/layout/_partial/header.ejs @@ -36,6 +36,22 @@
  • <%- partial('_partial/search-form', {id_name: 'search-input-header'}) %>
  • +
  • + +
  • diff --git a/doc/themes/weex/layout/_partial/search-form.ejs b/doc/themes/weex/layout/_partial/search-form.ejs index 347c3419ca..7331be5bd0 100644 --- a/doc/themes/weex/layout/_partial/search-form.ejs +++ b/doc/themes/weex/layout/_partial/search-form.ejs @@ -1,6 +1,6 @@