├── .gitignore ├── .travis.yml ├── .travis ├── id_rsa.enc └── ssh_config ├── README.md ├── _config.yml ├── package.json ├── scripts └── .eslintrc ├── source ├── 404.md ├── CNAME ├── _data │ └── languages.yml ├── _posts │ ├── en │ │ ├── closures.md │ │ ├── ecmascript.md │ │ ├── javascript.md │ │ ├── nodejs.md │ │ ├── npm.md │ │ └── set.md │ ├── ja │ │ └── javascript.md │ └── zh-cn │ │ ├── closures.md │ │ ├── ecmascript.md │ │ ├── javascript.md │ │ ├── nodejs.md │ │ ├── npm.md │ │ └── set.md └── google6cc0edae76a2e625.html └── themes └── wiki-i18n ├── _config.yml ├── languages ├── en.yml ├── ja.yml └── zh-cn.yml ├── layout ├── _partial │ ├── article.ejs │ ├── cards.ejs │ ├── footer.ejs │ ├── ga.ejs │ ├── head.ejs │ ├── header.ejs │ ├── jumbotron.ejs │ ├── scripts.ejs │ └── words.ejs ├── archive.ejs ├── index.ejs └── post.ejs ├── scripts ├── .eslintrc └── hexo-helpers.js └── source ├── css ├── _partial │ ├── archive.scss │ ├── article.scss │ ├── cards.scss │ ├── common.scss │ ├── footer.scss │ ├── header.scss │ ├── jumbotron.scss │ ├── variables.scss │ └── words.scss ├── index.scss └── normalize.css ├── images └── pixels.png └── js ├── .eslintrc └── header.js /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | Thumbs.db 3 | db.json 4 | *.log 5 | node_modules/ 6 | public/ 7 | .deploy*/ -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 4 4 | 5 | sudo: false 6 | 7 | branches: 8 | only: 9 | - master 10 | 11 | before_install: 12 | - openssl aes-256-cbc -K $encrypted_96258599e233_key -iv $encrypted_96258599e233_iv -in .travis/id_rsa.enc -out ~/.ssh/id_rsa -d 13 | - chmod 600 ~/.ssh/id_rsa 14 | - eval $(ssh-agent) 15 | - ssh-add ~/.ssh/id_rsa 16 | - cp .travis/ssh_config ~/.ssh/config 17 | - git config --global user.name 'xcatliu' 18 | - git config --global user.email 'xcatliu@gmail.com' 19 | 20 | install: 21 | - npm install hexo-cli -g 22 | - npm install 23 | 24 | script: 25 | - npm run deploy 26 | -------------------------------------------------------------------------------- /.travis/id_rsa.enc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xcatliu/js-index/615ac0a5b744f7d3bb70a22021e2876b92eed3f0/.travis/id_rsa.enc -------------------------------------------------------------------------------- /.travis/ssh_config: -------------------------------------------------------------------------------- 1 | Host github.com 2 | User git 3 | StrictHostKeyChecking no 4 | IdentityFile ~/.ssh/id_rsa 5 | IdentitiesOnly yes 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [简体中文](#zh-cn) 2 | 3 | [![Build Status](https://travis-ci.org/xcatliu/js-index.svg?branch=master)](https://travis-ci.org/xcatliu/js-index) 4 | 5 | # JS Index 6 | 7 | > The index of everything about JavaScript 8 | 9 | - Homepage: http://js-index.com/ 10 | - theme: https://github.com/xcatliu/hexo-theme-wiki-i18n 11 | 12 | I'll update one item per day. Welcome to open an issue or create a pull request. 13 | 14 | ## Why to create this index 15 | 16 | Because JavaScript is being more and more popular, the related concepts is growing every day. 17 | 18 | As for me, it's impossible to understand the whole world of JavaScript, but it's normally to hear some related concepts. 19 | 20 | So I hope to collect every JavaScript concepts, in order to help people who need it, especially friends new to JavaScript. 21 | 22 | ## Three principles 23 | 24 | 1. Collecting every concepts, no matter how basic or how deep it is 25 | 2. The description of each concept needs to be as simple as it can. It's ok to let our reader have a basic understanding for it, then additionally provide extra links for depth understanding 26 | 3. The links we provided need to be as authority and meaningful as it can. Quality is better than quantity. Links is the most valuable thing in JS Index 27 | 28 | ## Writing specifications 29 | 30 | 1. Every files need to be named with lowercased letters and `-`, no spaces. In some special cases, it's allowed to use `_`, i.e. `__proto__.md` 31 | 2. Second level heading need to be used for multiple meanings of one concept. In the other words, if one concept has only one meaning, but we need to use sub heading, then use third level heading instead 32 | 3. Use unified words for proper nouns, for example, use JavaScript, not javascript or Javascript 33 | 34 | ## TODOs 35 | 36 | - [ ] Use hexo to build the site 37 | - [ ] Apply for the domain name 38 | - [ ] Index concepts 39 | 40 | --- 41 | 42 | 43 | 44 | # JS Index 45 | 46 | > 有关 JavaScript 的一切的索引 47 | 48 | - 首页:http://js-index.com/ 49 | - 主题:https://github.com/xcatliu/hexo-theme-wiki-i18n 50 | 51 | 我会坚持每天更新一条。也欢迎提交 issue 或 pr。 52 | 53 | ## 为什么要创建这个索引 54 | 55 | 由于 JavaScript 正变得越来越流行,相关的概念也越来越多。 56 | 57 | 我认为,一个人是无法掌握 JavaScript 整个世界的,但是却会经常听到一些相关的概念。 58 | 59 | 所以我希望能够把 JavaScript 的所有概念都搜集起来,方便大家(特别是刚入门的朋友)查阅。 60 | 61 | ## 三个原则 62 | 63 | 1. 搜集所有概念,不管它有多么基础或多么深奥 64 | 2. 每个概念的描述尽可能简单明了,只需要让读者有个大致的理解即可。提供相关链接帮助读者深入理解 65 | 3. 提供的相关链接尽可能权威,有意义,而不要堆积数量。相关链接是 JS Index 中最有价值的地方 66 | 67 | ## 书写规范 68 | 69 | 1. 所有文件必须使用小写字母和 `-` 命名,如果是中文概念,则使用全拼命名,不能出现空格。特殊情况可以出现 `_`,比如 `__proto__.md` 70 | 2. 中文排版遵循这个规范:[写给大家看的中文排版指南](https://zhuanlan.zhihu.com/p/20506092) 71 | 3. 二级标题用于区分一个概念的多种含义,不能用于其他用途。换句话说,如果一个概念只有一种含义,但是需要子标题,则需要直接使用三级标题 72 | 4. 当涉及到专有名词的时候,需要使用统一的词语。比如应该是 JavaScript 而不是 javascript 或 Javascript 73 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | # Hexo Configuration 2 | ## Docs: https://hexo.io/docs/configuration.html 3 | ## Source: https://github.com/hexojs/hexo/ 4 | 5 | # Site 6 | title: JS Index 7 | subtitle: The index of everything about JavaScript 8 | description: 9 | author: Xcat Liu 10 | author_link: https://github.com/xcatliu 11 | language: 12 | - en 13 | - zh-cn 14 | - ja 15 | timezone: 16 | 17 | # URL 18 | ## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/' 19 | url: http://js-index.com 20 | root: / 21 | permalink: :lang/i/:title.html 22 | permalink_defaults: 23 | 24 | # Directory 25 | source_dir: source 26 | public_dir: public 27 | tag_dir: tags 28 | archive_dir: archives 29 | category_dir: categories 30 | code_dir: downloads/code 31 | i18n_dir: :lang 32 | skip_render: 33 | - google6cc0edae76a2e625.html 34 | 35 | # Writing 36 | new_post_name: :lang/:title.md # File name of new posts 37 | default_layout: post 38 | titlecase: false # Transform title into titlecase 39 | external_link: true # Open external links in new tab 40 | filename_case: 0 41 | render_drafts: false 42 | post_asset_folder: false 43 | relative_link: false 44 | future: true 45 | highlight: 46 | enable: true 47 | line_number: true 48 | auto_detect: false 49 | tab_replace: 50 | 51 | # Category & Tag 52 | default_category: uncategorized 53 | category_map: 54 | tag_map: 55 | 56 | # Date / Time format 57 | ## Hexo uses Moment.js to parse and display date 58 | ## You can customize the date format as defined in 59 | ## http://momentjs.com/docs/#/displaying/format/ 60 | date_format: YYYY-MM-DD 61 | time_format: HH:mm:ss 62 | 63 | # Pagination 64 | ## Set per_page to 0 to disable pagination 65 | per_page: 1000 66 | pagination_dir: page 67 | 68 | # Extensions 69 | ## Plugins: https://hexo.io/plugins/ 70 | ## Themes: https://hexo.io/themes/ 71 | theme: wiki-i18n 72 | 73 | # Deployment 74 | ## Docs: https://hexo.io/docs/deployment.html 75 | deploy: 76 | type: git 77 | repo: git@github.com:xcatliu/js-index.git 78 | branch: gh-pages 79 | message: 80 | 81 | github: https://github.com/xcatliu/js-index 82 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "js-index", 3 | "version": "1.0.0", 4 | "description": "The index of everything about JavaScript", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "hexo clean && hexo generate && hexo serve --watch", 8 | "deploy": "npm run test && hexo clean && hexo generate && hexo deploy", 9 | "lint": "eslint . && echo 'ESLint Passed!\\n'", 10 | "test": "npm run lint" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "git+https://github.com/xcatliu/js-index.git" 15 | }, 16 | "keywords": [ 17 | "JavaScript", 18 | "Index" 19 | ], 20 | "author": "xcatliu ", 21 | "license": "MIT", 22 | "bugs": { 23 | "url": "https://github.com/xcatliu/js-index/issues" 24 | }, 25 | "homepage": "https://github.com/xcatliu/js-index#readme", 26 | "hexo": { 27 | "version": "3.2.2" 28 | }, 29 | "dependencies": { 30 | "hexo": "^3.2.0", 31 | "hexo-deployer-git": "^0.2.0", 32 | "hexo-filter-author-from-git": "^0.1.0", 33 | "hexo-filter-date-from-git": "^0.1.0", 34 | "hexo-generator-archive-alphabet-i18n": "^0.1.0", 35 | "hexo-generator-index": "^0.2.0", 36 | "hexo-generator-index-i18n": "^0.1.1", 37 | "hexo-generator-sitemap": "^1.1.2", 38 | "hexo-renderer-ejs": "^0.2.0", 39 | "hexo-renderer-marked": "^0.2.10", 40 | "hexo-renderer-sass": "^0.2.0", 41 | "hexo-server": "^0.2.0" 42 | }, 43 | "devDependencies": { 44 | "eslint": "^2.13.1", 45 | "eslint-config-airbnb-base": "^3.0.1", 46 | "eslint-plugin-import": "^1.8.1" 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /scripts/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "airbnb-base", 3 | "rules": { 4 | "import/no-unresolved": 0, 5 | "no-use-before-define": 0 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /source/404.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 404 Not Found 3 | --- 4 | 5 | Sorry this page is not ready yet. 6 | -------------------------------------------------------------------------------- /source/CNAME: -------------------------------------------------------------------------------- 1 | js-index.com 2 | -------------------------------------------------------------------------------- /source/_data/languages.yml: -------------------------------------------------------------------------------- 1 | en: English 2 | zh-cn: 简体中文 3 | ja: 日本語 4 | -------------------------------------------------------------------------------- /source/_posts/en/closures.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Closures 3 | --- 4 | 5 | Closures allows functions to access variables which are declared outside of the function scope. 6 | 7 | Specifically, when one function ends, variables in it will not get garbage collected for now if there are some reference of the variables in other functions. 8 | 9 | - [How do JavaScript closures work?](http://stackoverflow.com/questions/111102/how-do-javascript-closures-work) 10 | -------------------------------------------------------------------------------- /source/_posts/en/ecmascript.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: ECMAScript 3 | alias: ES 4 | --- 5 | 6 | ECMAScript is the specification of JavaScript core. 7 | 8 | JavaScript is composed of ECMAScript, DOM and BOM. 9 | 10 | - [What is the difference between JavaScript and ECMAScript?](http://stackoverflow.com/questions/912479/what-is-the-difference-between-javascript-and-ecmascript) 11 | -------------------------------------------------------------------------------- /source/_posts/en/javascript.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: JavaScript 3 | alias: JS 4 | --- 5 | 6 | JavaScript is a scripting language. 7 | 8 | Basically, JavaScript runs in browser environment, With the emergence of Node.js, JavaScript can also run in server side or some embedded devices. 9 | 10 | - [JavaScript Tutorial](http://www.w3schools.com/js/) 11 | - An authority JavaScript API Document:[MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript) 12 | - [Professional JavaScript for Web Developers 3rd Edition](https://www.amazon.com/Professional-JavaScript-Developers-Nicholas-Zakas/dp/1118026691) 13 | -------------------------------------------------------------------------------- /source/_posts/en/nodejs.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Node.js 3 | --- 4 | 5 | Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. 6 | 7 | Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. 8 | 9 | Node.js' package ecosystem, npm, is the largest ecosystem of open source libraries in the world. 10 | 11 | - [Node.js official site](https://nodejs.org/en/) 12 | - [Node.js the Right Way: Practical, Server-Side JavaScript That Scales](https://www.amazon.com/Node-js-Right-Way-Server-Side-JavaScript/dp/1937785734) 13 | -------------------------------------------------------------------------------- /source/_posts/en/npm.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: npm 3 | --- 4 | 5 | npm is the package manager for JavaScript. 6 | 7 | - [Official Site](https://www.npmjs.com/) 8 | -------------------------------------------------------------------------------- /source/_posts/en/set.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Set 3 | --- 4 | 5 | Set is a new data structure in ES2016. It's similar to Array, but it's items are unique. 6 | 7 | Use constructor to create a Set: 8 | 9 | ```js 10 | let set = new Set([1, 4, 2, 4, 3]); 11 | console.log(set); 12 | // Set {1, 4, 2, 3} 13 | ``` 14 | 15 | Use `size` property to get the item value: 16 | 17 | ```js 18 | let set = new Set([1, 4, 2, 4, 3]); 19 | console.log(set.size); 20 | // 4 21 | ``` 22 | 23 | Use `add(value)`, `delete(value)` or `clear()` to modify a Set: 24 | 25 | ```js 26 | let set = new Set([1, 4, 2, 4, 3]); 27 | set.add(5); 28 | console.log(set); 29 | // Set {1, 4, 2, 3, 5} 30 | 31 | set.delete(2); 32 | console.log(set); 33 | // Set {1, 4, 3, 5} 34 | 35 | set.clear(); 36 | console.log(set); 37 | // Set {} 38 | ``` 39 | 40 | Use `has(value)` to determine whether the value exist: 41 | 42 | ```js 43 | let set = new Set([1, 4, 2, 4, 3]); 44 | console.log(set.has(3)); 45 | // true 46 | ``` 47 | 48 | Normally, we use `for...of` to traversal a Set: 49 | 50 | ```js 51 | let set = new Set([1, 4, 2, 4, 3]); 52 | for (let i of set) { 53 | console.log(i); 54 | } 55 | ``` 56 | 57 | - [MDN Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) 58 | -------------------------------------------------------------------------------- /source/_posts/ja/javascript.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: JavaScript 3 | alias: JS 4 | --- 5 | 6 | JavaScript(ジャバ スクリプト)とは、プログラミング言語のひとつである。 7 | 8 | - [JavaScript 入門](http://www.w3schools.com/js/)([日本語](http://memopad.bitter.jp/w3c/js/default.html)) 9 | - 権限の JavaScript API ドキュメント:[MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript)([日本語](https://developer.mozilla.org/ja/docs/Web/JavaScript)) 10 | - [JavaScript 第6版](https://www.amazon.co.jp/JavaScript-%E7%AC%AC6%E7%89%88-David-Flanagan/dp/4873115736) 11 | - [Professional JavaScript for Web Developers (Wrox Professional Guides) (英語)](https://www.amazon.co.jp/Professional-JavaScript-Developers-Wrox-Guides/dp/1118026691) 12 | -------------------------------------------------------------------------------- /source/_posts/zh-cn/closures.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 闭包 3 | --- 4 | 5 | 闭包允许函数内部可以访问函数外部的变量。 6 | 7 | 具体地说,当一个函数执行完之后,如果其中的一个变量在其他函数中被引用了,那么它暂时不会被垃圾回收机制回收。 8 | 9 | - [理解 JavaScript 的闭包](http://coolshell.cn/articles/6731.html) 10 | - [How do JavaScript closures work?](http://stackoverflow.com/questions/111102/how-do-javascript-closures-work) 11 | -------------------------------------------------------------------------------- /source/_posts/zh-cn/ecmascript.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: ECMAScript 3 | alias: ES 4 | --- 5 | 6 | ECMAScript 是 JavaScript 核心的标准。 7 | 8 | JavaScript 是由 ECMAScript、DOM 以及 BOM 组成的。 9 | 10 | - [ECMAScript 和 JavaScript 的关系](http://es6.ruanyifeng.com/#docs/intro#ECMAScript和JavaScript的关系) 11 | -------------------------------------------------------------------------------- /source/_posts/zh-cn/javascript.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: JavaScript 3 | alias: JS 4 | --- 5 | 6 | JavaScript 是一种脚本语言。 7 | 8 | 通常 JavaScript 运行于浏览器环境中,随着 Node.js 的出现,JavaScript 也可以运行在服务端或者一些嵌入式设备中。 9 | 10 | - [JavaScript 入门教程](http://www.w3schools.com/js/)([简体中文](http://www.w3school.com.cn/js/index.asp)) 11 | - 很权威的 JavaScript API 文档:[MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript)([中文版](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript)) 12 | - [《JavaScript 高级程序设计》](https://book.douban.com/subject/10546125/) 13 | -------------------------------------------------------------------------------- /source/_posts/zh-cn/nodejs.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Node.js 3 | --- 4 | 5 | Node.js 是一个基于 Chrome V8 引擎的 JavaScript 运行环境。 6 | 7 | Node.js 使用了一个事件驱动、非阻塞式 I/O 的模型,使其轻量又高效。 8 | 9 | Node.js 的包管理器 npm,是全球最大的开源库生态系统。 10 | 11 | - [Node.js 官网](https://nodejs.org/en/)([中文版](https://nodejs.org/zh-cn/)) 12 | - [《深入浅出 Node.js》](https://book.douban.com/subject/25768396/) 13 | -------------------------------------------------------------------------------- /source/_posts/zh-cn/npm.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: npm 3 | --- 4 | 5 | npm is JavaScript 的包管理器。 6 | 7 | - [官方网站](https://www.npmjs.com/) 8 | - 可以搭建在内网的 [cnpm](https://github.com/cnpm/cnpm) 9 | -------------------------------------------------------------------------------- /source/_posts/zh-cn/set.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Set 3 | --- 4 | 5 | Set 是 ES2016 提供的一种新的数据结构。它类似于数组,但是成员都是唯一的,没有重复的值。 6 | 7 | 使用构造函数创建 Set: 8 | 9 | ```js 10 | let set = new Set([1, 4, 2, 4, 3]); 11 | console.log(set); 12 | // Set {1, 4, 2, 3} 13 | ``` 14 | 15 | 通过 `size` 属性获取成员的数量: 16 | 17 | ```js 18 | let set = new Set([1, 4, 2, 4, 3]); 19 | console.log(set.size); 20 | // 4 21 | ``` 22 | 23 | 使用 `add(value)`、`delete(value)` 和 `clear()` 修改 Set: 24 | 25 | ```js 26 | let set = new Set([1, 4, 2, 4, 3]); 27 | set.add(5); 28 | console.log(set); 29 | // Set {1, 4, 2, 3, 5} 30 | 31 | set.delete(2); 32 | console.log(set); 33 | // Set {1, 4, 3, 5} 34 | 35 | set.clear(); 36 | console.log(set); 37 | // Set {} 38 | ``` 39 | 40 | 使用 `has(value)` 判断某个值是否存在: 41 | 42 | ```js 43 | let set = new Set([1, 4, 2, 4, 3]); 44 | console.log(set.has(3)); 45 | // true 46 | ``` 47 | 48 | 通常使用 `for...of` 来遍历 Set: 49 | 50 | ```js 51 | let set = new Set([1, 4, 2, 4, 3]); 52 | for (let i of set) { 53 | console.log(i); 54 | } 55 | ``` 56 | 57 | - [ECMAScript 6 入门 - Set](http://es6.ruanyifeng.com/#docs/set-map#Set) 58 | -------------------------------------------------------------------------------- /source/google6cc0edae76a2e625.html: -------------------------------------------------------------------------------- 1 | google-site-verification: google6cc0edae76a2e625.html -------------------------------------------------------------------------------- /themes/wiki-i18n/_config.yml: -------------------------------------------------------------------------------- 1 | name: wiki-i18n 2 | link: https://github.com/xcatliu/hexo-theme-wiki-i18n 3 | 4 | # Google analytics 5 | google_analytics: UA-45256157-8 6 | -------------------------------------------------------------------------------- /themes/wiki-i18n/languages/en.yml: -------------------------------------------------------------------------------- 1 | archives: Archives 2 | explore: Explore 3 | new: New 4 | github: GitHub 5 | search: Search... 6 | 7 | jumbotron: 8 | title: The index of everything about JavaScript 9 | create: Create an item 10 | 11 | more: Show more 12 | -------------------------------------------------------------------------------- /themes/wiki-i18n/languages/ja.yml: -------------------------------------------------------------------------------- 1 | archives: Archives 2 | explore: 探る 3 | new: 最新の 4 | github: GitHub 5 | search: サイト内検索 6 | 7 | jumbotron: 8 | title: The index of everything about JavaScript 9 | create: Create an item 10 | 11 | more: 続きを見る 12 | -------------------------------------------------------------------------------- /themes/wiki-i18n/languages/zh-cn.yml: -------------------------------------------------------------------------------- 1 | archives: 归档 2 | explore: 探索 3 | new: 最新 4 | github: GitHub 5 | search: 全站搜索 6 | 7 | jumbotron: 8 | title: 有关 JavaScript 的一切的索引 9 | create: 新建一项 10 | 11 | more: 查看更多 12 | -------------------------------------------------------------------------------- /themes/wiki-i18n/layout/_partial/article.ejs: -------------------------------------------------------------------------------- 1 |
2 |

<%= page.title %>

3 |
4 | <%- page.content %> 5 |
6 |
7 | -------------------------------------------------------------------------------- /themes/wiki-i18n/layout/_partial/cards.ejs: -------------------------------------------------------------------------------- 1 |
2 |

<%= title %>

3 | 28 |
29 | -------------------------------------------------------------------------------- /themes/wiki-i18n/layout/_partial/footer.ejs: -------------------------------------------------------------------------------- 1 | 10 | -------------------------------------------------------------------------------- /themes/wiki-i18n/layout/_partial/ga.ejs: -------------------------------------------------------------------------------- 1 | <% if (theme.google_analytics) { %> 2 | 12 | <% } %> 13 | -------------------------------------------------------------------------------- /themes/wiki-i18n/layout/_partial/head.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | <%= (page.title ? (page.title + ' | ') : '') + config.title %> 5 | 6 | 7 | <%- css('css/normalize.css') %> 8 | <%- css('css/index.css') %> 9 | 10 | -------------------------------------------------------------------------------- /themes/wiki-i18n/layout/_partial/header.ejs: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |

5 | JS Index 12 |

13 | <%= __('archives') %> 14 | <%= __('explore') %> 15 | <%= __('github') %> 16 |
17 | 18 |
19 | 46 |
47 |
48 |
49 | -------------------------------------------------------------------------------- /themes/wiki-i18n/layout/_partial/jumbotron.ejs: -------------------------------------------------------------------------------- 1 |
2 |
3 |

<%= __('jumbotron.title') %>

4 |
5 | 6 | <%= __('jumbotron.create') %> 7 |
8 |
9 | <% if (is_root()) { %> 10 | Choose a language: 11 | <% } %> 12 | <% get_langs().forEach(lang => { %> 13 | <% if (lang === page.lang && !is_root()) { %> 14 | <%= site.data.languages[lang] %> 15 | <% } else { %> 16 | <%= site.data.languages[lang] %> 17 | <% } %> 18 | <% }); %> 19 |
20 |
21 |
22 | -------------------------------------------------------------------------------- /themes/wiki-i18n/layout/_partial/scripts.ejs: -------------------------------------------------------------------------------- 1 | <%- partial('ga') %> 2 | 7 | <%- js('js/header.js') %> 8 | -------------------------------------------------------------------------------- /themes/wiki-i18n/layout/_partial/words.ejs: -------------------------------------------------------------------------------- 1 |
2 | <% 3 | var lastAlphabet = ''; 4 | items.forEach(item => { 5 | if (typeof item.alphabet === 'undefined') item.alphabet = '_'; 6 | if (lastAlphabet !== item.alphabet) { 7 | lastAlphabet = item.alphabet; %> 8 |

<%= lastAlphabet %>

9 | <% } %> 10 | 11 | <%= item.title %> 12 | 13 | <% }) %> 14 |
15 | -------------------------------------------------------------------------------- /themes/wiki-i18n/layout/archive.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- partial('_partial/head') %> 4 | 5 | <%- partial('_partial/header') %> 6 |
7 |

<%= __('archives') %>

8 |
9 | <%- partial('_partial/words', { 10 | items: page.posts, 11 | }) %> 12 | <%- partial('_partial/footer') %> 13 | <%- partial('_partial/scripts') %> 14 | 15 | 16 | -------------------------------------------------------------------------------- /themes/wiki-i18n/layout/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- partial('_partial/head') %> 4 | 5 | <%- partial('_partial/header') %> 6 | <%- partial('_partial/jumbotron') %> 7 | <%- partial('_partial/cards', { 8 | title: __('new'), 9 | items: page.posts, 10 | }) %> 11 | <%- partial('_partial/footer') %> 12 | <%- partial('_partial/scripts') %> 13 | 14 | 15 | -------------------------------------------------------------------------------- /themes/wiki-i18n/layout/post.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%- partial('_partial/head') %> 4 | 5 | <%- partial('_partial/header') %> 6 | <%- partial('_partial/article') %> 7 | <%- partial('_partial/footer') %> 8 | <%- partial('_partial/scripts') %> 9 | 10 | 11 | -------------------------------------------------------------------------------- /themes/wiki-i18n/scripts/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "airbnb-base", 3 | "rules": { 4 | "no-use-before-define": 0 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /themes/wiki-i18n/scripts/hexo-helpers.js: -------------------------------------------------------------------------------- 1 | /* global hexo */ 2 | 3 | hexo.extend.helper.register('is_root', isRoot); 4 | hexo.extend.helper.register('get_langs', getLangs); 5 | hexo.extend.helper.register('switch_lang', switchLang); 6 | 7 | function isRoot() { 8 | return this.page.path === 'index.html'; 9 | } 10 | 11 | function getLangs() { 12 | return this.config.language.filter(lang => lang !== 'default'); 13 | } 14 | 15 | function switchLang(lang) { 16 | if (typeof lang === 'undefined') return ''; 17 | if (this.is_root()) return this.url_for(lang); 18 | if (this.page.lang === lang) return ''; 19 | const langReg = new RegExp(`^${this.page.lang}/`); 20 | if (langReg.test(this.page.path)) { 21 | return this.url_for(this.page.path.replace(langReg, `${lang}/`)); 22 | } 23 | return ''; 24 | } 25 | -------------------------------------------------------------------------------- /themes/wiki-i18n/source/css/_partial/archive.scss: -------------------------------------------------------------------------------- 1 | .archive-title { 2 | margin: 2rem 0 0; 3 | } 4 | -------------------------------------------------------------------------------- /themes/wiki-i18n/source/css/_partial/article.scss: -------------------------------------------------------------------------------- 1 | .article { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /themes/wiki-i18n/source/css/_partial/cards.scss: -------------------------------------------------------------------------------- 1 | @import 'variables'; 2 | 3 | .cards-title { 4 | margin: 0; 5 | padding: 2rem 0 1rem 0; 6 | } 7 | 8 | .cards-content { 9 | margin: 0 -1rem; 10 | padding: 0; 11 | list-style: none; 12 | display: flex; 13 | flex-flow: row wrap; 14 | } 15 | 16 | .card-wrap { 17 | margin: 1rem; 18 | width: 30rem; 19 | min-height: 9.7rem; 20 | } 21 | 22 | .card { 23 | display: block; 24 | box-sizing: border-box; 25 | width: 100%; 26 | height: 100%; 27 | padding: 1rem 1.5rem; 28 | color: $color-text-base; 29 | text-decoration: none; 30 | background: $color-light-white-gray; 31 | 32 | &:hover { 33 | background: $color-white-gray; 34 | } 35 | 36 | p { 37 | margin: 0; 38 | } 39 | } 40 | 41 | .card-title { 42 | margin: 0 0 0.5rem; 43 | } 44 | 45 | .card-read-more { 46 | text-align: center; 47 | } 48 | -------------------------------------------------------------------------------- /themes/wiki-i18n/source/css/_partial/common.scss: -------------------------------------------------------------------------------- 1 | @import 'variables'; 2 | 3 | html { 4 | font-size: $font-size-base; 5 | } 6 | 7 | body { 8 | font-size: $font-size-normal; 9 | font-family: "微软雅黑", "Microsoft YaHei", arial, sans-serif; 10 | line-height: $line-height-normal; 11 | color: $color-text-base; 12 | } 13 | 14 | .container { 15 | max-width: 1260px; 16 | padding: 0 20px; 17 | margin: 0 auto; 18 | @media screen and (max-width: 1299px) { 19 | width: 940px; 20 | } 21 | } 22 | 23 | .no-style { 24 | text-decoration: none; 25 | color: inherit; 26 | } 27 | 28 | .hidden { 29 | display: none; 30 | } 31 | -------------------------------------------------------------------------------- /themes/wiki-i18n/source/css/_partial/footer.scss: -------------------------------------------------------------------------------- 1 | .footer { 2 | background-color: $color-dark-gray; 3 | background-image: url('/images/pixels.png'); 4 | background-repeat: repeat; 5 | overflow: hidden; 6 | text-align: center; 7 | font-size: 1.4rem; 8 | color: $color-text-white; 9 | margin-top: 3rem; 10 | padding: 2rem 0; 11 | 12 | a { 13 | color: $color-text-white; 14 | text-decoration: underline; 15 | 16 | &:hover { 17 | text-decoration: underline; 18 | } 19 | } 20 | } 21 | 22 | .footer-item { 23 | margin: 0 1rem; 24 | } 25 | -------------------------------------------------------------------------------- /themes/wiki-i18n/source/css/_partial/header.scss: -------------------------------------------------------------------------------- 1 | @import 'variables'; 2 | 3 | .header { 4 | background: $color-yellow; 5 | } 6 | 7 | .header-content { 8 | margin: 0 -0.5rem; 9 | } 10 | 11 | .header-logo { 12 | margin: 0; 13 | font-size: $font-size-big; 14 | display: inline-block; 15 | } 16 | 17 | .header-link { 18 | display: inline-block; 19 | padding: 0.5rem; 20 | } 21 | 22 | .header-search-form { 23 | display: inline-block; 24 | } 25 | 26 | .header-search-input { 27 | padding: 0.4rem 0.5rem 0.1rem; 28 | border: 0; 29 | background: lighten($color-yellow, 25%); 30 | width: 16rem; 31 | &:hover { 32 | background: lighten($color-yellow, 30%); 33 | } 34 | &:focus { 35 | background: lighten($color-yellow, 40%); 36 | } 37 | } 38 | 39 | .header-lang-select-wrap { 40 | display: inline-block; 41 | position: relative; 42 | top: 0.5rem; 43 | float: right; 44 | text-align: center; 45 | } 46 | 47 | .header-lang-select { 48 | opacity: 0; 49 | position: absolute; 50 | top: 0; 51 | left: 0; 52 | width: 100%; 53 | height: 100%; 54 | cursor: pointer; 55 | } 56 | -------------------------------------------------------------------------------- /themes/wiki-i18n/source/css/_partial/jumbotron.scss: -------------------------------------------------------------------------------- 1 | @import 'variables'; 2 | 3 | .jumbotron { 4 | background-color: $color-dark-gray; 5 | background-image: url('/images/pixels.png'); 6 | background-repeat: repeat; 7 | overflow: hidden; 8 | text-align: center; 9 | color: $color-text-white; 10 | 11 | a { 12 | color: $color-text-white; 13 | text-decoration: underline; 14 | 15 | &:hover { 16 | text-decoration: underline; 17 | } 18 | } 19 | } 20 | 21 | .jumbotron-title { 22 | font-size: 4rem; 23 | margin: 6rem 0 3rem 0; 24 | color: $color-text-yellow; 25 | } 26 | 27 | .jumbotron-star { 28 | vertical-align: middle; 29 | } 30 | 31 | .jumbotron-create-link { 32 | vertical-align: middle; 33 | } 34 | 35 | .jumbotron-languages { 36 | margin: 3rem 0; 37 | } 38 | 39 | .jumbotron-language-link { 40 | margin: 0 0.5rem; 41 | } 42 | 43 | .jumbotron-language-strong { 44 | margin: 0 0.5rem; 45 | color: $color-text-yellow; 46 | } 47 | -------------------------------------------------------------------------------- /themes/wiki-i18n/source/css/_partial/variables.scss: -------------------------------------------------------------------------------- 1 | $color-yellow: #f3df49; 2 | $color-dark-gray: #333; 3 | $color-white-gray: darken(white, 10%); 4 | $color-light-white-gray: darken(white, 5%); 5 | $color-dark-white-gray: darken(white, 15%); 6 | 7 | $color-text-white: $color-white-gray; 8 | $color-text-base: $color-dark-gray; 9 | $color-text-yellow: darken($color-yellow, 10%); 10 | 11 | $font-size-base: 10px; 12 | $font-size-normal: 1.6rem; 13 | $font-size-big: 2rem; 14 | 15 | $line-height-normal: 1.5; 16 | -------------------------------------------------------------------------------- /themes/wiki-i18n/source/css/_partial/words.scss: -------------------------------------------------------------------------------- 1 | .words-title { 2 | margin: 0; 3 | padding: 2rem 0 1rem 0; 4 | } 5 | 6 | .word { 7 | display: inline-block; 8 | padding: 0.2rem 1rem; 9 | margin: 0 0.5rem 0.8rem 0; 10 | color: $color-text-base; 11 | text-decoration: none; 12 | background: $color-light-white-gray; 13 | 14 | &:hover { 15 | background: $color-white-gray; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /themes/wiki-i18n/source/css/index.scss: -------------------------------------------------------------------------------- 1 | @import '_partial/common'; 2 | @import '_partial/header'; 3 | @import '_partial/jumbotron'; 4 | @import '_partial/cards'; 5 | @import '_partial/words'; 6 | @import '_partial/article'; 7 | @import '_partial/archive'; 8 | @import '_partial/footer'; 9 | -------------------------------------------------------------------------------- /themes/wiki-i18n/source/css/normalize.css: -------------------------------------------------------------------------------- 1 | /*! normalize.css v4.1.1 | MIT License | github.com/necolas/normalize.css */ 2 | 3 | /** 4 | * 1. Change the default font family in all browsers (opinionated). 5 | * 2. Prevent adjustments of font size after orientation changes in IE and iOS. 6 | */ 7 | 8 | html { 9 | font-family: sans-serif; /* 1 */ 10 | -ms-text-size-adjust: 100%; /* 2 */ 11 | -webkit-text-size-adjust: 100%; /* 2 */ 12 | } 13 | 14 | /** 15 | * Remove the margin in all browsers (opinionated). 16 | */ 17 | 18 | body { 19 | margin: 0; 20 | } 21 | 22 | /* HTML5 display definitions 23 | ========================================================================== */ 24 | 25 | /** 26 | * Add the correct display in IE 9-. 27 | * 1. Add the correct display in Edge, IE, and Firefox. 28 | * 2. Add the correct display in IE. 29 | */ 30 | 31 | article, 32 | aside, 33 | details, /* 1 */ 34 | figcaption, 35 | figure, 36 | footer, 37 | header, 38 | main, /* 2 */ 39 | menu, 40 | nav, 41 | section, 42 | summary { /* 1 */ 43 | display: block; 44 | } 45 | 46 | /** 47 | * Add the correct display in IE 9-. 48 | */ 49 | 50 | audio, 51 | canvas, 52 | progress, 53 | video { 54 | display: inline-block; 55 | } 56 | 57 | /** 58 | * Add the correct display in iOS 4-7. 59 | */ 60 | 61 | audio:not([controls]) { 62 | display: none; 63 | height: 0; 64 | } 65 | 66 | /** 67 | * Add the correct vertical alignment in Chrome, Firefox, and Opera. 68 | */ 69 | 70 | progress { 71 | vertical-align: baseline; 72 | } 73 | 74 | /** 75 | * Add the correct display in IE 10-. 76 | * 1. Add the correct display in IE. 77 | */ 78 | 79 | template, /* 1 */ 80 | [hidden] { 81 | display: none; 82 | } 83 | 84 | /* Links 85 | ========================================================================== */ 86 | 87 | /** 88 | * 1. Remove the gray background on active links in IE 10. 89 | * 2. Remove gaps in links underline in iOS 8+ and Safari 8+. 90 | */ 91 | 92 | a { 93 | background-color: transparent; /* 1 */ 94 | -webkit-text-decoration-skip: objects; /* 2 */ 95 | } 96 | 97 | /** 98 | * Remove the outline on focused links when they are also active or hovered 99 | * in all browsers (opinionated). 100 | */ 101 | 102 | a:active, 103 | a:hover { 104 | outline-width: 0; 105 | } 106 | 107 | /* Text-level semantics 108 | ========================================================================== */ 109 | 110 | /** 111 | * 1. Remove the bottom border in Firefox 39-. 112 | * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. 113 | */ 114 | 115 | abbr[title] { 116 | border-bottom: none; /* 1 */ 117 | text-decoration: underline; /* 2 */ 118 | text-decoration: underline dotted; /* 2 */ 119 | } 120 | 121 | /** 122 | * Prevent the duplicate application of `bolder` by the next rule in Safari 6. 123 | */ 124 | 125 | b, 126 | strong { 127 | font-weight: inherit; 128 | } 129 | 130 | /** 131 | * Add the correct font weight in Chrome, Edge, and Safari. 132 | */ 133 | 134 | b, 135 | strong { 136 | font-weight: bolder; 137 | } 138 | 139 | /** 140 | * Add the correct font style in Android 4.3-. 141 | */ 142 | 143 | dfn { 144 | font-style: italic; 145 | } 146 | 147 | /** 148 | * Correct the font size and margin on `h1` elements within `section` and 149 | * `article` contexts in Chrome, Firefox, and Safari. 150 | */ 151 | 152 | h1 { 153 | font-size: 2em; 154 | margin: 0.67em 0; 155 | } 156 | 157 | /** 158 | * Add the correct background and color in IE 9-. 159 | */ 160 | 161 | mark { 162 | background-color: #ff0; 163 | color: #000; 164 | } 165 | 166 | /** 167 | * Add the correct font size in all browsers. 168 | */ 169 | 170 | small { 171 | font-size: 80%; 172 | } 173 | 174 | /** 175 | * Prevent `sub` and `sup` elements from affecting the line height in 176 | * all browsers. 177 | */ 178 | 179 | sub, 180 | sup { 181 | font-size: 75%; 182 | line-height: 0; 183 | position: relative; 184 | vertical-align: baseline; 185 | } 186 | 187 | sub { 188 | bottom: -0.25em; 189 | } 190 | 191 | sup { 192 | top: -0.5em; 193 | } 194 | 195 | /* Embedded content 196 | ========================================================================== */ 197 | 198 | /** 199 | * Remove the border on images inside links in IE 10-. 200 | */ 201 | 202 | img { 203 | border-style: none; 204 | } 205 | 206 | /** 207 | * Hide the overflow in IE. 208 | */ 209 | 210 | svg:not(:root) { 211 | overflow: hidden; 212 | } 213 | 214 | /* Grouping content 215 | ========================================================================== */ 216 | 217 | /** 218 | * 1. Correct the inheritance and scaling of font size in all browsers. 219 | * 2. Correct the odd `em` font sizing in all browsers. 220 | */ 221 | 222 | code, 223 | kbd, 224 | pre, 225 | samp { 226 | font-family: monospace, monospace; /* 1 */ 227 | font-size: 1em; /* 2 */ 228 | } 229 | 230 | /** 231 | * Add the correct margin in IE 8. 232 | */ 233 | 234 | figure { 235 | margin: 1em 40px; 236 | } 237 | 238 | /** 239 | * 1. Add the correct box sizing in Firefox. 240 | * 2. Show the overflow in Edge and IE. 241 | */ 242 | 243 | hr { 244 | box-sizing: content-box; /* 1 */ 245 | height: 0; /* 1 */ 246 | overflow: visible; /* 2 */ 247 | } 248 | 249 | /* Forms 250 | ========================================================================== */ 251 | 252 | /** 253 | * 1. Change font properties to `inherit` in all browsers (opinionated). 254 | * 2. Remove the margin in Firefox and Safari. 255 | */ 256 | 257 | button, 258 | input, 259 | select, 260 | textarea { 261 | font: inherit; /* 1 */ 262 | margin: 0; /* 2 */ 263 | } 264 | 265 | /** 266 | * Restore the font weight unset by the previous rule. 267 | */ 268 | 269 | optgroup { 270 | font-weight: bold; 271 | } 272 | 273 | /** 274 | * Show the overflow in IE. 275 | * 1. Show the overflow in Edge. 276 | */ 277 | 278 | button, 279 | input { /* 1 */ 280 | overflow: visible; 281 | } 282 | 283 | /** 284 | * Remove the inheritance of text transform in Edge, Firefox, and IE. 285 | * 1. Remove the inheritance of text transform in Firefox. 286 | */ 287 | 288 | button, 289 | select { /* 1 */ 290 | text-transform: none; 291 | } 292 | 293 | /** 294 | * 1. Prevent a WebKit bug where (2) destroys native `audio` and `video` 295 | * controls in Android 4. 296 | * 2. Correct the inability to style clickable types in iOS and Safari. 297 | */ 298 | 299 | button, 300 | html [type="button"], /* 1 */ 301 | [type="reset"], 302 | [type="submit"] { 303 | -webkit-appearance: button; /* 2 */ 304 | } 305 | 306 | /** 307 | * Remove the inner border and padding in Firefox. 308 | */ 309 | 310 | button::-moz-focus-inner, 311 | [type="button"]::-moz-focus-inner, 312 | [type="reset"]::-moz-focus-inner, 313 | [type="submit"]::-moz-focus-inner { 314 | border-style: none; 315 | padding: 0; 316 | } 317 | 318 | /** 319 | * Restore the focus styles unset by the previous rule. 320 | */ 321 | 322 | button:-moz-focusring, 323 | [type="button"]:-moz-focusring, 324 | [type="reset"]:-moz-focusring, 325 | [type="submit"]:-moz-focusring { 326 | outline: 1px dotted ButtonText; 327 | } 328 | 329 | /** 330 | * Change the border, margin, and padding in all browsers (opinionated). 331 | */ 332 | 333 | fieldset { 334 | border: 1px solid #c0c0c0; 335 | margin: 0 2px; 336 | padding: 0.35em 0.625em 0.75em; 337 | } 338 | 339 | /** 340 | * 1. Correct the text wrapping in Edge and IE. 341 | * 2. Correct the color inheritance from `fieldset` elements in IE. 342 | * 3. Remove the padding so developers are not caught out when they zero out 343 | * `fieldset` elements in all browsers. 344 | */ 345 | 346 | legend { 347 | box-sizing: border-box; /* 1 */ 348 | color: inherit; /* 2 */ 349 | display: table; /* 1 */ 350 | max-width: 100%; /* 1 */ 351 | padding: 0; /* 3 */ 352 | white-space: normal; /* 1 */ 353 | } 354 | 355 | /** 356 | * Remove the default vertical scrollbar in IE. 357 | */ 358 | 359 | textarea { 360 | overflow: auto; 361 | } 362 | 363 | /** 364 | * 1. Add the correct box sizing in IE 10-. 365 | * 2. Remove the padding in IE 10-. 366 | */ 367 | 368 | [type="checkbox"], 369 | [type="radio"] { 370 | box-sizing: border-box; /* 1 */ 371 | padding: 0; /* 2 */ 372 | } 373 | 374 | /** 375 | * Correct the cursor style of increment and decrement buttons in Chrome. 376 | */ 377 | 378 | [type="number"]::-webkit-inner-spin-button, 379 | [type="number"]::-webkit-outer-spin-button { 380 | height: auto; 381 | } 382 | 383 | /** 384 | * 1. Correct the odd appearance in Chrome and Safari. 385 | * 2. Correct the outline style in Safari. 386 | */ 387 | 388 | [type="search"] { 389 | -webkit-appearance: textfield; /* 1 */ 390 | outline-offset: -2px; /* 2 */ 391 | } 392 | 393 | /** 394 | * Remove the inner padding and cancel buttons in Chrome and Safari on OS X. 395 | */ 396 | 397 | [type="search"]::-webkit-search-cancel-button, 398 | [type="search"]::-webkit-search-decoration { 399 | -webkit-appearance: none; 400 | } 401 | 402 | /** 403 | * Correct the text style of placeholders in Chrome, Edge, and Safari. 404 | */ 405 | 406 | ::-webkit-input-placeholder { 407 | color: inherit; 408 | opacity: 0.54; 409 | } 410 | 411 | /** 412 | * 1. Correct the inability to style clickable types in iOS and Safari. 413 | * 2. Change font properties to `inherit` in Safari. 414 | */ 415 | 416 | ::-webkit-file-upload-button { 417 | -webkit-appearance: button; /* 1 */ 418 | font: inherit; /* 2 */ 419 | } 420 | -------------------------------------------------------------------------------- /themes/wiki-i18n/source/images/pixels.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xcatliu/js-index/615ac0a5b744f7d3bb70a22021e2876b92eed3f0/themes/wiki-i18n/source/images/pixels.png -------------------------------------------------------------------------------- /themes/wiki-i18n/source/js/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "airbnb-base/legacy", 3 | "rules": { 4 | "vars-on-top": 0, 5 | "no-use-before-define": 0 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /themes/wiki-i18n/source/js/header.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | var form = document.getElementById('header-search-form'); 3 | var input = document.getElementById('header-search-input'); 4 | form.addEventListener('submit', function (e) { 5 | e.preventDefault(); 6 | var text = input.value.trim(); 7 | if (text === '') { 8 | return; 9 | } 10 | var googleSearchPrefix = 'https://www.google.com/#newwindow=1&q='; 11 | var siteUrl = window.HEXO_DATA.config.url; 12 | window.open(googleSearchPrefix + 'site:' + siteUrl + '+' + text, '_blank'); 13 | }); 14 | 15 | var select = document.getElementById('header-lang-select'); 16 | select.addEventListener('change', function (e) { 17 | e.preventDefault(); 18 | var option = e.target.querySelector('[value="' + e.target.value + '"]'); 19 | location.href = option.dataset.href; 20 | }); 21 | }()); 22 | --------------------------------------------------------------------------------