* [doc] add language selector on the header.
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/6e72a242 Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/6e72a242 Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/6e72a242 Branch: refs/heads/master Commit: 6e72a2429e26b48159933a2415c29451f1c25c3d Parents: 83bfe64 Author: Yun Dong <[email protected]> Authored: Wed Mar 1 16:37:43 2017 +0800 Committer: Yun Dong <[email protected]> Committed: Wed Mar 1 16:37:43 2017 +0800 ---------------------------------------------------------------------- doc/source/cn/references/modules/index.md | 31 +++++++------------ doc/source/references/modules/index.md | 31 +++++++------------ doc/themes/weex/layout/_partial/header.ejs | 16 ++++++++++ doc/themes/weex/layout/_partial/search-form.ejs | 2 +- doc/themes/weex/layout/_partial/sidebar.ejs | 2 +- doc/themes/weex/source/css/media-queries.scss | 3 ++ doc/themes/weex/source/css/partial/footer.scss | 1 + doc/themes/weex/source/css/partial/header.scss | 32 +++++++++++++++++--- .../weex/source/css/partial/search-form.scss | 3 -- doc/themes/weex/source/css/partial/sidebar.scss | 1 + doc/themes/weex/source/js/common.js | 28 +++++++++-------- 11 files changed, 89 insertions(+), 61 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/6e72a242/doc/source/cn/references/modules/index.md ---------------------------------------------------------------------- diff --git a/doc/source/cn/references/modules/index.md b/doc/source/cn/references/modules/index.md index 8171de2..543b9d2 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 -<script> - const modal = weex.requireModule('modal') - - module.exports = { - data: {}, - methods: { - toast: function () { - modal.toast({ - message: 'props: ' + event.data.join(', ') - }) - } - } - } -</script> -``` +- [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) http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/6e72a242/doc/source/references/modules/index.md ---------------------------------------------------------------------- diff --git a/doc/source/references/modules/index.md b/doc/source/references/modules/index.md index ec3b4a0..444ec81 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 -<script> - const modal = weex.requireModule('modal') - - module.exports = { - data: {}, - methods: { - toast: function () { - modal.toast({ - message: 'props: ' + event.data.join(', ') - }) - } - } - } -</script> -``` \ 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) http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/6e72a242/doc/themes/weex/layout/_partial/header.ejs ---------------------------------------------------------------------- diff --git a/doc/themes/weex/layout/_partial/header.ejs b/doc/themes/weex/layout/_partial/header.ejs index a1d42cd..9b2cdb6 100644 --- a/doc/themes/weex/layout/_partial/header.ejs +++ b/doc/themes/weex/layout/_partial/header.ejs @@ -36,6 +36,22 @@ <li> <%- partial('_partial/search-form', {id_name: 'search-input-header'}) %> </li> + <li> + <div class="dropdown select-lang"> + <a href="javascript:;" class="dropdown-toggle"> + Language + <span class="caret"></span> + </a> + <ul class="dropdown-menu pick-lang"> + <li> + <a href="<%= pick_lang('en') %>" data-lang="en">English</a> + </li> + <li> + <a href="<%= pick_lang('cn') %>" data-lang="zh-cn">䏿</a> + </li> + </ul> + </div> + </li> <!--<li></li>--> </ul> </div> http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/6e72a242/doc/themes/weex/layout/_partial/search-form.ejs ---------------------------------------------------------------------- diff --git a/doc/themes/weex/layout/_partial/search-form.ejs b/doc/themes/weex/layout/_partial/search-form.ejs index 347c341..7331be5 100644 --- a/doc/themes/weex/layout/_partial/search-form.ejs +++ b/doc/themes/weex/layout/_partial/search-form.ejs @@ -1,6 +1,6 @@ <div class="search"> <form id="search-form" class="search-form"> <!-- æç´¢æ¡ç¸å ³ --> - <input type="text" id="<%= id_name %>" name="q" results="0" placeholder="search..." class="form-control search-input" autocomplete="off" autocorrect="off"/> + <input type="text" id="<%= id_name %>" name="q" results="0" class="form-control search-input" autocomplete="off" autocorrect="off"/> <span class="iconfont icon-search"></span> </form> <div class="results-panel"> http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/6e72a242/doc/themes/weex/layout/_partial/sidebar.ejs ---------------------------------------------------------------------- diff --git a/doc/themes/weex/layout/_partial/sidebar.ejs b/doc/themes/weex/layout/_partial/sidebar.ejs index a6c0968..2287671 100644 --- a/doc/themes/weex/layout/_partial/sidebar.ejs +++ b/doc/themes/weex/layout/_partial/sidebar.ejs @@ -19,7 +19,7 @@ </a> </li> <li> - <a href="<%= url_for_lang('faq') %>"> + <a href="<%= url_for_lang('faq.html') %>"> <%= _p('menu.faq') %> </a> </li> http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/6e72a242/doc/themes/weex/source/css/media-queries.scss ---------------------------------------------------------------------- diff --git a/doc/themes/weex/source/css/media-queries.scss b/doc/themes/weex/source/css/media-queries.scss index 6aa9a79..f461e84 100644 --- a/doc/themes/weex/source/css/media-queries.scss +++ b/doc/themes/weex/source/css/media-queries.scss @@ -31,6 +31,9 @@ #footer { padding: 0 20px; + .select-lang { + display: block; + } } /*********************************************** http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/6e72a242/doc/themes/weex/source/css/partial/footer.scss ---------------------------------------------------------------------- diff --git a/doc/themes/weex/source/css/partial/footer.scss b/doc/themes/weex/source/css/partial/footer.scss index 959d3c5..3c4d976 100644 --- a/doc/themes/weex/source/css/partial/footer.scss +++ b/doc/themes/weex/source/css/partial/footer.scss @@ -18,6 +18,7 @@ } .select-lang { + display: none; width: 105px; height: 25px; line-height: 25px; http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/6e72a242/doc/themes/weex/source/css/partial/header.scss ---------------------------------------------------------------------- diff --git a/doc/themes/weex/source/css/partial/header.scss b/doc/themes/weex/source/css/partial/header.scss index 85d8a29..f109404 100644 --- a/doc/themes/weex/source/css/partial/header.scss +++ b/doc/themes/weex/source/css/partial/header.scss @@ -79,12 +79,17 @@ } .info li { - margin-left: 50px; + margin-left: 40px; } - .tools li { - position: relative; - margin-left: 4em; + .tools { + > li { + margin-left: 30px; + position: relative; + } + .search-form { + width: 120px; + } } .dropdown { @@ -101,4 +106,23 @@ } } } + + .select-lang { + width: 90px; + } + + .select-lang .dropdown-toggle { + color: #00293D; + } + + .select-lang .dropdown-menu { + width: 105px; + left: 0; + } + + .caret { + display: inline-block; + margin-left: 2px; + @include triangle-down($border-gray, 4px); + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/6e72a242/doc/themes/weex/source/css/partial/search-form.scss ---------------------------------------------------------------------- diff --git a/doc/themes/weex/source/css/partial/search-form.scss b/doc/themes/weex/source/css/partial/search-form.scss index 0bed6df..1f18e6c 100644 --- a/doc/themes/weex/source/css/partial/search-form.scss +++ b/doc/themes/weex/source/css/partial/search-form.scss @@ -25,9 +25,6 @@ } } - /*.search-label { - display: block; - }*/ .icon-search { position: absolute; font-size: 14px; http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/6e72a242/doc/themes/weex/source/css/partial/sidebar.scss ---------------------------------------------------------------------- diff --git a/doc/themes/weex/source/css/partial/sidebar.scss b/doc/themes/weex/source/css/partial/sidebar.scss index aba94e4..6e681b1 100644 --- a/doc/themes/weex/source/css/partial/sidebar.scss +++ b/doc/themes/weex/source/css/partial/sidebar.scss @@ -64,6 +64,7 @@ .summary { display: block; + margin-top: 20px; } .results-panel { http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/6e72a242/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 70dc2dc..d4177dd 100644 --- a/doc/themes/weex/source/js/common.js +++ b/doc/themes/weex/source/js/common.js @@ -77,23 +77,27 @@ */ function initPickLang () { document.addEventListener('DOMContentLoaded', function (e) { - var pick = document.querySelector('.pick-lang') + var pickers = document.querySelectorAll('.pick-lang') var elements = document.querySelectorAll('.pick-lang a') + var pickersArr = Array.prototype.slice.call(pickers) - pick.addEventListener('click', function (e) { - e.preventDefault() - e.stopPropagation() + pickersArr.forEach(function (picker) { + picker.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 (window.localStorage) { - window.localStorage.setItem('lang', lang) - } + if (picker.contains(target)) { + var lang = target.getAttribute('data-lang') - location.href = target.href - } + if (window.localStorage) { + window.localStorage.setItem('lang', lang) + } + + location.href = target.href + } + }) }) }) }
