Showing
54 changed files
with
6966 additions
and
0 deletions
74.2 KB
59.6 KB
1 | +# ECMAScript 6 语法 | ||
2 | + | ||
3 | +### 1.let 命令 | ||
4 | + | ||
5 | +##### 代码作用域 | ||
6 | +ES6新增 **let** 命令,用来声明变量,用法类似于 **var**。 | ||
7 | +但其声明的变量,只在let命令所在的代码块有效。 | ||
8 | + | ||
9 | +``` | ||
10 | +{ | ||
11 | + let a = 10; | ||
12 | + var b = 1; | ||
13 | +} | ||
14 | + | ||
15 | +a // ReferenceError: a is not defined. | ||
16 | +b // 1 | ||
17 | +``` | ||
18 | + | ||
19 | +for循环的计数器,就很合适使用let命令。 | ||
20 | + | ||
21 | +``` | ||
22 | +for (let i = 0; i < arr.length; i++) {} | ||
23 | +console.log(i); //ReferenceError: i is not defined | ||
24 | +``` | ||
25 | + | ||
26 | + | ||
27 | +##### 不存在变量提升 | ||
28 | + | ||
29 | +let不像var那样会发生“变量提升”现象。所以,变量一定要在声明后使用,否则报错。 | ||
30 | + | ||
31 | +``` | ||
32 | +console.log(foo); // 输出undefined | ||
33 | +console.log(bar); // 报错ReferenceError | ||
34 | +var foo = 2; | ||
35 | +let bar = 2; | ||
36 | +``` | ||
37 | + | ||
38 | +##### 不允许重复声明 | ||
39 | + | ||
40 | +let不允许在相同作用域内,重复声明同一个变量。 | ||
41 | + | ||
42 | +``` | ||
43 | +// 报错 | ||
44 | +function () { | ||
45 | + let a = 10; | ||
46 | + var a = 1; | ||
47 | +} | ||
48 | +``` | ||
49 | + | ||
50 | + | ||
51 | +--- | ||
52 | + | ||
53 | +### 2.const命令 | ||
54 | + | ||
55 | +const 声明一个只读的常量。一旦声明,常量的值就不能改变。 | ||
56 | + | ||
57 | +``` | ||
58 | +'use strict'; | ||
59 | +const PI = 3.1415; | ||
60 | +PI // 3.1415 | ||
61 | +PI = 3; // TypeError: "PI" is read-only | ||
62 | +``` | ||
63 | + | ||
64 | +--- | ||
65 | + | ||
66 | +### 3.数组解构赋值 | ||
67 | + | ||
68 | + [参考链接](http://es6.ruanyifeng.com/#docs/destructuring) | ||
69 | + | ||
70 | +ES6允许以下方式赋值变量 | ||
71 | + `var [a, b, c] = [1, 2, 3];` | ||
72 | + | ||
73 | +##### 嵌套解构 | ||
74 | +下面是一些使用嵌套数组进行解构的例子。 | ||
75 | + | ||
76 | +``` | ||
77 | +let [foo, [[bar], baz]] = [1, [[2], 3]]; | ||
78 | +let [ , , third] = ["foo", "bar", "baz"]; | ||
79 | +let [x, , y] = [1, 2, 3]; | ||
80 | +x // 1 | ||
81 | +y // 3 | ||
82 | +let [head, ...tail] = [1, 2, 3, 4]; | ||
83 | +head // 1 | ||
84 | +tail // [2, 3, 4] | ||
85 | +``` | ||
86 | + | ||
87 | +##### 解析缺少 | ||
88 | + | ||
89 | +如果解构不成功,变量的值就等于undefined。 | ||
90 | + | ||
91 | +``` | ||
92 | +var [foo] = []; | ||
93 | +var [bar, foo] = [1]; | ||
94 | +// 以上两种情况都属于解构不成功,foo的值都会等于undefined。 | ||
95 | +``` | ||
96 | + | ||
97 | + | ||
98 | +##### 不完全解析 | ||
99 | +等号左边的模式,只匹配一部分的等号右边的数组。这种情况下,解构依然可以成功。 | ||
100 | + | ||
101 | +``` | ||
102 | +let [x, y] = [1, 2, 3]; | ||
103 | +x // 1 | ||
104 | +y // 2 | ||
105 | + | ||
106 | +let [a, [b], d] = [1, [2, 3], 4]; | ||
107 | +a // 1 | ||
108 | +b // 2 | ||
109 | +d // 4 | ||
110 | +``` | ||
111 | + | ||
112 | +--- | ||
113 | + | ||
114 | + | ||
115 | +### 4. 对象的解构赋值 | ||
116 | + | ||
117 | + 解构不仅可以用于数组,还可以用于对象。 | ||
118 | + | ||
119 | +``` | ||
120 | +var { foo, bar } = { foo: "aaa", bar: "bbb" }; | ||
121 | +foo // "aaa" ; bar // "bbb" | ||
122 | +``` | ||
123 | + | ||
124 | +对象的解构与数组有一个重要的不同。数组的元素是按次序排列的,变量的取值由它的位置决定;而 **对象的属性没有次序,变量必须与属性同名**,才能取到正确的值。 | ||
125 | + | ||
126 | +``` | ||
127 | +var { bar, foo } = { foo: "aaa", bar: "bbb" }; | ||
128 | +foo // "aaa" | ||
129 | +bar // "bbb" | ||
130 | +``` | ||
131 | + | ||
132 | +如果变量名与属性名不一致,必须写成下面这样。 | ||
133 | + | ||
134 | +``` | ||
135 | +var { foo: baz } = { foo: "aaa", bar: "bbb" }; | ||
136 | +baz // "aaa" | ||
137 | +``` | ||
138 | + | ||
139 | +这实际上说明, **对象的解构赋值是下面形式的简写** | ||
140 | +对象的解构赋值的内部机制,是先找到同名属性,然后再赋给对应的变量。真正被赋值的是后者,而不是前者。 | ||
141 | + `var { foo: foo, bar: bar } = { foo: "aaa", bar: "bbb" };` | ||
142 | + | ||
143 | + | ||
144 | +--- | ||
145 | + | ||
146 | +### 5. 字符串的解构赋值 | ||
147 | + | ||
148 | +字符串也可以解构赋值。这是因为此时,字符串被转换成了一个类似数组的对象。 | ||
149 | + | ||
150 | +``` | ||
151 | +const [a, b, c, d, e] = 'hello'; | ||
152 | +a // "h" | ||
153 | +b // "e" | ||
154 | +c // "l" | ||
155 | +d // "l" | ||
156 | +e // "o" | ||
157 | +``` |
1 | +# NPM 使用帮助 | ||
2 | + | ||
3 | +### 1.使用npm其它源 | ||
4 | + | ||
5 | + 可以使用nrm工具,具体链接参考: | ||
6 | + [nrm](https://github.com/Pana/nrm) | ||
7 | + | ||
8 | +``` | ||
9 | + npm install -g nrm | ||
10 | + nrm use rednpm | ||
11 | +``` | ||
12 | + | ||
13 | + | ||
14 | +### 2.npm 安装库到devDependencies和dependencies | ||
15 | +devDependencies是开发时所需要用的库 | ||
16 | +dependencies 是开发和运行都需要运行的库 | ||
17 | + | ||
18 | +> devDependencies | ||
19 | + | ||
20 | + `npm i npm_module -D || npm install npm_module --save-dev` | ||
21 | + | ||
22 | +> dependencies | ||
23 | + | ||
24 | + `npm i npm_module -S || npm install npm_module --save` | ||
25 | + | ||
26 | + | ||
27 | +### 3. 查看npm配置 | ||
28 | + | ||
29 | +`$ npm config list -l` | ||
30 | + | ||
31 | +### 4. 设置环境变量。 | ||
32 | + | ||
33 | +``` | ||
34 | +$ npm set init-author-name 'Your name' | ||
35 | +$ npm set init-author-email 'Your email' | ||
36 | +$ npm set init-author-url 'http://yourdomain.com' | ||
37 | +$ npm set init-license 'MIT' | ||
38 | +``` | ||
39 | + | ||
40 | +### 5. 查看已安装模块 | ||
41 | + | ||
42 | +> 列出当前项目安装的所有模块及全局模块 | ||
43 | + `npm list | npm list --global` | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +# 前端组件化的一些学习资料 | ||
2 | + | ||
3 | +### 前端整体 | ||
4 | + | ||
5 | +>[Vue+ES6+Jade+Scss+Webpack+Gulp 编程](https://segmentfault.com/a/1190000005115926) | ||
6 | + | ||
7 | +>[2016年后Web 开发趋势是什么](http://yafeilee.me/blogs/86) | ||
8 | + | ||
9 | +>[AlloyTeam腾讯全端Blog](http://www.alloyteam.com/) | ||
10 | + | ||
11 | +>[前端开发者手册](https://dwqs.gitbooks.io/frontenddevhandbook/content/) | ||
12 | + | ||
13 | +>[CommonJS规范](http://www.feeldesignstudio.com/2013/09/javascript-module-pattern-commonjs/) | ||
14 | + | ||
15 | +>[浅淡Javascript模块化编程](https://segmentfault.com/a/1190000000492678) | ||
16 | + | ||
17 | +--- | ||
18 | + | ||
19 | +## ECMAScript6 | ||
20 | + | ||
21 | +>[-- ES6初探](https://github.com/shipfi/es6features) | ||
22 | + | ||
23 | +>[-- ES6相关学习资源](https://segmentfault.com/a/1190000003739409) | ||
24 | + | ||
25 | +>[-- ECMAScript6入门-阮一峰](http://es6.ruanyifeng.com/#docs/intro) | ||
26 | + | ||
27 | +>[-- ECMAScript6入门-木头人](http://www.hubwiz.com/course/5594e91ac086935f4a6fb8ef/) | ||
28 | + | ||
29 | +>[-- ES6 in depth](https://hacks.mozilla.org/category/es6-in-depth/) | ||
30 | + | ||
31 | ++ | ||
32 | + | ||
33 | +---- | ||
34 | + | ||
35 | +### Webpackt篇 | ||
36 | + | ||
37 | ++ 说明: | ||
38 | + | ||
39 | +>[-- Webpack Doc中文](https://github.com/liunian/webpack-doc/blob/master/SUMMARY.md) | ||
40 | + | ||
41 | +>[-- Webpack入门指南](http://www.cnblogs.com/vajoy/p/4650467.html#!/follow) | ||
42 | + | ||
43 | +>[-- Webpack入门指南2](https://segmentfault.com/a/1190000002551952) | ||
44 | + | ||
45 | +>[-- Webpack怎么用](https://segmentfault.com/a/1190000002552008) | ||
46 | + | ||
47 | +>[-- webpack中文指南](http://zhaoda.net/webpack-handbook/index.html) | ||
48 | + | ||
49 | +>[-- webpack傻瓜式指南****](https://github.com/vikingmute/webpack-for-fools) | ||
50 | + | ||
51 | +>[-- webpack loader](http://guowenfh.github.io/2016/03/24/vue-webpack-02-deploy/) | ||
52 | + | ||
53 | +>[-- webpack 使用](http://fakefish.github.io/react-webpack-cookbook/index.html) | ||
54 | + | ||
55 | + | ||
56 | ++ Webpack 套件 (可通过npm安装) | ||
57 | + | ||
58 | +>[-- 一个webpack插件,用于打包css资源文件](https://github.com/webpack/extract-text-webpack-plugin) | ||
59 | + | ||
60 | +>[-- css-loader,style-loader](https://github.com/liunian/webpack-doc/blob/master/tutorials/getting-started/index.md) | ||
61 | + | ||
62 | +``` | ||
63 | +css-loader 是处理css文件中的url()等 | ||
64 | +style-loader 将css插入到页面的style标签 | ||
65 | +less-loader 是将less文件编译成css | ||
66 | +sass-loader 是将sass文件编译成css | ||
67 | +``` | ||
68 | + | ||
69 | ++ 示例: | ||
70 | + | ||
71 | +>[-- webpack_JS_CSS数据打包及对生产环境html模板的生成](https://github.com/qianjiahao/webpack-babel-react-development-tools) | ||
72 | + | ||
73 | +>[-- webpack Samples](https://github.com/ruanyf/webpack-demos) | ||
74 | + | ||
75 | +>[-- Webpack+React+ES6开发模式入门](http://www.cnblogs.com/skylar/p/React-Webpack-ES6.html) | ||
76 | + | ||
77 | +--- | ||
78 | + | ||
79 | +### Vue篇 | ||
80 | + | ||
81 | ++ 实践 | ||
82 | + | ||
83 | +>[-- Vue组件化开放实践](http://gold.xitu.io/entry/55f77eb460b28e6a6f0f4f86) | ||
84 | + | ||
85 | +>[-- Webpack + vue-loader入坑之旅](https://segmentfault.com/a/1190000004690338) | ||
86 | + | ||
87 | +>[-- Vue + webpack 项目实践](http://ju.outofmemory.cn/entry/195573) | ||
88 | + | ||
89 | + | ||
90 | ++ 组件篇 | ||
91 | + | ||
92 | +> [Vue-Router](https://github.com/vuejs/vue-router) | ||
93 | +> 官方Vue Router | ||
94 | +> [flatiron/director](https://github.com/flatiron/director) | ||
95 | +> a tiny and isomorphic URL router for JavaScript | ||
96 | +> [vuejs/vue-resource](https://github.com/vuejs/vue-resource) | ||
97 | +> 网络请求库 | ||
98 | +> [vuejs/vue-validator](https://github.com/vuejs/vue-validator) | ||
99 | +> 表单验证库 | ||
100 | +> [vuejs/vue-touch] (https://github.com/vuejs/vue-touch) | ||
101 | +> 事件模拟 | ||
102 | + | ||
103 | ++ Github示例 | ||
104 | + | ||
105 | +>[-- vuejs/vue-webpack-example](https://github.com/vuejs/vue-webpack-example/blob/master/package.json) | ||
106 | + | ||
107 | + | ||
108 | +>[-- Vue官方Examples](https://github.com/vuejs/vue/tree/dev/examples) | ||
109 | + | ||
110 | +>[-- Vuewjs-templates/webpack](https://github.com/vuejs-templates/webpack/tree/dist/template) | ||
111 | + | ||
112 | +>A full-featured Webpack + vue-loader setup with hot reload, linting, testing & css extraction. | ||
113 | + | ||
114 | +>[-- Just Vue](https://github.com/JustClear/just-vue) | ||
115 | + | ||
116 | +> A quick starter for Vue and Webpack | ||
117 | + | ||
118 | + | ||
119 | + | ||
120 | +--- | ||
121 | + | ||
122 | +### Gulp篇 | ||
123 | + | ||
124 | + | ||
125 | +--- | ||
126 | + | ||
127 | +### Jade篇 | ||
128 | + | ||
129 | +>[Jade —— 源于 Node.js 的 HTML 模板引擎](https://segmentfault.com/a/1190000000357534) | ||
130 | + | ||
131 | +>[Jade Document](http://naltatis.github.io/jade-syntax-docs/) | ||
132 | + | ||
133 | +--- | ||
134 | + | ||
135 | +### 其它工具篇 | ||
136 | + | ||
137 | +>[-- Mobile Web Developer Tool:AlloyLever](http://www.alloyteam.com/2016/05/mobile-web-development-debugging-tools-alloylever-introduced/) | ||
138 | + | ||
139 | + | ||
140 | + | ||
141 | +--- | ||
142 | + | ||
143 | +### Javascript 语言篇 | ||
144 | + | ||
145 | +>[-- 从作用域链谈闭包](http://www.ido321.com/1641.html) | ||
146 | + | ||
147 | + 闭包是指有权访问另外一个函数作用域中的变量的函数 | ||
148 | + | ||
149 | +--- | ||
150 | + | ||
151 | + | ||
152 | +### Nodejs篇 | ||
153 | + | ||
154 | +>[Nodejs资源汇总](https://www.douban.com/group/topic/35067110/) | ||
155 | +>[Nodejs手册文档](http://nodeapi.ucdok.com/#/api/) | ||
156 | + | ||
157 | +##### QA | ||
158 | +>[nodejs中exports与module.exports的区别](http://www.cnblogs.com/pigtail/archive/2013/01/14/2859555.html) | ||
159 | + | ||
160 | +### NPM | ||
161 | + | ||
162 | +> [npm源](https://github.com/Pana/nrm) | ||
163 | +> 使用nrm工具来切换npm源 | ||
164 | + |
1 | +# Laravel中的User模型 | ||
2 | + | ||
3 | +分析在laravel中的User Model,会发现一些很有意思的事情 | ||
4 | + | ||
5 | ++ **User模型** | ||
6 | + | ||
7 | +``` | ||
8 | +use Illuminate\Auth\Authenticatable; | ||
9 | +use Illuminate\Database\Eloquent\Model; | ||
10 | +use Illuminate\Auth\Passwords\CanResetPassword; | ||
11 | +use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; | ||
12 | +use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract; | ||
13 | + | ||
14 | +// 实现了AuthenticatableContract,CanResetPasswordContract | ||
15 | +// 但是在模型类中不实现,只是 | ||
16 | +// 通过trait class = (Authenticatable,CanResetPassword)实现。 | ||
17 | + | ||
18 | +class User extends Model | ||
19 | + implements AuthenticatableContract, CanResetPasswordContract | ||
20 | +{ | ||
21 | + | ||
22 | + use Authenticatable, CanResetPassword; | ||
23 | + | ||
24 | + /** | ||
25 | + * The database table used by the model. | ||
26 | + * | ||
27 | + * @var string | ||
28 | + */ | ||
29 | + protected $table = 'users'; | ||
30 | + | ||
31 | + /** | ||
32 | + * The attributes that are mass assignable. | ||
33 | + * | ||
34 | + * @var array | ||
35 | + */ | ||
36 | + protected $fillable = ['name', 'email', 'password']; | ||
37 | + | ||
38 | + /** | ||
39 | + * The attributes excluded from the model's JSON form. | ||
40 | + * | ||
41 | + * @var array | ||
42 | + */ | ||
43 | + protected $hidden = ['password', 'remember_token']; | ||
44 | + | ||
45 | +} | ||
46 | +``` | ||
47 | + | ||
48 | ++ **AuthenticatableContract接口定义** | ||
49 | + | ||
50 | +``` | ||
51 | +namespace Illuminate\Contracts\Auth; | ||
52 | + | ||
53 | +// 约定,namespace带有Contracts的,表示接口 | ||
54 | + | ||
55 | +interface Authenticatable { | ||
56 | + | ||
57 | + /** | ||
58 | + * Get the unique identifier for the user. | ||
59 | + * | ||
60 | + * @return mixed | ||
61 | + */ | ||
62 | + public function getAuthIdentifier(); | ||
63 | + | ||
64 | + /** | ||
65 | + * Get the password for the user. | ||
66 | + * | ||
67 | + * @return string | ||
68 | + */ | ||
69 | + public function getAuthPassword(); | ||
70 | + | ||
71 | + /** | ||
72 | + * Get the token value for the "remember me" session. | ||
73 | + * | ||
74 | + * @return string | ||
75 | + */ | ||
76 | + public function getRememberToken(); | ||
77 | + | ||
78 | + /** | ||
79 | + * Set the token value for the "remember me" session. | ||
80 | + * | ||
81 | + * @param string $value | ||
82 | + * @return void | ||
83 | + */ | ||
84 | + public function setRememberToken($value); | ||
85 | + | ||
86 | + /** | ||
87 | + * Get the column name for the "remember me" token. | ||
88 | + * | ||
89 | + * @return string | ||
90 | + */ | ||
91 | + public function getRememberTokenName(); | ||
92 | + | ||
93 | +} | ||
94 | +``` | ||
95 | + | ||
96 | ++ **Authenticatable的实现** | ||
97 | + | ||
98 | +``` | ||
99 | +namespace Illuminate\Auth; | ||
100 | + | ||
101 | +trait Authenticatable { | ||
102 | + | ||
103 | + /** | ||
104 | + * Get the unique identifier for the user. | ||
105 | + * | ||
106 | + * @return mixed | ||
107 | + */ | ||
108 | + public function getAuthIdentifier() | ||
109 | + { | ||
110 | + return $this->getKey(); | ||
111 | + } | ||
112 | + | ||
113 | + /** | ||
114 | + * Get the password for the user. | ||
115 | + * | ||
116 | + * @return string | ||
117 | + */ | ||
118 | + public function getAuthPassword() | ||
119 | + { | ||
120 | + return $this->password; | ||
121 | + } | ||
122 | + | ||
123 | + /** | ||
124 | + * Get the token value for the "remember me" session. | ||
125 | + * | ||
126 | + * @return string | ||
127 | + */ | ||
128 | + public function getRememberToken() | ||
129 | + { | ||
130 | + return $this->{$this->getRememberTokenName()}; | ||
131 | + } | ||
132 | + | ||
133 | + /** | ||
134 | + * Set the token value for the "remember me" session. | ||
135 | + * | ||
136 | + * @param string $value | ||
137 | + * @return void | ||
138 | + */ | ||
139 | + public function setRememberToken($value) | ||
140 | + { | ||
141 | + // 用这样的方式很灵活.... | ||
142 | + $this->{$this->getRememberTokenName()} = $value; | ||
143 | + } | ||
144 | + | ||
145 | + /** | ||
146 | + * Get the column name for the "remember me" token. | ||
147 | + * | ||
148 | + * @return string | ||
149 | + */ | ||
150 | + public function getRememberTokenName() | ||
151 | + { | ||
152 | + return 'remember_token'; | ||
153 | + } | ||
154 | + | ||
155 | +} | ||
156 | +``` | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +# Laravel & Lumen 中整体配置的说明 | ||
2 | + | ||
3 | +### 1. Lumen使用自定义的配置文件 | ||
4 | +在laravel当中,默认是存在config文件夹,按照规则,相应的库需要配置文件,都是在config中以独立的一个php config文件存在的。 | ||
5 | +而在Lumen当中,是没有config文件夹,配置文件统一放到.env文件中。 | ||
6 | + | ||
7 | +- 以下是Laravel中使用的结构文件: | ||
8 | +![Alt text](../imgs/laravel_st1.png) | ||
9 | + | ||
10 | +- 以下是Lumen中使用的文件结构 | ||
11 | +![Alt text](../imgs/lumen_st1.png) | ||
12 | + | ||
13 | +如果在Lumen当中需要启用config文件夹,并且按库去设定相应的配置文件。那么就需要以下两个步骤: | ||
14 | + | ||
15 | +1. 在项目根目录中,建立config文件夹 | ||
16 | +2. 创建相应的.php配置文件,这些配置文件返回的是一个key=>value组成的数组结构 | ||
17 | +3. 在bootstrap/app.php中指定使用相应的配置文件,但是有一个config/database.php配置文件不需要configure指定,就可以默认加载。 | ||
18 | + | ||
19 | + | ||
20 | +``` | ||
21 | +$app->configure('api'); | ||
22 | +$app->configure('jwt'); | ||
23 | +$app->configure('auth'); | ||
24 | +``` | ||
25 | + | ||
26 | +--- | ||
27 | + | ||
28 | +### 2. 入口文件、启动文件和配置文件 | ||
29 | +[参考链接](https://segmentfault.com/a/1190000002902055) | ||
30 | + | ||
31 | +应用程序的入口文件是: | ||
32 | + /index.php ==> /public/index.php ==> /bootstrap/app.php | ||
33 | + | ||
34 | +应用程序最基本的启动是: | ||
35 | + | ||
36 | +- public/index.php | ||
37 | + `$app = require(bootstrap/app.php)` | ||
38 | +- bootstrap/app.php | ||
39 | +``` | ||
40 | +Dotenv\Dotenv(__DIR__.'/../'))->load(); // load env | ||
41 | +$app = new Laravel/Lumen/Application(); | ||
42 | +// 如果是Laravel,则是 new Illuminate/Foundation/Application | ||
43 | + | ||
44 | +// Register Singleton Container Bindings | ||
45 | +$app->singleton(...); | ||
46 | + | ||
47 | +// Register Middleware | ||
48 | +$app->middleware(...); | ||
49 | +$app->routeMiddleware(...); | ||
50 | + | ||
51 | +// Register Service Provider | ||
52 | +$app->register(...); | ||
53 | + | ||
54 | +// 加载路由 | ||
55 | +require app/Http/routes.php | ||
56 | +``` | ||
57 | +- router定义 | ||
58 | +``` | ||
59 | +$app->get('/', function () use ($app) { | ||
60 | + return $app->version(); | ||
61 | +}); | ||
62 | +``` | ||
63 | +- 程序运行(public/index.php) | ||
64 | +`$app->run();` | ||
65 | + | ||
66 | + | ||
67 | +Lumen的配置文件是根目录下的.env文件,.env文件的载入是bootstrap/app.php中的一行代码: | ||
68 | +`new Dotenv\Dotenv(__DIR__.'/../'))->load()` | ||
69 | + | ||
70 | +--- | ||
71 | + | ||
72 | +### 3. Facades | ||
73 | + | ||
74 | +>Facades 提供一个静态接口给在应用程序的服务容器中可以取用的类 | ||
75 | + | ||
76 | +在配置文件中,有一个`$app->withFacades();`是表示启用Facades. | ||
77 | +启用和不启用的区域在于: | ||
78 | + | ||
79 | +- 启用前: | ||
80 | +``` | ||
81 | +use Illuminate\Support\Facades\Cache; | ||
82 | +use Illuminate\Support\Facades\DB; | ||
83 | + | ||
84 | +Cache::put('key', 'value', $minutes); | ||
85 | +DB::getQueryLog(); | ||
86 | +``` | ||
87 | +- 启用后 | ||
88 | +``` | ||
89 | +use Cache; | ||
90 | +use DB; | ||
91 | +Cache::put('key', 'value', $minutes); | ||
92 | +DB::getQueryLog(); | ||
93 | +``` | ||
94 | + | ||
95 | +通过查看withFacades,可以看出玄机: | ||
96 | +``` | ||
97 | +public function withFacades() | ||
98 | +{ | ||
99 | + Facade::setFacadeApplication($this); | ||
100 | + | ||
101 | + if (! static::$aliasesRegistered) { | ||
102 | + static::$aliasesRegistered = true; | ||
103 | + | ||
104 | + class_alias('Illuminate\Support\Facades\App', 'App'); | ||
105 | + class_alias('Illuminate\Support\Facades\Auth', 'Auth'); | ||
106 | + class_alias('Illuminate\Support\Facades\Bus', 'Bus'); | ||
107 | + class_alias('Illuminate\Support\Facades\DB', 'DB'); | ||
108 | + class_alias('Illuminate\Support\Facades\Cache', 'Cache'); | ||
109 | + class_alias('Illuminate\Support\Facades\Cookie', 'Cookie'); | ||
110 | + class_alias('Illuminate\Support\Facades\Crypt', 'Crypt'); | ||
111 | + class_alias('Illuminate\Support\Facades\Event', 'Event'); | ||
112 | + class_alias('Illuminate\Support\Facades\Hash', 'Hash'); | ||
113 | + class_alias('Illuminate\Support\Facades\Log', 'Log'); | ||
114 | + class_alias('Illuminate\Support\Facades\Mail', 'Mail'); | ||
115 | + class_alias('Illuminate\Support\Facades\Queue', 'Queue'); | ||
116 | + class_alias('Illuminate\Support\Facades\Request', 'Request'); | ||
117 | + class_alias('Illuminate\Support\Facades\Schema', 'Schema'); | ||
118 | + class_alias('Illuminate\Support\Facades\Session', 'Session'); | ||
119 | + class_alias('Illuminate\Support\Facades\Storage', 'Storage'); | ||
120 | + class_alias('Illuminate\Support\Facades\Validator', 'Validator'); | ||
121 | + } | ||
122 | +} | ||
123 | +``` | ||
124 | + | ||
125 | +--- | ||
126 | + | ||
127 | +### 4. Session | ||
128 | +Session 默认未开启。 | ||
129 | +开启方式:去掉 bootstrap/app.php 中 $app->middleware(); 的 StartSession中间件的注释。 | ||
130 | + | ||
131 | +在 .env 文件中,Session 的默认驱动是:memcached。 | ||
132 | +目前支持的驱动有:file、cookie、database、memcached、redis、array | ||
133 | + | ||
134 | +[Session参考](http://lumen.laravel-china.org/docs/session#session-drivers) | ||
135 | + | ||
136 | + | ||
137 | +### 5. Laravel的一些package | ||
138 | +[参考](https://segmentfault.com/a/1190000002889864) | ||
139 | + |
1 | +# Laravel | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +# 一些Laravel中的代码说明 | ||
2 | + | ||
3 | +### 1.在Controller中函数参数使用Request | ||
4 | +首先需要引用Illuminate\Http\Request命名空间,才能使用$request变量 | ||
5 | + | ||
6 | +``` | ||
7 | +use Illuminate\Http\Request | ||
8 | +use dump; | ||
9 | +class ProjectController extends Controller | ||
10 | +{ | ||
11 | + public function index(Request $request) { | ||
12 | + dump($request); | ||
13 | + } | ||
14 | +} | ||
15 | +``` | ||
16 | + | ||
17 | +也可以在bootstrap/app.php中使用class_alias将Illuminate\Http\Request定义为Request. | ||
18 | + | ||
19 | +``` | ||
20 | +// in bootstrap/app.php | ||
21 | +class_alias('Illuminate\Http\Request','Request'); | ||
22 | + | ||
23 | +// in controller.php | ||
24 | +use Request; | ||
25 | +public function index(Request $request) {...} | ||
26 | +``` | ||
27 | + | ||
28 | +--- | ||
29 | + | ||
30 | +### 2.Request操作 | ||
31 | + | ||
32 | +>[参考链接](http://laravel-china.org/docs/5.1/requests) | ||
33 | + | ||
34 | ++ 验证 | ||
35 | + | ||
36 | +``` | ||
37 | + $this->validate($request, [ | ||
38 | + 'email' => 'required|email|max:255', | ||
39 | + 'password' => 'required', | ||
40 | + ]); | ||
41 | +``` | ||
42 | + | ||
43 | ++ 获得请求字段 | ||
44 | + | ||
45 | +``` | ||
46 | +- 方式1: | ||
47 | + $order_state = Request::input('order_state'); | ||
48 | + $evaluation_state = Request::input('evaluation_state'); | ||
49 | + $orderId = $request->input('order_id',1); | ||
50 | + | ||
51 | +- 方式2: | ||
52 | + $request->only('email', 'password'); | ||
53 | +``` | ||
54 | + | ||
55 | +--- | ||
56 | + | ||
57 | +### 3.Response操作 | ||
58 | + | ||
59 | +Response默认使用的类为 `Illuminate\Http\Response` | ||
60 | +当然,也可以实现一个自定义的Response,作为ServiceProvider,注册到容器中。 | ||
61 | +具体自定义Response,可以查看Lumen-Api这本书。 | ||
62 | + | ||
63 | +>[Response文档](http://laravel-china.org/docs/5.1/responses) | ||
64 | +>[Response详细API](http://laravel-china.org/api/master/Illuminate/Http/Response.html) | ||
65 | + | ||
66 | + | ||
67 | ++ **基本响应** | ||
68 | + | ||
69 | +``` | ||
70 | +return (new Response($content, $status)) | ||
71 | + ->header('Content-Type', $value); | ||
72 | + | ||
73 | +return response($content, $status) | ||
74 | + ->header('Content-Type', $value); | ||
75 | +``` | ||
76 | + | ||
77 | ++ **标头定义响应** | ||
78 | + | ||
79 | +``` | ||
80 | +return response($content) | ||
81 | + ->header('Content-Type', $type) | ||
82 | + ->header('X-Header-One', 'Header Value') | ||
83 | + ->header('X-Header-Two', 'Header Value'); | ||
84 | +``` | ||
85 | + | ||
86 | ++ **附加Cookies** | ||
87 | + | ||
88 | +``` | ||
89 | +return response($content)->header('Content-Type', $type) | ||
90 | + ->withCookie('name', 'value'); | ||
91 | + | ||
92 | +- Cookie的可定义属性 | ||
93 | +->withCookie($name, $value, $minutes, $path, $domain, $secure, $httpOnly) | ||
94 | +``` | ||
95 | + | ||
96 | ++ **视图响应** | ||
97 | + | ||
98 | +``` | ||
99 | +return response()->view('hello', $data)->header('Content-Type', $type); | ||
100 | +``` | ||
101 | + | ||
102 | + | ||
103 | ++ **JSON响应** | ||
104 | + | ||
105 | +``` | ||
106 | +return response()->json(['name' => 'Abigail', 'state' => 'CA']); | ||
107 | + | ||
108 | +- JSONP 响应 | ||
109 | +return response()->json(['name' => 'Abigail', 'state' => 'CA']) | ||
110 | + ->setCallback($request->input('callback')); | ||
111 | +``` | ||
112 | + | ||
113 | ++ **文件下载** | ||
114 | + | ||
115 | +``` | ||
116 | +return response()->download($pathToFile); | ||
117 | +return response()->download($pathToFile, $name, $headers); | ||
118 | +``` | ||
119 | + | ||
120 | ++ **重定向** | ||
121 | + | ||
122 | +``` | ||
123 | +return redirect('home/dashboard'); | ||
124 | +// 重定向到某个位置 | ||
125 | +return back()->withInput(); | ||
126 | +// 重定向至命名路由 | ||
127 | +return redirect()->route('login'); | ||
128 | +// 重定向至路由,路由带有参数 | ||
129 | +return redirect()->route('profile', [1]); | ||
130 | +return redirect()->route('profile', [$user]); | ||
131 | +// 重定向至控制器行为 | ||
132 | +return redirect()->action('HomeController@index'); | ||
133 | +return redirect()->action('UserController@profile', [1]); | ||
134 | +``` | ||
135 | + | ||
136 | + | ||
137 | +### 4.注册中间件(Middleware) | ||
138 | +中间件的注册,在laravel和Lumen中的方式是不一样的。 | ||
139 | + | ||
140 | ++ 在Laravel中,通过app/Http/Kernal.php进行注册 | ||
141 | + | ||
142 | +``` | ||
143 | +protected $middleware = [ | ||
144 | + 'Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode', | ||
145 | + 'Illuminate\Cookie\Middleware\EncryptCookies', | ||
146 | + 'Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse', | ||
147 | + 'Illuminate\Session\Middleware\StartSession', | ||
148 | + 'Illuminate\View\Middleware\ShareErrorsFromSession', | ||
149 | + 'App\Http\Middleware\VerifyCsrfToken', | ||
150 | + ]; | ||
151 | +protected $routeMiddleware = [ | ||
152 | + 'auth' => 'App\Http\Middleware\Authenticate', | ||
153 | + 'auth.basic' => 'Illuminate\Auth\Middleware\AuthenticateWithBasicAuth', | ||
154 | + 'guest' => 'App\Http\Middleware\RedirectIfAuthenticated', | ||
155 | + ]; | ||
156 | +``` | ||
157 | + | ||
158 | + | ||
159 | ++ 而在Lumen中,则是通过bootstrap/app.php注册 | ||
160 | + | ||
161 | +``` | ||
162 | +$app->middleware([ | ||
163 | + App\Http\Middleware\ExampleMiddleware::class | ||
164 | + ]); | ||
165 | + | ||
166 | + $app->routeMiddleware([ | ||
167 | + 'auth' => App\Http\Middleware\Authenticate::class, | ||
168 | + 'jwt.auth' => Tymon\JWTAuth\Middleware\GetUserFromToken::class, | ||
169 | + 'jwt.refresh' => Tymon\JWTAuth\Middleware\RefreshToken::class, | ||
170 | + ]); | ||
171 | +``` | ||
172 | + | ||
173 | +--- | ||
174 | + | ||
175 | +### 5. 服务提供者和服务容器 | ||
176 | +应用程序通过 bootstrap/app.php 文件中所生成的 Laravel 应用程序实例。 | ||
177 | +通过调用以下代码,创建应用程序Application的实例app,app中创建了服务容器(loadedProviders). | ||
178 | + | ||
179 | +``` | ||
180 | +-- in bootstrap/app.php | ||
181 | +$app = new Laravel\Lumen\Application() | ||
182 | + | ||
183 | +-- in Application.php | ||
184 | +protected $serviceProviders = array(); | ||
185 | +protected $loadedProviders = array(); | ||
186 | +protected $deferredServices = array(); | ||
187 | +... | ||
188 | +$this->registerBaseBindings(); | ||
189 | +$this->registerBaseServiceProviders(); | ||
190 | +$this->registerCoreContainerAliases(); | ||
191 | +... | ||
192 | +``` | ||
193 | + | ||
194 | +### 6.服务的注册(ServiceProvider) | ||
195 | +ServiceProvider的注册,在Laravel和Lumen中情况不一样。 | ||
196 | + | ||
197 | ++ Laravel | ||
198 | + | ||
199 | +> Laravel中的服务提供是,都在config/app.php配置文件的providers数组 | ||
200 | + | ||
201 | +``` | ||
202 | +'providers' => [ | ||
203 | + | ||
204 | + /* | ||
205 | + * Laravel Framework Service Providers... | ||
206 | + */ | ||
207 | + 'Illuminate\Foundation\Providers\ArtisanServiceProvider', | ||
208 | + 'Illuminate\Auth\AuthServiceProvider', | ||
209 | + 'Illuminate\Bus\BusServiceProvider', | ||
210 | + 'Illuminate\Cache\CacheServiceProvider', | ||
211 | + 'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider', | ||
212 | + 'Illuminate\Routing\ControllerServiceProvider', | ||
213 | + 'App\Providers\AppServiceProvider', | ||
214 | + 'App\Providers\BusServiceProvider', | ||
215 | + 'App\Providers\ConfigServiceProvider', | ||
216 | + ... | ||
217 | +]; | ||
218 | +``` | ||
219 | + | ||
220 | ++ Luemn | ||
221 | + | ||
222 | +> Lumen中直接使用register进行注册 | ||
223 | + | ||
224 | +``` | ||
225 | +$app->register(Tymon\JWTAuth\Providers\JWTAuthServiceProvider::class); | ||
226 | +// Dingo API Register | ||
227 | +$app->register(Dingo\Api\Provider\LumenServiceProvider::class); | ||
228 | +// $app->register(App\Providers\AuthServiceProvider::class); | ||
229 | +$app->register(App\Providers\EventServiceProvider::class); | ||
230 | +``` | ||
231 | + | ||
232 | + |
1 | +# Artisan命令行 | ||
2 | + | ||
3 | +## artisan提供的帮助 | ||
4 | +在Laravel&Lumen中,artisan命令行是一个非常重要的工具,平常使用到的有: | ||
5 | + | ||
6 | +**artisan 命令帮助** | ||
7 | +在命令行中,可以通过`php artisan`或者`php artisan list`来查看Artisan命令所支持的命令 | ||
8 | + | ||
9 | +命令前面加上help可以显示帮助界面: | ||
10 | + `php artisan help migrate` | ||
11 | + | ||
12 | +**参考:** | ||
13 | + [artisan命令行](http://laravel-china.org/docs/5.1/artisan) | ||
14 | + | ||
15 | +--- | ||
16 | + | ||
17 | +#### **1. make:migration** | ||
18 | +> 生成数据库迁移命令,命令示例: | ||
19 | + | ||
20 | + `php artisan make:migration create_some_table --table=table_name` | ||
21 | + | ||
22 | + `php artisan make:migration add_column_to_table --table=table_name` | ||
23 | + | ||
24 | + `php artisan make:migration alter_column_to_table --table=table_name` | ||
25 | + | ||
26 | +> 以上命令是让框架在database/migrations目录下生成migration文件。文件格式如下: | ||
27 | + | ||
28 | + `2016_04_21_143315_create_user_login.php` | ||
29 | + | ||
30 | +> 通过编写生成的文件,我们可以控制数据库的结构和数据,相关示例: | ||
31 | + | ||
32 | + | ||
33 | +文件中内容相关示例: | ||
34 | + | ||
35 | +- 创建数据表 | ||
36 | + ``` | ||
37 | + class CreateBrand extends Migration | ||
38 | + { | ||
39 | + public function up() | ||
40 | + { | ||
41 | + Schema::create('brand', function (Blueprint $table) { | ||
42 | + $table->engine = 'InnoDB'; | ||
43 | + $table->increments('brand_id'); | ||
44 | + $table->string('app_id',30)->comment('集团联盟ID'); | ||
45 | + $table->string('brand_name',100)->comment('品牌名称'); | ||
46 | + $table->string('brand_pic',100)->comment('图片'); | ||
47 | + $table->timestamps(); | ||
48 | + }); | ||
49 | + } | ||
50 | + | ||
51 | + public function down() | ||
52 | + { | ||
53 | + Schema::drop('brand'); | ||
54 | + } | ||
55 | + } | ||
56 | + ``` | ||
57 | + | ||
58 | +- 修改数据字段 | ||
59 | + ``` | ||
60 | + class RenameColumnForCart extends Migration | ||
61 | + { | ||
62 | + public function up() | ||
63 | + { | ||
64 | + Schema::table('cart_default', function (Blueprint $table) { | ||
65 | + $table->renameColumn('spd_common_id', 'spd_detail_id'); | ||
66 | + }); | ||
67 | + } | ||
68 | + public function down() | ||
69 | + { | ||
70 | + Schema::table('cart_default', function (Blueprint $table) { | ||
71 | + | ||
72 | + }); | ||
73 | + } | ||
74 | + } | ||
75 | + ``` | ||
76 | + | ||
77 | +- 添加数据字段 | ||
78 | + ``` | ||
79 | + class AddCustomerIdColumnToBuyer extends Migration | ||
80 | + { | ||
81 | + public function up() | ||
82 | + { | ||
83 | + Schema::table('buyer', function (Blueprint $table) { | ||
84 | + $table->string('customer_id')->after('buyer_id')->comment('会员ID,从CRM获得'); | ||
85 | + }); | ||
86 | + } | ||
87 | + | ||
88 | + public function down() | ||
89 | + { | ||
90 | + Schema::table('buyer', function (Blueprint $table) { | ||
91 | + $table->dropColumn('customer_id'); | ||
92 | + }); | ||
93 | + } | ||
94 | + } | ||
95 | + ``` | ||
96 | + | ||
97 | +--- | ||
98 | + | ||
99 | +#### **2.migrate** | ||
100 | + | ||
101 | +> 将make:migration所生成的数据库迁移文件反映到数据库中。 | ||
102 | + | ||
103 | +> 参考:[数据迁移](http://laravel-china.org/docs/5.1/migrations) | ||
104 | + | ||
105 | +>相关命令: | ||
106 | + | ||
107 | +- `php artisan migrate` | ||
108 | + | ||
109 | + >对于这个命令,数据库中都会生成migration数据表,表中的数据行设置了哪些文件已经被迁移了.laravel只会对新的文件执行迁移动作(文件内定义的up函数),表中所记录的文件将不会被执行迁移动作。 | ||
110 | + 当新的文件被执行完成后,这些文件将被记录到migration数据表中。 | ||
111 | + | ||
112 | +- `php artisan migrate:refresh` | ||
113 | + | ||
114 | + > 对于这个命令,将会清除数据表migration数据,回滚所有迁移并重新运行所有迁移。 | ||
115 | + 所谓回滚,就是先执行回滚动作(down()函数定义), 再执行迁移动作(up()函数定义)。 | ||
116 | + | ||
117 | +- `php artisan migrate:rollback` | ||
118 | + | ||
119 | + > 回滚最后一次迁移 | ||
120 | + | ||
121 | +- `php artisan migrate:reset` | ||
122 | + | ||
123 | + > 回滚所有迁移 | ||
124 | + | ||
125 | +- `php artisan migrate:refresh --seed` | ||
126 | + | ||
127 | + > 回滚所有迁移并重新运行迁移,迁移后,执行database/seeds/DatabaSeeder进行数据表的数据填充 | ||
128 | + | ||
129 | +--- | ||
130 | + | ||
131 | +#### **3.db:seed** | ||
132 | + | ||
133 | +> 依照database/seeds/目录下文件内容对数据库执行填充。 | ||
134 | +参考链接: [数据填充](http://laravel-china.org/docs/5.1/seeding) | ||
135 | + | ||
136 | +数据填充Seeder,是使用 seed 类来给数据库填充测试数据。 | ||
137 | +一般在laravel中,填充测试数据有以下几种方式 | ||
138 | + | ||
139 | + **注意** | ||
140 | +在Database/seeds/目录下创建一个数据填充文件后,需要通过以下命令注册到Laravel中,否则这个文件类不会被识别 : | ||
141 | +`composer dump-autoload` | ||
142 | + | ||
143 | +** 数据生成的命令 ** | ||
144 | +运行database/seeds/DatabaseSeeder.php执行数据填充 | ||
145 | + `php artisan db:seed` | ||
146 | +指定database/seeds/目录下的某个类进行填充 | ||
147 | + `php artisan db:seed --clas=SomeSeederClass` | ||
148 | + | ||
149 | + | ||
150 | +- 可以使用数据工厂来生成数据,数据工厂在database/factories目录内定义。 | ||
151 | + | ||
152 | + ``` | ||
153 | + $factory->define(App\Models\AppGroup::class,function($faker){ | ||
154 | + $appId = str_replace('-','',$faker->uuid); | ||
155 | + return [ | ||
156 | + 'group_name'=>$faker->company, | ||
157 | + 'app_secret'=>substr($appId,1,12), | ||
158 | + 'crm_url'=>$faker->url, | ||
159 | + 'group_logo'=>$faker->imageUrl, | ||
160 | + 'group_areaid'=>$faker->numerify("###"), | ||
161 | + 'group_area_info'=>$faker->state.' '.$faker->city.' '.$faker->country, | ||
162 | + 'create_time'=>$faker->unixTime(), | ||
163 | + 'create_person'=>$faker->name, | ||
164 | + 'created_at'=>\Carbon\Carbon::now(), | ||
165 | + 'updated_at'=>\Carbon\Carbon::now() | ||
166 | + ]; | ||
167 | + }); | ||
168 | + // 在Seeder文件中,使用factory()函数调用工厂类创建数据 | ||
169 | + $brands = factory(App\Models\AppGroup::class,12)->make(); | ||
170 | + ``` | ||
171 | + | ||
172 | +- 可以直接在seed文件内SQL生成数据 | ||
173 | + | ||
174 | + ``` | ||
175 | + //直接在seeder中创建数据 | ||
176 | + DB::table('product_class')->truncate(); | ||
177 | + DB::statement('INSERT INTO ev_product_class(gc_id,app_id,gc_name,type_id,gc_parent_id,gc_sort,gc_title, | ||
178 | + gc_keywords,gc_description,gc_image,level_num,create_time,create_person,created_at,updated_at) | ||
179 | + SELECT ecc.gc_id,:app_id,ecc.gc_name,type_id,gc_parent_id,gc_sort,:gc_title, | ||
180 | + gc_keywords,:gc_description,gc_image,level_num,:create_time,create_person,:created_at,:updated_at FROM ev_common_class ecc | ||
181 | + where ecc.industry_id=1', | ||
182 | + [ | ||
183 | + 'app_id'=>$this->app_id_str, | ||
184 | + 'gc_title'=>$this->faker->word, | ||
185 | + 'gc_description'=>$this->faker->sentences(3,10), | ||
186 | + 'create_time'=>Carbon::now()->timestamp, | ||
187 | + 'created_at'=>Carbon::now(), | ||
188 | + 'updated_at'=>Carbon::now() | ||
189 | + ] | ||
190 | + ); | ||
191 | + ``` | ||
192 | + | ||
193 | +- 使用Eloquent模型创建数据 | ||
194 | + ``` | ||
195 | + $OrderCommon = [ | ||
196 | + 'order_id' => $orderModel->order_id, | ||
197 | + 'app_id' => $orderModel->app_id, | ||
198 | + 'order_sn' => $orderModel->order_sn, | ||
199 | + 'shipping_time' => $this->faker->unixTime, | ||
200 | + 'shipping_express_id' => 1, //物流公司id | ||
201 | + 'shipping_code' => '', | ||
202 | + 'evaluation_time' => '', | ||
203 | + 'order_message' => $this->faker->word, | ||
204 | + 'order_pointscount' => 0, | ||
205 | + 'deliver_explain' => '', | ||
206 | + 'seller_daddress_id' => '', | ||
207 | + 'reciver_name' => $buyserAddress->buyer_name, | ||
208 | + 'reciver_info' => $buyserAddress->address, | ||
209 | + 'reciver_province_id' => $buyserAddress->province_id, | ||
210 | + 'reciver_daddress_id' => $buyserAddress->buyer_address_id, | ||
211 | + 'invoice_info' => '', | ||
212 | + 'create_time' => $this->faker->unixTime('now'), | ||
213 | + 'create_person' => $this->faker->name | ||
214 | + ]; | ||
215 | + App\Models\ShopOrderCommon::create($OrderCommon); | ||
216 | + ``` | ||
217 | + | ||
218 | + | ||
219 | +--- | ||
220 | + | ||
221 | +#### **4.tinker** | ||
222 | + | ||
223 | +> 是 laravel提供的命令行工具,可以和项目进行交互。 | ||
224 | +对于Lumen框架来说,默认是不带tinker命令的,需要安装以下库才允许使用: | ||
225 | + `composer require vluzrmos/tinker` | ||
226 | + | ||
227 | +- tinker命令的使用 | ||
228 | + 参考:[tinker使用](http://www.cnblogs.com/ZhangJinglin/p/4383513.html) | ||
229 | + | ||
230 | +- 具体示例 | ||
231 | + | ||
232 | +php artisan tinker | ||
233 | + | ||
234 | +**以下是在tinker中的交互输入** | ||
235 | + | ||
236 | + Psy Shell v0.4.1 (PHP 5.4.16 — cli) by Justin Hileman | ||
237 | + >>> $name = 'zhang jinglin'; | ||
238 | + => "zhang jinglin" | ||
239 | + | ||
240 | + >>> $name | ||
241 | + => "zhang jinglin" | ||
242 | + | ||
243 | + >>> $article = new App\Article; | ||
244 | + => <App\Article #000000005c4b7ee400000000ab91a676> {} | ||
245 | + | ||
246 | + >>> $article->title = 'My First Article'; | ||
247 | + => "My First Article" | ||
248 | + | ||
249 | + >>> $article->published_at = Carbon\Carbon::now(); | ||
250 | + => <Carbon\Carbon #000000005c4b7ee600000000ab91dcb6> { | ||
251 | + date: "2015-03-28 06:37:22", | ||
252 | + timezone_type: 3, | ||
253 | + timezone: "UTC" | ||
254 | + } | ||
255 | + | ||
256 | + >>> $article; | ||
257 | + => <App\Article #000000005c4b7ee400000000ab91a676> { | ||
258 | + title: "My First Article", | ||
259 | + body: "Some content...", | ||
260 | + published_at: <Carbon\Carbon #000000005c4b7ee600000000ab91dcb6> { | ||
261 | + date: "2015-03-28 06:37:22", | ||
262 | + timezone_type: 3, | ||
263 | + timezone: "UTC" | ||
264 | + } | ||
265 | + } | ||
266 | + | ||
267 | + >>> $article->toArray(); | ||
268 | + => [ | ||
269 | + "title" => "My First Article", | ||
270 | + "body" => "Some content...", | ||
271 | + "published_at" => <Carbon\Carbon #000000005c4b7ee600000000ab91dcb6> { | ||
272 | + date: "2015-03-28 06:37:22", | ||
273 | + timezone_type: 3, | ||
274 | + timezone: "UTC" | ||
275 | + } | ||
276 | + ] | ||
277 | + | ||
278 | + >>> $article->save(); | ||
279 | + => true | ||
280 | + | ||
281 | + >>> App\Article::all()->toArray(); | ||
282 | + => [ | ||
283 | + [ | ||
284 | + "id" => "1", | ||
285 | + "title" => "My First Article", | ||
286 | + "body" => "Some content...", | ||
287 | + "published_at" => "2015-03-28 06:37:22", | ||
288 | + "created_at" => "2015-03-28 06:38:53", | ||
289 | + "updated_at" => "2015-03-28 06:38:53" | ||
290 | + ] | ||
291 | + ] | ||
292 | + | ||
293 | + >>> $article = App\Article::find(1); | ||
294 | + => <App\Article #000000005c4b7e1600000000ab91a676> { | ||
295 | + id: "1", | ||
296 | + title: "My First Update Title", | ||
297 | + body: "Some content...", | ||
298 | + published_at: "2015-03-28 06:37:22", | ||
299 | + created_at: "2015-03-28 06:38:53", | ||
300 | + updated_at: "2015-03-28 06:42:03" | ||
301 | + } | ||
302 | + | ||
303 | + >>> $article = App\Article::where('body', 'Some content...')->get(); | ||
304 | + ... | ||
305 | + | ||
306 | + >>> $article = App\Article::where('body', 'Some content...')->first(); | ||
307 | + ... | ||
308 | + | ||
309 | + >>> $article = App\Article::create(['title' => 'New Article', 'body' => 'New body', 'published_at' => Carbon\Carbon::now()]); | ||
310 | + | ||
311 | + >>> $article->update(['body' => 'New Updaet Body']); | ||
312 | + => true | ||
313 | + | ||
314 | + | ||
315 | +--- | ||
316 | + | ||
317 | +**<u>=>以下命令可能就是laravel所独有的</u>** | ||
318 | + | ||
319 | +#### 5.make controller | ||
320 | +通过命令创建Controller类 | ||
321 | + | ||
322 | ++ 默认方式,类中会有一系列方法,包括index,create,store,show...: | ||
323 | + `php artisan make:controller TestController` | ||
324 | ++ 创建没有任何预定义方法的控制器类 | ||
325 | + `php artisan make:controller TestContoller --plain` | ||
326 | + | ||
327 | +--- | ||
328 | + | ||
329 | +#### 6. make其它功能 | ||
330 | + 包括: | ||
331 | + - make:event | ||
332 | + - make:middleware | ||
333 | + - make:model | ||
334 | + - make:provider | ||
335 | + - make:request | ||
336 | + | ||
337 | +--- | ||
338 | + | ||
339 | +#### 7. 查看路由 | ||
340 | +针对当前的路由配置,可以通过以下命令查看: | ||
341 | +`php artisan route:list` | ||
342 | + |
18.9 KB
17.8 KB
Docs/GITBOOK/CodeHelping/README.md
0 → 100644
1 | +# Summary | ||
2 | + | ||
3 | +- [README](.\README.md) | ||
4 | +- Thinkphp | ||
5 | + - Controller | ||
6 | + - [evshop_controller](Thinkphp\Controller\evshop_controller.md) | ||
7 | + - DB | ||
8 | + - [db_sqls](Thinkphp\DB\db_sqls.md) | ||
9 | + - Others | ||
10 | + - [functions](Thinkphp\Others\functions.md) | ||
11 | + - [UsefulCodes](Thinkphp\Others\UsefulCodes.md) | ||
12 | + - Structure | ||
13 | + - [evshop_structure](Thinkphp\Structure\evshop_structure.md) | ||
14 | + - View | ||
15 | + - [evshop_view](Thinkphp\View\evshop_view.md) | ||
16 | + - Javascript | ||
17 | + - [evshop_dialog](Thinkphp\Javascript\evshop_dialog.md) | ||
18 | + - [evshop_js](Thinkphp\Javascript\evshop_js.md) |
Docs/GITBOOK/CodeHelping/SUMMARY.md
0 → 100644
1 | +# Summary | ||
2 | + | ||
3 | +- [简介](.\README.md) | ||
4 | +- Thinkphp | ||
5 | + - Structure | ||
6 | + - [EVShop框架结构图](Thinkphp\Structure\evshop_structure.md) | ||
7 | + - Controller | ||
8 | + - [EVShop之Controller篇](Thinkphp\Controller\evshop_controller.md) | ||
9 | + - View | ||
10 | + - [EVShop之View篇](Thinkphp\View\evshop_view.md) | ||
11 | + - Javascript | ||
12 | + - [EVShop之Dialog篇](Thinkphp\Javascript\evshop_dialog.md) | ||
13 | + - [EVShop之Javascript篇](Thinkphp\Javascript\evshop_js.md) | ||
14 | + - DB | ||
15 | + - [Thinkphp中SQL的写法](Thinkphp\DB\db_sqls.md) | ||
16 | + - Others | ||
17 | + - [Thinkphp中常用功能](Thinkphp\Others\functions.md) | ||
18 | + - [EVShop中备用代码片段](Thinkphp\Others\UsefulCodes.md) | ||
19 | +- Laravel | ||
20 | + - 其它 | ||
21 | + - [artisan命令行](Laravel\Others\artisan.md) | ||
22 | + - [laraval学习站点](Laravel\Others\laravel_sites.md) | ||
23 | + - 配置 | ||
24 | + - [整体配置说明](Laravel\Configs\configs.md) | ||
25 | +- Javascript | ||
26 | + - 学习 | ||
27 | + - [前端各工具集学习链接](Javascript\Learn\webfront.md) | ||
28 | + - [NPM使用](Javascript\Learn\npm_cmd.md) | ||
29 | + - [ES6学习](Javascript\Learn\ES6.md) | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +# EVShop编程规则之Controller篇 | ||
2 | + | ||
3 | +### 1. Controller中成功和错误的处理 | ||
4 | +不涉及对话框处理,只在Controller页面跳转的情况下,针对错误处理和成功处理规则如下: | ||
5 | + | ||
6 | +1. 错误和异常情况下,使用 `$this->error(message);` | ||
7 | +2. 成功的情况下,使用 `$this->success(message);` | ||
8 | + | ||
9 | +而具体error,success函数调用后所显示的画面的样式,可以在conf/config.php中进行定义 | ||
10 | +``` | ||
11 | +//默认错误跳转对应的模板文件(View/Public/error.html) | ||
12 | +'TMPL_ACTION_ERROR' => 'Public:error', | ||
13 | +//默认成功跳转对应的模板文件' (View/Public/success.html) | ||
14 | +'TMPL_ACTION_SUCCESS' => 'Public:success', | ||
15 | +``` | ||
16 | + | ||
17 | + | ||
18 | +--- | ||
19 | + | ||
20 | + | ||
21 | +### 2. Controller中成功或者失败返回JSON数据格式 | ||
22 | +Controller返回JSON数据,一般用于前端JS异步调用Controller方法的场合。 | ||
23 | +返回JSON,为了后期扩展,统一使用以下函数生成json返回 | ||
24 | + | ||
25 | +1. 成功的场合: | ||
26 | + | ||
27 | + json_return_success('successMessage'); | ||
28 | + // will return { 'errCode':0, 'info':'successMessage'} | ||
29 | + | ||
30 | +2. 失败的场合: | ||
31 | + | ||
32 | + json_return_error('errorMessage'); | ||
33 | + // will return {'errCode':1, 'info':'errorMessage'} | ||
34 | + | ||
35 | +3. 需要自定义errorCode的场合: | ||
36 | + | ||
37 | + json_return_err_code(4001,'errorMessage'); | ||
38 | + // will return {'errCode':4001, 'info':'errorMessage'} | ||
39 | + | ||
40 | +4. 需要自定义多个数据字段的场合: | ||
41 | + | ||
42 | + json_return_customer([ | ||
43 | + 'errCode'=>4002, | ||
44 | + 'Message'=>'Customer Message', | ||
45 | + 'OtherInfo'=>'Other Infomation' | ||
46 | + ]); | ||
47 | + | ||
48 | +5. 对于微页面(weipage),有其自定义的JSON定义,在微页面编辑中,涉及到的JSON返回一般使用: | ||
49 | + | ||
50 | + json_return_for_weipage($err_code,$err_msg='',$err_dom=''); | ||
51 | + | ||
52 | + | ||
53 | +--- | ||
54 | + | ||
55 | +### 3. 页面中分页显示的设置 | ||
56 | +设置数据的分页需要以下步骤: | ||
57 | + | ||
58 | ++ 在Controller中导入以下命名空间 | ||
59 | +`use Library\MyPage;` | ||
60 | ++ 在对应的Controller方法中,调用MyPage类 | ||
61 | +```php | ||
62 | +public function album_pic_list() { | ||
63 | + $where_condition = Array('aclass_id'=>$_GET['id'],'app_id'=>$this->app_id); // 查询条件 | ||
64 | + $pic_count = M('album_pic')->where($where_condition)->count(); // 获得显示的总数目 | ||
65 | + $pic_page = new MyPage($pic_count,6); // 创建MyPage类,参数1表示显示的总数,参数2表示一页中显示的数目 | ||
66 | + $pic_list = M('album_pic')->where($where_condition) | ||
67 | + ->order('create_timedesc') | ||
68 | + ->limit($pic_page->firstRow.','.$pic_page->listRows) | ||
69 | + ->select(); // 查询时注意加入limit进行限定 | ||
70 | + $this->assign('pic_list',$pic_list);// 向页面赋值列表 | ||
71 | + $pagebar = $pic_page->show(); | ||
72 | + $this->assign('show_page',$pagebar); // 向页面赋值pagebar元素 | ||
73 | + $this->display('gp02_goods_album_pic_list'); // 视图显示 | ||
74 | +} | ||
75 | +``` | ||
76 | ++ 在视图中,通过以下代码显示Pager导航 | ||
77 | +`<div class="pagination"><?php echo $show_page; ?></div>` | ||
78 | + | ||
79 | +--- | ||
80 | + |
1 | +# Thinkphp中复杂SQL的写法 | ||
2 | + | ||
3 | +### 1. SQL 多表联接的写法: | ||
4 | +``` | ||
5 | +$spc_common_default = D("spc_common_default"); | ||
6 | +$filter['S.spc_common_id'] = array('eq',71); | ||
7 | +$model_list = $spc_common_default->table('__SPC_COMMON_DEFAULT__ S') | ||
8 | + ->join('LEFT JOIN __SPC_PGROUP_DEFAULT__ U ON S.spc_common_id = U.spc_common_id') | ||
9 | + ->field('S.*') | ||
10 | + ->where($map) | ||
11 | + ->select(); | ||
12 | +``` | ||
13 | +以上代码相当于以下SQL语句: | ||
14 | +``` | ||
15 | +SELECT S.* FROM ev_spc_common_default as S | ||
16 | +LEFT JOIN ev_spc_group_default as U | ||
17 | +ON S.spc_common_id=U.spc_common_id | ||
18 | +WHERE s.spc_common_id=71 | ||
19 | +``` | ||
20 | + | ||
21 | +### 2. SQL Group 写法: | ||
22 | +``` | ||
23 | +$model_list = $this->table('__ALBUM_CLASS__ A')->join('LEFT JOIN __ALBUM_PIC__ B ON A.aclass_id=B.aclass_id') | ||
24 | + ->field('A.aclass_id,A.app_id,A.aclass_name,A.aclass_des,A.aclass_conver,A.aclass_dic,A.is_default,A.create_time,count(B.aclass_id) as ClassCount') | ||
25 | + ->where($condition) | ||
26 | + ->group('A.aclass_id') | ||
27 | + ->order('A.create_time') | ||
28 | + ->select(); | ||
29 | +``` | ||
30 | + | ||
31 | + | ||
32 | +### 3. 统计查询(count,sum...) | ||
33 | +``` | ||
34 | +$model->table('__ALBUM_CLASS__')->where($condition)->count(); | ||
35 | +$model->table('__ALBUM_CLASS__')->count('columnName'); | ||
36 | +$sumScore = $User->sum('score'); | ||
37 | +``` | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +# EVShop编程规则之Dialog篇 | ||
2 | + | ||
3 | +> 在Evshop中,对话框是使用artDialog控件,关于artDialog的使用方式,可以参考: | ||
4 | +> [artDialog文档](http://aui.github.io/artDialog/doc/index.html) | ||
5 | +> 我们在artDialog基础上,做了一些基础的封装,封装参考代码: | ||
6 | +> `/data/application/common/myDialog.js` | ||
7 | +> 对话框的基本使用示例,参考: | ||
8 | +> `/data/application/shop/sample_list.js` | ||
9 | + | ||
10 | +### 对话框(myDialog)的使用 | ||
11 | + | ||
12 | ++ 要使用对话框,需要在前端js中引入: | ||
13 | +`var myDialog = require("myDialog");` | ||
14 | + | ||
15 | ++ 使用基本的 **Success/Error/Info** 对话框: | ||
16 | +``` | ||
17 | +myDialog.showSucc("Success"); | ||
18 | +myDialog.showError("Failed"); | ||
19 | +myDialog.showInfo("title","你好啊"); | ||
20 | +``` | ||
21 | + | ||
22 | ++ 对话框中显示本页面中元素内的内容: | ||
23 | +``` | ||
24 | +$("#opelem").bind("click",function(){ | ||
25 | + var dialog= myDialog.showMoreDialog(this,{ | ||
26 | + width:400, | ||
27 | + height:$("#dlg_element").height+200, | ||
28 | + title:$(this).attr("dialog_title"), | ||
29 | + content:$("#dlg_element").html(), | ||
30 | + },true); | ||
31 | +}); | ||
32 | +``` | ||
33 | + | ||
34 | ++ 显示自定义confirm对话框 | ||
35 | +``` | ||
36 | +myDialog.showConfirm("提示信息","删除相册?注意:相册内的图片将转移到默认相册",function(){ | ||
37 | + $(this).ajaxSubmit({ | ||
38 | + data: {"id":album_id}, | ||
39 | + dataType:'json', | ||
40 | + type:'get', | ||
41 | + url:process_uri, | ||
42 | + success:function(responseText,stsText,xhr){ | ||
43 | + commonFunc.showAjaxProcessInfo(responseText); | ||
44 | + }, | ||
45 | + error:function(error) { | ||
46 | + myDialog.showError(error); | ||
47 | + } | ||
48 | + }); | ||
49 | + //alert('xxx'); | ||
50 | +}); | ||
51 | +``` | ||
52 | + | ||
53 | + | ||
54 | ++ 对话框中显示指定URL的内容 | ||
55 | +``` | ||
56 | + $("#opelurl2").bind('click',function(){ | ||
57 | + // support param: width, | ||
58 | + var dialog = myDialog.showFormDialog(this,{ | ||
59 | + width:500, | ||
60 | + title:"Open Dialog", | ||
61 | + url:$(this).attr("dialog_url"), | ||
62 | + okValue : "确定", // 确定按钮文件,如果不设定,则默认为"确定" | ||
63 | + extraSubmitData : {"param1":"1","param2":"2"}, | ||
64 | + success: function(dialogObj,responseText) { | ||
65 | + console.log(responseText); // responsetext后端返回的JSON对象 | ||
66 | + myDialog.showSucc("Success"); | ||
67 | + //dialogObj.close().remove(); | ||
68 | + }, | ||
69 | + error: function(dialogObj,errorText) { | ||
70 | + console.log(errorText); | ||
71 | + myDialog.showError(errorText); | ||
72 | + //dialogObj.close().remove(); | ||
73 | + } | ||
74 | + }); | ||
75 | + }); | ||
76 | +``` | ||
77 | + | ||
78 | + > 注:一般来说,指定URL内容包含的是FORM表单,表单提交的Button不需要在页面中定义, | ||
79 | + > 而是使用对话框提供的OK/Cancel按钮 | ||
80 | + | ||
81 | + | ||
82 | ++ 对话框URL方式打开后,支持对话框内元素事件的监听 | ||
83 | +在myDialog.showFormDialog函数内, | ||
84 | +可以使用eventListeners来监听对话框内元素的事件监听。方式如下: | ||
85 | +``` | ||
86 | +$("#opelurl2").bind('click',function(){ | ||
87 | + // support param: width, | ||
88 | + var dialog = myDialog.showFormDialog(this,{ | ||
89 | + width:500, | ||
90 | + title:"Open Dialog", | ||
91 | + url:$(this).attr("dialog_url"), | ||
92 | + eventListeners : [{ | ||
93 | + selector:'input[type="text"]', // Dialog中事件绑定的选择器 | ||
94 | + eventName:'change', // Dialog中需要监测的事件 | ||
95 | + eventFunction : function($sender,$dlgDocument) { // 事件产生后所回调的函数 | ||
96 | + // $sender是触发此事件的jquery对象,$document是页面中document的jquery对象 | ||
97 | + console.log($sender.attr("name")); | ||
98 | + //console.log($dlgDocument); | ||
99 | + } | ||
100 | + }], | ||
101 | + okValue : "确定", // 确定按钮文件,如果不设定,则默认为"确定" | ||
102 | + ... | ||
103 | +} | ||
104 | +``` |
1 | +# EVShop编程规则之Javascript篇 | ||
2 | + | ||
3 | +### 1. HTML中添加sevent/saction/sparams 对元素进行事件的绑定 | ||
4 | + | ||
5 | + > 事件绑定是通过jquery的on方法,绑定在document元素上,基于事件的冒泡实现的。 | ||
6 | + | ||
7 | ++ 在视图html中,可以通过以下方式进行事件的绑定动作: | ||
8 | + | ||
9 | +``` | ||
10 | +<a href="JavaScript:void(0);" class="ncsc-btn-mini" sevent="click" saction="picAction" stype="multiDel" sparams="1,2" ></a> | ||
11 | +<a href="JavaScript:void(1);" class="ncsc-btn-mini" id="img_move" sevent="click" saction="picAction" stype="multiMov" sparms="3,4"></a> | ||
12 | +``` | ||
13 | + | ||
14 | ++ 在此视图对应的js文件中,只需要定义以下事件: | ||
15 | +``` | ||
16 | +PageModel.prototype.picAction = function(sender,param1,param2) { | ||
17 | + if($(sender).attr("stype")==="multiDel") { | ||
18 | + //具体事件的动作 | ||
19 | + } | ||
20 | +} | ||
21 | +``` | ||
22 | + | ||
23 | +在绑定的过程中,支持的事件行为(sevent)有: | ||
24 | + | ||
25 | + "click", "change", "blur", "dbclick", "focus", "hover", "resize" | ||
26 | + | ||
27 | +--- | ||
28 | + | ||
29 | +### 2. JSON.Parse函数的参数存在特殊字符的处理 | ||
30 | + | ||
31 | +> JSON.Parse()函数,使用的参数是一个字符串, | ||
32 | +> 该字符串中存在"\"时,函数转换就会出错,出错提示为: | ||
33 | +> `JSON.parse: expected ',' or '}' after property value in object` | ||
34 | +> 所以,需要将字符串进行转换,为"\"符号进行转义 | ||
35 | + | ||
36 | +__具体实现__: | ||
37 | + | ||
38 | +1. 在PHP中,针对字符串,使用addslashes函数: | ||
39 | + `$this->assign('customField', addslashes(json_encode($customField)));` | ||
40 | +2. 在JS中,使用replace将"\"转换成"\\"格式 | ||
41 | + | ||
42 | +--- | ||
43 | + | ||
44 | +### 3. 使用jquery-form 进行异步提交 | ||
45 | + | ||
46 | +> jquery-form是一种js的异步提交,提交时,除了把指定的form数据进行提交, | ||
47 | +> 还支持额外自定义数据的提交 | ||
48 | + | ||
49 | +实现方式: | ||
50 | +``` | ||
51 | +var jquery_form = require("jquery-form"); | ||
52 | +$(selector).ajaxSubmit({ | ||
53 | + data:[extraSubmitdata] | ||
54 | + dataType:'json', | ||
55 | + type:'post', | ||
56 | + timeout:5000, | ||
57 | + success:function(responseText,stsText,xhr,element) { | ||
58 | + | ||
59 | + }, | ||
60 | + error:function(error) { | ||
61 | + | ||
62 | + } | ||
63 | +}); | ||
64 | +``` | ||
65 | + |
1 | +# Thinkphp中一些常用功能 | ||
2 | + | ||
3 | +### 1. 加入验证码功能 | ||
4 | +Think\Verify类可以支持验证码的生成和验证功能。 | ||
5 | + | ||
6 | +> 参考:[Thinkphp验证码](http://document.thinkphp.cn/manual_3_2.html#verify) | ||
7 | + | ||
8 | +下面是最简单的方式生成验证码: | ||
9 | +``` | ||
10 | +$Verify = new \Think\Verify(); | ||
11 | +$Verify->entry(); | ||
12 | +``` | ||
13 | + | ||
14 | +--- | ||
15 | + | ||
16 | +### 2. 文件上传(后台) | ||
17 | +``` | ||
18 | +use Library\UploadFile; | ||
19 | +if (!empty($_FILES['group_logo']['name'])){ | ||
20 | + $upload = new UploadFile(); | ||
21 | + $upload->set('default_dir',ATTACH_COMMON); | ||
22 | + $upload->set('file_name','category-pic-'.$newClassId.'.jpg'); | ||
23 | + $upload->set('ifremove',false); | ||
24 | + $upload->set('fprefix','fprefix'); | ||
25 | + $upload->set('ext','ext'); | ||
26 | + if ($result){ | ||
27 | + $this->success("上传图片成功"); | ||
28 | + }else { | ||
29 | + $this->error("上传图片失败"); | ||
30 | + } | ||
31 | +} | ||
32 | +``` | ||
33 | + | ||
34 | +--- | ||
35 | + | ||
36 | +### 3. 图像处理 | ||
37 | +Todo : write here | ||
38 | + | ||
39 | +--- | ||
40 | + | ||
41 | +### 4. IP获取 | ||
42 | +内置了get_client_ip方法用于获取客户端的IP地址 | ||
43 | + | ||
44 | ++ 获取IP示例: | ||
45 | +`$ip = get_client_ip();` | ||
46 | ++ IP定位示例: | ||
47 | +``` | ||
48 | +$Ip = new \Org\Net\IpLocation('UTFWry.dat'); // 实例化类 参数表示IP地址库文件 | ||
49 | +$area = $Ip->getlocation('203.34.5.66'); // 获取某个IP地址所在的位置 | ||
50 | +``` | ||
51 | + | ||
52 | +--- | ||
53 | + | ||
54 | +### 5. 字符转换成二维码 | ||
55 | + | ||
56 | +生成带有LOGO的二维码,可以参考: | ||
57 | + | ||
58 | +> 参考: [带有LOGO二维码]( http://www.cnblogs.com/txw1958/p/phpqrcode.html) | ||
59 | + | ||
60 | +二维码转换实现: | ||
61 | +``` | ||
62 | +use Library\QRcode; | ||
63 | +include_once '/app/Library/phpqrcode.php'; | ||
64 | + | ||
65 | +$test="http://www.evate-soft.com/"; | ||
66 | +$filename = "baidu.png"; | ||
67 | +$level='L'; | ||
68 | +$size = '6'; | ||
69 | +$margin=4; | ||
70 | +QRcode::png($test, false, $level, $size, $margin); | ||
71 | +``` | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +# EVShop编程规则之View篇 | ||
2 | + | ||
3 | +### 1. 系统变量和配置变量 | ||
4 | +系统变量的输出通常以$Think 打头,比如: | ||
5 | +``` | ||
6 | +1. {$Think.server.script_name} // 输出$_SERVER['SCRIPT_NAME']变量 | ||
7 | +2. {$Think.session.user_id} // 输出$_SESSION['user_id']变量 | ||
8 | +3. {$Think.get.pageNumber} // 输出$_GET['pageNumber']变量 | ||
9 | +4. {$Think.cookie.name} // 输出$_COOKIE['name']变量 | ||
10 | +5. {$Think.const.MODULE_NAME} 输出常量 | ||
11 | +6. {$Think.config.url_model} // 配置参数(在config.php)中设定 | ||
12 | +7. {$Think.MODULE_NAME} // 模块名称 | ||
13 | +``` | ||
14 | + | ||
15 | +--- | ||
16 | + | ||
17 | + | ||
18 | +### 2. View中将php变量值传递到前端JS文件 | ||
19 | +需要两个步骤: | ||
20 | + | ||
21 | +1. View中定义pageParam字面量对象 | ||
22 | +``` | ||
23 | +<script> | ||
24 | + var pageParam = { | ||
25 | + s:"page1", | ||
26 | + }; | ||
27 | +</script> | ||
28 | +``` | ||
29 | +2. 在js的initialize()函数中直接使用options.pageParam属性 | ||
30 | +``` | ||
31 | +var PageModel = function (options) { | ||
32 | + this.pageName = options.page; | ||
33 | + this.module = options.module; | ||
34 | + this.pageParam = options.pageParam; | ||
35 | + this.languageData = new LanguageData("member_group_index"); | ||
36 | +} | ||
37 | +``` | ||
38 | + | ||
39 | +如果需要将变量转换成JSON传递到前端js中: | ||
40 | +``` | ||
41 | +<script> | ||
42 | + var pageParam = { | ||
43 | + language: <?php echo json_encode($lang) ?>, | ||
44 | + }; | ||
45 | +</script> | ||
46 | +``` | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +# Summary | ||
2 | + | ||
3 | +- [README](.\README.md) | ||
4 | +- Thinkphp | ||
5 | + - Controller | ||
6 | + - [evshop_controller](Thinkphp\Controller\evshop_controller.md) | ||
7 | + - DB | ||
8 | + - [db_sqls](Thinkphp\DB\db_sqls.md) | ||
9 | + - Others | ||
10 | + - [functions](Thinkphp\Others\functions.md) | ||
11 | + - [UsefulCodes](Thinkphp\Others\UsefulCodes.md) | ||
12 | + - Structure | ||
13 | + - [evshop_structure](Thinkphp\Structure\evshop_structure.md) | ||
14 | + - View | ||
15 | + - [evshop_view](Thinkphp\View\evshop_view.md) | ||
16 | + - Javascript | ||
17 | + - [evshop_dialog](Thinkphp\Javascript\evshop_dialog.md) | ||
18 | + - [evshop_js](Thinkphp\Javascript\evshop_js.md) |
1 | +<!DOCTYPE HTML> | ||
2 | +<html lang="en" > | ||
3 | + | ||
4 | + <head> | ||
5 | + | ||
6 | + <meta charset="UTF-8"> | ||
7 | + <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
8 | + <title>EVShop之Controller篇 | Introduction</title> | ||
9 | + <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> | ||
10 | + <meta name="description" content=""> | ||
11 | + <meta name="generator" content="GitBook 2.6.7"> | ||
12 | + | ||
13 | + | ||
14 | + <meta name="HandheldFriendly" content="true"/> | ||
15 | + <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> | ||
16 | + <meta name="apple-mobile-web-app-capable" content="yes"> | ||
17 | + <meta name="apple-mobile-web-app-status-bar-style" content="black"> | ||
18 | + <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png"> | ||
19 | + <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon"> | ||
20 | + | ||
21 | + <link rel="stylesheet" href="../../gitbook/style.css"> | ||
22 | + | ||
23 | + | ||
24 | + <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-highlight/website.css"> | ||
25 | + | ||
26 | + | ||
27 | + | ||
28 | + <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-search/search.css"> | ||
29 | + | ||
30 | + | ||
31 | + | ||
32 | + <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-fontsettings/website.css"> | ||
33 | + | ||
34 | + | ||
35 | + | ||
36 | + | ||
37 | + | ||
38 | + | ||
39 | + | ||
40 | + <link rel="next" href="../../Thinkphp/View/evshop_view.html" /> | ||
41 | + | ||
42 | + | ||
43 | + <link rel="prev" href="../../Thinkphp/Structure/evshop_structure.html" /> | ||
44 | + | ||
45 | + | ||
46 | + | ||
47 | + </head> | ||
48 | + <body> | ||
49 | + | ||
50 | + | ||
51 | + <div class="book" | ||
52 | + data-level="1.2.1" | ||
53 | + data-chapter-title="EVShop之Controller篇" | ||
54 | + data-filepath="Thinkphp/Controller/evshop_controller.md" | ||
55 | + data-basepath="../.." | ||
56 | + data-revision="Wed May 11 2016 00:54:11 GMT+0800 (中国标准时间)" | ||
57 | + data-innerlanguage=""> | ||
58 | + | ||
59 | + | ||
60 | +<div class="book-summary"> | ||
61 | + <nav role="navigation"> | ||
62 | + <ul class="summary"> | ||
63 | + | ||
64 | + | ||
65 | + | ||
66 | + | ||
67 | + | ||
68 | + | ||
69 | + | ||
70 | + | ||
71 | + | ||
72 | + <li class="chapter " data-level="0" data-path="index.html"> | ||
73 | + | ||
74 | + | ||
75 | + <a href="../../index.html"> | ||
76 | + | ||
77 | + <i class="fa fa-check"></i> | ||
78 | + | ||
79 | + 简介 | ||
80 | + </a> | ||
81 | + | ||
82 | + | ||
83 | + </li> | ||
84 | + | ||
85 | + <li class="chapter " data-level="1" > | ||
86 | + | ||
87 | + <span><b>1.</b> Thinkphp</span> | ||
88 | + | ||
89 | + | ||
90 | + <ul class="articles"> | ||
91 | + | ||
92 | + | ||
93 | + <li class="chapter " data-level="1.1" > | ||
94 | + | ||
95 | + <span><b>1.1.</b> Structure</span> | ||
96 | + | ||
97 | + | ||
98 | + <ul class="articles"> | ||
99 | + | ||
100 | + | ||
101 | + <li class="chapter " data-level="1.1.1" data-path="Thinkphp/Structure/evshop_structure.html"> | ||
102 | + | ||
103 | + | ||
104 | + <a href="../../Thinkphp/Structure/evshop_structure.html"> | ||
105 | + | ||
106 | + <i class="fa fa-check"></i> | ||
107 | + | ||
108 | + <b>1.1.1.</b> | ||
109 | + | ||
110 | + EVShop框架结构图 | ||
111 | + </a> | ||
112 | + | ||
113 | + | ||
114 | + </li> | ||
115 | + | ||
116 | + | ||
117 | + </ul> | ||
118 | + | ||
119 | + </li> | ||
120 | + | ||
121 | + <li class="chapter " data-level="1.2" > | ||
122 | + | ||
123 | + <span><b>1.2.</b> Controller</span> | ||
124 | + | ||
125 | + | ||
126 | + <ul class="articles"> | ||
127 | + | ||
128 | + | ||
129 | + <li class="chapter active" data-level="1.2.1" data-path="Thinkphp/Controller/evshop_controller.html"> | ||
130 | + | ||
131 | + | ||
132 | + <a href="../../Thinkphp/Controller/evshop_controller.html"> | ||
133 | + | ||
134 | + <i class="fa fa-check"></i> | ||
135 | + | ||
136 | + <b>1.2.1.</b> | ||
137 | + | ||
138 | + EVShop之Controller篇 | ||
139 | + </a> | ||
140 | + | ||
141 | + | ||
142 | + </li> | ||
143 | + | ||
144 | + | ||
145 | + </ul> | ||
146 | + | ||
147 | + </li> | ||
148 | + | ||
149 | + <li class="chapter " data-level="1.3" > | ||
150 | + | ||
151 | + <span><b>1.3.</b> View</span> | ||
152 | + | ||
153 | + | ||
154 | + <ul class="articles"> | ||
155 | + | ||
156 | + | ||
157 | + <li class="chapter " data-level="1.3.1" data-path="Thinkphp/View/evshop_view.html"> | ||
158 | + | ||
159 | + | ||
160 | + <a href="../../Thinkphp/View/evshop_view.html"> | ||
161 | + | ||
162 | + <i class="fa fa-check"></i> | ||
163 | + | ||
164 | + <b>1.3.1.</b> | ||
165 | + | ||
166 | + EVShop之View篇 | ||
167 | + </a> | ||
168 | + | ||
169 | + | ||
170 | + </li> | ||
171 | + | ||
172 | + | ||
173 | + </ul> | ||
174 | + | ||
175 | + </li> | ||
176 | + | ||
177 | + <li class="chapter " data-level="1.4" > | ||
178 | + | ||
179 | + <span><b>1.4.</b> Javascript</span> | ||
180 | + | ||
181 | + | ||
182 | + <ul class="articles"> | ||
183 | + | ||
184 | + | ||
185 | + <li class="chapter " data-level="1.4.1" data-path="Thinkphp/Javascript/evshop_dialog.html"> | ||
186 | + | ||
187 | + | ||
188 | + <a href="../../Thinkphp/Javascript/evshop_dialog.html"> | ||
189 | + | ||
190 | + <i class="fa fa-check"></i> | ||
191 | + | ||
192 | + <b>1.4.1.</b> | ||
193 | + | ||
194 | + EVShop之Dialog篇 | ||
195 | + </a> | ||
196 | + | ||
197 | + | ||
198 | + </li> | ||
199 | + | ||
200 | + <li class="chapter " data-level="1.4.2" data-path="Thinkphp/Javascript/evshop_js.html"> | ||
201 | + | ||
202 | + | ||
203 | + <a href="../../Thinkphp/Javascript/evshop_js.html"> | ||
204 | + | ||
205 | + <i class="fa fa-check"></i> | ||
206 | + | ||
207 | + <b>1.4.2.</b> | ||
208 | + | ||
209 | + EVShop之Javascript篇 | ||
210 | + </a> | ||
211 | + | ||
212 | + | ||
213 | + </li> | ||
214 | + | ||
215 | + | ||
216 | + </ul> | ||
217 | + | ||
218 | + </li> | ||
219 | + | ||
220 | + <li class="chapter " data-level="1.5" > | ||
221 | + | ||
222 | + <span><b>1.5.</b> DB</span> | ||
223 | + | ||
224 | + | ||
225 | + <ul class="articles"> | ||
226 | + | ||
227 | + | ||
228 | + <li class="chapter " data-level="1.5.1" data-path="Thinkphp/DB/db_sqls.html"> | ||
229 | + | ||
230 | + | ||
231 | + <a href="../../Thinkphp/DB/db_sqls.html"> | ||
232 | + | ||
233 | + <i class="fa fa-check"></i> | ||
234 | + | ||
235 | + <b>1.5.1.</b> | ||
236 | + | ||
237 | + Thinkphp中SQL的写法 | ||
238 | + </a> | ||
239 | + | ||
240 | + | ||
241 | + </li> | ||
242 | + | ||
243 | + | ||
244 | + </ul> | ||
245 | + | ||
246 | + </li> | ||
247 | + | ||
248 | + <li class="chapter " data-level="1.6" > | ||
249 | + | ||
250 | + <span><b>1.6.</b> Others</span> | ||
251 | + | ||
252 | + | ||
253 | + <ul class="articles"> | ||
254 | + | ||
255 | + | ||
256 | + <li class="chapter " data-level="1.6.1" data-path="Thinkphp/Others/functions.html"> | ||
257 | + | ||
258 | + | ||
259 | + <a href="../../Thinkphp/Others/functions.html"> | ||
260 | + | ||
261 | + <i class="fa fa-check"></i> | ||
262 | + | ||
263 | + <b>1.6.1.</b> | ||
264 | + | ||
265 | + Thinkphp中常用功能 | ||
266 | + </a> | ||
267 | + | ||
268 | + | ||
269 | + </li> | ||
270 | + | ||
271 | + <li class="chapter " data-level="1.6.2" data-path="Thinkphp/Others/UsefulCodes.html"> | ||
272 | + | ||
273 | + | ||
274 | + <a href="../../Thinkphp/Others/UsefulCodes.html"> | ||
275 | + | ||
276 | + <i class="fa fa-check"></i> | ||
277 | + | ||
278 | + <b>1.6.2.</b> | ||
279 | + | ||
280 | + EVShop中备用代码片段 | ||
281 | + </a> | ||
282 | + | ||
283 | + | ||
284 | + </li> | ||
285 | + | ||
286 | + | ||
287 | + </ul> | ||
288 | + | ||
289 | + </li> | ||
290 | + | ||
291 | + | ||
292 | + </ul> | ||
293 | + | ||
294 | + </li> | ||
295 | + | ||
296 | + | ||
297 | + | ||
298 | + | ||
299 | + <li class="divider"></li> | ||
300 | + <li> | ||
301 | + <a href="https://www.gitbook.com" target="blank" class="gitbook-link"> | ||
302 | + Published with GitBook | ||
303 | + </a> | ||
304 | + </li> | ||
305 | + | ||
306 | + </ul> | ||
307 | + </nav> | ||
308 | +</div> | ||
309 | + | ||
310 | + <div class="book-body"> | ||
311 | + <div class="body-inner"> | ||
312 | + <div class="book-header" role="navigation"> | ||
313 | + <!-- Actions Left --> | ||
314 | + | ||
315 | + | ||
316 | + <!-- Title --> | ||
317 | + <h1> | ||
318 | + <i class="fa fa-circle-o-notch fa-spin"></i> | ||
319 | + <a href="../../" >Introduction</a> | ||
320 | + </h1> | ||
321 | +</div> | ||
322 | + | ||
323 | + <div class="page-wrapper" tabindex="-1" role="main"> | ||
324 | + <div class="page-inner"> | ||
325 | + | ||
326 | + | ||
327 | + <section class="normal" id="section-"> | ||
328 | + | ||
329 | + <h1 id="evshop编程规则之controller篇">EVShop编程规则之Controller篇</h1> | ||
330 | +<h3 id="1-controller中成功和错误的处理">1. Controller中成功和错误的处理</h3> | ||
331 | +<p>不涉及对话框处理,只在Controller页面跳转的情况下,针对错误处理和成功处理规则如下:</p> | ||
332 | +<ol> | ||
333 | +<li>错误和异常情况下,使用 <code>$this->error(message);</code> </li> | ||
334 | +<li>成功的情况下,使用 <code>$this->success(message);</code></li> | ||
335 | +</ol> | ||
336 | +<p>而具体error,success函数调用后所显示的画面的样式,可以在conf/config.php中进行定义</p> | ||
337 | +<pre><code>//默认错误跳转对应的模板文件(View/Public/error.html) | ||
338 | +'TMPL_ACTION_ERROR' => 'Public:error', | ||
339 | +//默认成功跳转对应的模板文件' (View/Public/success.html) | ||
340 | +'TMPL_ACTION_SUCCESS' => 'Public:success', | ||
341 | +</code></pre><hr> | ||
342 | +<h3 id="2-controller中成功或者失败返回json数据格式">2. Controller中成功或者失败返回JSON数据格式</h3> | ||
343 | +<p>Controller返回JSON数据,一般用于前端JS异步调用Controller方法的场合。 | ||
344 | +返回JSON,为了后期扩展,统一使用以下函数生成json返回</p> | ||
345 | +<ol> | ||
346 | +<li><p>成功的场合:</p> | ||
347 | +<pre><code> json_return_success('successMessage'); | ||
348 | + // will return { 'errCode':0, 'info':'successMessage'} | ||
349 | +</code></pre></li> | ||
350 | +<li><p>失败的场合:</p> | ||
351 | +<pre><code> json_return_error('errorMessage'); | ||
352 | + // will return {'errCode':1, 'info':'errorMessage'} | ||
353 | +</code></pre></li> | ||
354 | +<li><p>需要自定义errorCode的场合:</p> | ||
355 | +<pre><code> json_return_err_code(4001,'errorMessage'); | ||
356 | + // will return {'errCode':4001, 'info':'errorMessage'} | ||
357 | +</code></pre></li> | ||
358 | +<li><p>需要自定义多个数据字段的场合:</p> | ||
359 | +<pre><code> json_return_customer([ | ||
360 | + 'errCode'=>4002, | ||
361 | + 'Message'=>'Customer Message', | ||
362 | + 'OtherInfo'=>'Other Infomation' | ||
363 | + ]); | ||
364 | +</code></pre></li> | ||
365 | +<li><p>对于微页面(weipage),有其自定义的JSON定义,在微页面编辑中,涉及到的JSON返回一般使用:</p> | ||
366 | +<pre><code> json_return_for_weipage($err_code,$err_msg='',$err_dom=''); | ||
367 | +</code></pre></li> | ||
368 | +</ol> | ||
369 | +<hr> | ||
370 | +<h3 id="3-页面中分页显示的设置">3. 页面中分页显示的设置</h3> | ||
371 | +<p>设置数据的分页需要以下步骤:</p> | ||
372 | +<ul> | ||
373 | +<li>在Controller中导入以下命名空间 | ||
374 | +<code>use Library\MyPage;</code></li> | ||
375 | +<li>在对应的Controller方法中,调用MyPage类<pre><code>public function album_pic_list() { | ||
376 | + $where_condition = Array('aclass_id'=>$_GET['id'],'app_id'=>$this->app_id); // 查询条件 | ||
377 | + $pic_count = M('album_pic')->where($where_condition)->count(); // 获得显示的总数目 | ||
378 | + $pic_page = new MyPage($pic_count,6); // 创建MyPage类,参数1表示显示的总数,参数2表示一页中显示的数目 | ||
379 | + $pic_list = M('album_pic')->where($where_condition) | ||
380 | + ->order('create_timedesc') | ||
381 | + ->limit($pic_page->firstRow.','.$pic_page->listRows) | ||
382 | + ->select(); // 查询时注意加入limit进行限定 | ||
383 | + $this->assign('pic_list',$pic_list);// 向页面赋值列表 | ||
384 | + $pagebar = $pic_page->show(); | ||
385 | + $this->assign('show_page',$pagebar); // 向页面赋值pagebar元素 | ||
386 | + $this->display('gp02_goods_album_pic_list'); // 视图显示 | ||
387 | +} | ||
388 | +</code></pre></li> | ||
389 | +<li>在视图中,通过以下代码显示Pager导航 | ||
390 | +<code><div class="pagination"><?php echo $show_page; ?></div></code></li> | ||
391 | +</ul> | ||
392 | +<hr> | ||
393 | + | ||
394 | + | ||
395 | + </section> | ||
396 | + | ||
397 | + | ||
398 | + </div> | ||
399 | + </div> | ||
400 | + </div> | ||
401 | + | ||
402 | + | ||
403 | + <a href="../../Thinkphp/Structure/evshop_structure.html" class="navigation navigation-prev " aria-label="Previous page: EVShop框架结构图"><i class="fa fa-angle-left"></i></a> | ||
404 | + | ||
405 | + | ||
406 | + <a href="../../Thinkphp/View/evshop_view.html" class="navigation navigation-next " aria-label="Next page: EVShop之View篇"><i class="fa fa-angle-right"></i></a> | ||
407 | + | ||
408 | + </div> | ||
409 | +</div> | ||
410 | + | ||
411 | + | ||
412 | +<script src="../../gitbook/app.js"></script> | ||
413 | + | ||
414 | + | ||
415 | + <script src="../../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script> | ||
416 | + | ||
417 | + | ||
418 | + | ||
419 | + <script src="../../gitbook/plugins/gitbook-plugin-search/search.js"></script> | ||
420 | + | ||
421 | + | ||
422 | + | ||
423 | + <script src="../../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script> | ||
424 | + | ||
425 | + | ||
426 | + | ||
427 | + <script src="../../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script> | ||
428 | + | ||
429 | + | ||
430 | +<script> | ||
431 | +require(["gitbook"], function(gitbook) { | ||
432 | + var config = {"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2}}; | ||
433 | + gitbook.start(config); | ||
434 | +}); | ||
435 | +</script> | ||
436 | + | ||
437 | + | ||
438 | + </body> | ||
439 | + | ||
440 | +</html> |
1 | +<!DOCTYPE HTML> | ||
2 | +<html lang="en" > | ||
3 | + | ||
4 | + <head> | ||
5 | + | ||
6 | + <meta charset="UTF-8"> | ||
7 | + <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
8 | + <title>Thinkphp中SQL的写法 | Introduction</title> | ||
9 | + <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> | ||
10 | + <meta name="description" content=""> | ||
11 | + <meta name="generator" content="GitBook 2.6.7"> | ||
12 | + | ||
13 | + | ||
14 | + <meta name="HandheldFriendly" content="true"/> | ||
15 | + <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> | ||
16 | + <meta name="apple-mobile-web-app-capable" content="yes"> | ||
17 | + <meta name="apple-mobile-web-app-status-bar-style" content="black"> | ||
18 | + <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png"> | ||
19 | + <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon"> | ||
20 | + | ||
21 | + <link rel="stylesheet" href="../../gitbook/style.css"> | ||
22 | + | ||
23 | + | ||
24 | + <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-highlight/website.css"> | ||
25 | + | ||
26 | + | ||
27 | + | ||
28 | + <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-search/search.css"> | ||
29 | + | ||
30 | + | ||
31 | + | ||
32 | + <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-fontsettings/website.css"> | ||
33 | + | ||
34 | + | ||
35 | + | ||
36 | + | ||
37 | + | ||
38 | + | ||
39 | + | ||
40 | + <link rel="next" href="../../Thinkphp/Others/functions.html" /> | ||
41 | + | ||
42 | + | ||
43 | + <link rel="prev" href="../../Thinkphp/Javascript/evshop_js.html" /> | ||
44 | + | ||
45 | + | ||
46 | + | ||
47 | + </head> | ||
48 | + <body> | ||
49 | + | ||
50 | + | ||
51 | + <div class="book" | ||
52 | + data-level="1.5.1" | ||
53 | + data-chapter-title="Thinkphp中SQL的写法" | ||
54 | + data-filepath="Thinkphp/DB/db_sqls.md" | ||
55 | + data-basepath="../.." | ||
56 | + data-revision="Wed May 11 2016 00:54:11 GMT+0800 (中国标准时间)" | ||
57 | + data-innerlanguage=""> | ||
58 | + | ||
59 | + | ||
60 | +<div class="book-summary"> | ||
61 | + <nav role="navigation"> | ||
62 | + <ul class="summary"> | ||
63 | + | ||
64 | + | ||
65 | + | ||
66 | + | ||
67 | + | ||
68 | + | ||
69 | + | ||
70 | + | ||
71 | + | ||
72 | + <li class="chapter " data-level="0" data-path="index.html"> | ||
73 | + | ||
74 | + | ||
75 | + <a href="../../index.html"> | ||
76 | + | ||
77 | + <i class="fa fa-check"></i> | ||
78 | + | ||
79 | + 简介 | ||
80 | + </a> | ||
81 | + | ||
82 | + | ||
83 | + </li> | ||
84 | + | ||
85 | + <li class="chapter " data-level="1" > | ||
86 | + | ||
87 | + <span><b>1.</b> Thinkphp</span> | ||
88 | + | ||
89 | + | ||
90 | + <ul class="articles"> | ||
91 | + | ||
92 | + | ||
93 | + <li class="chapter " data-level="1.1" > | ||
94 | + | ||
95 | + <span><b>1.1.</b> Structure</span> | ||
96 | + | ||
97 | + | ||
98 | + <ul class="articles"> | ||
99 | + | ||
100 | + | ||
101 | + <li class="chapter " data-level="1.1.1" data-path="Thinkphp/Structure/evshop_structure.html"> | ||
102 | + | ||
103 | + | ||
104 | + <a href="../../Thinkphp/Structure/evshop_structure.html"> | ||
105 | + | ||
106 | + <i class="fa fa-check"></i> | ||
107 | + | ||
108 | + <b>1.1.1.</b> | ||
109 | + | ||
110 | + EVShop框架结构图 | ||
111 | + </a> | ||
112 | + | ||
113 | + | ||
114 | + </li> | ||
115 | + | ||
116 | + | ||
117 | + </ul> | ||
118 | + | ||
119 | + </li> | ||
120 | + | ||
121 | + <li class="chapter " data-level="1.2" > | ||
122 | + | ||
123 | + <span><b>1.2.</b> Controller</span> | ||
124 | + | ||
125 | + | ||
126 | + <ul class="articles"> | ||
127 | + | ||
128 | + | ||
129 | + <li class="chapter " data-level="1.2.1" data-path="Thinkphp/Controller/evshop_controller.html"> | ||
130 | + | ||
131 | + | ||
132 | + <a href="../../Thinkphp/Controller/evshop_controller.html"> | ||
133 | + | ||
134 | + <i class="fa fa-check"></i> | ||
135 | + | ||
136 | + <b>1.2.1.</b> | ||
137 | + | ||
138 | + EVShop之Controller篇 | ||
139 | + </a> | ||
140 | + | ||
141 | + | ||
142 | + </li> | ||
143 | + | ||
144 | + | ||
145 | + </ul> | ||
146 | + | ||
147 | + </li> | ||
148 | + | ||
149 | + <li class="chapter " data-level="1.3" > | ||
150 | + | ||
151 | + <span><b>1.3.</b> View</span> | ||
152 | + | ||
153 | + | ||
154 | + <ul class="articles"> | ||
155 | + | ||
156 | + | ||
157 | + <li class="chapter " data-level="1.3.1" data-path="Thinkphp/View/evshop_view.html"> | ||
158 | + | ||
159 | + | ||
160 | + <a href="../../Thinkphp/View/evshop_view.html"> | ||
161 | + | ||
162 | + <i class="fa fa-check"></i> | ||
163 | + | ||
164 | + <b>1.3.1.</b> | ||
165 | + | ||
166 | + EVShop之View篇 | ||
167 | + </a> | ||
168 | + | ||
169 | + | ||
170 | + </li> | ||
171 | + | ||
172 | + | ||
173 | + </ul> | ||
174 | + | ||
175 | + </li> | ||
176 | + | ||
177 | + <li class="chapter " data-level="1.4" > | ||
178 | + | ||
179 | + <span><b>1.4.</b> Javascript</span> | ||
180 | + | ||
181 | + | ||
182 | + <ul class="articles"> | ||
183 | + | ||
184 | + | ||
185 | + <li class="chapter " data-level="1.4.1" data-path="Thinkphp/Javascript/evshop_dialog.html"> | ||
186 | + | ||
187 | + | ||
188 | + <a href="../../Thinkphp/Javascript/evshop_dialog.html"> | ||
189 | + | ||
190 | + <i class="fa fa-check"></i> | ||
191 | + | ||
192 | + <b>1.4.1.</b> | ||
193 | + | ||
194 | + EVShop之Dialog篇 | ||
195 | + </a> | ||
196 | + | ||
197 | + | ||
198 | + </li> | ||
199 | + | ||
200 | + <li class="chapter " data-level="1.4.2" data-path="Thinkphp/Javascript/evshop_js.html"> | ||
201 | + | ||
202 | + | ||
203 | + <a href="../../Thinkphp/Javascript/evshop_js.html"> | ||
204 | + | ||
205 | + <i class="fa fa-check"></i> | ||
206 | + | ||
207 | + <b>1.4.2.</b> | ||
208 | + | ||
209 | + EVShop之Javascript篇 | ||
210 | + </a> | ||
211 | + | ||
212 | + | ||
213 | + </li> | ||
214 | + | ||
215 | + | ||
216 | + </ul> | ||
217 | + | ||
218 | + </li> | ||
219 | + | ||
220 | + <li class="chapter " data-level="1.5" > | ||
221 | + | ||
222 | + <span><b>1.5.</b> DB</span> | ||
223 | + | ||
224 | + | ||
225 | + <ul class="articles"> | ||
226 | + | ||
227 | + | ||
228 | + <li class="chapter active" data-level="1.5.1" data-path="Thinkphp/DB/db_sqls.html"> | ||
229 | + | ||
230 | + | ||
231 | + <a href="../../Thinkphp/DB/db_sqls.html"> | ||
232 | + | ||
233 | + <i class="fa fa-check"></i> | ||
234 | + | ||
235 | + <b>1.5.1.</b> | ||
236 | + | ||
237 | + Thinkphp中SQL的写法 | ||
238 | + </a> | ||
239 | + | ||
240 | + | ||
241 | + </li> | ||
242 | + | ||
243 | + | ||
244 | + </ul> | ||
245 | + | ||
246 | + </li> | ||
247 | + | ||
248 | + <li class="chapter " data-level="1.6" > | ||
249 | + | ||
250 | + <span><b>1.6.</b> Others</span> | ||
251 | + | ||
252 | + | ||
253 | + <ul class="articles"> | ||
254 | + | ||
255 | + | ||
256 | + <li class="chapter " data-level="1.6.1" data-path="Thinkphp/Others/functions.html"> | ||
257 | + | ||
258 | + | ||
259 | + <a href="../../Thinkphp/Others/functions.html"> | ||
260 | + | ||
261 | + <i class="fa fa-check"></i> | ||
262 | + | ||
263 | + <b>1.6.1.</b> | ||
264 | + | ||
265 | + Thinkphp中常用功能 | ||
266 | + </a> | ||
267 | + | ||
268 | + | ||
269 | + </li> | ||
270 | + | ||
271 | + <li class="chapter " data-level="1.6.2" data-path="Thinkphp/Others/UsefulCodes.html"> | ||
272 | + | ||
273 | + | ||
274 | + <a href="../../Thinkphp/Others/UsefulCodes.html"> | ||
275 | + | ||
276 | + <i class="fa fa-check"></i> | ||
277 | + | ||
278 | + <b>1.6.2.</b> | ||
279 | + | ||
280 | + EVShop中备用代码片段 | ||
281 | + </a> | ||
282 | + | ||
283 | + | ||
284 | + </li> | ||
285 | + | ||
286 | + | ||
287 | + </ul> | ||
288 | + | ||
289 | + </li> | ||
290 | + | ||
291 | + | ||
292 | + </ul> | ||
293 | + | ||
294 | + </li> | ||
295 | + | ||
296 | + | ||
297 | + | ||
298 | + | ||
299 | + <li class="divider"></li> | ||
300 | + <li> | ||
301 | + <a href="https://www.gitbook.com" target="blank" class="gitbook-link"> | ||
302 | + Published with GitBook | ||
303 | + </a> | ||
304 | + </li> | ||
305 | + | ||
306 | + </ul> | ||
307 | + </nav> | ||
308 | +</div> | ||
309 | + | ||
310 | + <div class="book-body"> | ||
311 | + <div class="body-inner"> | ||
312 | + <div class="book-header" role="navigation"> | ||
313 | + <!-- Actions Left --> | ||
314 | + | ||
315 | + | ||
316 | + <!-- Title --> | ||
317 | + <h1> | ||
318 | + <i class="fa fa-circle-o-notch fa-spin"></i> | ||
319 | + <a href="../../" >Introduction</a> | ||
320 | + </h1> | ||
321 | +</div> | ||
322 | + | ||
323 | + <div class="page-wrapper" tabindex="-1" role="main"> | ||
324 | + <div class="page-inner"> | ||
325 | + | ||
326 | + | ||
327 | + <section class="normal" id="section-"> | ||
328 | + | ||
329 | + <h1 id="thinkphp中复杂sql的写法">Thinkphp中复杂SQL的写法</h1> | ||
330 | +<h3 id="1-sql-多表联接的写法:">1. SQL 多表联接的写法:</h3> | ||
331 | +<pre><code>$spc_common_default = D("spc_common_default"); | ||
332 | +$filter['S.spc_common_id'] = array('eq',71); | ||
333 | +$model_list = $spc_common_default->table('__SPC_COMMON_DEFAULT__ S') | ||
334 | + ->join('LEFT JOIN __SPC_PGROUP_DEFAULT__ U ON S.spc_common_id = U.spc_common_id') | ||
335 | + ->field('S.*') | ||
336 | + ->where($map) | ||
337 | + ->select(); | ||
338 | +</code></pre><p>以上代码相当于以下SQL语句:</p> | ||
339 | +<pre><code>SELECT S.* FROM ev_spc_common_default as S | ||
340 | +LEFT JOIN ev_spc_group_default as U | ||
341 | +ON S.spc_common_id=U.spc_common_id | ||
342 | +WHERE s.spc_common_id=71 | ||
343 | +</code></pre><h3 id="2-sql-group-写法">2. SQL Group 写法:</h3> | ||
344 | +<pre><code>$model_list = $this->table('__ALBUM_CLASS__ A')->join('LEFT JOIN __ALBUM_PIC__ B ON A.aclass_id=B.aclass_id') | ||
345 | + ->field('A.aclass_id,A.app_id,A.aclass_name,A.aclass_des,A.aclass_conver,A.aclass_dic,A.is_default,A.create_time,count(B.aclass_id) as ClassCount') | ||
346 | + ->where($condition) | ||
347 | + ->group('A.aclass_id') | ||
348 | + ->order('A.create_time') | ||
349 | + ->select(); | ||
350 | +</code></pre><h3 id="3-统计查询countsum">3. 统计查询(count,sum...)</h3> | ||
351 | +<pre><code>$model->table('__ALBUM_CLASS__')->where($condition)->count(); | ||
352 | +$model->table('__ALBUM_CLASS__')->count('columnName'); | ||
353 | +$sumScore = $User->sum('score'); | ||
354 | +</code></pre> | ||
355 | + | ||
356 | + </section> | ||
357 | + | ||
358 | + | ||
359 | + </div> | ||
360 | + </div> | ||
361 | + </div> | ||
362 | + | ||
363 | + | ||
364 | + <a href="../../Thinkphp/Javascript/evshop_js.html" class="navigation navigation-prev " aria-label="Previous page: EVShop之Javascript篇"><i class="fa fa-angle-left"></i></a> | ||
365 | + | ||
366 | + | ||
367 | + <a href="../../Thinkphp/Others/functions.html" class="navigation navigation-next " aria-label="Next page: Thinkphp中常用功能"><i class="fa fa-angle-right"></i></a> | ||
368 | + | ||
369 | + </div> | ||
370 | +</div> | ||
371 | + | ||
372 | + | ||
373 | +<script src="../../gitbook/app.js"></script> | ||
374 | + | ||
375 | + | ||
376 | + <script src="../../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script> | ||
377 | + | ||
378 | + | ||
379 | + | ||
380 | + <script src="../../gitbook/plugins/gitbook-plugin-search/search.js"></script> | ||
381 | + | ||
382 | + | ||
383 | + | ||
384 | + <script src="../../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script> | ||
385 | + | ||
386 | + | ||
387 | + | ||
388 | + <script src="../../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script> | ||
389 | + | ||
390 | + | ||
391 | +<script> | ||
392 | +require(["gitbook"], function(gitbook) { | ||
393 | + var config = {"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2}}; | ||
394 | + gitbook.start(config); | ||
395 | +}); | ||
396 | +</script> | ||
397 | + | ||
398 | + | ||
399 | + </body> | ||
400 | + | ||
401 | +</html> |
1 | +<!DOCTYPE HTML> | ||
2 | +<html lang="en" > | ||
3 | + | ||
4 | + <head> | ||
5 | + | ||
6 | + <meta charset="UTF-8"> | ||
7 | + <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
8 | + <title>EVShop之Dialog篇 | Introduction</title> | ||
9 | + <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> | ||
10 | + <meta name="description" content=""> | ||
11 | + <meta name="generator" content="GitBook 2.6.7"> | ||
12 | + | ||
13 | + | ||
14 | + <meta name="HandheldFriendly" content="true"/> | ||
15 | + <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> | ||
16 | + <meta name="apple-mobile-web-app-capable" content="yes"> | ||
17 | + <meta name="apple-mobile-web-app-status-bar-style" content="black"> | ||
18 | + <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png"> | ||
19 | + <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon"> | ||
20 | + | ||
21 | + <link rel="stylesheet" href="../../gitbook/style.css"> | ||
22 | + | ||
23 | + | ||
24 | + <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-highlight/website.css"> | ||
25 | + | ||
26 | + | ||
27 | + | ||
28 | + <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-search/search.css"> | ||
29 | + | ||
30 | + | ||
31 | + | ||
32 | + <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-fontsettings/website.css"> | ||
33 | + | ||
34 | + | ||
35 | + | ||
36 | + | ||
37 | + | ||
38 | + | ||
39 | + | ||
40 | + <link rel="next" href="../../Thinkphp/Javascript/evshop_js.html" /> | ||
41 | + | ||
42 | + | ||
43 | + <link rel="prev" href="../../Thinkphp/View/evshop_view.html" /> | ||
44 | + | ||
45 | + | ||
46 | + | ||
47 | + </head> | ||
48 | + <body> | ||
49 | + | ||
50 | + | ||
51 | + <div class="book" | ||
52 | + data-level="1.4.1" | ||
53 | + data-chapter-title="EVShop之Dialog篇" | ||
54 | + data-filepath="Thinkphp/Javascript/evshop_dialog.md" | ||
55 | + data-basepath="../.." | ||
56 | + data-revision="Wed May 11 2016 00:54:11 GMT+0800 (中国标准时间)" | ||
57 | + data-innerlanguage=""> | ||
58 | + | ||
59 | + | ||
60 | +<div class="book-summary"> | ||
61 | + <nav role="navigation"> | ||
62 | + <ul class="summary"> | ||
63 | + | ||
64 | + | ||
65 | + | ||
66 | + | ||
67 | + | ||
68 | + | ||
69 | + | ||
70 | + | ||
71 | + | ||
72 | + <li class="chapter " data-level="0" data-path="index.html"> | ||
73 | + | ||
74 | + | ||
75 | + <a href="../../index.html"> | ||
76 | + | ||
77 | + <i class="fa fa-check"></i> | ||
78 | + | ||
79 | + 简介 | ||
80 | + </a> | ||
81 | + | ||
82 | + | ||
83 | + </li> | ||
84 | + | ||
85 | + <li class="chapter " data-level="1" > | ||
86 | + | ||
87 | + <span><b>1.</b> Thinkphp</span> | ||
88 | + | ||
89 | + | ||
90 | + <ul class="articles"> | ||
91 | + | ||
92 | + | ||
93 | + <li class="chapter " data-level="1.1" > | ||
94 | + | ||
95 | + <span><b>1.1.</b> Structure</span> | ||
96 | + | ||
97 | + | ||
98 | + <ul class="articles"> | ||
99 | + | ||
100 | + | ||
101 | + <li class="chapter " data-level="1.1.1" data-path="Thinkphp/Structure/evshop_structure.html"> | ||
102 | + | ||
103 | + | ||
104 | + <a href="../../Thinkphp/Structure/evshop_structure.html"> | ||
105 | + | ||
106 | + <i class="fa fa-check"></i> | ||
107 | + | ||
108 | + <b>1.1.1.</b> | ||
109 | + | ||
110 | + EVShop框架结构图 | ||
111 | + </a> | ||
112 | + | ||
113 | + | ||
114 | + </li> | ||
115 | + | ||
116 | + | ||
117 | + </ul> | ||
118 | + | ||
119 | + </li> | ||
120 | + | ||
121 | + <li class="chapter " data-level="1.2" > | ||
122 | + | ||
123 | + <span><b>1.2.</b> Controller</span> | ||
124 | + | ||
125 | + | ||
126 | + <ul class="articles"> | ||
127 | + | ||
128 | + | ||
129 | + <li class="chapter " data-level="1.2.1" data-path="Thinkphp/Controller/evshop_controller.html"> | ||
130 | + | ||
131 | + | ||
132 | + <a href="../../Thinkphp/Controller/evshop_controller.html"> | ||
133 | + | ||
134 | + <i class="fa fa-check"></i> | ||
135 | + | ||
136 | + <b>1.2.1.</b> | ||
137 | + | ||
138 | + EVShop之Controller篇 | ||
139 | + </a> | ||
140 | + | ||
141 | + | ||
142 | + </li> | ||
143 | + | ||
144 | + | ||
145 | + </ul> | ||
146 | + | ||
147 | + </li> | ||
148 | + | ||
149 | + <li class="chapter " data-level="1.3" > | ||
150 | + | ||
151 | + <span><b>1.3.</b> View</span> | ||
152 | + | ||
153 | + | ||
154 | + <ul class="articles"> | ||
155 | + | ||
156 | + | ||
157 | + <li class="chapter " data-level="1.3.1" data-path="Thinkphp/View/evshop_view.html"> | ||
158 | + | ||
159 | + | ||
160 | + <a href="../../Thinkphp/View/evshop_view.html"> | ||
161 | + | ||
162 | + <i class="fa fa-check"></i> | ||
163 | + | ||
164 | + <b>1.3.1.</b> | ||
165 | + | ||
166 | + EVShop之View篇 | ||
167 | + </a> | ||
168 | + | ||
169 | + | ||
170 | + </li> | ||
171 | + | ||
172 | + | ||
173 | + </ul> | ||
174 | + | ||
175 | + </li> | ||
176 | + | ||
177 | + <li class="chapter " data-level="1.4" > | ||
178 | + | ||
179 | + <span><b>1.4.</b> Javascript</span> | ||
180 | + | ||
181 | + | ||
182 | + <ul class="articles"> | ||
183 | + | ||
184 | + | ||
185 | + <li class="chapter active" data-level="1.4.1" data-path="Thinkphp/Javascript/evshop_dialog.html"> | ||
186 | + | ||
187 | + | ||
188 | + <a href="../../Thinkphp/Javascript/evshop_dialog.html"> | ||
189 | + | ||
190 | + <i class="fa fa-check"></i> | ||
191 | + | ||
192 | + <b>1.4.1.</b> | ||
193 | + | ||
194 | + EVShop之Dialog篇 | ||
195 | + </a> | ||
196 | + | ||
197 | + | ||
198 | + </li> | ||
199 | + | ||
200 | + <li class="chapter " data-level="1.4.2" data-path="Thinkphp/Javascript/evshop_js.html"> | ||
201 | + | ||
202 | + | ||
203 | + <a href="../../Thinkphp/Javascript/evshop_js.html"> | ||
204 | + | ||
205 | + <i class="fa fa-check"></i> | ||
206 | + | ||
207 | + <b>1.4.2.</b> | ||
208 | + | ||
209 | + EVShop之Javascript篇 | ||
210 | + </a> | ||
211 | + | ||
212 | + | ||
213 | + </li> | ||
214 | + | ||
215 | + | ||
216 | + </ul> | ||
217 | + | ||
218 | + </li> | ||
219 | + | ||
220 | + <li class="chapter " data-level="1.5" > | ||
221 | + | ||
222 | + <span><b>1.5.</b> DB</span> | ||
223 | + | ||
224 | + | ||
225 | + <ul class="articles"> | ||
226 | + | ||
227 | + | ||
228 | + <li class="chapter " data-level="1.5.1" data-path="Thinkphp/DB/db_sqls.html"> | ||
229 | + | ||
230 | + | ||
231 | + <a href="../../Thinkphp/DB/db_sqls.html"> | ||
232 | + | ||
233 | + <i class="fa fa-check"></i> | ||
234 | + | ||
235 | + <b>1.5.1.</b> | ||
236 | + | ||
237 | + Thinkphp中SQL的写法 | ||
238 | + </a> | ||
239 | + | ||
240 | + | ||
241 | + </li> | ||
242 | + | ||
243 | + | ||
244 | + </ul> | ||
245 | + | ||
246 | + </li> | ||
247 | + | ||
248 | + <li class="chapter " data-level="1.6" > | ||
249 | + | ||
250 | + <span><b>1.6.</b> Others</span> | ||
251 | + | ||
252 | + | ||
253 | + <ul class="articles"> | ||
254 | + | ||
255 | + | ||
256 | + <li class="chapter " data-level="1.6.1" data-path="Thinkphp/Others/functions.html"> | ||
257 | + | ||
258 | + | ||
259 | + <a href="../../Thinkphp/Others/functions.html"> | ||
260 | + | ||
261 | + <i class="fa fa-check"></i> | ||
262 | + | ||
263 | + <b>1.6.1.</b> | ||
264 | + | ||
265 | + Thinkphp中常用功能 | ||
266 | + </a> | ||
267 | + | ||
268 | + | ||
269 | + </li> | ||
270 | + | ||
271 | + <li class="chapter " data-level="1.6.2" data-path="Thinkphp/Others/UsefulCodes.html"> | ||
272 | + | ||
273 | + | ||
274 | + <a href="../../Thinkphp/Others/UsefulCodes.html"> | ||
275 | + | ||
276 | + <i class="fa fa-check"></i> | ||
277 | + | ||
278 | + <b>1.6.2.</b> | ||
279 | + | ||
280 | + EVShop中备用代码片段 | ||
281 | + </a> | ||
282 | + | ||
283 | + | ||
284 | + </li> | ||
285 | + | ||
286 | + | ||
287 | + </ul> | ||
288 | + | ||
289 | + </li> | ||
290 | + | ||
291 | + | ||
292 | + </ul> | ||
293 | + | ||
294 | + </li> | ||
295 | + | ||
296 | + | ||
297 | + | ||
298 | + | ||
299 | + <li class="divider"></li> | ||
300 | + <li> | ||
301 | + <a href="https://www.gitbook.com" target="blank" class="gitbook-link"> | ||
302 | + Published with GitBook | ||
303 | + </a> | ||
304 | + </li> | ||
305 | + | ||
306 | + </ul> | ||
307 | + </nav> | ||
308 | +</div> | ||
309 | + | ||
310 | + <div class="book-body"> | ||
311 | + <div class="body-inner"> | ||
312 | + <div class="book-header" role="navigation"> | ||
313 | + <!-- Actions Left --> | ||
314 | + | ||
315 | + | ||
316 | + <!-- Title --> | ||
317 | + <h1> | ||
318 | + <i class="fa fa-circle-o-notch fa-spin"></i> | ||
319 | + <a href="../../" >Introduction</a> | ||
320 | + </h1> | ||
321 | +</div> | ||
322 | + | ||
323 | + <div class="page-wrapper" tabindex="-1" role="main"> | ||
324 | + <div class="page-inner"> | ||
325 | + | ||
326 | + | ||
327 | + <section class="normal" id="section-"> | ||
328 | + | ||
329 | + <h1 id="evshop编程规则之dialog篇">EVShop编程规则之Dialog篇</h1> | ||
330 | +<blockquote> | ||
331 | +<p>在Evshop中,对话框是使用artDialog控件,关于artDialog的使用方式,可以参考: | ||
332 | +<a href="http://aui.github.io/artDialog/doc/index.html" target="_blank">artDialog文档</a> | ||
333 | +我们在artDialog基础上,做了一些基础的封装,封装参考代码: | ||
334 | + <code>/data/application/common/myDialog.js</code> | ||
335 | +对话框的基本使用示例,参考: | ||
336 | + <code>/data/application/shop/sample_list.js</code></p> | ||
337 | +</blockquote> | ||
338 | +<h3 id="对话框mydialog的使用">对话框(myDialog)的使用</h3> | ||
339 | +<ul> | ||
340 | +<li><p>要使用对话框,需要在前端js中引入: | ||
341 | +<code>var myDialog = require("myDialog");</code></p> | ||
342 | +</li> | ||
343 | +<li><p>使用基本的 <strong>Success/Error/Info</strong> 对话框:</p> | ||
344 | +<pre><code>myDialog.showSucc("Success"); | ||
345 | +myDialog.showError("Failed"); | ||
346 | +myDialog.showInfo("title","你好啊"); | ||
347 | +</code></pre></li> | ||
348 | +<li><p>对话框中显示本页面中元素内的内容:</p> | ||
349 | +<pre><code>$("#opelem").bind("click",function(){ | ||
350 | + var dialog= myDialog.showMoreDialog(this,{ | ||
351 | + width:400, | ||
352 | + height:$("#dlg_element").height+200, | ||
353 | + title:$(this).attr("dialog_title"), | ||
354 | + content:$("#dlg_element").html(), | ||
355 | + },true); | ||
356 | +}); | ||
357 | +</code></pre></li> | ||
358 | +<li><p>显示自定义confirm对话框</p> | ||
359 | +<pre><code>myDialog.showConfirm("提示信息","删除相册?注意:相册内的图片将转移到默认相册",function(){ | ||
360 | + $(this).ajaxSubmit({ | ||
361 | + data: {"id":album_id}, | ||
362 | + dataType:'json', | ||
363 | + type:'get', | ||
364 | + url:process_uri, | ||
365 | + success:function(responseText,stsText,xhr){ | ||
366 | + commonFunc.showAjaxProcessInfo(responseText); | ||
367 | + }, | ||
368 | + error:function(error) { | ||
369 | + myDialog.showError(error); | ||
370 | + } | ||
371 | + }); | ||
372 | + //alert('xxx'); | ||
373 | +}); | ||
374 | +</code></pre></li> | ||
375 | +</ul> | ||
376 | +<ul> | ||
377 | +<li><p>对话框中显示指定URL的内容 </p> | ||
378 | +<pre><code> $("#opelurl2").bind('click',function(){ | ||
379 | + // support param: width, | ||
380 | + var dialog = myDialog.showFormDialog(this,{ | ||
381 | + width:500, | ||
382 | + title:"Open Dialog", | ||
383 | + url:$(this).attr("dialog_url"), | ||
384 | + okValue : "确定", // 确定按钮文件,如果不设定,则默认为"确定" | ||
385 | + extraSubmitData : {"param1":"1","param2":"2"}, | ||
386 | + success: function(dialogObj,responseText) { | ||
387 | + console.log(responseText); // responsetext后端返回的JSON对象 | ||
388 | + myDialog.showSucc("Success"); | ||
389 | + //dialogObj.close().remove(); | ||
390 | + }, | ||
391 | + error: function(dialogObj,errorText) { | ||
392 | + console.log(errorText); | ||
393 | + myDialog.showError(errorText); | ||
394 | + //dialogObj.close().remove(); | ||
395 | + } | ||
396 | + }); | ||
397 | + }); | ||
398 | +</code></pre><blockquote> | ||
399 | +<p>注:一般来说,指定URL内容包含的是FORM表单,表单提交的Button不需要在页面中定义, | ||
400 | +而是使用对话框提供的OK/Cancel按钮 </p> | ||
401 | +</blockquote> | ||
402 | +</li> | ||
403 | +</ul> | ||
404 | +<ul> | ||
405 | +<li>对话框URL方式打开后,支持对话框内元素事件的监听 | ||
406 | +在myDialog.showFormDialog函数内, | ||
407 | +可以使用eventListeners来监听对话框内元素的事件监听。方式如下:<pre><code>$("#opelurl2").bind('click',function(){ | ||
408 | + // support param: width, | ||
409 | + var dialog = myDialog.showFormDialog(this,{ | ||
410 | + width:500, | ||
411 | + title:"Open Dialog", | ||
412 | + url:$(this).attr("dialog_url"), | ||
413 | + eventListeners : [{ | ||
414 | + selector:'input[type="text"]', // Dialog中事件绑定的选择器 | ||
415 | + eventName:'change', // Dialog中需要监测的事件 | ||
416 | + eventFunction : function($sender,$dlgDocument) { // 事件产生后所回调的函数 | ||
417 | + // $sender是触发此事件的jquery对象,$document是页面中document的jquery对象 | ||
418 | + console.log($sender.attr("name")); | ||
419 | + //console.log($dlgDocument); | ||
420 | + } | ||
421 | + }], | ||
422 | + okValue : "确定", // 确定按钮文件,如果不设定,则默认为"确定" | ||
423 | + ... | ||
424 | +} | ||
425 | +</code></pre></li> | ||
426 | +</ul> | ||
427 | + | ||
428 | + | ||
429 | + </section> | ||
430 | + | ||
431 | + | ||
432 | + </div> | ||
433 | + </div> | ||
434 | + </div> | ||
435 | + | ||
436 | + | ||
437 | + <a href="../../Thinkphp/View/evshop_view.html" class="navigation navigation-prev " aria-label="Previous page: EVShop之View篇"><i class="fa fa-angle-left"></i></a> | ||
438 | + | ||
439 | + | ||
440 | + <a href="../../Thinkphp/Javascript/evshop_js.html" class="navigation navigation-next " aria-label="Next page: EVShop之Javascript篇"><i class="fa fa-angle-right"></i></a> | ||
441 | + | ||
442 | + </div> | ||
443 | +</div> | ||
444 | + | ||
445 | + | ||
446 | +<script src="../../gitbook/app.js"></script> | ||
447 | + | ||
448 | + | ||
449 | + <script src="../../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script> | ||
450 | + | ||
451 | + | ||
452 | + | ||
453 | + <script src="../../gitbook/plugins/gitbook-plugin-search/search.js"></script> | ||
454 | + | ||
455 | + | ||
456 | + | ||
457 | + <script src="../../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script> | ||
458 | + | ||
459 | + | ||
460 | + | ||
461 | + <script src="../../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script> | ||
462 | + | ||
463 | + | ||
464 | +<script> | ||
465 | +require(["gitbook"], function(gitbook) { | ||
466 | + var config = {"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2}}; | ||
467 | + gitbook.start(config); | ||
468 | +}); | ||
469 | +</script> | ||
470 | + | ||
471 | + | ||
472 | + </body> | ||
473 | + | ||
474 | +</html> |
1 | +<!DOCTYPE HTML> | ||
2 | +<html lang="en" > | ||
3 | + | ||
4 | + <head> | ||
5 | + | ||
6 | + <meta charset="UTF-8"> | ||
7 | + <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
8 | + <title>EVShop之Javascript篇 | Introduction</title> | ||
9 | + <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> | ||
10 | + <meta name="description" content=""> | ||
11 | + <meta name="generator" content="GitBook 2.6.7"> | ||
12 | + | ||
13 | + | ||
14 | + <meta name="HandheldFriendly" content="true"/> | ||
15 | + <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> | ||
16 | + <meta name="apple-mobile-web-app-capable" content="yes"> | ||
17 | + <meta name="apple-mobile-web-app-status-bar-style" content="black"> | ||
18 | + <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png"> | ||
19 | + <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon"> | ||
20 | + | ||
21 | + <link rel="stylesheet" href="../../gitbook/style.css"> | ||
22 | + | ||
23 | + | ||
24 | + <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-highlight/website.css"> | ||
25 | + | ||
26 | + | ||
27 | + | ||
28 | + <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-search/search.css"> | ||
29 | + | ||
30 | + | ||
31 | + | ||
32 | + <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-fontsettings/website.css"> | ||
33 | + | ||
34 | + | ||
35 | + | ||
36 | + | ||
37 | + | ||
38 | + | ||
39 | + | ||
40 | + <link rel="next" href="../../Thinkphp/DB/db_sqls.html" /> | ||
41 | + | ||
42 | + | ||
43 | + <link rel="prev" href="../../Thinkphp/Javascript/evshop_dialog.html" /> | ||
44 | + | ||
45 | + | ||
46 | + | ||
47 | + </head> | ||
48 | + <body> | ||
49 | + | ||
50 | + | ||
51 | + <div class="book" | ||
52 | + data-level="1.4.2" | ||
53 | + data-chapter-title="EVShop之Javascript篇" | ||
54 | + data-filepath="Thinkphp/Javascript/evshop_js.md" | ||
55 | + data-basepath="../.." | ||
56 | + data-revision="Wed May 11 2016 00:54:11 GMT+0800 (中国标准时间)" | ||
57 | + data-innerlanguage=""> | ||
58 | + | ||
59 | + | ||
60 | +<div class="book-summary"> | ||
61 | + <nav role="navigation"> | ||
62 | + <ul class="summary"> | ||
63 | + | ||
64 | + | ||
65 | + | ||
66 | + | ||
67 | + | ||
68 | + | ||
69 | + | ||
70 | + | ||
71 | + | ||
72 | + <li class="chapter " data-level="0" data-path="index.html"> | ||
73 | + | ||
74 | + | ||
75 | + <a href="../../index.html"> | ||
76 | + | ||
77 | + <i class="fa fa-check"></i> | ||
78 | + | ||
79 | + 简介 | ||
80 | + </a> | ||
81 | + | ||
82 | + | ||
83 | + </li> | ||
84 | + | ||
85 | + <li class="chapter " data-level="1" > | ||
86 | + | ||
87 | + <span><b>1.</b> Thinkphp</span> | ||
88 | + | ||
89 | + | ||
90 | + <ul class="articles"> | ||
91 | + | ||
92 | + | ||
93 | + <li class="chapter " data-level="1.1" > | ||
94 | + | ||
95 | + <span><b>1.1.</b> Structure</span> | ||
96 | + | ||
97 | + | ||
98 | + <ul class="articles"> | ||
99 | + | ||
100 | + | ||
101 | + <li class="chapter " data-level="1.1.1" data-path="Thinkphp/Structure/evshop_structure.html"> | ||
102 | + | ||
103 | + | ||
104 | + <a href="../../Thinkphp/Structure/evshop_structure.html"> | ||
105 | + | ||
106 | + <i class="fa fa-check"></i> | ||
107 | + | ||
108 | + <b>1.1.1.</b> | ||
109 | + | ||
110 | + EVShop框架结构图 | ||
111 | + </a> | ||
112 | + | ||
113 | + | ||
114 | + </li> | ||
115 | + | ||
116 | + | ||
117 | + </ul> | ||
118 | + | ||
119 | + </li> | ||
120 | + | ||
121 | + <li class="chapter " data-level="1.2" > | ||
122 | + | ||
123 | + <span><b>1.2.</b> Controller</span> | ||
124 | + | ||
125 | + | ||
126 | + <ul class="articles"> | ||
127 | + | ||
128 | + | ||
129 | + <li class="chapter " data-level="1.2.1" data-path="Thinkphp/Controller/evshop_controller.html"> | ||
130 | + | ||
131 | + | ||
132 | + <a href="../../Thinkphp/Controller/evshop_controller.html"> | ||
133 | + | ||
134 | + <i class="fa fa-check"></i> | ||
135 | + | ||
136 | + <b>1.2.1.</b> | ||
137 | + | ||
138 | + EVShop之Controller篇 | ||
139 | + </a> | ||
140 | + | ||
141 | + | ||
142 | + </li> | ||
143 | + | ||
144 | + | ||
145 | + </ul> | ||
146 | + | ||
147 | + </li> | ||
148 | + | ||
149 | + <li class="chapter " data-level="1.3" > | ||
150 | + | ||
151 | + <span><b>1.3.</b> View</span> | ||
152 | + | ||
153 | + | ||
154 | + <ul class="articles"> | ||
155 | + | ||
156 | + | ||
157 | + <li class="chapter " data-level="1.3.1" data-path="Thinkphp/View/evshop_view.html"> | ||
158 | + | ||
159 | + | ||
160 | + <a href="../../Thinkphp/View/evshop_view.html"> | ||
161 | + | ||
162 | + <i class="fa fa-check"></i> | ||
163 | + | ||
164 | + <b>1.3.1.</b> | ||
165 | + | ||
166 | + EVShop之View篇 | ||
167 | + </a> | ||
168 | + | ||
169 | + | ||
170 | + </li> | ||
171 | + | ||
172 | + | ||
173 | + </ul> | ||
174 | + | ||
175 | + </li> | ||
176 | + | ||
177 | + <li class="chapter " data-level="1.4" > | ||
178 | + | ||
179 | + <span><b>1.4.</b> Javascript</span> | ||
180 | + | ||
181 | + | ||
182 | + <ul class="articles"> | ||
183 | + | ||
184 | + | ||
185 | + <li class="chapter " data-level="1.4.1" data-path="Thinkphp/Javascript/evshop_dialog.html"> | ||
186 | + | ||
187 | + | ||
188 | + <a href="../../Thinkphp/Javascript/evshop_dialog.html"> | ||
189 | + | ||
190 | + <i class="fa fa-check"></i> | ||
191 | + | ||
192 | + <b>1.4.1.</b> | ||
193 | + | ||
194 | + EVShop之Dialog篇 | ||
195 | + </a> | ||
196 | + | ||
197 | + | ||
198 | + </li> | ||
199 | + | ||
200 | + <li class="chapter active" data-level="1.4.2" data-path="Thinkphp/Javascript/evshop_js.html"> | ||
201 | + | ||
202 | + | ||
203 | + <a href="../../Thinkphp/Javascript/evshop_js.html"> | ||
204 | + | ||
205 | + <i class="fa fa-check"></i> | ||
206 | + | ||
207 | + <b>1.4.2.</b> | ||
208 | + | ||
209 | + EVShop之Javascript篇 | ||
210 | + </a> | ||
211 | + | ||
212 | + | ||
213 | + </li> | ||
214 | + | ||
215 | + | ||
216 | + </ul> | ||
217 | + | ||
218 | + </li> | ||
219 | + | ||
220 | + <li class="chapter " data-level="1.5" > | ||
221 | + | ||
222 | + <span><b>1.5.</b> DB</span> | ||
223 | + | ||
224 | + | ||
225 | + <ul class="articles"> | ||
226 | + | ||
227 | + | ||
228 | + <li class="chapter " data-level="1.5.1" data-path="Thinkphp/DB/db_sqls.html"> | ||
229 | + | ||
230 | + | ||
231 | + <a href="../../Thinkphp/DB/db_sqls.html"> | ||
232 | + | ||
233 | + <i class="fa fa-check"></i> | ||
234 | + | ||
235 | + <b>1.5.1.</b> | ||
236 | + | ||
237 | + Thinkphp中SQL的写法 | ||
238 | + </a> | ||
239 | + | ||
240 | + | ||
241 | + </li> | ||
242 | + | ||
243 | + | ||
244 | + </ul> | ||
245 | + | ||
246 | + </li> | ||
247 | + | ||
248 | + <li class="chapter " data-level="1.6" > | ||
249 | + | ||
250 | + <span><b>1.6.</b> Others</span> | ||
251 | + | ||
252 | + | ||
253 | + <ul class="articles"> | ||
254 | + | ||
255 | + | ||
256 | + <li class="chapter " data-level="1.6.1" data-path="Thinkphp/Others/functions.html"> | ||
257 | + | ||
258 | + | ||
259 | + <a href="../../Thinkphp/Others/functions.html"> | ||
260 | + | ||
261 | + <i class="fa fa-check"></i> | ||
262 | + | ||
263 | + <b>1.6.1.</b> | ||
264 | + | ||
265 | + Thinkphp中常用功能 | ||
266 | + </a> | ||
267 | + | ||
268 | + | ||
269 | + </li> | ||
270 | + | ||
271 | + <li class="chapter " data-level="1.6.2" data-path="Thinkphp/Others/UsefulCodes.html"> | ||
272 | + | ||
273 | + | ||
274 | + <a href="../../Thinkphp/Others/UsefulCodes.html"> | ||
275 | + | ||
276 | + <i class="fa fa-check"></i> | ||
277 | + | ||
278 | + <b>1.6.2.</b> | ||
279 | + | ||
280 | + EVShop中备用代码片段 | ||
281 | + </a> | ||
282 | + | ||
283 | + | ||
284 | + </li> | ||
285 | + | ||
286 | + | ||
287 | + </ul> | ||
288 | + | ||
289 | + </li> | ||
290 | + | ||
291 | + | ||
292 | + </ul> | ||
293 | + | ||
294 | + </li> | ||
295 | + | ||
296 | + | ||
297 | + | ||
298 | + | ||
299 | + <li class="divider"></li> | ||
300 | + <li> | ||
301 | + <a href="https://www.gitbook.com" target="blank" class="gitbook-link"> | ||
302 | + Published with GitBook | ||
303 | + </a> | ||
304 | + </li> | ||
305 | + | ||
306 | + </ul> | ||
307 | + </nav> | ||
308 | +</div> | ||
309 | + | ||
310 | + <div class="book-body"> | ||
311 | + <div class="body-inner"> | ||
312 | + <div class="book-header" role="navigation"> | ||
313 | + <!-- Actions Left --> | ||
314 | + | ||
315 | + | ||
316 | + <!-- Title --> | ||
317 | + <h1> | ||
318 | + <i class="fa fa-circle-o-notch fa-spin"></i> | ||
319 | + <a href="../../" >Introduction</a> | ||
320 | + </h1> | ||
321 | +</div> | ||
322 | + | ||
323 | + <div class="page-wrapper" tabindex="-1" role="main"> | ||
324 | + <div class="page-inner"> | ||
325 | + | ||
326 | + | ||
327 | + <section class="normal" id="section-"> | ||
328 | + | ||
329 | + <h1 id="evshop编程规则之javascript篇">EVShop编程规则之Javascript篇</h1> | ||
330 | +<h3 id="1-html中添加seventsactionsparams-对元素进行事件的绑定">1. HTML中添加sevent/saction/sparams 对元素进行事件的绑定</h3> | ||
331 | +<pre><code>> 事件绑定是通过jquery的on方法,绑定在document元素上,基于事件的冒泡实现的。 | ||
332 | +</code></pre><ul> | ||
333 | +<li>在视图html中,可以通过以下方式进行事件的绑定动作:</li> | ||
334 | +</ul> | ||
335 | +<pre><code><a href="JavaScript:void(0);" class="ncsc-btn-mini" sevent="click" saction="picAction" stype="multiDel" sparams="1,2" ></a> | ||
336 | +<a href="JavaScript:void(1);" class="ncsc-btn-mini" id="img_move" sevent="click" saction="picAction" stype="multiMov" sparms="3,4"></a> | ||
337 | +</code></pre><ul> | ||
338 | +<li>在此视图对应的js文件中,只需要定义以下事件:<pre><code>PageModel.prototype.picAction = function(sender,param1,param2) { | ||
339 | + if($(sender).attr("stype")==="multiDel") { | ||
340 | + //具体事件的动作 | ||
341 | + } | ||
342 | +} | ||
343 | +</code></pre></li> | ||
344 | +</ul> | ||
345 | +<p>在绑定的过程中,支持的事件行为(sevent)有:</p> | ||
346 | +<pre><code> "click", "change", "blur", "dbclick", "focus", "hover", "resize" | ||
347 | +</code></pre><hr> | ||
348 | +<h3 id="2-jsonparse函数的参数存在特殊字符的处理">2. JSON.Parse函数的参数存在特殊字符的处理</h3> | ||
349 | +<blockquote> | ||
350 | +<p>JSON.Parse()函数,使用的参数是一个字符串, | ||
351 | +该字符串中存在"\"时,函数转换就会出错,出错提示为: | ||
352 | + <code>JSON.parse: expected ',' or '}' after property value in object</code> | ||
353 | +所以,需要将字符串进行转换,为"\"符号进行转义</p> | ||
354 | +</blockquote> | ||
355 | +<p><strong>具体实现</strong>:</p> | ||
356 | +<ol> | ||
357 | +<li>在PHP中,针对字符串,使用addslashes函数: | ||
358 | + <code>$this->assign('customField', addslashes(json_encode($customField)));</code></li> | ||
359 | +<li>在JS中,使用replace将"\"转换成"\"格式 </li> | ||
360 | +</ol> | ||
361 | +<hr> | ||
362 | +<h3 id="3-使用jqueryform-进行异步提交">3. 使用jquery-form 进行异步提交</h3> | ||
363 | +<blockquote> | ||
364 | +<p>jquery-form是一种js的异步提交,提交时,除了把指定的form数据进行提交, | ||
365 | +还支持额外自定义数据的提交</p> | ||
366 | +</blockquote> | ||
367 | +<p>实现方式:</p> | ||
368 | +<pre><code>var jquery_form = require("jquery-form"); | ||
369 | +$(selector).ajaxSubmit({ | ||
370 | + data:[extraSubmitdata] | ||
371 | + dataType:'json', | ||
372 | + type:'post', | ||
373 | + timeout:5000, | ||
374 | + success:function(responseText,stsText,xhr,element) { | ||
375 | + | ||
376 | + }, | ||
377 | + error:function(error) { | ||
378 | + | ||
379 | + } | ||
380 | +}); | ||
381 | +</code></pre> | ||
382 | + | ||
383 | + </section> | ||
384 | + | ||
385 | + | ||
386 | + </div> | ||
387 | + </div> | ||
388 | + </div> | ||
389 | + | ||
390 | + | ||
391 | + <a href="../../Thinkphp/Javascript/evshop_dialog.html" class="navigation navigation-prev " aria-label="Previous page: EVShop之Dialog篇"><i class="fa fa-angle-left"></i></a> | ||
392 | + | ||
393 | + | ||
394 | + <a href="../../Thinkphp/DB/db_sqls.html" class="navigation navigation-next " aria-label="Next page: Thinkphp中SQL的写法"><i class="fa fa-angle-right"></i></a> | ||
395 | + | ||
396 | + </div> | ||
397 | +</div> | ||
398 | + | ||
399 | + | ||
400 | +<script src="../../gitbook/app.js"></script> | ||
401 | + | ||
402 | + | ||
403 | + <script src="../../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script> | ||
404 | + | ||
405 | + | ||
406 | + | ||
407 | + <script src="../../gitbook/plugins/gitbook-plugin-search/search.js"></script> | ||
408 | + | ||
409 | + | ||
410 | + | ||
411 | + <script src="../../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script> | ||
412 | + | ||
413 | + | ||
414 | + | ||
415 | + <script src="../../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script> | ||
416 | + | ||
417 | + | ||
418 | +<script> | ||
419 | +require(["gitbook"], function(gitbook) { | ||
420 | + var config = {"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2}}; | ||
421 | + gitbook.start(config); | ||
422 | +}); | ||
423 | +</script> | ||
424 | + | ||
425 | + | ||
426 | + </body> | ||
427 | + | ||
428 | +</html> |
1 | +<!DOCTYPE HTML> | ||
2 | +<html lang="en" > | ||
3 | + | ||
4 | + <head> | ||
5 | + | ||
6 | + <meta charset="UTF-8"> | ||
7 | + <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
8 | + <title>EVShop中备用代码片段 | Introduction</title> | ||
9 | + <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> | ||
10 | + <meta name="description" content=""> | ||
11 | + <meta name="generator" content="GitBook 2.6.7"> | ||
12 | + | ||
13 | + | ||
14 | + <meta name="HandheldFriendly" content="true"/> | ||
15 | + <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> | ||
16 | + <meta name="apple-mobile-web-app-capable" content="yes"> | ||
17 | + <meta name="apple-mobile-web-app-status-bar-style" content="black"> | ||
18 | + <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png"> | ||
19 | + <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon"> | ||
20 | + | ||
21 | + <link rel="stylesheet" href="../../gitbook/style.css"> | ||
22 | + | ||
23 | + | ||
24 | + <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-highlight/website.css"> | ||
25 | + | ||
26 | + | ||
27 | + | ||
28 | + <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-search/search.css"> | ||
29 | + | ||
30 | + | ||
31 | + | ||
32 | + <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-fontsettings/website.css"> | ||
33 | + | ||
34 | + | ||
35 | + | ||
36 | + | ||
37 | + | ||
38 | + | ||
39 | + | ||
40 | + | ||
41 | + <link rel="prev" href="../../Thinkphp/Others/functions.html" /> | ||
42 | + | ||
43 | + | ||
44 | + | ||
45 | + </head> | ||
46 | + <body> | ||
47 | + | ||
48 | + | ||
49 | + <div class="book" | ||
50 | + data-level="1.6.2" | ||
51 | + data-chapter-title="EVShop中备用代码片段" | ||
52 | + data-filepath="Thinkphp/Others/UsefulCodes.md" | ||
53 | + data-basepath="../.." | ||
54 | + data-revision="Wed May 11 2016 00:54:11 GMT+0800 (中国标准时间)" | ||
55 | + data-innerlanguage=""> | ||
56 | + | ||
57 | + | ||
58 | +<div class="book-summary"> | ||
59 | + <nav role="navigation"> | ||
60 | + <ul class="summary"> | ||
61 | + | ||
62 | + | ||
63 | + | ||
64 | + | ||
65 | + | ||
66 | + | ||
67 | + | ||
68 | + | ||
69 | + | ||
70 | + <li class="chapter " data-level="0" data-path="index.html"> | ||
71 | + | ||
72 | + | ||
73 | + <a href="../../index.html"> | ||
74 | + | ||
75 | + <i class="fa fa-check"></i> | ||
76 | + | ||
77 | + 简介 | ||
78 | + </a> | ||
79 | + | ||
80 | + | ||
81 | + </li> | ||
82 | + | ||
83 | + <li class="chapter " data-level="1" > | ||
84 | + | ||
85 | + <span><b>1.</b> Thinkphp</span> | ||
86 | + | ||
87 | + | ||
88 | + <ul class="articles"> | ||
89 | + | ||
90 | + | ||
91 | + <li class="chapter " data-level="1.1" > | ||
92 | + | ||
93 | + <span><b>1.1.</b> Structure</span> | ||
94 | + | ||
95 | + | ||
96 | + <ul class="articles"> | ||
97 | + | ||
98 | + | ||
99 | + <li class="chapter " data-level="1.1.1" data-path="Thinkphp/Structure/evshop_structure.html"> | ||
100 | + | ||
101 | + | ||
102 | + <a href="../../Thinkphp/Structure/evshop_structure.html"> | ||
103 | + | ||
104 | + <i class="fa fa-check"></i> | ||
105 | + | ||
106 | + <b>1.1.1.</b> | ||
107 | + | ||
108 | + EVShop框架结构图 | ||
109 | + </a> | ||
110 | + | ||
111 | + | ||
112 | + </li> | ||
113 | + | ||
114 | + | ||
115 | + </ul> | ||
116 | + | ||
117 | + </li> | ||
118 | + | ||
119 | + <li class="chapter " data-level="1.2" > | ||
120 | + | ||
121 | + <span><b>1.2.</b> Controller</span> | ||
122 | + | ||
123 | + | ||
124 | + <ul class="articles"> | ||
125 | + | ||
126 | + | ||
127 | + <li class="chapter " data-level="1.2.1" data-path="Thinkphp/Controller/evshop_controller.html"> | ||
128 | + | ||
129 | + | ||
130 | + <a href="../../Thinkphp/Controller/evshop_controller.html"> | ||
131 | + | ||
132 | + <i class="fa fa-check"></i> | ||
133 | + | ||
134 | + <b>1.2.1.</b> | ||
135 | + | ||
136 | + EVShop之Controller篇 | ||
137 | + </a> | ||
138 | + | ||
139 | + | ||
140 | + </li> | ||
141 | + | ||
142 | + | ||
143 | + </ul> | ||
144 | + | ||
145 | + </li> | ||
146 | + | ||
147 | + <li class="chapter " data-level="1.3" > | ||
148 | + | ||
149 | + <span><b>1.3.</b> View</span> | ||
150 | + | ||
151 | + | ||
152 | + <ul class="articles"> | ||
153 | + | ||
154 | + | ||
155 | + <li class="chapter " data-level="1.3.1" data-path="Thinkphp/View/evshop_view.html"> | ||
156 | + | ||
157 | + | ||
158 | + <a href="../../Thinkphp/View/evshop_view.html"> | ||
159 | + | ||
160 | + <i class="fa fa-check"></i> | ||
161 | + | ||
162 | + <b>1.3.1.</b> | ||
163 | + | ||
164 | + EVShop之View篇 | ||
165 | + </a> | ||
166 | + | ||
167 | + | ||
168 | + </li> | ||
169 | + | ||
170 | + | ||
171 | + </ul> | ||
172 | + | ||
173 | + </li> | ||
174 | + | ||
175 | + <li class="chapter " data-level="1.4" > | ||
176 | + | ||
177 | + <span><b>1.4.</b> Javascript</span> | ||
178 | + | ||
179 | + | ||
180 | + <ul class="articles"> | ||
181 | + | ||
182 | + | ||
183 | + <li class="chapter " data-level="1.4.1" data-path="Thinkphp/Javascript/evshop_dialog.html"> | ||
184 | + | ||
185 | + | ||
186 | + <a href="../../Thinkphp/Javascript/evshop_dialog.html"> | ||
187 | + | ||
188 | + <i class="fa fa-check"></i> | ||
189 | + | ||
190 | + <b>1.4.1.</b> | ||
191 | + | ||
192 | + EVShop之Dialog篇 | ||
193 | + </a> | ||
194 | + | ||
195 | + | ||
196 | + </li> | ||
197 | + | ||
198 | + <li class="chapter " data-level="1.4.2" data-path="Thinkphp/Javascript/evshop_js.html"> | ||
199 | + | ||
200 | + | ||
201 | + <a href="../../Thinkphp/Javascript/evshop_js.html"> | ||
202 | + | ||
203 | + <i class="fa fa-check"></i> | ||
204 | + | ||
205 | + <b>1.4.2.</b> | ||
206 | + | ||
207 | + EVShop之Javascript篇 | ||
208 | + </a> | ||
209 | + | ||
210 | + | ||
211 | + </li> | ||
212 | + | ||
213 | + | ||
214 | + </ul> | ||
215 | + | ||
216 | + </li> | ||
217 | + | ||
218 | + <li class="chapter " data-level="1.5" > | ||
219 | + | ||
220 | + <span><b>1.5.</b> DB</span> | ||
221 | + | ||
222 | + | ||
223 | + <ul class="articles"> | ||
224 | + | ||
225 | + | ||
226 | + <li class="chapter " data-level="1.5.1" data-path="Thinkphp/DB/db_sqls.html"> | ||
227 | + | ||
228 | + | ||
229 | + <a href="../../Thinkphp/DB/db_sqls.html"> | ||
230 | + | ||
231 | + <i class="fa fa-check"></i> | ||
232 | + | ||
233 | + <b>1.5.1.</b> | ||
234 | + | ||
235 | + Thinkphp中SQL的写法 | ||
236 | + </a> | ||
237 | + | ||
238 | + | ||
239 | + </li> | ||
240 | + | ||
241 | + | ||
242 | + </ul> | ||
243 | + | ||
244 | + </li> | ||
245 | + | ||
246 | + <li class="chapter " data-level="1.6" > | ||
247 | + | ||
248 | + <span><b>1.6.</b> Others</span> | ||
249 | + | ||
250 | + | ||
251 | + <ul class="articles"> | ||
252 | + | ||
253 | + | ||
254 | + <li class="chapter " data-level="1.6.1" data-path="Thinkphp/Others/functions.html"> | ||
255 | + | ||
256 | + | ||
257 | + <a href="../../Thinkphp/Others/functions.html"> | ||
258 | + | ||
259 | + <i class="fa fa-check"></i> | ||
260 | + | ||
261 | + <b>1.6.1.</b> | ||
262 | + | ||
263 | + Thinkphp中常用功能 | ||
264 | + </a> | ||
265 | + | ||
266 | + | ||
267 | + </li> | ||
268 | + | ||
269 | + <li class="chapter active" data-level="1.6.2" data-path="Thinkphp/Others/UsefulCodes.html"> | ||
270 | + | ||
271 | + | ||
272 | + <a href="../../Thinkphp/Others/UsefulCodes.html"> | ||
273 | + | ||
274 | + <i class="fa fa-check"></i> | ||
275 | + | ||
276 | + <b>1.6.2.</b> | ||
277 | + | ||
278 | + EVShop中备用代码片段 | ||
279 | + </a> | ||
280 | + | ||
281 | + | ||
282 | + </li> | ||
283 | + | ||
284 | + | ||
285 | + </ul> | ||
286 | + | ||
287 | + </li> | ||
288 | + | ||
289 | + | ||
290 | + </ul> | ||
291 | + | ||
292 | + </li> | ||
293 | + | ||
294 | + | ||
295 | + | ||
296 | + | ||
297 | + <li class="divider"></li> | ||
298 | + <li> | ||
299 | + <a href="https://www.gitbook.com" target="blank" class="gitbook-link"> | ||
300 | + Published with GitBook | ||
301 | + </a> | ||
302 | + </li> | ||
303 | + | ||
304 | + </ul> | ||
305 | + </nav> | ||
306 | +</div> | ||
307 | + | ||
308 | + <div class="book-body"> | ||
309 | + <div class="body-inner"> | ||
310 | + <div class="book-header" role="navigation"> | ||
311 | + <!-- Actions Left --> | ||
312 | + | ||
313 | + | ||
314 | + <!-- Title --> | ||
315 | + <h1> | ||
316 | + <i class="fa fa-circle-o-notch fa-spin"></i> | ||
317 | + <a href="../../" >Introduction</a> | ||
318 | + </h1> | ||
319 | +</div> | ||
320 | + | ||
321 | + <div class="page-wrapper" tabindex="-1" role="main"> | ||
322 | + <div class="page-inner"> | ||
323 | + | ||
324 | + | ||
325 | + <section class="normal" id="section-"> | ||
326 | + | ||
327 | + <h1 id="evshop中备用代码片段">EVShop中备用代码片段</h1> | ||
328 | +<blockquote> | ||
329 | +<p>此文件记录了Evshop实现过程中的一些经常被使用到的代码。 | ||
330 | +记录于此,需要时以备查询。</p> | ||
331 | +</blockquote> | ||
332 | + | ||
333 | + | ||
334 | + </section> | ||
335 | + | ||
336 | + | ||
337 | + </div> | ||
338 | + </div> | ||
339 | + </div> | ||
340 | + | ||
341 | + | ||
342 | + <a href="../../Thinkphp/Others/functions.html" class="navigation navigation-prev navigation-unique" aria-label="Previous page: Thinkphp中常用功能"><i class="fa fa-angle-left"></i></a> | ||
343 | + | ||
344 | + | ||
345 | + </div> | ||
346 | +</div> | ||
347 | + | ||
348 | + | ||
349 | +<script src="../../gitbook/app.js"></script> | ||
350 | + | ||
351 | + | ||
352 | + <script src="../../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script> | ||
353 | + | ||
354 | + | ||
355 | + | ||
356 | + <script src="../../gitbook/plugins/gitbook-plugin-search/search.js"></script> | ||
357 | + | ||
358 | + | ||
359 | + | ||
360 | + <script src="../../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script> | ||
361 | + | ||
362 | + | ||
363 | + | ||
364 | + <script src="../../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script> | ||
365 | + | ||
366 | + | ||
367 | +<script> | ||
368 | +require(["gitbook"], function(gitbook) { | ||
369 | + var config = {"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2}}; | ||
370 | + gitbook.start(config); | ||
371 | +}); | ||
372 | +</script> | ||
373 | + | ||
374 | + | ||
375 | + </body> | ||
376 | + | ||
377 | +</html> |
1 | +<!DOCTYPE HTML> | ||
2 | +<html lang="en" > | ||
3 | + | ||
4 | + <head> | ||
5 | + | ||
6 | + <meta charset="UTF-8"> | ||
7 | + <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
8 | + <title>Thinkphp中常用功能 | Introduction</title> | ||
9 | + <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> | ||
10 | + <meta name="description" content=""> | ||
11 | + <meta name="generator" content="GitBook 2.6.7"> | ||
12 | + | ||
13 | + | ||
14 | + <meta name="HandheldFriendly" content="true"/> | ||
15 | + <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> | ||
16 | + <meta name="apple-mobile-web-app-capable" content="yes"> | ||
17 | + <meta name="apple-mobile-web-app-status-bar-style" content="black"> | ||
18 | + <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png"> | ||
19 | + <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon"> | ||
20 | + | ||
21 | + <link rel="stylesheet" href="../../gitbook/style.css"> | ||
22 | + | ||
23 | + | ||
24 | + <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-highlight/website.css"> | ||
25 | + | ||
26 | + | ||
27 | + | ||
28 | + <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-search/search.css"> | ||
29 | + | ||
30 | + | ||
31 | + | ||
32 | + <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-fontsettings/website.css"> | ||
33 | + | ||
34 | + | ||
35 | + | ||
36 | + | ||
37 | + | ||
38 | + | ||
39 | + | ||
40 | + <link rel="next" href="../../Thinkphp/Others/UsefulCodes.html" /> | ||
41 | + | ||
42 | + | ||
43 | + <link rel="prev" href="../../Thinkphp/DB/db_sqls.html" /> | ||
44 | + | ||
45 | + | ||
46 | + | ||
47 | + </head> | ||
48 | + <body> | ||
49 | + | ||
50 | + | ||
51 | + <div class="book" | ||
52 | + data-level="1.6.1" | ||
53 | + data-chapter-title="Thinkphp中常用功能" | ||
54 | + data-filepath="Thinkphp/Others/functions.md" | ||
55 | + data-basepath="../.." | ||
56 | + data-revision="Wed May 11 2016 00:54:11 GMT+0800 (中国标准时间)" | ||
57 | + data-innerlanguage=""> | ||
58 | + | ||
59 | + | ||
60 | +<div class="book-summary"> | ||
61 | + <nav role="navigation"> | ||
62 | + <ul class="summary"> | ||
63 | + | ||
64 | + | ||
65 | + | ||
66 | + | ||
67 | + | ||
68 | + | ||
69 | + | ||
70 | + | ||
71 | + | ||
72 | + <li class="chapter " data-level="0" data-path="index.html"> | ||
73 | + | ||
74 | + | ||
75 | + <a href="../../index.html"> | ||
76 | + | ||
77 | + <i class="fa fa-check"></i> | ||
78 | + | ||
79 | + 简介 | ||
80 | + </a> | ||
81 | + | ||
82 | + | ||
83 | + </li> | ||
84 | + | ||
85 | + <li class="chapter " data-level="1" > | ||
86 | + | ||
87 | + <span><b>1.</b> Thinkphp</span> | ||
88 | + | ||
89 | + | ||
90 | + <ul class="articles"> | ||
91 | + | ||
92 | + | ||
93 | + <li class="chapter " data-level="1.1" > | ||
94 | + | ||
95 | + <span><b>1.1.</b> Structure</span> | ||
96 | + | ||
97 | + | ||
98 | + <ul class="articles"> | ||
99 | + | ||
100 | + | ||
101 | + <li class="chapter " data-level="1.1.1" data-path="Thinkphp/Structure/evshop_structure.html"> | ||
102 | + | ||
103 | + | ||
104 | + <a href="../../Thinkphp/Structure/evshop_structure.html"> | ||
105 | + | ||
106 | + <i class="fa fa-check"></i> | ||
107 | + | ||
108 | + <b>1.1.1.</b> | ||
109 | + | ||
110 | + EVShop框架结构图 | ||
111 | + </a> | ||
112 | + | ||
113 | + | ||
114 | + </li> | ||
115 | + | ||
116 | + | ||
117 | + </ul> | ||
118 | + | ||
119 | + </li> | ||
120 | + | ||
121 | + <li class="chapter " data-level="1.2" > | ||
122 | + | ||
123 | + <span><b>1.2.</b> Controller</span> | ||
124 | + | ||
125 | + | ||
126 | + <ul class="articles"> | ||
127 | + | ||
128 | + | ||
129 | + <li class="chapter " data-level="1.2.1" data-path="Thinkphp/Controller/evshop_controller.html"> | ||
130 | + | ||
131 | + | ||
132 | + <a href="../../Thinkphp/Controller/evshop_controller.html"> | ||
133 | + | ||
134 | + <i class="fa fa-check"></i> | ||
135 | + | ||
136 | + <b>1.2.1.</b> | ||
137 | + | ||
138 | + EVShop之Controller篇 | ||
139 | + </a> | ||
140 | + | ||
141 | + | ||
142 | + </li> | ||
143 | + | ||
144 | + | ||
145 | + </ul> | ||
146 | + | ||
147 | + </li> | ||
148 | + | ||
149 | + <li class="chapter " data-level="1.3" > | ||
150 | + | ||
151 | + <span><b>1.3.</b> View</span> | ||
152 | + | ||
153 | + | ||
154 | + <ul class="articles"> | ||
155 | + | ||
156 | + | ||
157 | + <li class="chapter " data-level="1.3.1" data-path="Thinkphp/View/evshop_view.html"> | ||
158 | + | ||
159 | + | ||
160 | + <a href="../../Thinkphp/View/evshop_view.html"> | ||
161 | + | ||
162 | + <i class="fa fa-check"></i> | ||
163 | + | ||
164 | + <b>1.3.1.</b> | ||
165 | + | ||
166 | + EVShop之View篇 | ||
167 | + </a> | ||
168 | + | ||
169 | + | ||
170 | + </li> | ||
171 | + | ||
172 | + | ||
173 | + </ul> | ||
174 | + | ||
175 | + </li> | ||
176 | + | ||
177 | + <li class="chapter " data-level="1.4" > | ||
178 | + | ||
179 | + <span><b>1.4.</b> Javascript</span> | ||
180 | + | ||
181 | + | ||
182 | + <ul class="articles"> | ||
183 | + | ||
184 | + | ||
185 | + <li class="chapter " data-level="1.4.1" data-path="Thinkphp/Javascript/evshop_dialog.html"> | ||
186 | + | ||
187 | + | ||
188 | + <a href="../../Thinkphp/Javascript/evshop_dialog.html"> | ||
189 | + | ||
190 | + <i class="fa fa-check"></i> | ||
191 | + | ||
192 | + <b>1.4.1.</b> | ||
193 | + | ||
194 | + EVShop之Dialog篇 | ||
195 | + </a> | ||
196 | + | ||
197 | + | ||
198 | + </li> | ||
199 | + | ||
200 | + <li class="chapter " data-level="1.4.2" data-path="Thinkphp/Javascript/evshop_js.html"> | ||
201 | + | ||
202 | + | ||
203 | + <a href="../../Thinkphp/Javascript/evshop_js.html"> | ||
204 | + | ||
205 | + <i class="fa fa-check"></i> | ||
206 | + | ||
207 | + <b>1.4.2.</b> | ||
208 | + | ||
209 | + EVShop之Javascript篇 | ||
210 | + </a> | ||
211 | + | ||
212 | + | ||
213 | + </li> | ||
214 | + | ||
215 | + | ||
216 | + </ul> | ||
217 | + | ||
218 | + </li> | ||
219 | + | ||
220 | + <li class="chapter " data-level="1.5" > | ||
221 | + | ||
222 | + <span><b>1.5.</b> DB</span> | ||
223 | + | ||
224 | + | ||
225 | + <ul class="articles"> | ||
226 | + | ||
227 | + | ||
228 | + <li class="chapter " data-level="1.5.1" data-path="Thinkphp/DB/db_sqls.html"> | ||
229 | + | ||
230 | + | ||
231 | + <a href="../../Thinkphp/DB/db_sqls.html"> | ||
232 | + | ||
233 | + <i class="fa fa-check"></i> | ||
234 | + | ||
235 | + <b>1.5.1.</b> | ||
236 | + | ||
237 | + Thinkphp中SQL的写法 | ||
238 | + </a> | ||
239 | + | ||
240 | + | ||
241 | + </li> | ||
242 | + | ||
243 | + | ||
244 | + </ul> | ||
245 | + | ||
246 | + </li> | ||
247 | + | ||
248 | + <li class="chapter " data-level="1.6" > | ||
249 | + | ||
250 | + <span><b>1.6.</b> Others</span> | ||
251 | + | ||
252 | + | ||
253 | + <ul class="articles"> | ||
254 | + | ||
255 | + | ||
256 | + <li class="chapter active" data-level="1.6.1" data-path="Thinkphp/Others/functions.html"> | ||
257 | + | ||
258 | + | ||
259 | + <a href="../../Thinkphp/Others/functions.html"> | ||
260 | + | ||
261 | + <i class="fa fa-check"></i> | ||
262 | + | ||
263 | + <b>1.6.1.</b> | ||
264 | + | ||
265 | + Thinkphp中常用功能 | ||
266 | + </a> | ||
267 | + | ||
268 | + | ||
269 | + </li> | ||
270 | + | ||
271 | + <li class="chapter " data-level="1.6.2" data-path="Thinkphp/Others/UsefulCodes.html"> | ||
272 | + | ||
273 | + | ||
274 | + <a href="../../Thinkphp/Others/UsefulCodes.html"> | ||
275 | + | ||
276 | + <i class="fa fa-check"></i> | ||
277 | + | ||
278 | + <b>1.6.2.</b> | ||
279 | + | ||
280 | + EVShop中备用代码片段 | ||
281 | + </a> | ||
282 | + | ||
283 | + | ||
284 | + </li> | ||
285 | + | ||
286 | + | ||
287 | + </ul> | ||
288 | + | ||
289 | + </li> | ||
290 | + | ||
291 | + | ||
292 | + </ul> | ||
293 | + | ||
294 | + </li> | ||
295 | + | ||
296 | + | ||
297 | + | ||
298 | + | ||
299 | + <li class="divider"></li> | ||
300 | + <li> | ||
301 | + <a href="https://www.gitbook.com" target="blank" class="gitbook-link"> | ||
302 | + Published with GitBook | ||
303 | + </a> | ||
304 | + </li> | ||
305 | + | ||
306 | + </ul> | ||
307 | + </nav> | ||
308 | +</div> | ||
309 | + | ||
310 | + <div class="book-body"> | ||
311 | + <div class="body-inner"> | ||
312 | + <div class="book-header" role="navigation"> | ||
313 | + <!-- Actions Left --> | ||
314 | + | ||
315 | + | ||
316 | + <!-- Title --> | ||
317 | + <h1> | ||
318 | + <i class="fa fa-circle-o-notch fa-spin"></i> | ||
319 | + <a href="../../" >Introduction</a> | ||
320 | + </h1> | ||
321 | +</div> | ||
322 | + | ||
323 | + <div class="page-wrapper" tabindex="-1" role="main"> | ||
324 | + <div class="page-inner"> | ||
325 | + | ||
326 | + | ||
327 | + <section class="normal" id="section-"> | ||
328 | + | ||
329 | + <h1 id="thinkphp中一些常用功能">Thinkphp中一些常用功能</h1> | ||
330 | +<h3 id="1-加入验证码功能">1. 加入验证码功能</h3> | ||
331 | +<p>Think\Verify类可以支持验证码的生成和验证功能。</p> | ||
332 | +<blockquote> | ||
333 | +<p>参考:<a href="http://document.thinkphp.cn/manual_3_2.html#verify" target="_blank">Thinkphp验证码</a></p> | ||
334 | +</blockquote> | ||
335 | +<p>下面是最简单的方式生成验证码:</p> | ||
336 | +<pre><code>$Verify = new \Think\Verify(); | ||
337 | +$Verify->entry(); | ||
338 | +</code></pre><hr> | ||
339 | +<h3 id="2-文件上传后台">2. 文件上传(后台)</h3> | ||
340 | +<pre><code>use Library\UploadFile; | ||
341 | +if (!empty($_FILES['group_logo']['name'])){ | ||
342 | + $upload = new UploadFile(); | ||
343 | + $upload->set('default_dir',ATTACH_COMMON); | ||
344 | + $upload->set('file_name','category-pic-'.$newClassId.'.jpg'); | ||
345 | + $upload->set('ifremove',false); | ||
346 | + $upload->set('fprefix','fprefix'); | ||
347 | + $upload->set('ext','ext'); | ||
348 | + if ($result){ | ||
349 | + $this->success("上传图片成功"); | ||
350 | + }else { | ||
351 | + $this->error("上传图片失败"); | ||
352 | + } | ||
353 | +} | ||
354 | +</code></pre><hr> | ||
355 | +<h3 id="3-图像处理">3. 图像处理</h3> | ||
356 | +<p>Todo : write here</p> | ||
357 | +<hr> | ||
358 | +<h3 id="4-ip获取">4. IP获取</h3> | ||
359 | +<p>内置了get_client_ip方法用于获取客户端的IP地址</p> | ||
360 | +<ul> | ||
361 | +<li>获取IP示例: | ||
362 | +<code>$ip = get_client_ip();</code></li> | ||
363 | +<li>IP定位示例:<pre><code>$Ip = new \Org\Net\IpLocation('UTFWry.dat'); // 实例化类 参数表示IP地址库文件 | ||
364 | +$area = $Ip->getlocation('203.34.5.66'); // 获取某个IP地址所在的位置 | ||
365 | +</code></pre></li> | ||
366 | +</ul> | ||
367 | +<hr> | ||
368 | +<h3 id="5-字符转换成二维码">5. 字符转换成二维码</h3> | ||
369 | +<p>生成带有LOGO的二维码,可以参考:</p> | ||
370 | +<blockquote> | ||
371 | +<p>参考: <a href="http://www.cnblogs.com/txw1958/p/phpqrcode.html" target="_blank">带有LOGO二维码</a></p> | ||
372 | +</blockquote> | ||
373 | +<p>二维码转换实现:</p> | ||
374 | +<pre><code>use Library\QRcode; | ||
375 | +include_once '/app/Library/phpqrcode.php'; | ||
376 | + | ||
377 | +$test="http://www.evate-soft.com/"; | ||
378 | +$filename = "baidu.png"; | ||
379 | +$level='L'; | ||
380 | +$size = '6'; | ||
381 | +$margin=4; | ||
382 | +QRcode::png($test, false, $level, $size, $margin); | ||
383 | +</code></pre> | ||
384 | + | ||
385 | + </section> | ||
386 | + | ||
387 | + | ||
388 | + </div> | ||
389 | + </div> | ||
390 | + </div> | ||
391 | + | ||
392 | + | ||
393 | + <a href="../../Thinkphp/DB/db_sqls.html" class="navigation navigation-prev " aria-label="Previous page: Thinkphp中SQL的写法"><i class="fa fa-angle-left"></i></a> | ||
394 | + | ||
395 | + | ||
396 | + <a href="../../Thinkphp/Others/UsefulCodes.html" class="navigation navigation-next " aria-label="Next page: EVShop中备用代码片段"><i class="fa fa-angle-right"></i></a> | ||
397 | + | ||
398 | + </div> | ||
399 | +</div> | ||
400 | + | ||
401 | + | ||
402 | +<script src="../../gitbook/app.js"></script> | ||
403 | + | ||
404 | + | ||
405 | + <script src="../../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script> | ||
406 | + | ||
407 | + | ||
408 | + | ||
409 | + <script src="../../gitbook/plugins/gitbook-plugin-search/search.js"></script> | ||
410 | + | ||
411 | + | ||
412 | + | ||
413 | + <script src="../../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script> | ||
414 | + | ||
415 | + | ||
416 | + | ||
417 | + <script src="../../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script> | ||
418 | + | ||
419 | + | ||
420 | +<script> | ||
421 | +require(["gitbook"], function(gitbook) { | ||
422 | + var config = {"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2}}; | ||
423 | + gitbook.start(config); | ||
424 | +}); | ||
425 | +</script> | ||
426 | + | ||
427 | + | ||
428 | + </body> | ||
429 | + | ||
430 | +</html> |
1 | +<!DOCTYPE HTML> | ||
2 | +<html lang="en" > | ||
3 | + | ||
4 | + <head> | ||
5 | + | ||
6 | + <meta charset="UTF-8"> | ||
7 | + <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
8 | + <title>EVShop框架结构图 | Introduction</title> | ||
9 | + <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> | ||
10 | + <meta name="description" content=""> | ||
11 | + <meta name="generator" content="GitBook 2.6.7"> | ||
12 | + | ||
13 | + | ||
14 | + <meta name="HandheldFriendly" content="true"/> | ||
15 | + <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> | ||
16 | + <meta name="apple-mobile-web-app-capable" content="yes"> | ||
17 | + <meta name="apple-mobile-web-app-status-bar-style" content="black"> | ||
18 | + <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png"> | ||
19 | + <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon"> | ||
20 | + | ||
21 | + <link rel="stylesheet" href="../../gitbook/style.css"> | ||
22 | + | ||
23 | + | ||
24 | + <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-highlight/website.css"> | ||
25 | + | ||
26 | + | ||
27 | + | ||
28 | + <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-search/search.css"> | ||
29 | + | ||
30 | + | ||
31 | + | ||
32 | + <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-fontsettings/website.css"> | ||
33 | + | ||
34 | + | ||
35 | + | ||
36 | + | ||
37 | + | ||
38 | + | ||
39 | + | ||
40 | + <link rel="next" href="../../Thinkphp/Controller/evshop_controller.html" /> | ||
41 | + | ||
42 | + | ||
43 | + <link rel="prev" href="../../index.html" /> | ||
44 | + | ||
45 | + | ||
46 | + | ||
47 | + </head> | ||
48 | + <body> | ||
49 | + | ||
50 | + | ||
51 | + <div class="book" | ||
52 | + data-level="1.1.1" | ||
53 | + data-chapter-title="EVShop框架结构图" | ||
54 | + data-filepath="Thinkphp/Structure/evshop_structure.md" | ||
55 | + data-basepath="../.." | ||
56 | + data-revision="Wed May 11 2016 00:54:11 GMT+0800 (中国标准时间)" | ||
57 | + data-innerlanguage=""> | ||
58 | + | ||
59 | + | ||
60 | +<div class="book-summary"> | ||
61 | + <nav role="navigation"> | ||
62 | + <ul class="summary"> | ||
63 | + | ||
64 | + | ||
65 | + | ||
66 | + | ||
67 | + | ||
68 | + | ||
69 | + | ||
70 | + | ||
71 | + | ||
72 | + <li class="chapter " data-level="0" data-path="index.html"> | ||
73 | + | ||
74 | + | ||
75 | + <a href="../../index.html"> | ||
76 | + | ||
77 | + <i class="fa fa-check"></i> | ||
78 | + | ||
79 | + 简介 | ||
80 | + </a> | ||
81 | + | ||
82 | + | ||
83 | + </li> | ||
84 | + | ||
85 | + <li class="chapter " data-level="1" > | ||
86 | + | ||
87 | + <span><b>1.</b> Thinkphp</span> | ||
88 | + | ||
89 | + | ||
90 | + <ul class="articles"> | ||
91 | + | ||
92 | + | ||
93 | + <li class="chapter " data-level="1.1" > | ||
94 | + | ||
95 | + <span><b>1.1.</b> Structure</span> | ||
96 | + | ||
97 | + | ||
98 | + <ul class="articles"> | ||
99 | + | ||
100 | + | ||
101 | + <li class="chapter active" data-level="1.1.1" data-path="Thinkphp/Structure/evshop_structure.html"> | ||
102 | + | ||
103 | + | ||
104 | + <a href="../../Thinkphp/Structure/evshop_structure.html"> | ||
105 | + | ||
106 | + <i class="fa fa-check"></i> | ||
107 | + | ||
108 | + <b>1.1.1.</b> | ||
109 | + | ||
110 | + EVShop框架结构图 | ||
111 | + </a> | ||
112 | + | ||
113 | + | ||
114 | + </li> | ||
115 | + | ||
116 | + | ||
117 | + </ul> | ||
118 | + | ||
119 | + </li> | ||
120 | + | ||
121 | + <li class="chapter " data-level="1.2" > | ||
122 | + | ||
123 | + <span><b>1.2.</b> Controller</span> | ||
124 | + | ||
125 | + | ||
126 | + <ul class="articles"> | ||
127 | + | ||
128 | + | ||
129 | + <li class="chapter " data-level="1.2.1" data-path="Thinkphp/Controller/evshop_controller.html"> | ||
130 | + | ||
131 | + | ||
132 | + <a href="../../Thinkphp/Controller/evshop_controller.html"> | ||
133 | + | ||
134 | + <i class="fa fa-check"></i> | ||
135 | + | ||
136 | + <b>1.2.1.</b> | ||
137 | + | ||
138 | + EVShop之Controller篇 | ||
139 | + </a> | ||
140 | + | ||
141 | + | ||
142 | + </li> | ||
143 | + | ||
144 | + | ||
145 | + </ul> | ||
146 | + | ||
147 | + </li> | ||
148 | + | ||
149 | + <li class="chapter " data-level="1.3" > | ||
150 | + | ||
151 | + <span><b>1.3.</b> View</span> | ||
152 | + | ||
153 | + | ||
154 | + <ul class="articles"> | ||
155 | + | ||
156 | + | ||
157 | + <li class="chapter " data-level="1.3.1" data-path="Thinkphp/View/evshop_view.html"> | ||
158 | + | ||
159 | + | ||
160 | + <a href="../../Thinkphp/View/evshop_view.html"> | ||
161 | + | ||
162 | + <i class="fa fa-check"></i> | ||
163 | + | ||
164 | + <b>1.3.1.</b> | ||
165 | + | ||
166 | + EVShop之View篇 | ||
167 | + </a> | ||
168 | + | ||
169 | + | ||
170 | + </li> | ||
171 | + | ||
172 | + | ||
173 | + </ul> | ||
174 | + | ||
175 | + </li> | ||
176 | + | ||
177 | + <li class="chapter " data-level="1.4" > | ||
178 | + | ||
179 | + <span><b>1.4.</b> Javascript</span> | ||
180 | + | ||
181 | + | ||
182 | + <ul class="articles"> | ||
183 | + | ||
184 | + | ||
185 | + <li class="chapter " data-level="1.4.1" data-path="Thinkphp/Javascript/evshop_dialog.html"> | ||
186 | + | ||
187 | + | ||
188 | + <a href="../../Thinkphp/Javascript/evshop_dialog.html"> | ||
189 | + | ||
190 | + <i class="fa fa-check"></i> | ||
191 | + | ||
192 | + <b>1.4.1.</b> | ||
193 | + | ||
194 | + EVShop之Dialog篇 | ||
195 | + </a> | ||
196 | + | ||
197 | + | ||
198 | + </li> | ||
199 | + | ||
200 | + <li class="chapter " data-level="1.4.2" data-path="Thinkphp/Javascript/evshop_js.html"> | ||
201 | + | ||
202 | + | ||
203 | + <a href="../../Thinkphp/Javascript/evshop_js.html"> | ||
204 | + | ||
205 | + <i class="fa fa-check"></i> | ||
206 | + | ||
207 | + <b>1.4.2.</b> | ||
208 | + | ||
209 | + EVShop之Javascript篇 | ||
210 | + </a> | ||
211 | + | ||
212 | + | ||
213 | + </li> | ||
214 | + | ||
215 | + | ||
216 | + </ul> | ||
217 | + | ||
218 | + </li> | ||
219 | + | ||
220 | + <li class="chapter " data-level="1.5" > | ||
221 | + | ||
222 | + <span><b>1.5.</b> DB</span> | ||
223 | + | ||
224 | + | ||
225 | + <ul class="articles"> | ||
226 | + | ||
227 | + | ||
228 | + <li class="chapter " data-level="1.5.1" data-path="Thinkphp/DB/db_sqls.html"> | ||
229 | + | ||
230 | + | ||
231 | + <a href="../../Thinkphp/DB/db_sqls.html"> | ||
232 | + | ||
233 | + <i class="fa fa-check"></i> | ||
234 | + | ||
235 | + <b>1.5.1.</b> | ||
236 | + | ||
237 | + Thinkphp中SQL的写法 | ||
238 | + </a> | ||
239 | + | ||
240 | + | ||
241 | + </li> | ||
242 | + | ||
243 | + | ||
244 | + </ul> | ||
245 | + | ||
246 | + </li> | ||
247 | + | ||
248 | + <li class="chapter " data-level="1.6" > | ||
249 | + | ||
250 | + <span><b>1.6.</b> Others</span> | ||
251 | + | ||
252 | + | ||
253 | + <ul class="articles"> | ||
254 | + | ||
255 | + | ||
256 | + <li class="chapter " data-level="1.6.1" data-path="Thinkphp/Others/functions.html"> | ||
257 | + | ||
258 | + | ||
259 | + <a href="../../Thinkphp/Others/functions.html"> | ||
260 | + | ||
261 | + <i class="fa fa-check"></i> | ||
262 | + | ||
263 | + <b>1.6.1.</b> | ||
264 | + | ||
265 | + Thinkphp中常用功能 | ||
266 | + </a> | ||
267 | + | ||
268 | + | ||
269 | + </li> | ||
270 | + | ||
271 | + <li class="chapter " data-level="1.6.2" data-path="Thinkphp/Others/UsefulCodes.html"> | ||
272 | + | ||
273 | + | ||
274 | + <a href="../../Thinkphp/Others/UsefulCodes.html"> | ||
275 | + | ||
276 | + <i class="fa fa-check"></i> | ||
277 | + | ||
278 | + <b>1.6.2.</b> | ||
279 | + | ||
280 | + EVShop中备用代码片段 | ||
281 | + </a> | ||
282 | + | ||
283 | + | ||
284 | + </li> | ||
285 | + | ||
286 | + | ||
287 | + </ul> | ||
288 | + | ||
289 | + </li> | ||
290 | + | ||
291 | + | ||
292 | + </ul> | ||
293 | + | ||
294 | + </li> | ||
295 | + | ||
296 | + | ||
297 | + | ||
298 | + | ||
299 | + <li class="divider"></li> | ||
300 | + <li> | ||
301 | + <a href="https://www.gitbook.com" target="blank" class="gitbook-link"> | ||
302 | + Published with GitBook | ||
303 | + </a> | ||
304 | + </li> | ||
305 | + | ||
306 | + </ul> | ||
307 | + </nav> | ||
308 | +</div> | ||
309 | + | ||
310 | + <div class="book-body"> | ||
311 | + <div class="body-inner"> | ||
312 | + <div class="book-header" role="navigation"> | ||
313 | + <!-- Actions Left --> | ||
314 | + | ||
315 | + | ||
316 | + <!-- Title --> | ||
317 | + <h1> | ||
318 | + <i class="fa fa-circle-o-notch fa-spin"></i> | ||
319 | + <a href="../../" >Introduction</a> | ||
320 | + </h1> | ||
321 | +</div> | ||
322 | + | ||
323 | + <div class="page-wrapper" tabindex="-1" role="main"> | ||
324 | + <div class="page-inner"> | ||
325 | + | ||
326 | + | ||
327 | + <section class="normal" id="section-"> | ||
328 | + | ||
329 | + <h1 id="evshop程序框架整体结构图">EVShop程序框架整体结构图</h1> | ||
330 | +<blockquote> | ||
331 | +<p>待完成</p> | ||
332 | +</blockquote> | ||
333 | + | ||
334 | + | ||
335 | + </section> | ||
336 | + | ||
337 | + | ||
338 | + </div> | ||
339 | + </div> | ||
340 | + </div> | ||
341 | + | ||
342 | + | ||
343 | + <a href="../../index.html" class="navigation navigation-prev " aria-label="Previous page: 简介"><i class="fa fa-angle-left"></i></a> | ||
344 | + | ||
345 | + | ||
346 | + <a href="../../Thinkphp/Controller/evshop_controller.html" class="navigation navigation-next " aria-label="Next page: EVShop之Controller篇"><i class="fa fa-angle-right"></i></a> | ||
347 | + | ||
348 | + </div> | ||
349 | +</div> | ||
350 | + | ||
351 | + | ||
352 | +<script src="../../gitbook/app.js"></script> | ||
353 | + | ||
354 | + | ||
355 | + <script src="../../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script> | ||
356 | + | ||
357 | + | ||
358 | + | ||
359 | + <script src="../../gitbook/plugins/gitbook-plugin-search/search.js"></script> | ||
360 | + | ||
361 | + | ||
362 | + | ||
363 | + <script src="../../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script> | ||
364 | + | ||
365 | + | ||
366 | + | ||
367 | + <script src="../../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script> | ||
368 | + | ||
369 | + | ||
370 | +<script> | ||
371 | +require(["gitbook"], function(gitbook) { | ||
372 | + var config = {"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2}}; | ||
373 | + gitbook.start(config); | ||
374 | +}); | ||
375 | +</script> | ||
376 | + | ||
377 | + | ||
378 | + </body> | ||
379 | + | ||
380 | +</html> |
1 | +<!DOCTYPE HTML> | ||
2 | +<html lang="en" > | ||
3 | + | ||
4 | + <head> | ||
5 | + | ||
6 | + <meta charset="UTF-8"> | ||
7 | + <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
8 | + <title>EVShop之View篇 | Introduction</title> | ||
9 | + <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> | ||
10 | + <meta name="description" content=""> | ||
11 | + <meta name="generator" content="GitBook 2.6.7"> | ||
12 | + | ||
13 | + | ||
14 | + <meta name="HandheldFriendly" content="true"/> | ||
15 | + <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> | ||
16 | + <meta name="apple-mobile-web-app-capable" content="yes"> | ||
17 | + <meta name="apple-mobile-web-app-status-bar-style" content="black"> | ||
18 | + <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png"> | ||
19 | + <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon"> | ||
20 | + | ||
21 | + <link rel="stylesheet" href="../../gitbook/style.css"> | ||
22 | + | ||
23 | + | ||
24 | + <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-highlight/website.css"> | ||
25 | + | ||
26 | + | ||
27 | + | ||
28 | + <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-search/search.css"> | ||
29 | + | ||
30 | + | ||
31 | + | ||
32 | + <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-fontsettings/website.css"> | ||
33 | + | ||
34 | + | ||
35 | + | ||
36 | + | ||
37 | + | ||
38 | + | ||
39 | + | ||
40 | + <link rel="next" href="../../Thinkphp/Javascript/evshop_dialog.html" /> | ||
41 | + | ||
42 | + | ||
43 | + <link rel="prev" href="../../Thinkphp/Controller/evshop_controller.html" /> | ||
44 | + | ||
45 | + | ||
46 | + | ||
47 | + </head> | ||
48 | + <body> | ||
49 | + | ||
50 | + | ||
51 | + <div class="book" | ||
52 | + data-level="1.3.1" | ||
53 | + data-chapter-title="EVShop之View篇" | ||
54 | + data-filepath="Thinkphp/View/evshop_view.md" | ||
55 | + data-basepath="../.." | ||
56 | + data-revision="Wed May 11 2016 00:54:11 GMT+0800 (中国标准时间)" | ||
57 | + data-innerlanguage=""> | ||
58 | + | ||
59 | + | ||
60 | +<div class="book-summary"> | ||
61 | + <nav role="navigation"> | ||
62 | + <ul class="summary"> | ||
63 | + | ||
64 | + | ||
65 | + | ||
66 | + | ||
67 | + | ||
68 | + | ||
69 | + | ||
70 | + | ||
71 | + | ||
72 | + <li class="chapter " data-level="0" data-path="index.html"> | ||
73 | + | ||
74 | + | ||
75 | + <a href="../../index.html"> | ||
76 | + | ||
77 | + <i class="fa fa-check"></i> | ||
78 | + | ||
79 | + 简介 | ||
80 | + </a> | ||
81 | + | ||
82 | + | ||
83 | + </li> | ||
84 | + | ||
85 | + <li class="chapter " data-level="1" > | ||
86 | + | ||
87 | + <span><b>1.</b> Thinkphp</span> | ||
88 | + | ||
89 | + | ||
90 | + <ul class="articles"> | ||
91 | + | ||
92 | + | ||
93 | + <li class="chapter " data-level="1.1" > | ||
94 | + | ||
95 | + <span><b>1.1.</b> Structure</span> | ||
96 | + | ||
97 | + | ||
98 | + <ul class="articles"> | ||
99 | + | ||
100 | + | ||
101 | + <li class="chapter " data-level="1.1.1" data-path="Thinkphp/Structure/evshop_structure.html"> | ||
102 | + | ||
103 | + | ||
104 | + <a href="../../Thinkphp/Structure/evshop_structure.html"> | ||
105 | + | ||
106 | + <i class="fa fa-check"></i> | ||
107 | + | ||
108 | + <b>1.1.1.</b> | ||
109 | + | ||
110 | + EVShop框架结构图 | ||
111 | + </a> | ||
112 | + | ||
113 | + | ||
114 | + </li> | ||
115 | + | ||
116 | + | ||
117 | + </ul> | ||
118 | + | ||
119 | + </li> | ||
120 | + | ||
121 | + <li class="chapter " data-level="1.2" > | ||
122 | + | ||
123 | + <span><b>1.2.</b> Controller</span> | ||
124 | + | ||
125 | + | ||
126 | + <ul class="articles"> | ||
127 | + | ||
128 | + | ||
129 | + <li class="chapter " data-level="1.2.1" data-path="Thinkphp/Controller/evshop_controller.html"> | ||
130 | + | ||
131 | + | ||
132 | + <a href="../../Thinkphp/Controller/evshop_controller.html"> | ||
133 | + | ||
134 | + <i class="fa fa-check"></i> | ||
135 | + | ||
136 | + <b>1.2.1.</b> | ||
137 | + | ||
138 | + EVShop之Controller篇 | ||
139 | + </a> | ||
140 | + | ||
141 | + | ||
142 | + </li> | ||
143 | + | ||
144 | + | ||
145 | + </ul> | ||
146 | + | ||
147 | + </li> | ||
148 | + | ||
149 | + <li class="chapter " data-level="1.3" > | ||
150 | + | ||
151 | + <span><b>1.3.</b> View</span> | ||
152 | + | ||
153 | + | ||
154 | + <ul class="articles"> | ||
155 | + | ||
156 | + | ||
157 | + <li class="chapter active" data-level="1.3.1" data-path="Thinkphp/View/evshop_view.html"> | ||
158 | + | ||
159 | + | ||
160 | + <a href="../../Thinkphp/View/evshop_view.html"> | ||
161 | + | ||
162 | + <i class="fa fa-check"></i> | ||
163 | + | ||
164 | + <b>1.3.1.</b> | ||
165 | + | ||
166 | + EVShop之View篇 | ||
167 | + </a> | ||
168 | + | ||
169 | + | ||
170 | + </li> | ||
171 | + | ||
172 | + | ||
173 | + </ul> | ||
174 | + | ||
175 | + </li> | ||
176 | + | ||
177 | + <li class="chapter " data-level="1.4" > | ||
178 | + | ||
179 | + <span><b>1.4.</b> Javascript</span> | ||
180 | + | ||
181 | + | ||
182 | + <ul class="articles"> | ||
183 | + | ||
184 | + | ||
185 | + <li class="chapter " data-level="1.4.1" data-path="Thinkphp/Javascript/evshop_dialog.html"> | ||
186 | + | ||
187 | + | ||
188 | + <a href="../../Thinkphp/Javascript/evshop_dialog.html"> | ||
189 | + | ||
190 | + <i class="fa fa-check"></i> | ||
191 | + | ||
192 | + <b>1.4.1.</b> | ||
193 | + | ||
194 | + EVShop之Dialog篇 | ||
195 | + </a> | ||
196 | + | ||
197 | + | ||
198 | + </li> | ||
199 | + | ||
200 | + <li class="chapter " data-level="1.4.2" data-path="Thinkphp/Javascript/evshop_js.html"> | ||
201 | + | ||
202 | + | ||
203 | + <a href="../../Thinkphp/Javascript/evshop_js.html"> | ||
204 | + | ||
205 | + <i class="fa fa-check"></i> | ||
206 | + | ||
207 | + <b>1.4.2.</b> | ||
208 | + | ||
209 | + EVShop之Javascript篇 | ||
210 | + </a> | ||
211 | + | ||
212 | + | ||
213 | + </li> | ||
214 | + | ||
215 | + | ||
216 | + </ul> | ||
217 | + | ||
218 | + </li> | ||
219 | + | ||
220 | + <li class="chapter " data-level="1.5" > | ||
221 | + | ||
222 | + <span><b>1.5.</b> DB</span> | ||
223 | + | ||
224 | + | ||
225 | + <ul class="articles"> | ||
226 | + | ||
227 | + | ||
228 | + <li class="chapter " data-level="1.5.1" data-path="Thinkphp/DB/db_sqls.html"> | ||
229 | + | ||
230 | + | ||
231 | + <a href="../../Thinkphp/DB/db_sqls.html"> | ||
232 | + | ||
233 | + <i class="fa fa-check"></i> | ||
234 | + | ||
235 | + <b>1.5.1.</b> | ||
236 | + | ||
237 | + Thinkphp中SQL的写法 | ||
238 | + </a> | ||
239 | + | ||
240 | + | ||
241 | + </li> | ||
242 | + | ||
243 | + | ||
244 | + </ul> | ||
245 | + | ||
246 | + </li> | ||
247 | + | ||
248 | + <li class="chapter " data-level="1.6" > | ||
249 | + | ||
250 | + <span><b>1.6.</b> Others</span> | ||
251 | + | ||
252 | + | ||
253 | + <ul class="articles"> | ||
254 | + | ||
255 | + | ||
256 | + <li class="chapter " data-level="1.6.1" data-path="Thinkphp/Others/functions.html"> | ||
257 | + | ||
258 | + | ||
259 | + <a href="../../Thinkphp/Others/functions.html"> | ||
260 | + | ||
261 | + <i class="fa fa-check"></i> | ||
262 | + | ||
263 | + <b>1.6.1.</b> | ||
264 | + | ||
265 | + Thinkphp中常用功能 | ||
266 | + </a> | ||
267 | + | ||
268 | + | ||
269 | + </li> | ||
270 | + | ||
271 | + <li class="chapter " data-level="1.6.2" data-path="Thinkphp/Others/UsefulCodes.html"> | ||
272 | + | ||
273 | + | ||
274 | + <a href="../../Thinkphp/Others/UsefulCodes.html"> | ||
275 | + | ||
276 | + <i class="fa fa-check"></i> | ||
277 | + | ||
278 | + <b>1.6.2.</b> | ||
279 | + | ||
280 | + EVShop中备用代码片段 | ||
281 | + </a> | ||
282 | + | ||
283 | + | ||
284 | + </li> | ||
285 | + | ||
286 | + | ||
287 | + </ul> | ||
288 | + | ||
289 | + </li> | ||
290 | + | ||
291 | + | ||
292 | + </ul> | ||
293 | + | ||
294 | + </li> | ||
295 | + | ||
296 | + | ||
297 | + | ||
298 | + | ||
299 | + <li class="divider"></li> | ||
300 | + <li> | ||
301 | + <a href="https://www.gitbook.com" target="blank" class="gitbook-link"> | ||
302 | + Published with GitBook | ||
303 | + </a> | ||
304 | + </li> | ||
305 | + | ||
306 | + </ul> | ||
307 | + </nav> | ||
308 | +</div> | ||
309 | + | ||
310 | + <div class="book-body"> | ||
311 | + <div class="body-inner"> | ||
312 | + <div class="book-header" role="navigation"> | ||
313 | + <!-- Actions Left --> | ||
314 | + | ||
315 | + | ||
316 | + <!-- Title --> | ||
317 | + <h1> | ||
318 | + <i class="fa fa-circle-o-notch fa-spin"></i> | ||
319 | + <a href="../../" >Introduction</a> | ||
320 | + </h1> | ||
321 | +</div> | ||
322 | + | ||
323 | + <div class="page-wrapper" tabindex="-1" role="main"> | ||
324 | + <div class="page-inner"> | ||
325 | + | ||
326 | + | ||
327 | + <section class="normal" id="section-"> | ||
328 | + | ||
329 | + <h1 id="evshop编程规则之view篇">EVShop编程规则之View篇</h1> | ||
330 | +<h3 id="1-系统变量和配置变量">1. 系统变量和配置变量</h3> | ||
331 | +<p>系统变量的输出通常以$Think 打头,比如:</p> | ||
332 | +<pre><code>1. {$Think.server.script_name} // 输出$_SERVER['SCRIPT_NAME']变量 | ||
333 | +2. {$Think.session.user_id} // 输出$_SESSION['user_id']变量 | ||
334 | +3. {$Think.get.pageNumber} // 输出$_GET['pageNumber']变量 | ||
335 | +4. {$Think.cookie.name} // 输出$_COOKIE['name']变量 | ||
336 | +5. {$Think.const.MODULE_NAME} 输出常量 | ||
337 | +6. {$Think.config.url_model} // 配置参数(在config.php)中设定 | ||
338 | +7. {$Think.MODULE_NAME} // 模块名称 | ||
339 | +</code></pre><hr> | ||
340 | +<h3 id="2-view中将php变量值传递到前端js文件">2. View中将php变量值传递到前端JS文件</h3> | ||
341 | +<p>需要两个步骤:</p> | ||
342 | +<ol> | ||
343 | +<li>View中定义pageParam字面量对象<pre><code><script> | ||
344 | + var pageParam = { | ||
345 | + s:"page1", | ||
346 | + }; | ||
347 | +</script> | ||
348 | +</code></pre></li> | ||
349 | +<li>在js的initialize()函数中直接使用options.pageParam属性<pre><code>var PageModel = function (options) { | ||
350 | + this.pageName = options.page; | ||
351 | + this.module = options.module; | ||
352 | + this.pageParam = options.pageParam; | ||
353 | + this.languageData = new LanguageData("member_group_index"); | ||
354 | +} | ||
355 | +</code></pre></li> | ||
356 | +</ol> | ||
357 | +<p>如果需要将变量转换成JSON传递到前端js中:</p> | ||
358 | +<pre><code><script> | ||
359 | + var pageParam = { | ||
360 | + language: <?php echo json_encode($lang) ?>, | ||
361 | + }; | ||
362 | +</script> | ||
363 | +</code></pre> | ||
364 | + | ||
365 | + </section> | ||
366 | + | ||
367 | + | ||
368 | + </div> | ||
369 | + </div> | ||
370 | + </div> | ||
371 | + | ||
372 | + | ||
373 | + <a href="../../Thinkphp/Controller/evshop_controller.html" class="navigation navigation-prev " aria-label="Previous page: EVShop之Controller篇"><i class="fa fa-angle-left"></i></a> | ||
374 | + | ||
375 | + | ||
376 | + <a href="../../Thinkphp/Javascript/evshop_dialog.html" class="navigation navigation-next " aria-label="Next page: EVShop之Dialog篇"><i class="fa fa-angle-right"></i></a> | ||
377 | + | ||
378 | + </div> | ||
379 | +</div> | ||
380 | + | ||
381 | + | ||
382 | +<script src="../../gitbook/app.js"></script> | ||
383 | + | ||
384 | + | ||
385 | + <script src="../../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script> | ||
386 | + | ||
387 | + | ||
388 | + | ||
389 | + <script src="../../gitbook/plugins/gitbook-plugin-search/search.js"></script> | ||
390 | + | ||
391 | + | ||
392 | + | ||
393 | + <script src="../../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script> | ||
394 | + | ||
395 | + | ||
396 | + | ||
397 | + <script src="../../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script> | ||
398 | + | ||
399 | + | ||
400 | +<script> | ||
401 | +require(["gitbook"], function(gitbook) { | ||
402 | + var config = {"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2}}; | ||
403 | + gitbook.start(config); | ||
404 | +}); | ||
405 | +</script> | ||
406 | + | ||
407 | + | ||
408 | + </body> | ||
409 | + | ||
410 | +</html> |
This diff could not be displayed because it is too large.
No preview for this file type
No preview for this file type
This diff could not be displayed because it is too large.
No preview for this file type
No preview for this file type
90.6 KB
No preview for this file type
1 | +require(["gitbook", "lodash", "jQuery"], function(gitbook, _, $) { | ||
2 | + var fontState; | ||
3 | + | ||
4 | + var THEMES = { | ||
5 | + "white": 0, | ||
6 | + "sepia": 1, | ||
7 | + "night": 2 | ||
8 | + }; | ||
9 | + | ||
10 | + var FAMILY = { | ||
11 | + "serif": 0, | ||
12 | + "sans": 1 | ||
13 | + }; | ||
14 | + | ||
15 | + // Save current font settings | ||
16 | + function saveFontSettings() { | ||
17 | + gitbook.storage.set("fontState", fontState); | ||
18 | + update(); | ||
19 | + } | ||
20 | + | ||
21 | + // Increase font size | ||
22 | + function enlargeFontSize(e) { | ||
23 | + e.preventDefault(); | ||
24 | + if (fontState.size >= 4) return; | ||
25 | + | ||
26 | + fontState.size++; | ||
27 | + saveFontSettings(); | ||
28 | + }; | ||
29 | + | ||
30 | + // Decrease font size | ||
31 | + function reduceFontSize(e) { | ||
32 | + e.preventDefault(); | ||
33 | + if (fontState.size <= 0) return; | ||
34 | + | ||
35 | + fontState.size--; | ||
36 | + saveFontSettings(); | ||
37 | + }; | ||
38 | + | ||
39 | + // Change font family | ||
40 | + function changeFontFamily(index, e) { | ||
41 | + e.preventDefault(); | ||
42 | + | ||
43 | + fontState.family = index; | ||
44 | + saveFontSettings(); | ||
45 | + }; | ||
46 | + | ||
47 | + // Change type of color | ||
48 | + function changeColorTheme(index, e) { | ||
49 | + e.preventDefault(); | ||
50 | + | ||
51 | + var $book = $(".book"); | ||
52 | + | ||
53 | + if (fontState.theme !== 0) | ||
54 | + $book.removeClass("color-theme-"+fontState.theme); | ||
55 | + | ||
56 | + fontState.theme = index; | ||
57 | + if (fontState.theme !== 0) | ||
58 | + $book.addClass("color-theme-"+fontState.theme); | ||
59 | + | ||
60 | + saveFontSettings(); | ||
61 | + }; | ||
62 | + | ||
63 | + function update() { | ||
64 | + var $book = gitbook.state.$book; | ||
65 | + | ||
66 | + $(".font-settings .font-family-list li").removeClass("active"); | ||
67 | + $(".font-settings .font-family-list li:nth-child("+(fontState.family+1)+")").addClass("active"); | ||
68 | + | ||
69 | + $book[0].className = $book[0].className.replace(/\bfont-\S+/g, ''); | ||
70 | + $book.addClass("font-size-"+fontState.size); | ||
71 | + $book.addClass("font-family-"+fontState.family); | ||
72 | + | ||
73 | + if(fontState.theme !== 0) { | ||
74 | + $book[0].className = $book[0].className.replace(/\bcolor-theme-\S+/g, ''); | ||
75 | + $book.addClass("color-theme-"+fontState.theme); | ||
76 | + } | ||
77 | + }; | ||
78 | + | ||
79 | + function init(config) { | ||
80 | + var $bookBody, $book; | ||
81 | + | ||
82 | + //Find DOM elements. | ||
83 | + $book = gitbook.state.$book; | ||
84 | + $bookBody = $book.find(".book-body"); | ||
85 | + | ||
86 | + // Instantiate font state object | ||
87 | + fontState = gitbook.storage.get("fontState", { | ||
88 | + size: config.size || 2, | ||
89 | + family: FAMILY[config.family || "sans"], | ||
90 | + theme: THEMES[config.theme || "white"] | ||
91 | + }); | ||
92 | + | ||
93 | + update(); | ||
94 | + }; | ||
95 | + | ||
96 | + | ||
97 | + gitbook.events.bind("start", function(e, config) { | ||
98 | + var opts = config.fontsettings; | ||
99 | + | ||
100 | + // Create buttons in toolbar | ||
101 | + gitbook.toolbar.createButton({ | ||
102 | + icon: 'fa fa-font', | ||
103 | + label: 'Font Settings', | ||
104 | + className: 'font-settings', | ||
105 | + dropdown: [ | ||
106 | + [ | ||
107 | + { | ||
108 | + text: 'A', | ||
109 | + className: 'font-reduce', | ||
110 | + onClick: reduceFontSize | ||
111 | + }, | ||
112 | + { | ||
113 | + text: 'A', | ||
114 | + className: 'font-enlarge', | ||
115 | + onClick: enlargeFontSize | ||
116 | + } | ||
117 | + ], | ||
118 | + [ | ||
119 | + { | ||
120 | + text: 'Serif', | ||
121 | + onClick: _.partial(changeFontFamily, 0) | ||
122 | + }, | ||
123 | + { | ||
124 | + text: 'Sans', | ||
125 | + onClick: _.partial(changeFontFamily, 1) | ||
126 | + } | ||
127 | + ], | ||
128 | + [ | ||
129 | + { | ||
130 | + text: 'White', | ||
131 | + onClick: _.partial(changeColorTheme, 0) | ||
132 | + }, | ||
133 | + { | ||
134 | + text: 'Sepia', | ||
135 | + onClick: _.partial(changeColorTheme, 1) | ||
136 | + }, | ||
137 | + { | ||
138 | + text: 'Night', | ||
139 | + onClick: _.partial(changeColorTheme, 2) | ||
140 | + } | ||
141 | + ] | ||
142 | + ] | ||
143 | + }); | ||
144 | + | ||
145 | + | ||
146 | + // Init current settings | ||
147 | + init(opts); | ||
148 | + }); | ||
149 | +}); | ||
150 | + | ||
151 | + |
1 | +/* | ||
2 | + * Theme 1 | ||
3 | + */ | ||
4 | +.color-theme-1 .dropdown-menu { | ||
5 | + background-color: #111111; | ||
6 | + border-color: #7e888b; | ||
7 | +} | ||
8 | +.color-theme-1 .dropdown-menu .dropdown-caret .caret-inner { | ||
9 | + border-bottom: 9px solid #111111; | ||
10 | +} | ||
11 | +.color-theme-1 .dropdown-menu .buttons { | ||
12 | + border-color: #7e888b; | ||
13 | +} | ||
14 | +.color-theme-1 .dropdown-menu .button { | ||
15 | + color: #afa790; | ||
16 | +} | ||
17 | +.color-theme-1 .dropdown-menu .button:hover { | ||
18 | + color: #73553c; | ||
19 | +} | ||
20 | +/* | ||
21 | + * Theme 2 | ||
22 | + */ | ||
23 | +.color-theme-2 .dropdown-menu { | ||
24 | + background-color: #2d3143; | ||
25 | + border-color: #272a3a; | ||
26 | +} | ||
27 | +.color-theme-2 .dropdown-menu .dropdown-caret .caret-inner { | ||
28 | + border-bottom: 9px solid #2d3143; | ||
29 | +} | ||
30 | +.color-theme-2 .dropdown-menu .buttons { | ||
31 | + border-color: #272a3a; | ||
32 | +} | ||
33 | +.color-theme-2 .dropdown-menu .button { | ||
34 | + color: #62677f; | ||
35 | +} | ||
36 | +.color-theme-2 .dropdown-menu .button:hover { | ||
37 | + color: #f4f4f5; | ||
38 | +} | ||
39 | +.book .book-header .font-settings .font-enlarge { | ||
40 | + line-height: 30px; | ||
41 | + font-size: 1.4em; | ||
42 | +} | ||
43 | +.book .book-header .font-settings .font-reduce { | ||
44 | + line-height: 30px; | ||
45 | + font-size: 1em; | ||
46 | +} | ||
47 | +.book.color-theme-1 .book-body { | ||
48 | + color: #704214; | ||
49 | + background: #f3eacb; | ||
50 | +} | ||
51 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section { | ||
52 | + background: #f3eacb; | ||
53 | +} | ||
54 | +.book.color-theme-2 .book-body { | ||
55 | + color: #bdcadb; | ||
56 | + background: #1c1f2b; | ||
57 | +} | ||
58 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section { | ||
59 | + background: #1c1f2b; | ||
60 | +} | ||
61 | +.book.font-size-0 .book-body .page-inner section { | ||
62 | + font-size: 1.2rem; | ||
63 | +} | ||
64 | +.book.font-size-1 .book-body .page-inner section { | ||
65 | + font-size: 1.4rem; | ||
66 | +} | ||
67 | +.book.font-size-2 .book-body .page-inner section { | ||
68 | + font-size: 1.6rem; | ||
69 | +} | ||
70 | +.book.font-size-3 .book-body .page-inner section { | ||
71 | + font-size: 2.2rem; | ||
72 | +} | ||
73 | +.book.font-size-4 .book-body .page-inner section { | ||
74 | + font-size: 4rem; | ||
75 | +} | ||
76 | +.book.font-family-0 { | ||
77 | + font-family: Georgia, serif; | ||
78 | +} | ||
79 | +.book.font-family-1 { | ||
80 | + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; | ||
81 | +} | ||
82 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal { | ||
83 | + color: #704214; | ||
84 | +} | ||
85 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal a { | ||
86 | + color: inherit; | ||
87 | +} | ||
88 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h1, | ||
89 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h2, | ||
90 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h3, | ||
91 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h4, | ||
92 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h5, | ||
93 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h6 { | ||
94 | + color: inherit; | ||
95 | +} | ||
96 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h1, | ||
97 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h2 { | ||
98 | + border-color: inherit; | ||
99 | +} | ||
100 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h6 { | ||
101 | + color: inherit; | ||
102 | +} | ||
103 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal hr { | ||
104 | + background-color: inherit; | ||
105 | +} | ||
106 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal blockquote { | ||
107 | + border-color: inherit; | ||
108 | +} | ||
109 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre, | ||
110 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code { | ||
111 | + background: #fdf6e3; | ||
112 | + color: #657b83; | ||
113 | + border-color: #f8df9c; | ||
114 | +} | ||
115 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal .highlight { | ||
116 | + background-color: inherit; | ||
117 | +} | ||
118 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table th, | ||
119 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table td { | ||
120 | + border-color: #f5d06c; | ||
121 | +} | ||
122 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table tr { | ||
123 | + color: inherit; | ||
124 | + background-color: #fdf6e3; | ||
125 | + border-color: #444444; | ||
126 | +} | ||
127 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table tr:nth-child(2n) { | ||
128 | + background-color: #fbeecb; | ||
129 | +} | ||
130 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal { | ||
131 | + color: #bdcadb; | ||
132 | +} | ||
133 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal a { | ||
134 | + color: #3eb1d0; | ||
135 | +} | ||
136 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h1, | ||
137 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h2, | ||
138 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h3, | ||
139 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h4, | ||
140 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h5, | ||
141 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h6 { | ||
142 | + color: #fffffa; | ||
143 | +} | ||
144 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h1, | ||
145 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h2 { | ||
146 | + border-color: #373b4e; | ||
147 | +} | ||
148 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h6 { | ||
149 | + color: #373b4e; | ||
150 | +} | ||
151 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal hr { | ||
152 | + background-color: #373b4e; | ||
153 | +} | ||
154 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal blockquote { | ||
155 | + border-color: #373b4e; | ||
156 | +} | ||
157 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre, | ||
158 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code { | ||
159 | + color: #9dbed8; | ||
160 | + background: #2d3143; | ||
161 | + border-color: #2d3143; | ||
162 | +} | ||
163 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal .highlight { | ||
164 | + background-color: #282a39; | ||
165 | +} | ||
166 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table th, | ||
167 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table td { | ||
168 | + border-color: #3b3f54; | ||
169 | +} | ||
170 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table tr { | ||
171 | + color: #b6c2d2; | ||
172 | + background-color: #2d3143; | ||
173 | + border-color: #3b3f54; | ||
174 | +} | ||
175 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table tr:nth-child(2n) { | ||
176 | + background-color: #35394b; | ||
177 | +} | ||
178 | +.book.color-theme-1 .book-header { | ||
179 | + color: #afa790; | ||
180 | + background: transparent; | ||
181 | +} | ||
182 | +.book.color-theme-1 .book-header .btn { | ||
183 | + color: #afa790; | ||
184 | +} | ||
185 | +.book.color-theme-1 .book-header .btn:hover { | ||
186 | + color: #73553c; | ||
187 | + background: none; | ||
188 | +} | ||
189 | +.book.color-theme-1 .book-header h1 { | ||
190 | + color: #704214; | ||
191 | +} | ||
192 | +.book.color-theme-2 .book-header { | ||
193 | + color: #7e888b; | ||
194 | + background: transparent; | ||
195 | +} | ||
196 | +.book.color-theme-2 .book-header .btn { | ||
197 | + color: #3b3f54; | ||
198 | +} | ||
199 | +.book.color-theme-2 .book-header .btn:hover { | ||
200 | + color: #fffff5; | ||
201 | + background: none; | ||
202 | +} | ||
203 | +.book.color-theme-2 .book-header h1 { | ||
204 | + color: #bdcadb; | ||
205 | +} | ||
206 | +.book.color-theme-1 .book-body .navigation { | ||
207 | + color: #afa790; | ||
208 | +} | ||
209 | +.book.color-theme-1 .book-body .navigation:hover { | ||
210 | + color: #73553c; | ||
211 | +} | ||
212 | +.book.color-theme-2 .book-body .navigation { | ||
213 | + color: #383f52; | ||
214 | +} | ||
215 | +.book.color-theme-2 .book-body .navigation:hover { | ||
216 | + color: #fffff5; | ||
217 | +} | ||
218 | +/* | ||
219 | + * Theme 1 | ||
220 | + */ | ||
221 | +.book.color-theme-1 .book-summary { | ||
222 | + color: #afa790; | ||
223 | + background: #111111; | ||
224 | + border-right: 1px solid rgba(0, 0, 0, 0.07); | ||
225 | +} | ||
226 | +.book.color-theme-1 .book-summary .book-search { | ||
227 | + background: transparent; | ||
228 | +} | ||
229 | +.book.color-theme-1 .book-summary .book-search input, | ||
230 | +.book.color-theme-1 .book-summary .book-search input:focus { | ||
231 | + border: 1px solid transparent; | ||
232 | +} | ||
233 | +.book.color-theme-1 .book-summary ul.summary li.divider { | ||
234 | + background: #7e888b; | ||
235 | + box-shadow: none; | ||
236 | +} | ||
237 | +.book.color-theme-1 .book-summary ul.summary li i.fa-check { | ||
238 | + color: #33cc33; | ||
239 | +} | ||
240 | +.book.color-theme-1 .book-summary ul.summary li.done > a { | ||
241 | + color: #877f6a; | ||
242 | +} | ||
243 | +.book.color-theme-1 .book-summary ul.summary li a, | ||
244 | +.book.color-theme-1 .book-summary ul.summary li span { | ||
245 | + color: #877f6a; | ||
246 | + background: transparent; | ||
247 | + font-weight: normal; | ||
248 | +} | ||
249 | +.book.color-theme-1 .book-summary ul.summary li.active > a, | ||
250 | +.book.color-theme-1 .book-summary ul.summary li a:hover { | ||
251 | + color: #704214; | ||
252 | + background: transparent; | ||
253 | + font-weight: normal; | ||
254 | +} | ||
255 | +/* | ||
256 | + * Theme 2 | ||
257 | + */ | ||
258 | +.book.color-theme-2 .book-summary { | ||
259 | + color: #bcc1d2; | ||
260 | + background: #2d3143; | ||
261 | + border-right: none; | ||
262 | +} | ||
263 | +.book.color-theme-2 .book-summary .book-search { | ||
264 | + background: transparent; | ||
265 | +} | ||
266 | +.book.color-theme-2 .book-summary .book-search input, | ||
267 | +.book.color-theme-2 .book-summary .book-search input:focus { | ||
268 | + border: 1px solid transparent; | ||
269 | +} | ||
270 | +.book.color-theme-2 .book-summary ul.summary li.divider { | ||
271 | + background: #272a3a; | ||
272 | + box-shadow: none; | ||
273 | +} | ||
274 | +.book.color-theme-2 .book-summary ul.summary li i.fa-check { | ||
275 | + color: #33cc33; | ||
276 | +} | ||
277 | +.book.color-theme-2 .book-summary ul.summary li.done > a { | ||
278 | + color: #62687f; | ||
279 | +} | ||
280 | +.book.color-theme-2 .book-summary ul.summary li a, | ||
281 | +.book.color-theme-2 .book-summary ul.summary li span { | ||
282 | + color: #c1c6d7; | ||
283 | + background: transparent; | ||
284 | + font-weight: 600; | ||
285 | +} | ||
286 | +.book.color-theme-2 .book-summary ul.summary li.active > a, | ||
287 | +.book.color-theme-2 .book-summary ul.summary li a:hover { | ||
288 | + color: #f4f4f5; | ||
289 | + background: #252737; | ||
290 | + font-weight: 600; | ||
291 | +} |
1 | +pre, | ||
2 | +code { | ||
3 | + /* http://jmblog.github.io/color-themes-for-highlightjs */ | ||
4 | + /* Tomorrow Comment */ | ||
5 | + /* Tomorrow Red */ | ||
6 | + /* Tomorrow Orange */ | ||
7 | + /* Tomorrow Yellow */ | ||
8 | + /* Tomorrow Green */ | ||
9 | + /* Tomorrow Aqua */ | ||
10 | + /* Tomorrow Blue */ | ||
11 | + /* Tomorrow Purple */ | ||
12 | +} | ||
13 | +pre .hljs-comment, | ||
14 | +code .hljs-comment, | ||
15 | +pre .hljs-title, | ||
16 | +code .hljs-title { | ||
17 | + color: #8e908c; | ||
18 | +} | ||
19 | +pre .hljs-variable, | ||
20 | +code .hljs-variable, | ||
21 | +pre .hljs-attribute, | ||
22 | +code .hljs-attribute, | ||
23 | +pre .hljs-tag, | ||
24 | +code .hljs-tag, | ||
25 | +pre .hljs-regexp, | ||
26 | +code .hljs-regexp, | ||
27 | +pre .ruby .hljs-constant, | ||
28 | +code .ruby .hljs-constant, | ||
29 | +pre .xml .hljs-tag .hljs-title, | ||
30 | +code .xml .hljs-tag .hljs-title, | ||
31 | +pre .xml .hljs-pi, | ||
32 | +code .xml .hljs-pi, | ||
33 | +pre .xml .hljs-doctype, | ||
34 | +code .xml .hljs-doctype, | ||
35 | +pre .html .hljs-doctype, | ||
36 | +code .html .hljs-doctype, | ||
37 | +pre .css .hljs-id, | ||
38 | +code .css .hljs-id, | ||
39 | +pre .css .hljs-class, | ||
40 | +code .css .hljs-class, | ||
41 | +pre .css .hljs-pseudo, | ||
42 | +code .css .hljs-pseudo { | ||
43 | + color: #c82829; | ||
44 | +} | ||
45 | +pre .hljs-number, | ||
46 | +code .hljs-number, | ||
47 | +pre .hljs-preprocessor, | ||
48 | +code .hljs-preprocessor, | ||
49 | +pre .hljs-pragma, | ||
50 | +code .hljs-pragma, | ||
51 | +pre .hljs-built_in, | ||
52 | +code .hljs-built_in, | ||
53 | +pre .hljs-literal, | ||
54 | +code .hljs-literal, | ||
55 | +pre .hljs-params, | ||
56 | +code .hljs-params, | ||
57 | +pre .hljs-constant, | ||
58 | +code .hljs-constant { | ||
59 | + color: #f5871f; | ||
60 | +} | ||
61 | +pre .ruby .hljs-class .hljs-title, | ||
62 | +code .ruby .hljs-class .hljs-title, | ||
63 | +pre .css .hljs-rules .hljs-attribute, | ||
64 | +code .css .hljs-rules .hljs-attribute { | ||
65 | + color: #eab700; | ||
66 | +} | ||
67 | +pre .hljs-string, | ||
68 | +code .hljs-string, | ||
69 | +pre .hljs-value, | ||
70 | +code .hljs-value, | ||
71 | +pre .hljs-inheritance, | ||
72 | +code .hljs-inheritance, | ||
73 | +pre .hljs-header, | ||
74 | +code .hljs-header, | ||
75 | +pre .ruby .hljs-symbol, | ||
76 | +code .ruby .hljs-symbol, | ||
77 | +pre .xml .hljs-cdata, | ||
78 | +code .xml .hljs-cdata { | ||
79 | + color: #718c00; | ||
80 | +} | ||
81 | +pre .css .hljs-hexcolor, | ||
82 | +code .css .hljs-hexcolor { | ||
83 | + color: #3e999f; | ||
84 | +} | ||
85 | +pre .hljs-function, | ||
86 | +code .hljs-function, | ||
87 | +pre .python .hljs-decorator, | ||
88 | +code .python .hljs-decorator, | ||
89 | +pre .python .hljs-title, | ||
90 | +code .python .hljs-title, | ||
91 | +pre .ruby .hljs-function .hljs-title, | ||
92 | +code .ruby .hljs-function .hljs-title, | ||
93 | +pre .ruby .hljs-title .hljs-keyword, | ||
94 | +code .ruby .hljs-title .hljs-keyword, | ||
95 | +pre .perl .hljs-sub, | ||
96 | +code .perl .hljs-sub, | ||
97 | +pre .javascript .hljs-title, | ||
98 | +code .javascript .hljs-title, | ||
99 | +pre .coffeescript .hljs-title, | ||
100 | +code .coffeescript .hljs-title { | ||
101 | + color: #4271ae; | ||
102 | +} | ||
103 | +pre .hljs-keyword, | ||
104 | +code .hljs-keyword, | ||
105 | +pre .javascript .hljs-function, | ||
106 | +code .javascript .hljs-function { | ||
107 | + color: #8959a8; | ||
108 | +} | ||
109 | +pre .hljs, | ||
110 | +code .hljs { | ||
111 | + display: block; | ||
112 | + background: white; | ||
113 | + color: #4d4d4c; | ||
114 | + padding: 0.5em; | ||
115 | +} | ||
116 | +pre .coffeescript .javascript, | ||
117 | +code .coffeescript .javascript, | ||
118 | +pre .javascript .xml, | ||
119 | +code .javascript .xml, | ||
120 | +pre .tex .hljs-formula, | ||
121 | +code .tex .hljs-formula, | ||
122 | +pre .xml .javascript, | ||
123 | +code .xml .javascript, | ||
124 | +pre .xml .vbscript, | ||
125 | +code .xml .vbscript, | ||
126 | +pre .xml .css, | ||
127 | +code .xml .css, | ||
128 | +pre .xml .hljs-cdata, | ||
129 | +code .xml .hljs-cdata { | ||
130 | + opacity: 0.5; | ||
131 | +} |
1 | +.book .book-body .page-wrapper .page-inner section.normal pre, | ||
2 | +.book .book-body .page-wrapper .page-inner section.normal code { | ||
3 | + /* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ | ||
4 | + /* Tomorrow Comment */ | ||
5 | + /* Tomorrow Red */ | ||
6 | + /* Tomorrow Orange */ | ||
7 | + /* Tomorrow Yellow */ | ||
8 | + /* Tomorrow Green */ | ||
9 | + /* Tomorrow Aqua */ | ||
10 | + /* Tomorrow Blue */ | ||
11 | + /* Tomorrow Purple */ | ||
12 | +} | ||
13 | +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-comment, | ||
14 | +.book .book-body .page-wrapper .page-inner section.normal code .hljs-comment, | ||
15 | +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-title, | ||
16 | +.book .book-body .page-wrapper .page-inner section.normal code .hljs-title { | ||
17 | + color: #8e908c; | ||
18 | +} | ||
19 | +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-variable, | ||
20 | +.book .book-body .page-wrapper .page-inner section.normal code .hljs-variable, | ||
21 | +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-attribute, | ||
22 | +.book .book-body .page-wrapper .page-inner section.normal code .hljs-attribute, | ||
23 | +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-tag, | ||
24 | +.book .book-body .page-wrapper .page-inner section.normal code .hljs-tag, | ||
25 | +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-regexp, | ||
26 | +.book .book-body .page-wrapper .page-inner section.normal code .hljs-regexp, | ||
27 | +.book .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-constant, | ||
28 | +.book .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-constant, | ||
29 | +.book .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-tag .hljs-title, | ||
30 | +.book .book-body .page-wrapper .page-inner section.normal code .xml .hljs-tag .hljs-title, | ||
31 | +.book .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-pi, | ||
32 | +.book .book-body .page-wrapper .page-inner section.normal code .xml .hljs-pi, | ||
33 | +.book .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-doctype, | ||
34 | +.book .book-body .page-wrapper .page-inner section.normal code .xml .hljs-doctype, | ||
35 | +.book .book-body .page-wrapper .page-inner section.normal pre .html .hljs-doctype, | ||
36 | +.book .book-body .page-wrapper .page-inner section.normal code .html .hljs-doctype, | ||
37 | +.book .book-body .page-wrapper .page-inner section.normal pre .css .hljs-id, | ||
38 | +.book .book-body .page-wrapper .page-inner section.normal code .css .hljs-id, | ||
39 | +.book .book-body .page-wrapper .page-inner section.normal pre .css .hljs-class, | ||
40 | +.book .book-body .page-wrapper .page-inner section.normal code .css .hljs-class, | ||
41 | +.book .book-body .page-wrapper .page-inner section.normal pre .css .hljs-pseudo, | ||
42 | +.book .book-body .page-wrapper .page-inner section.normal code .css .hljs-pseudo { | ||
43 | + color: #c82829; | ||
44 | +} | ||
45 | +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-number, | ||
46 | +.book .book-body .page-wrapper .page-inner section.normal code .hljs-number, | ||
47 | +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-preprocessor, | ||
48 | +.book .book-body .page-wrapper .page-inner section.normal code .hljs-preprocessor, | ||
49 | +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-pragma, | ||
50 | +.book .book-body .page-wrapper .page-inner section.normal code .hljs-pragma, | ||
51 | +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-built_in, | ||
52 | +.book .book-body .page-wrapper .page-inner section.normal code .hljs-built_in, | ||
53 | +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-literal, | ||
54 | +.book .book-body .page-wrapper .page-inner section.normal code .hljs-literal, | ||
55 | +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-params, | ||
56 | +.book .book-body .page-wrapper .page-inner section.normal code .hljs-params, | ||
57 | +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-constant, | ||
58 | +.book .book-body .page-wrapper .page-inner section.normal code .hljs-constant { | ||
59 | + color: #f5871f; | ||
60 | +} | ||
61 | +.book .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-class .hljs-title, | ||
62 | +.book .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-class .hljs-title, | ||
63 | +.book .book-body .page-wrapper .page-inner section.normal pre .css .hljs-rules .hljs-attribute, | ||
64 | +.book .book-body .page-wrapper .page-inner section.normal code .css .hljs-rules .hljs-attribute { | ||
65 | + color: #eab700; | ||
66 | +} | ||
67 | +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-string, | ||
68 | +.book .book-body .page-wrapper .page-inner section.normal code .hljs-string, | ||
69 | +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-value, | ||
70 | +.book .book-body .page-wrapper .page-inner section.normal code .hljs-value, | ||
71 | +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-inheritance, | ||
72 | +.book .book-body .page-wrapper .page-inner section.normal code .hljs-inheritance, | ||
73 | +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-header, | ||
74 | +.book .book-body .page-wrapper .page-inner section.normal code .hljs-header, | ||
75 | +.book .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-symbol, | ||
76 | +.book .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-symbol, | ||
77 | +.book .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-cdata, | ||
78 | +.book .book-body .page-wrapper .page-inner section.normal code .xml .hljs-cdata { | ||
79 | + color: #718c00; | ||
80 | +} | ||
81 | +.book .book-body .page-wrapper .page-inner section.normal pre .css .hljs-hexcolor, | ||
82 | +.book .book-body .page-wrapper .page-inner section.normal code .css .hljs-hexcolor { | ||
83 | + color: #3e999f; | ||
84 | +} | ||
85 | +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-function, | ||
86 | +.book .book-body .page-wrapper .page-inner section.normal code .hljs-function, | ||
87 | +.book .book-body .page-wrapper .page-inner section.normal pre .python .hljs-decorator, | ||
88 | +.book .book-body .page-wrapper .page-inner section.normal code .python .hljs-decorator, | ||
89 | +.book .book-body .page-wrapper .page-inner section.normal pre .python .hljs-title, | ||
90 | +.book .book-body .page-wrapper .page-inner section.normal code .python .hljs-title, | ||
91 | +.book .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-function .hljs-title, | ||
92 | +.book .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-function .hljs-title, | ||
93 | +.book .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-title .hljs-keyword, | ||
94 | +.book .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-title .hljs-keyword, | ||
95 | +.book .book-body .page-wrapper .page-inner section.normal pre .perl .hljs-sub, | ||
96 | +.book .book-body .page-wrapper .page-inner section.normal code .perl .hljs-sub, | ||
97 | +.book .book-body .page-wrapper .page-inner section.normal pre .javascript .hljs-title, | ||
98 | +.book .book-body .page-wrapper .page-inner section.normal code .javascript .hljs-title, | ||
99 | +.book .book-body .page-wrapper .page-inner section.normal pre .coffeescript .hljs-title, | ||
100 | +.book .book-body .page-wrapper .page-inner section.normal code .coffeescript .hljs-title { | ||
101 | + color: #4271ae; | ||
102 | +} | ||
103 | +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-keyword, | ||
104 | +.book .book-body .page-wrapper .page-inner section.normal code .hljs-keyword, | ||
105 | +.book .book-body .page-wrapper .page-inner section.normal pre .javascript .hljs-function, | ||
106 | +.book .book-body .page-wrapper .page-inner section.normal code .javascript .hljs-function { | ||
107 | + color: #8959a8; | ||
108 | +} | ||
109 | +.book .book-body .page-wrapper .page-inner section.normal pre .hljs, | ||
110 | +.book .book-body .page-wrapper .page-inner section.normal code .hljs { | ||
111 | + display: block; | ||
112 | + background: white; | ||
113 | + color: #4d4d4c; | ||
114 | + padding: 0.5em; | ||
115 | +} | ||
116 | +.book .book-body .page-wrapper .page-inner section.normal pre .coffeescript .javascript, | ||
117 | +.book .book-body .page-wrapper .page-inner section.normal code .coffeescript .javascript, | ||
118 | +.book .book-body .page-wrapper .page-inner section.normal pre .javascript .xml, | ||
119 | +.book .book-body .page-wrapper .page-inner section.normal code .javascript .xml, | ||
120 | +.book .book-body .page-wrapper .page-inner section.normal pre .tex .hljs-formula, | ||
121 | +.book .book-body .page-wrapper .page-inner section.normal code .tex .hljs-formula, | ||
122 | +.book .book-body .page-wrapper .page-inner section.normal pre .xml .javascript, | ||
123 | +.book .book-body .page-wrapper .page-inner section.normal code .xml .javascript, | ||
124 | +.book .book-body .page-wrapper .page-inner section.normal pre .xml .vbscript, | ||
125 | +.book .book-body .page-wrapper .page-inner section.normal code .xml .vbscript, | ||
126 | +.book .book-body .page-wrapper .page-inner section.normal pre .xml .css, | ||
127 | +.book .book-body .page-wrapper .page-inner section.normal code .xml .css, | ||
128 | +.book .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-cdata, | ||
129 | +.book .book-body .page-wrapper .page-inner section.normal code .xml .hljs-cdata { | ||
130 | + opacity: 0.5; | ||
131 | +} | ||
132 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre, | ||
133 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code { | ||
134 | + /* | ||
135 | + | ||
136 | +Orginal Style from ethanschoonover.com/solarized (c) Jeremy Hull <sourdrums@gmail.com> | ||
137 | + | ||
138 | +*/ | ||
139 | + /* Solarized Green */ | ||
140 | + /* Solarized Cyan */ | ||
141 | + /* Solarized Blue */ | ||
142 | + /* Solarized Yellow */ | ||
143 | + /* Solarized Orange */ | ||
144 | + /* Solarized Red */ | ||
145 | + /* Solarized Violet */ | ||
146 | +} | ||
147 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs, | ||
148 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs { | ||
149 | + display: block; | ||
150 | + padding: 0.5em; | ||
151 | + background: #fdf6e3; | ||
152 | + color: #657b83; | ||
153 | +} | ||
154 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-comment, | ||
155 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-comment, | ||
156 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-template_comment, | ||
157 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-template_comment, | ||
158 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .diff .hljs-header, | ||
159 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .diff .hljs-header, | ||
160 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-doctype, | ||
161 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-doctype, | ||
162 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-pi, | ||
163 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-pi, | ||
164 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .lisp .hljs-string, | ||
165 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .lisp .hljs-string, | ||
166 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-javadoc, | ||
167 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-javadoc { | ||
168 | + color: #93a1a1; | ||
169 | +} | ||
170 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-keyword, | ||
171 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-keyword, | ||
172 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-winutils, | ||
173 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-winutils, | ||
174 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .method, | ||
175 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .method, | ||
176 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-addition, | ||
177 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-addition, | ||
178 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .css .hljs-tag, | ||
179 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .css .hljs-tag, | ||
180 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-request, | ||
181 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-request, | ||
182 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-status, | ||
183 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-status, | ||
184 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .nginx .hljs-title, | ||
185 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .nginx .hljs-title { | ||
186 | + color: #859900; | ||
187 | +} | ||
188 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-number, | ||
189 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-number, | ||
190 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-command, | ||
191 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-command, | ||
192 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-string, | ||
193 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-string, | ||
194 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-tag .hljs-value, | ||
195 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-tag .hljs-value, | ||
196 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-rules .hljs-value, | ||
197 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-rules .hljs-value, | ||
198 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-phpdoc, | ||
199 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-phpdoc, | ||
200 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .tex .hljs-formula, | ||
201 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .tex .hljs-formula, | ||
202 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-regexp, | ||
203 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-regexp, | ||
204 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-hexcolor, | ||
205 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-hexcolor, | ||
206 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-link_url, | ||
207 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-link_url { | ||
208 | + color: #2aa198; | ||
209 | +} | ||
210 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-title, | ||
211 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-title, | ||
212 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-localvars, | ||
213 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-localvars, | ||
214 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-chunk, | ||
215 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-chunk, | ||
216 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-decorator, | ||
217 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-decorator, | ||
218 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-built_in, | ||
219 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-built_in, | ||
220 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-identifier, | ||
221 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-identifier, | ||
222 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .vhdl .hljs-literal, | ||
223 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .vhdl .hljs-literal, | ||
224 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-id, | ||
225 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-id, | ||
226 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .css .hljs-function, | ||
227 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .css .hljs-function { | ||
228 | + color: #268bd2; | ||
229 | +} | ||
230 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-attribute, | ||
231 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-attribute, | ||
232 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-variable, | ||
233 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-variable, | ||
234 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .lisp .hljs-body, | ||
235 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .lisp .hljs-body, | ||
236 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .smalltalk .hljs-number, | ||
237 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .smalltalk .hljs-number, | ||
238 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-constant, | ||
239 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-constant, | ||
240 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-class .hljs-title, | ||
241 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-class .hljs-title, | ||
242 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-parent, | ||
243 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-parent, | ||
244 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .haskell .hljs-type, | ||
245 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .haskell .hljs-type, | ||
246 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-link_reference, | ||
247 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-link_reference { | ||
248 | + color: #b58900; | ||
249 | +} | ||
250 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-preprocessor, | ||
251 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-preprocessor, | ||
252 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-preprocessor .hljs-keyword, | ||
253 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-preprocessor .hljs-keyword, | ||
254 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-pragma, | ||
255 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-pragma, | ||
256 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-shebang, | ||
257 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-shebang, | ||
258 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-symbol, | ||
259 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-symbol, | ||
260 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-symbol .hljs-string, | ||
261 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-symbol .hljs-string, | ||
262 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .diff .hljs-change, | ||
263 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .diff .hljs-change, | ||
264 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-special, | ||
265 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-special, | ||
266 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-attr_selector, | ||
267 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-attr_selector, | ||
268 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-subst, | ||
269 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-subst, | ||
270 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-cdata, | ||
271 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-cdata, | ||
272 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .clojure .hljs-title, | ||
273 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .clojure .hljs-title, | ||
274 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .css .hljs-pseudo, | ||
275 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .css .hljs-pseudo, | ||
276 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-header, | ||
277 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-header { | ||
278 | + color: #cb4b16; | ||
279 | +} | ||
280 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-deletion, | ||
281 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-deletion, | ||
282 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-important, | ||
283 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-important { | ||
284 | + color: #dc322f; | ||
285 | +} | ||
286 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-link_label, | ||
287 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-link_label { | ||
288 | + color: #6c71c4; | ||
289 | +} | ||
290 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .tex .hljs-formula, | ||
291 | +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .tex .hljs-formula { | ||
292 | + background: #eee8d5; | ||
293 | +} | ||
294 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre, | ||
295 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code { | ||
296 | + /* Tomorrow Night Bright Theme */ | ||
297 | + /* Original theme - https://github.com/chriskempson/tomorrow-theme */ | ||
298 | + /* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ | ||
299 | + /* Tomorrow Comment */ | ||
300 | + /* Tomorrow Red */ | ||
301 | + /* Tomorrow Orange */ | ||
302 | + /* Tomorrow Yellow */ | ||
303 | + /* Tomorrow Green */ | ||
304 | + /* Tomorrow Aqua */ | ||
305 | + /* Tomorrow Blue */ | ||
306 | + /* Tomorrow Purple */ | ||
307 | +} | ||
308 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-comment, | ||
309 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-comment, | ||
310 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-title, | ||
311 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-title { | ||
312 | + color: #969896; | ||
313 | +} | ||
314 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-variable, | ||
315 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-variable, | ||
316 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-attribute, | ||
317 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-attribute, | ||
318 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-tag, | ||
319 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-tag, | ||
320 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-regexp, | ||
321 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-regexp, | ||
322 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-constant, | ||
323 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-constant, | ||
324 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-tag .hljs-title, | ||
325 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .xml .hljs-tag .hljs-title, | ||
326 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-pi, | ||
327 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .xml .hljs-pi, | ||
328 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-doctype, | ||
329 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .xml .hljs-doctype, | ||
330 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .html .hljs-doctype, | ||
331 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .html .hljs-doctype, | ||
332 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .css .hljs-id, | ||
333 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .css .hljs-id, | ||
334 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .css .hljs-class, | ||
335 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .css .hljs-class, | ||
336 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .css .hljs-pseudo, | ||
337 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .css .hljs-pseudo { | ||
338 | + color: #d54e53; | ||
339 | +} | ||
340 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-number, | ||
341 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-number, | ||
342 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-preprocessor, | ||
343 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-preprocessor, | ||
344 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-pragma, | ||
345 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-pragma, | ||
346 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-built_in, | ||
347 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-built_in, | ||
348 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-literal, | ||
349 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-literal, | ||
350 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-params, | ||
351 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-params, | ||
352 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-constant, | ||
353 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-constant { | ||
354 | + color: #e78c45; | ||
355 | +} | ||
356 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-class .hljs-title, | ||
357 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-class .hljs-title, | ||
358 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .css .hljs-rules .hljs-attribute, | ||
359 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .css .hljs-rules .hljs-attribute { | ||
360 | + color: #e7c547; | ||
361 | +} | ||
362 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-string, | ||
363 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-string, | ||
364 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-value, | ||
365 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-value, | ||
366 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-inheritance, | ||
367 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-inheritance, | ||
368 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-header, | ||
369 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-header, | ||
370 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-symbol, | ||
371 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-symbol, | ||
372 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-cdata, | ||
373 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .xml .hljs-cdata { | ||
374 | + color: #b9ca4a; | ||
375 | +} | ||
376 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .css .hljs-hexcolor, | ||
377 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .css .hljs-hexcolor { | ||
378 | + color: #70c0b1; | ||
379 | +} | ||
380 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-function, | ||
381 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-function, | ||
382 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .python .hljs-decorator, | ||
383 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .python .hljs-decorator, | ||
384 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .python .hljs-title, | ||
385 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .python .hljs-title, | ||
386 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-function .hljs-title, | ||
387 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-function .hljs-title, | ||
388 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-title .hljs-keyword, | ||
389 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-title .hljs-keyword, | ||
390 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .perl .hljs-sub, | ||
391 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .perl .hljs-sub, | ||
392 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .javascript .hljs-title, | ||
393 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .javascript .hljs-title, | ||
394 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .coffeescript .hljs-title, | ||
395 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .coffeescript .hljs-title { | ||
396 | + color: #7aa6da; | ||
397 | +} | ||
398 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-keyword, | ||
399 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-keyword, | ||
400 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .javascript .hljs-function, | ||
401 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .javascript .hljs-function { | ||
402 | + color: #c397d8; | ||
403 | +} | ||
404 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs, | ||
405 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs { | ||
406 | + display: block; | ||
407 | + background: black; | ||
408 | + color: #eaeaea; | ||
409 | + padding: 0.5em; | ||
410 | +} | ||
411 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .coffeescript .javascript, | ||
412 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .coffeescript .javascript, | ||
413 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .javascript .xml, | ||
414 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .javascript .xml, | ||
415 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .tex .hljs-formula, | ||
416 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .tex .hljs-formula, | ||
417 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .xml .javascript, | ||
418 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .xml .javascript, | ||
419 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .xml .vbscript, | ||
420 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .xml .vbscript, | ||
421 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .xml .css, | ||
422 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .xml .css, | ||
423 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-cdata, | ||
424 | +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .xml .hljs-cdata { | ||
425 | + opacity: 0.5; | ||
426 | +} |
1 | +/** | ||
2 | + * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 0.5.12 | ||
3 | + * Copyright (C) 2015 Oliver Nightingale | ||
4 | + * MIT Licensed | ||
5 | + * @license | ||
6 | + */ | ||
7 | +!function(){var t=function(e){var n=new t.Index;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),e&&e.call(n,n),n};t.version="0.5.12",t.utils={},t.utils.warn=function(t){return function(e){t.console&&console.warn&&console.warn(e)}}(this),t.EventEmitter=function(){this.events={}},t.EventEmitter.prototype.addListener=function(){var t=Array.prototype.slice.call(arguments),e=t.pop(),n=t;if("function"!=typeof e)throw new TypeError("last argument must be a function");n.forEach(function(t){this.hasHandler(t)||(this.events[t]=[]),this.events[t].push(e)},this)},t.EventEmitter.prototype.removeListener=function(t,e){if(this.hasHandler(t)){var n=this.events[t].indexOf(e);this.events[t].splice(n,1),this.events[t].length||delete this.events[t]}},t.EventEmitter.prototype.emit=function(t){if(this.hasHandler(t)){var e=Array.prototype.slice.call(arguments,1);this.events[t].forEach(function(t){t.apply(void 0,e)})}},t.EventEmitter.prototype.hasHandler=function(t){return t in this.events},t.tokenizer=function(t){return arguments.length&&null!=t&&void 0!=t?Array.isArray(t)?t.map(function(t){return t.toLowerCase()}):t.toString().trim().toLowerCase().split(/[\s\-]+/):[]},t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions={},t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(e){var i=t.Pipeline.registeredFunctions[e];if(!i)throw new Error("Cannot load un-registered function: "+e);n.add(i)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(e){t.Pipeline.warnIfFunctionNotRegistered(e),this._stack.push(e)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._stack.indexOf(e);if(-1==i)throw new Error("Cannot find existingFn");i+=1,this._stack.splice(i,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._stack.indexOf(e);if(-1==i)throw new Error("Cannot find existingFn");this._stack.splice(i,0,n)},t.Pipeline.prototype.remove=function(t){var e=this._stack.indexOf(t);-1!=e&&this._stack.splice(e,1)},t.Pipeline.prototype.run=function(t){for(var e=[],n=t.length,i=this._stack.length,o=0;n>o;o++){for(var r=t[o],s=0;i>s&&(r=this._stack[s](r,o,t),void 0!==r);s++);void 0!==r&&e.push(r)}return e},t.Pipeline.prototype.reset=function(){this._stack=[]},t.Pipeline.prototype.toJSON=function(){return this._stack.map(function(e){return t.Pipeline.warnIfFunctionNotRegistered(e),e.label})},t.Vector=function(){this._magnitude=null,this.list=void 0,this.length=0},t.Vector.Node=function(t,e,n){this.idx=t,this.val=e,this.next=n},t.Vector.prototype.insert=function(e,n){this._magnitude=void 0;var i=this.list;if(!i)return this.list=new t.Vector.Node(e,n,i),this.length++;if(e<i.idx)return this.list=new t.Vector.Node(e,n,i),this.length++;for(var o=i,r=i.next;void 0!=r;){if(e<r.idx)return o.next=new t.Vector.Node(e,n,r),this.length++;o=r,r=r.next}return o.next=new t.Vector.Node(e,n,r),this.length++},t.Vector.prototype.magnitude=function(){if(this._magnitude)return this._magnitude;for(var t,e=this.list,n=0;e;)t=e.val,n+=t*t,e=e.next;return this._magnitude=Math.sqrt(n)},t.Vector.prototype.dot=function(t){for(var e=this.list,n=t.list,i=0;e&&n;)e.idx<n.idx?e=e.next:e.idx>n.idx?n=n.next:(i+=e.val*n.val,e=e.next,n=n.next);return i},t.Vector.prototype.similarity=function(t){return this.dot(t)/(this.magnitude()*t.magnitude())},t.SortedSet=function(){this.length=0,this.elements=[]},t.SortedSet.load=function(t){var e=new this;return e.elements=t,e.length=t.length,e},t.SortedSet.prototype.add=function(){var t,e;for(t=0;t<arguments.length;t++)e=arguments[t],~this.indexOf(e)||this.elements.splice(this.locationFor(e),0,e);this.length=this.elements.length},t.SortedSet.prototype.toArray=function(){return this.elements.slice()},t.SortedSet.prototype.map=function(t,e){return this.elements.map(t,e)},t.SortedSet.prototype.forEach=function(t,e){return this.elements.forEach(t,e)},t.SortedSet.prototype.indexOf=function(t){for(var e=0,n=this.elements.length,i=n-e,o=e+Math.floor(i/2),r=this.elements[o];i>1;){if(r===t)return o;t>r&&(e=o),r>t&&(n=o),i=n-e,o=e+Math.floor(i/2),r=this.elements[o]}return r===t?o:-1},t.SortedSet.prototype.locationFor=function(t){for(var e=0,n=this.elements.length,i=n-e,o=e+Math.floor(i/2),r=this.elements[o];i>1;)t>r&&(e=o),r>t&&(n=o),i=n-e,o=e+Math.floor(i/2),r=this.elements[o];return r>t?o:t>r?o+1:void 0},t.SortedSet.prototype.intersect=function(e){for(var n=new t.SortedSet,i=0,o=0,r=this.length,s=e.length,a=this.elements,h=e.elements;;){if(i>r-1||o>s-1)break;a[i]!==h[o]?a[i]<h[o]?i++:a[i]>h[o]&&o++:(n.add(a[i]),i++,o++)}return n},t.SortedSet.prototype.clone=function(){var e=new t.SortedSet;return e.elements=this.toArray(),e.length=e.elements.length,e},t.SortedSet.prototype.union=function(t){var e,n,i;return this.length>=t.length?(e=this,n=t):(e=t,n=this),i=e.clone(),i.add.apply(i,n.toArray()),i},t.SortedSet.prototype.toJSON=function(){return this.toArray()},t.Index=function(){this._fields=[],this._ref="id",this.pipeline=new t.Pipeline,this.documentStore=new t.Store,this.tokenStore=new t.TokenStore,this.corpusTokens=new t.SortedSet,this.eventEmitter=new t.EventEmitter,this._idfCache={},this.on("add","remove","update",function(){this._idfCache={}}.bind(this))},t.Index.prototype.on=function(){var t=Array.prototype.slice.call(arguments);return this.eventEmitter.addListener.apply(this.eventEmitter,t)},t.Index.prototype.off=function(t,e){return this.eventEmitter.removeListener(t,e)},t.Index.load=function(e){e.version!==t.version&&t.utils.warn("version mismatch: current "+t.version+" importing "+e.version);var n=new this;return n._fields=e.fields,n._ref=e.ref,n.documentStore=t.Store.load(e.documentStore),n.tokenStore=t.TokenStore.load(e.tokenStore),n.corpusTokens=t.SortedSet.load(e.corpusTokens),n.pipeline=t.Pipeline.load(e.pipeline),n},t.Index.prototype.field=function(t,e){var e=e||{},n={name:t,boost:e.boost||1};return this._fields.push(n),this},t.Index.prototype.ref=function(t){return this._ref=t,this},t.Index.prototype.add=function(e,n){var i={},o=new t.SortedSet,r=e[this._ref],n=void 0===n?!0:n;this._fields.forEach(function(n){var r=this.pipeline.run(t.tokenizer(e[n.name]));i[n.name]=r,t.SortedSet.prototype.add.apply(o,r)},this),this.documentStore.set(r,o),t.SortedSet.prototype.add.apply(this.corpusTokens,o.toArray());for(var s=0;s<o.length;s++){var a=o.elements[s],h=this._fields.reduce(function(t,e){var n=i[e.name].length;if(!n)return t;var o=i[e.name].filter(function(t){return t===a}).length;return t+o/n*e.boost},0);this.tokenStore.add(a,{ref:r,tf:h})}n&&this.eventEmitter.emit("add",e,this)},t.Index.prototype.remove=function(t,e){var n=t[this._ref],e=void 0===e?!0:e;if(this.documentStore.has(n)){var i=this.documentStore.get(n);this.documentStore.remove(n),i.forEach(function(t){this.tokenStore.remove(t,n)},this),e&&this.eventEmitter.emit("remove",t,this)}},t.Index.prototype.update=function(t,e){var e=void 0===e?!0:e;this.remove(t,!1),this.add(t,!1),e&&this.eventEmitter.emit("update",t,this)},t.Index.prototype.idf=function(t){var e="@"+t;if(Object.prototype.hasOwnProperty.call(this._idfCache,e))return this._idfCache[e];var n=this.tokenStore.count(t),i=1;return n>0&&(i=1+Math.log(this.documentStore.length/n)),this._idfCache[e]=i},t.Index.prototype.search=function(e){var n=this.pipeline.run(t.tokenizer(e)),i=new t.Vector,o=[],r=this._fields.reduce(function(t,e){return t+e.boost},0),s=n.some(function(t){return this.tokenStore.has(t)},this);if(!s)return[];n.forEach(function(e,n,s){var a=1/s.length*this._fields.length*r,h=this,l=this.tokenStore.expand(e).reduce(function(n,o){var r=h.corpusTokens.indexOf(o),s=h.idf(o),l=1,u=new t.SortedSet;if(o!==e){var c=Math.max(3,o.length-e.length);l=1/Math.log(c)}return r>-1&&i.insert(r,a*s*l),Object.keys(h.tokenStore.get(o)).forEach(function(t){u.add(t)}),n.union(u)},new t.SortedSet);o.push(l)},this);var a=o.reduce(function(t,e){return t.intersect(e)});return a.map(function(t){return{ref:t,score:i.similarity(this.documentVector(t))}},this).sort(function(t,e){return e.score-t.score})},t.Index.prototype.documentVector=function(e){for(var n=this.documentStore.get(e),i=n.length,o=new t.Vector,r=0;i>r;r++){var s=n.elements[r],a=this.tokenStore.get(s)[e].tf,h=this.idf(s);o.insert(this.corpusTokens.indexOf(s),a*h)}return o},t.Index.prototype.toJSON=function(){return{version:t.version,fields:this._fields,ref:this._ref,documentStore:this.documentStore.toJSON(),tokenStore:this.tokenStore.toJSON(),corpusTokens:this.corpusTokens.toJSON(),pipeline:this.pipeline.toJSON()}},t.Index.prototype.use=function(t){var e=Array.prototype.slice.call(arguments,1);e.unshift(this),t.apply(this,e)},t.Store=function(){this.store={},this.length=0},t.Store.load=function(e){var n=new this;return n.length=e.length,n.store=Object.keys(e.store).reduce(function(n,i){return n[i]=t.SortedSet.load(e.store[i]),n},{}),n},t.Store.prototype.set=function(t,e){this.has(t)||this.length++,this.store[t]=e},t.Store.prototype.get=function(t){return this.store[t]},t.Store.prototype.has=function(t){return t in this.store},t.Store.prototype.remove=function(t){this.has(t)&&(delete this.store[t],this.length--)},t.Store.prototype.toJSON=function(){return{store:this.store,length:this.length}},t.stemmer=function(){var t={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},e={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},n="[^aeiou]",i="[aeiouy]",o=n+"[^aeiouy]*",r=i+"[aeiou]*",s="^("+o+")?"+r+o,a="^("+o+")?"+r+o+"("+r+")?$",h="^("+o+")?"+r+o+r+o,l="^("+o+")?"+i,u=new RegExp(s),c=new RegExp(h),f=new RegExp(a),d=new RegExp(l),p=/^(.+?)(ss|i)es$/,m=/^(.+?)([^s])s$/,v=/^(.+?)eed$/,y=/^(.+?)(ed|ing)$/,g=/.$/,S=/(at|bl|iz)$/,w=new RegExp("([^aeiouylsz])\\1$"),x=new RegExp("^"+o+i+"[^aeiouwxy]$"),k=/^(.+?[^aeiou])y$/,b=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,E=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,_=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,F=/^(.+?)(s|t)(ion)$/,O=/^(.+?)e$/,P=/ll$/,N=new RegExp("^"+o+i+"[^aeiouwxy]$"),T=function(n){var i,o,r,s,a,h,l;if(n.length<3)return n;if(r=n.substr(0,1),"y"==r&&(n=r.toUpperCase()+n.substr(1)),s=p,a=m,s.test(n)?n=n.replace(s,"$1$2"):a.test(n)&&(n=n.replace(a,"$1$2")),s=v,a=y,s.test(n)){var T=s.exec(n);s=u,s.test(T[1])&&(s=g,n=n.replace(s,""))}else if(a.test(n)){var T=a.exec(n);i=T[1],a=d,a.test(i)&&(n=i,a=S,h=w,l=x,a.test(n)?n+="e":h.test(n)?(s=g,n=n.replace(s,"")):l.test(n)&&(n+="e"))}if(s=k,s.test(n)){var T=s.exec(n);i=T[1],n=i+"i"}if(s=b,s.test(n)){var T=s.exec(n);i=T[1],o=T[2],s=u,s.test(i)&&(n=i+t[o])}if(s=E,s.test(n)){var T=s.exec(n);i=T[1],o=T[2],s=u,s.test(i)&&(n=i+e[o])}if(s=_,a=F,s.test(n)){var T=s.exec(n);i=T[1],s=c,s.test(i)&&(n=i)}else if(a.test(n)){var T=a.exec(n);i=T[1]+T[2],a=c,a.test(i)&&(n=i)}if(s=O,s.test(n)){var T=s.exec(n);i=T[1],s=c,a=f,h=N,(s.test(i)||a.test(i)&&!h.test(i))&&(n=i)}return s=P,a=c,s.test(n)&&a.test(n)&&(s=g,n=n.replace(s,"")),"y"==r&&(n=r.toLowerCase()+n.substr(1)),n};return T}(),t.Pipeline.registerFunction(t.stemmer,"stemmer"),t.stopWordFilter=function(e){return e&&t.stopWordFilter.stopWords[e]!==e?e:void 0},t.stopWordFilter.stopWords={a:"a",able:"able",about:"about",across:"across",after:"after",all:"all",almost:"almost",also:"also",am:"am",among:"among",an:"an",and:"and",any:"any",are:"are",as:"as",at:"at",be:"be",because:"because",been:"been",but:"but",by:"by",can:"can",cannot:"cannot",could:"could",dear:"dear",did:"did","do":"do",does:"does",either:"either","else":"else",ever:"ever",every:"every","for":"for",from:"from",get:"get",got:"got",had:"had",has:"has",have:"have",he:"he",her:"her",hers:"hers",him:"him",his:"his",how:"how",however:"however",i:"i","if":"if","in":"in",into:"into",is:"is",it:"it",its:"its",just:"just",least:"least",let:"let",like:"like",likely:"likely",may:"may",me:"me",might:"might",most:"most",must:"must",my:"my",neither:"neither",no:"no",nor:"nor",not:"not",of:"of",off:"off",often:"often",on:"on",only:"only",or:"or",other:"other",our:"our",own:"own",rather:"rather",said:"said",say:"say",says:"says",she:"she",should:"should",since:"since",so:"so",some:"some",than:"than",that:"that",the:"the",their:"their",them:"them",then:"then",there:"there",these:"these",they:"they","this":"this",tis:"tis",to:"to",too:"too",twas:"twas",us:"us",wants:"wants",was:"was",we:"we",were:"were",what:"what",when:"when",where:"where",which:"which","while":"while",who:"who",whom:"whom",why:"why",will:"will","with":"with",would:"would",yet:"yet",you:"you",your:"your"},t.Pipeline.registerFunction(t.stopWordFilter,"stopWordFilter"),t.trimmer=function(t){var e=t.replace(/^\W+/,"").replace(/\W+$/,"");return""===e?void 0:e},t.Pipeline.registerFunction(t.trimmer,"trimmer"),t.TokenStore=function(){this.root={docs:{}},this.length=0},t.TokenStore.load=function(t){var e=new this;return e.root=t.root,e.length=t.length,e},t.TokenStore.prototype.add=function(t,e,n){var n=n||this.root,i=t[0],o=t.slice(1);return i in n||(n[i]={docs:{}}),0===o.length?(n[i].docs[e.ref]=e,void(this.length+=1)):this.add(o,e,n[i])},t.TokenStore.prototype.has=function(t){if(!t)return!1;for(var e=this.root,n=0;n<t.length;n++){if(!e[t[n]])return!1;e=e[t[n]]}return!0},t.TokenStore.prototype.getNode=function(t){if(!t)return{};for(var e=this.root,n=0;n<t.length;n++){if(!e[t[n]])return{};e=e[t[n]]}return e},t.TokenStore.prototype.get=function(t,e){return this.getNode(t,e).docs||{}},t.TokenStore.prototype.count=function(t,e){return Object.keys(this.get(t,e)).length},t.TokenStore.prototype.remove=function(t,e){if(t){for(var n=this.root,i=0;i<t.length;i++){if(!(t[i]in n))return;n=n[t[i]]}delete n.docs[e]}},t.TokenStore.prototype.expand=function(t,e){var n=this.getNode(t),i=n.docs||{},e=e||[];return Object.keys(i).length&&e.push(t),Object.keys(n).forEach(function(n){"docs"!==n&&e.concat(this.expand(t+n,e))},this),e},t.TokenStore.prototype.toJSON=function(){return{root:this.root,length:this.length}},function(t,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e():t.lunr=e()}(this,function(){return t})}(); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +.book .book-summary .book-search { | ||
2 | + padding: 6px; | ||
3 | + background: transparent; | ||
4 | + position: absolute; | ||
5 | + top: -50px; | ||
6 | + left: 0px; | ||
7 | + right: 0px; | ||
8 | + transition: top 0.5s ease; | ||
9 | +} | ||
10 | +.book .book-summary .book-search input, | ||
11 | +.book .book-summary .book-search input:focus, | ||
12 | +.book .book-summary .book-search input:hover { | ||
13 | + width: 100%; | ||
14 | + background: transparent; | ||
15 | + border: 1px solid transparent; | ||
16 | + box-shadow: none; | ||
17 | + outline: none; | ||
18 | + line-height: 22px; | ||
19 | + padding: 7px 4px; | ||
20 | + color: inherit; | ||
21 | +} | ||
22 | +.book.with-search .book-summary .book-search { | ||
23 | + top: 0px; | ||
24 | +} | ||
25 | +.book.with-search .book-summary ul.summary { | ||
26 | + top: 50px; | ||
27 | +} |
1 | +require([ | ||
2 | + "gitbook", | ||
3 | + "lodash" | ||
4 | +], function(gitbook, _) { | ||
5 | + var index = null; | ||
6 | + var $searchInput, $searchForm; | ||
7 | + | ||
8 | + // Use a specific index | ||
9 | + function loadIndex(data) { | ||
10 | + index = lunr.Index.load(data); | ||
11 | + } | ||
12 | + | ||
13 | + // Fetch the search index | ||
14 | + function fetchIndex() { | ||
15 | + $.getJSON(gitbook.state.basePath+"/search_index.json") | ||
16 | + .then(loadIndex); | ||
17 | + } | ||
18 | + | ||
19 | + // Search for a term and return results | ||
20 | + function search(q) { | ||
21 | + if (!index) return; | ||
22 | + | ||
23 | + var results = _.chain(index.search(q)) | ||
24 | + .map(function(result) { | ||
25 | + var parts = result.ref.split("#") | ||
26 | + return { | ||
27 | + path: parts[0], | ||
28 | + hash: parts[1] | ||
29 | + } | ||
30 | + }) | ||
31 | + .value(); | ||
32 | + | ||
33 | + return results; | ||
34 | + } | ||
35 | + | ||
36 | + // Create search form | ||
37 | + function createForm(value) { | ||
38 | + if ($searchForm) $searchForm.remove(); | ||
39 | + | ||
40 | + $searchForm = $('<div>', { | ||
41 | + 'class': 'book-search', | ||
42 | + 'role': 'search' | ||
43 | + }); | ||
44 | + | ||
45 | + $searchInput = $('<input>', { | ||
46 | + 'type': 'text', | ||
47 | + 'class': 'form-control', | ||
48 | + 'val': value, | ||
49 | + 'placeholder': 'Type to search' | ||
50 | + }); | ||
51 | + | ||
52 | + $searchInput.appendTo($searchForm); | ||
53 | + $searchForm.prependTo(gitbook.state.$book.find('.book-summary')); | ||
54 | + } | ||
55 | + | ||
56 | + // Return true if search is open | ||
57 | + function isSearchOpen() { | ||
58 | + return gitbook.state.$book.hasClass("with-search"); | ||
59 | + } | ||
60 | + | ||
61 | + // Toggle the search | ||
62 | + function toggleSearch(_state) { | ||
63 | + if (isSearchOpen() === _state) return; | ||
64 | + | ||
65 | + gitbook.state.$book.toggleClass("with-search", _state); | ||
66 | + | ||
67 | + // If search bar is open: focus input | ||
68 | + if (isSearchOpen()) { | ||
69 | + gitbook.sidebar.toggle(true); | ||
70 | + $searchInput.focus(); | ||
71 | + } else { | ||
72 | + $searchInput.blur(); | ||
73 | + $searchInput.val(""); | ||
74 | + gitbook.sidebar.filter(null); | ||
75 | + } | ||
76 | + } | ||
77 | + | ||
78 | + // Recover current search when page changed | ||
79 | + function recoverSearch() { | ||
80 | + var keyword = gitbook.storage.get("keyword", ""); | ||
81 | + | ||
82 | + createForm(keyword); | ||
83 | + | ||
84 | + if (keyword.length > 0) { | ||
85 | + if(!isSearchOpen()) { | ||
86 | + toggleSearch(); | ||
87 | + } | ||
88 | + gitbook.sidebar.filter(_.pluck(search(keyword), "path")); | ||
89 | + } | ||
90 | + }; | ||
91 | + | ||
92 | + | ||
93 | + gitbook.events.bind("start", function(config) { | ||
94 | + // Pre-fetch search index and create the form | ||
95 | + fetchIndex(); | ||
96 | + createForm(); | ||
97 | + | ||
98 | + // Type in search bar | ||
99 | + $(document).on("keyup", ".book-search input", function(e) { | ||
100 | + var key = (e.keyCode ? e.keyCode : e.which); | ||
101 | + var q = $(this).val(); | ||
102 | + | ||
103 | + if (key == 27) { | ||
104 | + e.preventDefault(); | ||
105 | + toggleSearch(false); | ||
106 | + return; | ||
107 | + } | ||
108 | + if (q.length == 0) { | ||
109 | + gitbook.sidebar.filter(null); | ||
110 | + gitbook.storage.remove("keyword"); | ||
111 | + } else { | ||
112 | + var results = search(q); | ||
113 | + gitbook.sidebar.filter( | ||
114 | + _.pluck(results, "path") | ||
115 | + ); | ||
116 | + gitbook.storage.set("keyword", q); | ||
117 | + } | ||
118 | + }); | ||
119 | + | ||
120 | + // Create the toggle search button | ||
121 | + gitbook.toolbar.createButton({ | ||
122 | + icon: 'fa fa-search', | ||
123 | + label: 'Search', | ||
124 | + position: 'left', | ||
125 | + onClick: toggleSearch | ||
126 | + }); | ||
127 | + | ||
128 | + // Bind keyboard to toggle search | ||
129 | + gitbook.keyboard.bind(['f'], toggleSearch) | ||
130 | + }); | ||
131 | + | ||
132 | + gitbook.events.bind("page.change", recoverSearch); | ||
133 | +}); | ||
134 | + | ||
135 | + |
1 | +require(["gitbook", "lodash"], function(gitbook, _) { | ||
2 | + var SITES = { | ||
3 | + 'facebook': { | ||
4 | + 'label': 'Facebook', | ||
5 | + 'icon': 'fa fa-facebook', | ||
6 | + 'onClick': function(e) { | ||
7 | + e.preventDefault(); | ||
8 | + window.open("http://www.facebook.com/sharer/sharer.php?s=100&p[url]="+encodeURIComponent(location.href)); | ||
9 | + } | ||
10 | + }, | ||
11 | + 'twitter': { | ||
12 | + 'label': 'Twitter', | ||
13 | + 'icon': 'fa fa-twitter', | ||
14 | + 'onClick': function(e) { | ||
15 | + e.preventDefault(); | ||
16 | + window.open("http://twitter.com/home?status="+encodeURIComponent(document.title+" "+location.href)); | ||
17 | + } | ||
18 | + }, | ||
19 | + 'google': { | ||
20 | + 'label': 'Google+', | ||
21 | + 'icon': 'fa fa-google-plus', | ||
22 | + 'onClick': function(e) { | ||
23 | + e.preventDefault(); | ||
24 | + window.open("https://plus.google.com/share?url="+encodeURIComponent(location.href)); | ||
25 | + } | ||
26 | + }, | ||
27 | + 'weibo': { | ||
28 | + 'label': 'Weibo', | ||
29 | + 'icon': 'fa fa-weibo', | ||
30 | + 'onClick': function(e) { | ||
31 | + e.preventDefault(); | ||
32 | + window.open("http://service.weibo.com/share/share.php?content=utf-8&url="+encodeURIComponent(location.href)+"&title="+encodeURIComponent(document.title)); | ||
33 | + } | ||
34 | + }, | ||
35 | + 'instapaper': { | ||
36 | + 'label': 'Instapaper', | ||
37 | + 'icon': 'fa fa-instapaper', | ||
38 | + 'onClick': function(e) { | ||
39 | + e.preventDefault(); | ||
40 | + window.open("http://www.instapaper.com/text?u="+encodeURIComponent(location.href)); | ||
41 | + } | ||
42 | + }, | ||
43 | + 'vk': { | ||
44 | + 'label': 'VK', | ||
45 | + 'icon': 'fa fa-vk', | ||
46 | + 'onClick': function(e) { | ||
47 | + e.preventDefault(); | ||
48 | + window.open("http://vkontakte.ru/share.php?url="+encodeURIComponent(location.href)); | ||
49 | + } | ||
50 | + } | ||
51 | + }; | ||
52 | + | ||
53 | + | ||
54 | + | ||
55 | + gitbook.events.bind("start", function(e, config) { | ||
56 | + var opts = config.sharing; | ||
57 | + | ||
58 | + // Create dropdown menu | ||
59 | + var menu = _.chain(opts.all) | ||
60 | + .map(function(id) { | ||
61 | + var site = SITES[id]; | ||
62 | + | ||
63 | + return { | ||
64 | + text: site.label, | ||
65 | + onClick: site.onClick | ||
66 | + }; | ||
67 | + }) | ||
68 | + .compact() | ||
69 | + .value(); | ||
70 | + | ||
71 | + // Create main button with dropdown | ||
72 | + if (menu.length > 0) { | ||
73 | + gitbook.toolbar.createButton({ | ||
74 | + icon: 'fa fa-share-alt', | ||
75 | + label: 'Share', | ||
76 | + position: 'right', | ||
77 | + dropdown: [menu] | ||
78 | + }); | ||
79 | + } | ||
80 | + | ||
81 | + // Direct actions to share | ||
82 | + _.each(SITES, function(site, sideId) { | ||
83 | + if (!opts[sideId]) return; | ||
84 | + | ||
85 | + gitbook.toolbar.createButton({ | ||
86 | + icon: site.icon, | ||
87 | + label: site.text, | ||
88 | + position: 'right', | ||
89 | + onClick: site.onClick | ||
90 | + }); | ||
91 | + }); | ||
92 | + }); | ||
93 | +}); |
1 | +/*! normalize.css v2.1.0 | MIT License | git.io/normalize */img,legend{border:0}*,.fa{-webkit-font-smoothing:antialiased}.fa-ul>li,sub,sup{position:relative}.book .book-body .page-wrapper .page-inner section.normal hr:after,.book-langs-index .inner .languages:after,.buttons:after,.dropdown-menu .buttons:after{clear:both}body,html{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,video{display:inline-block}.hidden,[hidden]{display:none}audio:not([controls]){display:none;height:0}html{font-family:sans-serif}body,figure{margin:0}a:focus{outline:dotted thin}a:active,a:hover{outline:0}h1{font-size:2em;margin:.67em 0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}mark{background:#ff0;color:#000}code,kbd,pre,samp{font-family:monospace,serif;font-size:1em}pre{white-space:pre-wrap}q{quotes:"\201C" "\201D" "\2018" "\2019"}small{font-size:80%}sub,sup{font-size:75%;line-height:0;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}svg:not(:root){overflow:hidden}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{padding:0}button,input,select,textarea{font-family:inherit;font-size:100%;margin:0}button,input{line-height:normal}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}textarea{overflow:auto;vertical-align:top}table{border-collapse:collapse;border-spacing:0}/*! | ||
2 | + * Preboot v2 | ||
3 | + * | ||
4 | + * Open sourced under MIT license by @mdo. | ||
5 | + * Some variables and mixins from Bootstrap (Apache 2 license). | ||
6 | + */.link-inherit,.link-inherit:focus,.link-inherit:hover{color:inherit}.fa,.fa-stack{display:inline-block}/*! | ||
7 | + * Font Awesome 4.1.0 by @davegandy - http://fontawesome.io - @fontawesome | ||
8 | + * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) | ||
9 | + */@font-face{font-family:FontAwesome;src:url(./fonts/fontawesome/fontawesome-webfont.eot?v=4.1.0);src:url(./fonts/fontawesome/fontawesome-webfont.eot?#iefix&v=4.1.0) format('embedded-opentype'),url(./fonts/fontawesome/fontawesome-webfont.woff?v=4.1.0) format('woff'),url(./fonts/fontawesome/fontawesome-webfont.ttf?v=4.1.0) format('truetype'),url(./fonts/fontawesome/fontawesome-webfont.svg?v=4.1.0#fontawesomeregular) format('svg');font-weight:400;font-style:normal}.fa{font-family:FontAwesome;font-style:normal;font-weight:400;line-height:1;-moz-osx-font-smoothing:grayscale}.book .book-header,.book .book-summary{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif}.fa-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-fw{width:1.28571429em;text-align:center}.fa-ul{padding-left:0;margin-left:2.14285714em;list-style-type:none}.fa-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em;text-align:center}.fa-li.fa-lg{left:-1.85714286em}.fa-border{padding:.2em .25em .15em;border:.08em solid #eee;border-radius:.1em}.pull-right{float:right}.pull-left{float:left}.fa.pull-left{margin-right:.3em}.fa.pull-right{margin-left:.3em}.fa-spin{-webkit-animation:spin 2s infinite linear;-moz-animation:spin 2s infinite linear;-o-animation:spin 2s infinite linear;animation:spin 2s infinite linear}@-moz-keyframes spin{0%{-moz-transform:rotate(0)}100%{-moz-transform:rotate(359deg)}}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0)}100%{-webkit-transform:rotate(359deg)}}@-o-keyframes spin{0%{-o-transform:rotate(0)}100%{-o-transform:rotate(359deg)}}@keyframes spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fa-rotate-90{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1);-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg);-ms-transform:rotate(90deg);-o-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2);-webkit-transform:rotate(180deg);-moz-transform:rotate(180deg);-ms-transform:rotate(180deg);-o-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=3);-webkit-transform:rotate(270deg);-moz-transform:rotate(270deg);-ms-transform:rotate(270deg);-o-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1);-webkit-transform:scale(-1,1);-moz-transform:scale(-1,1);-ms-transform:scale(-1,1);-o-transform:scale(-1,1);transform:scale(-1,1)}.fa-flip-vertical{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1);-webkit-transform:scale(1,-1);-moz-transform:scale(1,-1);-ms-transform:scale(1,-1);-o-transform:scale(1,-1);transform:scale(1,-1)}.fa-stack{position:relative;width:2em;height:2em;line-height:2em;vertical-align:middle}.fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-glass:before{content:"\f000"}.fa-music:before{content:"\f001"}.fa-search:before{content:"\f002"}.fa-envelope-o:before{content:"\f003"}.fa-heart:before{content:"\f004"}.fa-star:before{content:"\f005"}.fa-star-o:before{content:"\f006"}.fa-user:before{content:"\f007"}.fa-film:before{content:"\f008"}.fa-th-large:before{content:"\f009"}.fa-th:before{content:"\f00a"}.fa-th-list:before{content:"\f00b"}.fa-check:before{content:"\f00c"}.fa-times:before{content:"\f00d"}.fa-search-plus:before{content:"\f00e"}.fa-search-minus:before{content:"\f010"}.fa-power-off:before{content:"\f011"}.fa-signal:before{content:"\f012"}.fa-cog:before,.fa-gear:before{content:"\f013"}.fa-trash-o:before{content:"\f014"}.fa-home:before{content:"\f015"}.fa-file-o:before{content:"\f016"}.fa-clock-o:before{content:"\f017"}.fa-road:before{content:"\f018"}.fa-download:before{content:"\f019"}.fa-arrow-circle-o-down:before{content:"\f01a"}.fa-arrow-circle-o-up:before{content:"\f01b"}.fa-inbox:before{content:"\f01c"}.fa-play-circle-o:before{content:"\f01d"}.fa-repeat:before,.fa-rotate-right:before{content:"\f01e"}.fa-refresh:before{content:"\f021"}.fa-list-alt:before{content:"\f022"}.fa-lock:before{content:"\f023"}.fa-flag:before{content:"\f024"}.fa-headphones:before{content:"\f025"}.fa-volume-off:before{content:"\f026"}.fa-volume-down:before{content:"\f027"}.fa-volume-up:before{content:"\f028"}.fa-qrcode:before{content:"\f029"}.fa-barcode:before{content:"\f02a"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-book:before{content:"\f02d"}.fa-bookmark:before{content:"\f02e"}.fa-print:before{content:"\f02f"}.fa-camera:before{content:"\f030"}.fa-font:before{content:"\f031"}.fa-bold:before{content:"\f032"}.fa-italic:before{content:"\f033"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-align-left:before{content:"\f036"}.fa-align-center:before{content:"\f037"}.fa-align-right:before{content:"\f038"}.fa-align-justify:before{content:"\f039"}.fa-list:before{content:"\f03a"}.fa-dedent:before,.fa-outdent:before{content:"\f03b"}.fa-indent:before{content:"\f03c"}.fa-video-camera:before{content:"\f03d"}.fa-image:before,.fa-photo:before,.fa-picture-o:before{content:"\f03e"}.fa-pencil:before{content:"\f040"}.fa-map-marker:before{content:"\f041"}.fa-adjust:before{content:"\f042"}.fa-tint:before{content:"\f043"}.fa-edit:before,.fa-pencil-square-o:before{content:"\f044"}.fa-share-square-o:before{content:"\f045"}.fa-check-square-o:before{content:"\f046"}.fa-arrows:before{content:"\f047"}.fa-step-backward:before{content:"\f048"}.fa-fast-backward:before{content:"\f049"}.fa-backward:before{content:"\f04a"}.fa-play:before{content:"\f04b"}.fa-pause:before{content:"\f04c"}.fa-stop:before{content:"\f04d"}.fa-forward:before{content:"\f04e"}.fa-fast-forward:before{content:"\f050"}.fa-step-forward:before{content:"\f051"}.fa-eject:before{content:"\f052"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-plus-circle:before{content:"\f055"}.fa-minus-circle:before{content:"\f056"}.fa-times-circle:before{content:"\f057"}.fa-check-circle:before{content:"\f058"}.fa-question-circle:before{content:"\f059"}.fa-info-circle:before{content:"\f05a"}.fa-crosshairs:before{content:"\f05b"}.fa-times-circle-o:before{content:"\f05c"}.fa-check-circle-o:before{content:"\f05d"}.fa-ban:before{content:"\f05e"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrow-down:before{content:"\f063"}.fa-mail-forward:before,.fa-share:before{content:"\f064"}.fa-expand:before{content:"\f065"}.fa-compress:before{content:"\f066"}.fa-plus:before{content:"\f067"}.fa-minus:before{content:"\f068"}.fa-asterisk:before{content:"\f069"}.fa-exclamation-circle:before{content:"\f06a"}.fa-gift:before{content:"\f06b"}.fa-leaf:before{content:"\f06c"}.fa-fire:before{content:"\f06d"}.fa-eye:before{content:"\f06e"}.fa-eye-slash:before{content:"\f070"}.fa-exclamation-triangle:before,.fa-warning:before{content:"\f071"}.fa-plane:before{content:"\f072"}.fa-calendar:before{content:"\f073"}.fa-random:before{content:"\f074"}.fa-comment:before{content:"\f075"}.fa-magnet:before{content:"\f076"}.fa-chevron-up:before{content:"\f077"}.fa-chevron-down:before{content:"\f078"}.fa-retweet:before{content:"\f079"}.fa-shopping-cart:before{content:"\f07a"}.fa-folder:before{content:"\f07b"}.fa-folder-open:before{content:"\f07c"}.fa-arrows-v:before{content:"\f07d"}.fa-arrows-h:before{content:"\f07e"}.fa-bar-chart-o:before{content:"\f080"}.fa-twitter-square:before{content:"\f081"}.fa-facebook-square:before{content:"\f082"}.fa-camera-retro:before{content:"\f083"}.fa-key:before{content:"\f084"}.fa-cogs:before,.fa-gears:before{content:"\f085"}.fa-comments:before{content:"\f086"}.fa-thumbs-o-up:before{content:"\f087"}.fa-thumbs-o-down:before{content:"\f088"}.fa-star-half:before{content:"\f089"}.fa-heart-o:before{content:"\f08a"}.fa-sign-out:before{content:"\f08b"}.fa-linkedin-square:before{content:"\f08c"}.fa-thumb-tack:before{content:"\f08d"}.fa-external-link:before{content:"\f08e"}.fa-sign-in:before{content:"\f090"}.fa-trophy:before{content:"\f091"}.fa-github-square:before{content:"\f092"}.fa-upload:before{content:"\f093"}.fa-lemon-o:before{content:"\f094"}.fa-phone:before{content:"\f095"}.fa-square-o:before{content:"\f096"}.fa-bookmark-o:before{content:"\f097"}.fa-phone-square:before{content:"\f098"}.fa-twitter:before{content:"\f099"}.fa-facebook:before{content:"\f09a"}.fa-github:before{content:"\f09b"}.fa-unlock:before{content:"\f09c"}.fa-credit-card:before{content:"\f09d"}.fa-rss:before{content:"\f09e"}.fa-hdd-o:before{content:"\f0a0"}.fa-bullhorn:before{content:"\f0a1"}.fa-bell:before{content:"\f0f3"}.fa-certificate:before{content:"\f0a3"}.fa-hand-o-right:before{content:"\f0a4"}.fa-hand-o-left:before{content:"\f0a5"}.fa-hand-o-up:before{content:"\f0a6"}.fa-hand-o-down:before{content:"\f0a7"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-globe:before{content:"\f0ac"}.fa-wrench:before{content:"\f0ad"}.fa-tasks:before{content:"\f0ae"}.fa-filter:before{content:"\f0b0"}.fa-briefcase:before{content:"\f0b1"}.fa-arrows-alt:before{content:"\f0b2"}.fa-group:before,.fa-users:before{content:"\f0c0"}.fa-chain:before,.fa-link:before{content:"\f0c1"}.fa-cloud:before{content:"\f0c2"}.fa-flask:before{content:"\f0c3"}.fa-cut:before,.fa-scissors:before{content:"\f0c4"}.fa-copy:before,.fa-files-o:before{content:"\f0c5"}.fa-paperclip:before{content:"\f0c6"}.fa-floppy-o:before,.fa-save:before{content:"\f0c7"}.fa-square:before{content:"\f0c8"}.fa-bars:before,.fa-navicon:before,.fa-reorder:before{content:"\f0c9"}.fa-list-ul:before{content:"\f0ca"}.fa-list-ol:before{content:"\f0cb"}.fa-strikethrough:before{content:"\f0cc"}.fa-underline:before{content:"\f0cd"}.fa-table:before{content:"\f0ce"}.fa-magic:before{content:"\f0d0"}.fa-truck:before{content:"\f0d1"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-square:before{content:"\f0d3"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-plus:before{content:"\f0d5"}.fa-money:before{content:"\f0d6"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-up:before{content:"\f0d8"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-columns:before{content:"\f0db"}.fa-sort:before,.fa-unsorted:before{content:"\f0dc"}.fa-sort-desc:before,.fa-sort-down:before{content:"\f0dd"}.fa-sort-asc:before,.fa-sort-up:before{content:"\f0de"}.fa-envelope:before{content:"\f0e0"}.fa-linkedin:before{content:"\f0e1"}.fa-rotate-left:before,.fa-undo:before{content:"\f0e2"}.fa-gavel:before,.fa-legal:before{content:"\f0e3"}.fa-dashboard:before,.fa-tachometer:before{content:"\f0e4"}.fa-comment-o:before{content:"\f0e5"}.fa-comments-o:before{content:"\f0e6"}.fa-bolt:before,.fa-flash:before{content:"\f0e7"}.fa-sitemap:before{content:"\f0e8"}.fa-umbrella:before{content:"\f0e9"}.fa-clipboard:before,.fa-paste:before{content:"\f0ea"}.fa-lightbulb-o:before{content:"\f0eb"}.fa-exchange:before{content:"\f0ec"}.fa-cloud-download:before{content:"\f0ed"}.fa-cloud-upload:before{content:"\f0ee"}.fa-user-md:before{content:"\f0f0"}.fa-stethoscope:before{content:"\f0f1"}.fa-suitcase:before{content:"\f0f2"}.fa-bell-o:before{content:"\f0a2"}.fa-coffee:before{content:"\f0f4"}.fa-cutlery:before{content:"\f0f5"}.fa-file-text-o:before{content:"\f0f6"}.fa-building-o:before{content:"\f0f7"}.fa-hospital-o:before{content:"\f0f8"}.fa-ambulance:before{content:"\f0f9"}.fa-medkit:before{content:"\f0fa"}.fa-fighter-jet:before{content:"\f0fb"}.fa-beer:before{content:"\f0fc"}.fa-h-square:before{content:"\f0fd"}.fa-plus-square:before{content:"\f0fe"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angle-down:before{content:"\f107"}.fa-desktop:before{content:"\f108"}.fa-laptop:before{content:"\f109"}.fa-tablet:before{content:"\f10a"}.fa-mobile-phone:before,.fa-mobile:before{content:"\f10b"}.fa-circle-o:before{content:"\f10c"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-spinner:before{content:"\f110"}.fa-circle:before{content:"\f111"}.fa-mail-reply:before,.fa-reply:before{content:"\f112"}.fa-github-alt:before{content:"\f113"}.fa-folder-o:before{content:"\f114"}.fa-folder-open-o:before{content:"\f115"}.fa-smile-o:before{content:"\f118"}.fa-frown-o:before{content:"\f119"}.fa-meh-o:before{content:"\f11a"}.fa-gamepad:before{content:"\f11b"}.fa-keyboard-o:before{content:"\f11c"}.fa-flag-o:before{content:"\f11d"}.fa-flag-checkered:before{content:"\f11e"}.fa-terminal:before{content:"\f120"}.fa-code:before{content:"\f121"}.fa-mail-reply-all:before,.fa-reply-all:before{content:"\f122"}.fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:"\f123"}.fa-location-arrow:before{content:"\f124"}.fa-crop:before{content:"\f125"}.fa-code-fork:before{content:"\f126"}.fa-chain-broken:before,.fa-unlink:before{content:"\f127"}.fa-question:before{content:"\f128"}.fa-info:before{content:"\f129"}.fa-exclamation:before{content:"\f12a"}.fa-superscript:before{content:"\f12b"}.fa-subscript:before{content:"\f12c"}.fa-eraser:before{content:"\f12d"}.fa-puzzle-piece:before{content:"\f12e"}.fa-microphone:before{content:"\f130"}.fa-microphone-slash:before{content:"\f131"}.fa-shield:before{content:"\f132"}.fa-calendar-o:before{content:"\f133"}.fa-fire-extinguisher:before{content:"\f134"}.fa-rocket:before{content:"\f135"}.fa-maxcdn:before{content:"\f136"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-html5:before{content:"\f13b"}.fa-css3:before{content:"\f13c"}.fa-anchor:before{content:"\f13d"}.fa-unlock-alt:before{content:"\f13e"}.fa-bullseye:before{content:"\f140"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-rss-square:before{content:"\f143"}.fa-play-circle:before{content:"\f144"}.fa-ticket:before{content:"\f145"}.fa-minus-square:before{content:"\f146"}.fa-minus-square-o:before{content:"\f147"}.fa-level-up:before{content:"\f148"}.fa-level-down:before{content:"\f149"}.fa-check-square:before{content:"\f14a"}.fa-pencil-square:before{content:"\f14b"}.fa-external-link-square:before{content:"\f14c"}.fa-share-square:before{content:"\f14d"}.fa-compass:before{content:"\f14e"}.fa-caret-square-o-down:before,.fa-toggle-down:before{content:"\f150"}.fa-caret-square-o-up:before,.fa-toggle-up:before{content:"\f151"}.fa-caret-square-o-right:before,.fa-toggle-right:before{content:"\f152"}.fa-eur:before,.fa-euro:before{content:"\f153"}.fa-gbp:before{content:"\f154"}.fa-dollar:before,.fa-usd:before{content:"\f155"}.fa-inr:before,.fa-rupee:before{content:"\f156"}.fa-cny:before,.fa-jpy:before,.fa-rmb:before,.fa-yen:before{content:"\f157"}.fa-rouble:before,.fa-rub:before,.fa-ruble:before{content:"\f158"}.fa-krw:before,.fa-won:before{content:"\f159"}.fa-bitcoin:before,.fa-btc:before{content:"\f15a"}.fa-file:before{content:"\f15b"}.fa-file-text:before{content:"\f15c"}.fa-sort-alpha-asc:before{content:"\f15d"}.fa-sort-alpha-desc:before{content:"\f15e"}.fa-sort-amount-asc:before{content:"\f160"}.fa-sort-amount-desc:before{content:"\f161"}.fa-sort-numeric-asc:before{content:"\f162"}.fa-sort-numeric-desc:before{content:"\f163"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbs-down:before{content:"\f165"}.fa-youtube-square:before{content:"\f166"}.fa-youtube:before{content:"\f167"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-youtube-play:before{content:"\f16a"}.fa-dropbox:before{content:"\f16b"}.fa-stack-overflow:before{content:"\f16c"}.fa-instagram:before{content:"\f16d"}.fa-flickr:before{content:"\f16e"}.fa-adn:before{content:"\f170"}.fa-bitbucket:before{content:"\f171"}.fa-bitbucket-square:before{content:"\f172"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-long-arrow-down:before{content:"\f175"}.fa-long-arrow-up:before{content:"\f176"}.fa-long-arrow-left:before{content:"\f177"}.fa-long-arrow-right:before{content:"\f178"}.fa-apple:before{content:"\f179"}.fa-windows:before{content:"\f17a"}.fa-android:before{content:"\f17b"}.fa-linux:before{content:"\f17c"}.fa-dribbble:before{content:"\f17d"}.fa-skype:before{content:"\f17e"}.fa-foursquare:before{content:"\f180"}.fa-trello:before{content:"\f181"}.fa-female:before{content:"\f182"}.fa-male:before{content:"\f183"}.fa-gittip:before{content:"\f184"}.fa-sun-o:before{content:"\f185"}.fa-moon-o:before{content:"\f186"}.fa-archive:before{content:"\f187"}.fa-bug:before{content:"\f188"}.fa-vk:before{content:"\f189"}.fa-weibo:before{content:"\f18a"}.fa-renren:before{content:"\f18b"}.fa-pagelines:before{content:"\f18c"}.fa-stack-exchange:before{content:"\f18d"}.fa-arrow-circle-o-right:before{content:"\f18e"}.fa-arrow-circle-o-left:before{content:"\f190"}.fa-caret-square-o-left:before,.fa-toggle-left:before{content:"\f191"}.fa-dot-circle-o:before{content:"\f192"}.fa-wheelchair:before{content:"\f193"}.fa-vimeo-square:before{content:"\f194"}.fa-try:before,.fa-turkish-lira:before{content:"\f195"}.fa-plus-square-o:before{content:"\f196"}.fa-space-shuttle:before{content:"\f197"}.fa-slack:before{content:"\f198"}.fa-envelope-square:before{content:"\f199"}.fa-wordpress:before{content:"\f19a"}.fa-openid:before{content:"\f19b"}.fa-bank:before,.fa-institution:before,.fa-university:before{content:"\f19c"}.fa-graduation-cap:before,.fa-mortar-board:before{content:"\f19d"}.fa-yahoo:before{content:"\f19e"}.fa-google:before{content:"\f1a0"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-square:before{content:"\f1a2"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-stumbleupon:before{content:"\f1a4"}.fa-delicious:before{content:"\f1a5"}.fa-digg:before{content:"\f1a6"}.fa-pied-piper-square:before,.fa-pied-piper:before{content:"\f1a7"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-drupal:before{content:"\f1a9"}.fa-joomla:before{content:"\f1aa"}.fa-language:before{content:"\f1ab"}.fa-fax:before{content:"\f1ac"}.fa-building:before{content:"\f1ad"}.fa-child:before{content:"\f1ae"}.fa-paw:before{content:"\f1b0"}.fa-spoon:before{content:"\f1b1"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-recycle:before{content:"\f1b8"}.fa-automobile:before,.fa-car:before{content:"\f1b9"}.fa-cab:before,.fa-taxi:before{content:"\f1ba"}.fa-tree:before{content:"\f1bb"}.fa-spotify:before{content:"\f1bc"}.fa-deviantart:before{content:"\f1bd"}.fa-soundcloud:before{content:"\f1be"}.fa-database:before{content:"\f1c0"}.fa-file-pdf-o:before{content:"\f1c1"}.fa-file-word-o:before{content:"\f1c2"}.fa-file-excel-o:before{content:"\f1c3"}.fa-file-powerpoint-o:before{content:"\f1c4"}.fa-file-image-o:before,.fa-file-photo-o:before,.fa-file-picture-o:before{content:"\f1c5"}.fa-file-archive-o:before,.fa-file-zip-o:before{content:"\f1c6"}.fa-file-audio-o:before,.fa-file-sound-o:before{content:"\f1c7"}.fa-file-movie-o:before,.fa-file-video-o:before{content:"\f1c8"}.fa-file-code-o:before{content:"\f1c9"}.fa-vine:before{content:"\f1ca"}.fa-codepen:before{content:"\f1cb"}.fa-jsfiddle:before{content:"\f1cc"}.fa-life-bouy:before,.fa-life-ring:before,.fa-life-saver:before,.fa-support:before{content:"\f1cd"}.fa-circle-o-notch:before{content:"\f1ce"}.fa-ra:before,.fa-rebel:before{content:"\f1d0"}.fa-empire:before,.fa-ge:before{content:"\f1d1"}.fa-git-square:before{content:"\f1d2"}.fa-git:before{content:"\f1d3"}.fa-hacker-news:before{content:"\f1d4"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-qq:before{content:"\f1d6"}.fa-wechat:before,.fa-weixin:before{content:"\f1d7"}.fa-paper-plane:before,.fa-send:before{content:"\f1d8"}.fa-paper-plane-o:before,.fa-send-o:before{content:"\f1d9"}.fa-history:before{content:"\f1da"}.fa-circle-thin:before{content:"\f1db"}.fa-header:before{content:"\f1dc"}.fa-paragraph:before{content:"\f1dd"}.fa-sliders:before{content:"\f1de"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-bomb:before{content:"\f1e2"}.book-langs-index{width:100%;height:100%;padding:40px 0;margin:0;overflow:auto}@media (max-width:600px){.book-langs-index{padding:0}}.book-langs-index .inner{max-width:600px;width:100%;margin:0 auto;padding:30px;background:#fff;border-radius:3px}.book-langs-index .inner h3{margin:0}.book-langs-index .inner .languages{list-style:none;padding:20px 30px;margin-top:20px;border-top:1px solid #eee}.book-langs-index .inner .languages:after,.book-langs-index .inner .languages:before{content:" ";display:table;line-height:0}.book-langs-index .inner .languages li{width:50%;float:left;padding:10px 5px;font-size:16px}@media (max-width:600px){.book-langs-index .inner .languages li{width:100%;max-width:100%}}.book .book-header{overflow:visible;height:50px;padding:0 8px;z-index:2;font-size:.85em;color:#7e888b;background:0 0}.book .book-header .btn{display:block;height:50px;padding:0 15px;border-bottom:none;color:#ccc;text-transform:uppercase;line-height:50px;-webkit-box-shadow:none!important;box-shadow:none!important;position:relative;font-size:14px}.book .book-header .btn:hover{position:relative;text-decoration:none;color:#444;background:0 0}.book .book-header h1{margin:0;font-size:20px;font-weight:200;text-align:center;line-height:50px;opacity:0;padding-left:200px;padding-right:200px;-webkit-transition:opacity .2s ease;-moz-transition:opacity .2s ease;-o-transition:opacity .2s ease;transition:opacity .2s ease;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.book .book-header h1 a,.book .book-header h1 a:hover{color:inherit;text-decoration:none}@media (max-width:1000px){.book .book-header h1{display:none}}.book .book-header h1 i{display:none}.book .book-header:hover h1{opacity:1}.book.is-loading .book-header h1 i{display:inline-block}.book.is-loading .book-header h1 a{display:none}.dropdown{position:relative}.dropdown-menu{position:absolute;top:100%;left:0;z-index:100;display:none;float:left;min-width:160px;padding:0;margin:2px 0 0;list-style:none;font-size:14px;background-color:#fafafa;border:1px solid rgba(0,0,0,.07);border-radius:1px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175);background-clip:padding-box}.dropdown-menu.open{display:block}.dropdown-menu.dropdown-left{left:auto;right:4%}.dropdown-menu.dropdown-left .dropdown-caret{right:14px;left:auto}.dropdown-menu .dropdown-caret{position:absolute;top:-8px;left:14px;width:18px;height:10px;float:left;overflow:hidden}.dropdown-menu .dropdown-caret .caret-inner,.dropdown-menu .dropdown-caret .caret-outer{display:inline-block;top:0;border-left:9px solid transparent;border-right:9px solid transparent;position:absolute}.dropdown-menu .dropdown-caret .caret-outer{border-bottom:9px solid rgba(0,0,0,.1);height:auto;left:0;width:auto;margin-left:-1px}.dropdown-menu .dropdown-caret .caret-inner{margin-top:-1px;top:1px;border-bottom:9px solid #fafafa}.dropdown-menu .buttons{border-bottom:1px solid rgba(0,0,0,.07)}.dropdown-menu .buttons:after,.dropdown-menu .buttons:before{content:" ";display:table;line-height:0}.dropdown-menu .buttons:last-child{border-bottom:none}.dropdown-menu .buttons .button{border:0;background-color:transparent;color:#a6a6a6;width:100%;text-align:center;float:left;line-height:1.42857143;padding:8px 4px}.alert,.dropdown-menu .buttons .button:hover{color:#444}.dropdown-menu .buttons .button:focus,.dropdown-menu .buttons .button:hover{outline:0}.dropdown-menu .buttons .button.size-2{width:50%}.dropdown-menu .buttons .button.size-3{width:33%}.alert{padding:15px;margin-bottom:20px;background:#eee;border-bottom:5px solid #ddd}.alert-success{background:#dff0d8;border-color:#d6e9c6;color:#3c763d}.alert-info{background:#d9edf7;border-color:#bce8f1;color:#31708f}.alert-danger{background:#f2dede;border-color:#ebccd1;color:#a94442}.alert-warning{background:#fcf8e3;border-color:#faebcc;color:#8a6d3b}.book .book-summary{position:absolute;top:0;left:-300px;bottom:0;z-index:1;width:300px;color:#364149;background:#fafafa;border-right:1px solid rgba(0,0,0,.07);-webkit-transition:left 250ms ease;-moz-transition:left 250ms ease;-o-transition:left 250ms ease;transition:left 250ms ease}.book .book-summary ul.summary{position:absolute;top:0;left:0;right:0;bottom:0;overflow-y:auto;list-style:none;margin:0;padding:0;-webkit-transition:top .5s ease;-moz-transition:top .5s ease;-o-transition:top .5s ease;transition:top .5s ease}.book .book-summary ul.summary li{list-style:none}.book .book-summary ul.summary li.divider{height:1px;margin:7px 0;overflow:hidden;background:rgba(0,0,0,.07)}.book .book-summary ul.summary li i.fa-check{display:none;position:absolute;right:9px;top:16px;font-size:9px;color:#3c3}.book .book-summary ul.summary li.done>a{color:#364149;font-weight:400}.book .book-summary ul.summary li.done>a i{display:inline}.book .book-summary ul.summary li a,.book .book-summary ul.summary li span{display:block;padding:10px 15px;border-bottom:none;color:#364149;background:0 0;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;position:relative}.book .book-summary ul.summary li span{cursor:not-allowed;opacity:.3;filter:alpha(opacity=30)}.book .book-summary ul.summary li a:hover,.book .book-summary ul.summary li.active>a{color:#008cff;background:0 0;text-decoration:none}.book .book-summary ul.summary li ul{padding-left:20px}@media (max-width:600px){.book .book-summary{width:calc(100% - 60px);bottom:0;left:-100%}}.book.with-summary .book-summary{left:0}.book.without-animation .book-summary{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;transition:none!important}.book{position:relative;width:100%;height:100%}.book .book-body,.book .book-body .body-inner{position:absolute;top:0;left:0;overflow-y:auto;bottom:0;right:0}.book .book-body{color:#000;background:#fff;-webkit-transition:left 250ms ease;-moz-transition:left 250ms ease;-o-transition:left 250ms ease;transition:left 250ms ease}.book .book-body .page-wrapper{position:relative;outline:0}.book .book-body .page-wrapper .page-inner{max-width:800px;margin:0 auto;padding:20px 0 40px}.book .book-body .page-wrapper .page-inner section{margin:0;padding:5px 15px;background:#fff;border-radius:2px;line-height:1.7;font-size:1.6rem}.book .book-body .page-wrapper .page-inner .btn-group .btn{border-radius:0;background:#eee;border:0}@media (max-width:1240px){.book .book-body{-webkit-transition:-webkit-transform 250ms ease;-moz-transition:-moz-transform 250ms ease;-o-transition:-o-transform 250ms ease;transition:transform 250ms ease;padding-bottom:20px}.book .book-body .body-inner{position:static;min-height:calc(100% - 50px)}}@media (min-width:600px){.book.with-summary .book-body{left:300px}}@media (max-width:600px){.book.with-summary{overflow:hidden}.book.with-summary .book-body{-webkit-transform:translate(calc(100% - 60px),0);-moz-transform:translate(calc(100% - 60px),0);-ms-transform:translate(calc(100% - 60px),0);-o-transform:translate(calc(100% - 60px),0);transform:translate(calc(100% - 60px),0)}}.book.without-animation .book-body{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;transition:none!important}.buttons:after,.buttons:before{content:" ";display:table;line-height:0}.button{border:0;background:#eee;color:#666;width:100%;text-align:center;float:left;line-height:1.42857143;padding:8px 4px}.button:hover{color:#444}.button:focus,.button:hover{outline:0}.button.size-2{width:50%}.button.size-3{width:33%}.book .book-body .page-wrapper .page-inner section{display:none}.book .book-body .page-wrapper .page-inner section.normal{display:block;word-wrap:break-word;overflow:hidden;color:#333;line-height:1.7;text-size-adjust:100%;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%}.book .book-body .page-wrapper .page-inner section.normal *{box-sizing:border-box;-webkit-box-sizing:border-box;font-size:inherit}.book .book-body .page-wrapper .page-inner section.normal>:first-child{margin-top:0!important}.book .book-body .page-wrapper .page-inner section.normal>:last-child{margin-bottom:0!important}.book .book-body .page-wrapper .page-inner section.normal blockquote,.book .book-body .page-wrapper .page-inner section.normal code,.book .book-body .page-wrapper .page-inner section.normal figure,.book .book-body .page-wrapper .page-inner section.normal img,.book .book-body .page-wrapper .page-inner section.normal pre,.book .book-body .page-wrapper .page-inner section.normal table,.book .book-body .page-wrapper .page-inner section.normal tr{page-break-inside:avoid}.book .book-body .page-wrapper .page-inner section.normal h2,.book .book-body .page-wrapper .page-inner section.normal h3,.book .book-body .page-wrapper .page-inner section.normal h4,.book .book-body .page-wrapper .page-inner section.normal h5,.book .book-body .page-wrapper .page-inner section.normal p{orphans:3;widows:3}.book .book-body .page-wrapper .page-inner section.normal h1,.book .book-body .page-wrapper .page-inner section.normal h2,.book .book-body .page-wrapper .page-inner section.normal h3,.book .book-body .page-wrapper .page-inner section.normal h4,.book .book-body .page-wrapper .page-inner section.normal h5{page-break-after:avoid}.book .book-body .page-wrapper .page-inner section.normal b,.book .book-body .page-wrapper .page-inner section.normal strong{font-weight:700}.book .book-body .page-wrapper .page-inner section.normal em{font-style:italic}.book .book-body .page-wrapper .page-inner section.normal blockquote,.book .book-body .page-wrapper .page-inner section.normal dl,.book .book-body .page-wrapper .page-inner section.normal ol,.book .book-body .page-wrapper .page-inner section.normal p,.book .book-body .page-wrapper .page-inner section.normal table,.book .book-body .page-wrapper .page-inner section.normal ul{margin-top:0;margin-bottom:.85em}.book .book-body .page-wrapper .page-inner section.normal a{color:#4183c4;text-decoration:none;background:0 0}.book .book-body .page-wrapper .page-inner section.normal a:active,.book .book-body .page-wrapper .page-inner section.normal a:focus,.book .book-body .page-wrapper .page-inner section.normal a:hover{outline:0;text-decoration:underline}.book .book-body .page-wrapper .page-inner section.normal img{border:0;max-width:100%}.book .book-body .page-wrapper .page-inner section.normal hr{height:4px;padding:0;margin:1.7em 0;overflow:hidden;background-color:#e7e7e7;border:none}.book .book-body .page-wrapper .page-inner section.normal hr:after,.book .book-body .page-wrapper .page-inner section.normal hr:before{display:table;content:" "}.book .book-body .page-wrapper .page-inner section.normal h1,.book .book-body .page-wrapper .page-inner section.normal h2,.book .book-body .page-wrapper .page-inner section.normal h3,.book .book-body .page-wrapper .page-inner section.normal h4,.book .book-body .page-wrapper .page-inner section.normal h5,.book .book-body .page-wrapper .page-inner section.normal h6{margin-top:1.275em;margin-bottom:.85em;font-weight:700}.book .book-body .page-wrapper .page-inner section.normal h1{font-size:2em}.book .book-body .page-wrapper .page-inner section.normal h2{font-size:1.75em}.book .book-body .page-wrapper .page-inner section.normal h3{font-size:1.5em}.book .book-body .page-wrapper .page-inner section.normal h4{font-size:1.25em}.book .book-body .page-wrapper .page-inner section.normal h5{font-size:1em}.book .book-body .page-wrapper .page-inner section.normal h6{font-size:1em;color:#777}.book .book-body .page-wrapper .page-inner section.normal code,.book .book-body .page-wrapper .page-inner section.normal pre{font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;direction:ltr;border:none;color:inherit}.book .book-body .page-wrapper .page-inner section.normal pre{overflow:auto;word-wrap:normal;margin:0 0 1.275em;padding:.85em 1em;background:#f7f7f7}.book .book-body .page-wrapper .page-inner section.normal pre>code{display:inline;max-width:initial;padding:0;margin:0;overflow:initial;line-height:inherit;font-size:.85em;white-space:pre;background:0 0}.book .book-body .page-wrapper .page-inner section.normal pre>code:after,.book .book-body .page-wrapper .page-inner section.normal pre>code:before{content:normal}.book .book-body .page-wrapper .page-inner section.normal code{padding:.2em;margin:0;font-size:.85em;background-color:#f7f7f7}.book .book-body .page-wrapper .page-inner section.normal code:after,.book .book-body .page-wrapper .page-inner section.normal code:before{letter-spacing:-.2em;content:"\00a0"}.book .book-body .page-wrapper .page-inner section.normal table{display:table;width:100%;border-collapse:collapse;border-spacing:0;overflow:auto}.book .book-body .page-wrapper .page-inner section.normal table td,.book .book-body .page-wrapper .page-inner section.normal table th{padding:6px 13px;border:1px solid #ddd}.book .book-body .page-wrapper .page-inner section.normal table tr{background-color:#fff;border-top:1px solid #ccc}.book .book-body .page-wrapper .page-inner section.normal table tr:nth-child(2n){background-color:#f8f8f8}.book .book-body .page-wrapper .page-inner section.normal table th{font-weight:700}.book .book-body .page-wrapper .page-inner section.normal ol,.book .book-body .page-wrapper .page-inner section.normal ul{padding:0 0 0 2em;margin:0 0 .85em}.book .book-body .page-wrapper .page-inner section.normal ol ol,.book .book-body .page-wrapper .page-inner section.normal ol ul,.book .book-body .page-wrapper .page-inner section.normal ul ol,.book .book-body .page-wrapper .page-inner section.normal ul ul{margin-top:0;margin-bottom:0}.book .book-body .page-wrapper .page-inner section.normal ol ol{list-style-type:lower-roman}.book .book-body .page-wrapper .page-inner section.normal blockquote{margin:0 0 .85em;padding:0 15px;color:#858585;border-left:4px solid #e5e5e5}.book .book-body .page-wrapper .page-inner section.normal blockquote:first-child{margin-top:0}.book .book-body .page-wrapper .page-inner section.normal blockquote:last-child{margin-bottom:0}.book .book-body .page-wrapper .page-inner section.normal dl{padding:0}.book .book-body .page-wrapper .page-inner section.normal dl dt{padding:0;margin-top:.85em;font-style:italic;font-weight:700}.book .book-body .page-wrapper .page-inner section.normal dl dd{padding:0 .85em;margin-bottom:.85em}.book .book-body .page-wrapper .page-inner section.normal dd{margin-left:0}.book .book-body .page-wrapper .page-inner section.normal .glossary-term{cursor:help;text-decoration:underline}.book .book-body .navigation{position:absolute;top:50px;bottom:0;margin:0;max-width:150px;min-width:90px;display:flex;justify-content:center;align-content:center;flex-direction:column;font-size:40px;color:#ccc;text-align:center;-webkit-transition:all 350ms ease;-moz-transition:all 350ms ease;-o-transition:all 350ms ease;transition:all 350ms ease}.book .book-body .navigation:hover{text-decoration:none;color:#444}.book .book-body .navigation.navigation-next{right:0}.book .book-body .navigation.navigation-prev{left:0}@media (max-width:1240px){.book .book-body .navigation{position:static;top:auto;max-width:50%;width:50%;display:inline-block;float:left}.book .book-body .navigation.navigation-unique{max-width:100%;width:100%}}.book .book-body .page-wrapper .page-inner section.glossary{margin-bottom:40px}.book .book-body .page-wrapper .page-inner section.glossary h2 a,.book .book-body .page-wrapper .page-inner section.glossary h2 a:hover{color:inherit;text-decoration:none}.book .book-body .page-wrapper .page-inner section.glossary .glossary-index{list-style:none;margin:0;padding:0}.book .book-body .page-wrapper .page-inner section.glossary .glossary-index li{display:inline;margin:0 8px;white-space:nowrap}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-overflow-scrolling:touch;-webkit-tap-highlight-color:transparent;-webkit-text-size-adjust:none;-webkit-touch-callout:none}a{text-decoration:none}body,html{height:100%}html{font-size:62.5%}body{text-rendering:optimizeLegibility;font-smoothing:antialiased;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;letter-spacing:.2px;text-size-adjust:100%} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
Docs/GITBOOK/CodeHelping/_book/index.html
0 → 100644
1 | +<!DOCTYPE HTML> | ||
2 | +<html lang="en" > | ||
3 | + | ||
4 | + <head> | ||
5 | + | ||
6 | + <meta charset="UTF-8"> | ||
7 | + <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
8 | + <title>简介 | Introduction</title> | ||
9 | + <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> | ||
10 | + <meta name="description" content="众奇开放文档知识库## 开放.分享.学习 ##祝学习愉快 !!!"> | ||
11 | + <meta name="generator" content="GitBook 2.6.7"> | ||
12 | + | ||
13 | + | ||
14 | + <meta name="HandheldFriendly" content="true"/> | ||
15 | + <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> | ||
16 | + <meta name="apple-mobile-web-app-capable" content="yes"> | ||
17 | + <meta name="apple-mobile-web-app-status-bar-style" content="black"> | ||
18 | + <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png"> | ||
19 | + <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon"> | ||
20 | + | ||
21 | + <link rel="stylesheet" href="gitbook/style.css"> | ||
22 | + | ||
23 | + | ||
24 | + <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-highlight/website.css"> | ||
25 | + | ||
26 | + | ||
27 | + | ||
28 | + <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-search/search.css"> | ||
29 | + | ||
30 | + | ||
31 | + | ||
32 | + <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-fontsettings/website.css"> | ||
33 | + | ||
34 | + | ||
35 | + | ||
36 | + | ||
37 | + | ||
38 | + | ||
39 | + | ||
40 | + <link rel="next" href="./Thinkphp/Structure/evshop_structure.html" /> | ||
41 | + | ||
42 | + | ||
43 | + | ||
44 | + | ||
45 | + </head> | ||
46 | + <body> | ||
47 | + | ||
48 | + | ||
49 | + <div class="book" | ||
50 | + data-level="0" | ||
51 | + data-chapter-title="简介" | ||
52 | + data-filepath="README.md" | ||
53 | + data-basepath="." | ||
54 | + data-revision="Wed May 11 2016 00:54:11 GMT+0800 (中国标准时间)" | ||
55 | + data-innerlanguage=""> | ||
56 | + | ||
57 | + | ||
58 | +<div class="book-summary"> | ||
59 | + <nav role="navigation"> | ||
60 | + <ul class="summary"> | ||
61 | + | ||
62 | + | ||
63 | + | ||
64 | + | ||
65 | + | ||
66 | + | ||
67 | + | ||
68 | + | ||
69 | + | ||
70 | + <li class="chapter active" data-level="0" data-path="index.html"> | ||
71 | + | ||
72 | + | ||
73 | + <a href="./index.html"> | ||
74 | + | ||
75 | + <i class="fa fa-check"></i> | ||
76 | + | ||
77 | + 简介 | ||
78 | + </a> | ||
79 | + | ||
80 | + | ||
81 | + </li> | ||
82 | + | ||
83 | + <li class="chapter " data-level="1" > | ||
84 | + | ||
85 | + <span><b>1.</b> Thinkphp</span> | ||
86 | + | ||
87 | + | ||
88 | + <ul class="articles"> | ||
89 | + | ||
90 | + | ||
91 | + <li class="chapter " data-level="1.1" > | ||
92 | + | ||
93 | + <span><b>1.1.</b> Structure</span> | ||
94 | + | ||
95 | + | ||
96 | + <ul class="articles"> | ||
97 | + | ||
98 | + | ||
99 | + <li class="chapter " data-level="1.1.1" data-path="Thinkphp/Structure/evshop_structure.html"> | ||
100 | + | ||
101 | + | ||
102 | + <a href="./Thinkphp/Structure/evshop_structure.html"> | ||
103 | + | ||
104 | + <i class="fa fa-check"></i> | ||
105 | + | ||
106 | + <b>1.1.1.</b> | ||
107 | + | ||
108 | + EVShop框架结构图 | ||
109 | + </a> | ||
110 | + | ||
111 | + | ||
112 | + </li> | ||
113 | + | ||
114 | + | ||
115 | + </ul> | ||
116 | + | ||
117 | + </li> | ||
118 | + | ||
119 | + <li class="chapter " data-level="1.2" > | ||
120 | + | ||
121 | + <span><b>1.2.</b> Controller</span> | ||
122 | + | ||
123 | + | ||
124 | + <ul class="articles"> | ||
125 | + | ||
126 | + | ||
127 | + <li class="chapter " data-level="1.2.1" data-path="Thinkphp/Controller/evshop_controller.html"> | ||
128 | + | ||
129 | + | ||
130 | + <a href="./Thinkphp/Controller/evshop_controller.html"> | ||
131 | + | ||
132 | + <i class="fa fa-check"></i> | ||
133 | + | ||
134 | + <b>1.2.1.</b> | ||
135 | + | ||
136 | + EVShop之Controller篇 | ||
137 | + </a> | ||
138 | + | ||
139 | + | ||
140 | + </li> | ||
141 | + | ||
142 | + | ||
143 | + </ul> | ||
144 | + | ||
145 | + </li> | ||
146 | + | ||
147 | + <li class="chapter " data-level="1.3" > | ||
148 | + | ||
149 | + <span><b>1.3.</b> View</span> | ||
150 | + | ||
151 | + | ||
152 | + <ul class="articles"> | ||
153 | + | ||
154 | + | ||
155 | + <li class="chapter " data-level="1.3.1" data-path="Thinkphp/View/evshop_view.html"> | ||
156 | + | ||
157 | + | ||
158 | + <a href="./Thinkphp/View/evshop_view.html"> | ||
159 | + | ||
160 | + <i class="fa fa-check"></i> | ||
161 | + | ||
162 | + <b>1.3.1.</b> | ||
163 | + | ||
164 | + EVShop之View篇 | ||
165 | + </a> | ||
166 | + | ||
167 | + | ||
168 | + </li> | ||
169 | + | ||
170 | + | ||
171 | + </ul> | ||
172 | + | ||
173 | + </li> | ||
174 | + | ||
175 | + <li class="chapter " data-level="1.4" > | ||
176 | + | ||
177 | + <span><b>1.4.</b> Javascript</span> | ||
178 | + | ||
179 | + | ||
180 | + <ul class="articles"> | ||
181 | + | ||
182 | + | ||
183 | + <li class="chapter " data-level="1.4.1" data-path="Thinkphp/Javascript/evshop_dialog.html"> | ||
184 | + | ||
185 | + | ||
186 | + <a href="./Thinkphp/Javascript/evshop_dialog.html"> | ||
187 | + | ||
188 | + <i class="fa fa-check"></i> | ||
189 | + | ||
190 | + <b>1.4.1.</b> | ||
191 | + | ||
192 | + EVShop之Dialog篇 | ||
193 | + </a> | ||
194 | + | ||
195 | + | ||
196 | + </li> | ||
197 | + | ||
198 | + <li class="chapter " data-level="1.4.2" data-path="Thinkphp/Javascript/evshop_js.html"> | ||
199 | + | ||
200 | + | ||
201 | + <a href="./Thinkphp/Javascript/evshop_js.html"> | ||
202 | + | ||
203 | + <i class="fa fa-check"></i> | ||
204 | + | ||
205 | + <b>1.4.2.</b> | ||
206 | + | ||
207 | + EVShop之Javascript篇 | ||
208 | + </a> | ||
209 | + | ||
210 | + | ||
211 | + </li> | ||
212 | + | ||
213 | + | ||
214 | + </ul> | ||
215 | + | ||
216 | + </li> | ||
217 | + | ||
218 | + <li class="chapter " data-level="1.5" > | ||
219 | + | ||
220 | + <span><b>1.5.</b> DB</span> | ||
221 | + | ||
222 | + | ||
223 | + <ul class="articles"> | ||
224 | + | ||
225 | + | ||
226 | + <li class="chapter " data-level="1.5.1" data-path="Thinkphp/DB/db_sqls.html"> | ||
227 | + | ||
228 | + | ||
229 | + <a href="./Thinkphp/DB/db_sqls.html"> | ||
230 | + | ||
231 | + <i class="fa fa-check"></i> | ||
232 | + | ||
233 | + <b>1.5.1.</b> | ||
234 | + | ||
235 | + Thinkphp中SQL的写法 | ||
236 | + </a> | ||
237 | + | ||
238 | + | ||
239 | + </li> | ||
240 | + | ||
241 | + | ||
242 | + </ul> | ||
243 | + | ||
244 | + </li> | ||
245 | + | ||
246 | + <li class="chapter " data-level="1.6" > | ||
247 | + | ||
248 | + <span><b>1.6.</b> Others</span> | ||
249 | + | ||
250 | + | ||
251 | + <ul class="articles"> | ||
252 | + | ||
253 | + | ||
254 | + <li class="chapter " data-level="1.6.1" data-path="Thinkphp/Others/functions.html"> | ||
255 | + | ||
256 | + | ||
257 | + <a href="./Thinkphp/Others/functions.html"> | ||
258 | + | ||
259 | + <i class="fa fa-check"></i> | ||
260 | + | ||
261 | + <b>1.6.1.</b> | ||
262 | + | ||
263 | + Thinkphp中常用功能 | ||
264 | + </a> | ||
265 | + | ||
266 | + | ||
267 | + </li> | ||
268 | + | ||
269 | + <li class="chapter " data-level="1.6.2" data-path="Thinkphp/Others/UsefulCodes.html"> | ||
270 | + | ||
271 | + | ||
272 | + <a href="./Thinkphp/Others/UsefulCodes.html"> | ||
273 | + | ||
274 | + <i class="fa fa-check"></i> | ||
275 | + | ||
276 | + <b>1.6.2.</b> | ||
277 | + | ||
278 | + EVShop中备用代码片段 | ||
279 | + </a> | ||
280 | + | ||
281 | + | ||
282 | + </li> | ||
283 | + | ||
284 | + | ||
285 | + </ul> | ||
286 | + | ||
287 | + </li> | ||
288 | + | ||
289 | + | ||
290 | + </ul> | ||
291 | + | ||
292 | + </li> | ||
293 | + | ||
294 | + | ||
295 | + | ||
296 | + | ||
297 | + <li class="divider"></li> | ||
298 | + <li> | ||
299 | + <a href="https://www.gitbook.com" target="blank" class="gitbook-link"> | ||
300 | + Published with GitBook | ||
301 | + </a> | ||
302 | + </li> | ||
303 | + | ||
304 | + </ul> | ||
305 | + </nav> | ||
306 | +</div> | ||
307 | + | ||
308 | + <div class="book-body"> | ||
309 | + <div class="body-inner"> | ||
310 | + <div class="book-header" role="navigation"> | ||
311 | + <!-- Actions Left --> | ||
312 | + | ||
313 | + | ||
314 | + <!-- Title --> | ||
315 | + <h1> | ||
316 | + <i class="fa fa-circle-o-notch fa-spin"></i> | ||
317 | + <a href="./" >Introduction</a> | ||
318 | + </h1> | ||
319 | +</div> | ||
320 | + | ||
321 | + <div class="page-wrapper" tabindex="-1" role="main"> | ||
322 | + <div class="page-inner"> | ||
323 | + | ||
324 | + | ||
325 | + <section class="normal" id="section-"> | ||
326 | + | ||
327 | + <h1 id="introduction">Introduction</h1> | ||
328 | +<div style="color:#333">本知识库为 <strong>青鸽攻城狮</strong> 在项目中的点滴技术分享、工作积累、学习成果合集!</div> | ||
329 | + | ||
330 | +<p></p> | ||
331 | + | ||
332 | +<blockquote> | ||
333 | +<p>众奇开放文档知识库 | ||
334 | +<strong>## 开放.分享.学习 ##</strong> | ||
335 | +祝学习愉快 !!!</p> | ||
336 | +</blockquote> | ||
337 | +<hr> | ||
338 | +<p><strong>众奇信息技术有限公司 © Qingger Team</strong> </p> | ||
339 | + | ||
340 | + | ||
341 | + </section> | ||
342 | + | ||
343 | + | ||
344 | + </div> | ||
345 | + </div> | ||
346 | + </div> | ||
347 | + | ||
348 | + | ||
349 | + | ||
350 | + <a href="./Thinkphp/Structure/evshop_structure.html" class="navigation navigation-next navigation-unique" aria-label="Next page: EVShop框架结构图"><i class="fa fa-angle-right"></i></a> | ||
351 | + | ||
352 | + </div> | ||
353 | +</div> | ||
354 | + | ||
355 | + | ||
356 | +<script src="gitbook/app.js"></script> | ||
357 | + | ||
358 | + | ||
359 | + <script src="gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script> | ||
360 | + | ||
361 | + | ||
362 | + | ||
363 | + <script src="gitbook/plugins/gitbook-plugin-search/search.js"></script> | ||
364 | + | ||
365 | + | ||
366 | + | ||
367 | + <script src="gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script> | ||
368 | + | ||
369 | + | ||
370 | + | ||
371 | + <script src="gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script> | ||
372 | + | ||
373 | + | ||
374 | +<script> | ||
375 | +require(["gitbook"], function(gitbook) { | ||
376 | + var config = {"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2}}; | ||
377 | + gitbook.start(config); | ||
378 | +}); | ||
379 | +</script> | ||
380 | + | ||
381 | + | ||
382 | + </body> | ||
383 | + | ||
384 | +</html> |
This diff could not be displayed because it is too large.
Docs/GITBOOK/CodeHelping/前端集锦.md
0 → 100644
1 | +### 1. Markdown: Syntax | ||
2 | +* [MarkDown中文网](http://www.markdown.cn/ "MarkDown中文网") | ||
3 | + | ||
4 | +### 2. 解决ios设备页面滚动条卡顿 ### | ||
5 | +* CSS | ||
6 | + | ||
7 | + overflow: auto; | ||
8 | + -webkit-overflow-scrolling: touch; | ||
9 | +### 3. 单行文本溢出显示省略号(...) ### | ||
10 | +* CSS | ||
11 | + | ||
12 | + overflow: hidden; | ||
13 | + text-overflow: ellipsis;// 显示省略符号来代表被修剪的文本。 | ||
14 | + white-space: nowrap;// 文本不会换行, 在同一行上继续,直到遇到 <br> 标签为止。 | ||
15 | +### 4. 多行文本溢出显示省略号(...) ### | ||
16 | +* CSS | ||
17 | + | ||
18 | + overflow : hidden; | ||
19 | + text-overflow: ellipsis; | ||
20 | + -webkit-line-clamp: 2; // 限制文本行数2行(webkit私有属性) | ||
21 | + display: -webkit-box; | ||
22 | + -webkit-box-orient: vertical; | ||
23 | +### 5. 手机软键盘遮挡input ### | ||
24 | +1. 方案一 | ||
25 | + * JS | ||
26 | + | ||
27 | + $('INPUT').focus(function () { | ||
28 | + var SCROLLY = 100; | ||
29 | + var TIMER_NAME = 500; // focus事件中500ms后进行判断 | ||
30 | + var MAX_SCROLL = 9999; // 越大越好 | ||
31 | + setTimeout(function () { | ||
32 | + if (window.scrollY < SCROLLY) { | ||
33 | + window.scrollTo(0, MAX_SCROLL); | ||
34 | + } | ||
35 | + }, TIMER_NAME) | ||
36 | + }) | ||
37 | + | ||
38 | + | ||
39 | +2. 方案二 | ||
40 | + * JS | ||
41 | + | ||
42 | + var setScroll = function(obj){ | ||
43 | + var ua = navigator.userAgent; | ||
44 | + if(ua.match(/(iPhone|iPod|iPad|iPhone\s+Simulator)/i)){ | ||
45 | + setTimeout(function () { | ||
46 | + obj.scrollIntoViewIfNeeded(); //obj指元素本身 | ||
47 | + }, 500) | ||
48 | + } | ||
49 | + }; | ||
50 | + //只在当前元素在视窗的可见范围内不可见的情况下,才滚动浏览器窗口或容器元素,最终让当前元素可见。如果当前元素在视窗中可见,这个方法不做任何处理。如果将可选参数alignCenter设置为true,则表示尽量将元素显示在视窗中部(垂直方向)------Safari、Chrome实现了这个方法 | ||
51 | + | ||
52 | + * 扩展 | ||
53 | + | ||
54 | + scrollIntoView(alignWithTop);// 滚动浏览器窗口或容器元素,以便在当前视窗的可见范围看见当前元素。如果alignWithTop为true,或者省略它,窗口会尽可能滚动到自身顶部与元素顶部平齐。-------目前各浏览器均支持 | ||
55 | + | ||
56 | + scrollByLines(lineCount);// 将元素的内容滚动指定的行数的高度,lineCount的值可以为正值或是负值。---Safari、Chrome实现了这个方法 | ||
57 | + | ||
58 | + scrollByPages(pageCount);// 将元素的内容滚动指定的页面的高度,具体高度由元素的高度决定。---Safari、Chrome实现了这个方法 | ||
59 | +### 6. 禁止移动端页面的拷贝功能 ### | ||
60 | +* CSS | ||
61 | + | ||
62 | + *{ | ||
63 | + -webkit-touch-callout:none; /*系统默认菜单被禁用*/ | ||
64 | + -webkit-user-select:none; /*webkit浏览器*/ | ||
65 | + -khtml-user-select:none; /*早期浏览器*/ | ||
66 | + -moz-user-select:none;/*火狐*/ | ||
67 | + -ms-user-select:none; /*IE10*/ | ||
68 | + user-select:none; | ||
69 | + } | ||
70 | + | ||
71 | + * *IE6-9不支持user-select:none属性,但支持使用标签属性 onselectstart="return false";* | ||
72 | + * *在添加完上述代码后,在IOS 上会有问题的,input 框无法正常输入了内容了,添加如下样式* | ||
73 | + | ||
74 | + input { | ||
75 | + -webkit-user-select:auto; /*webkit浏览器*/ | ||
76 | + } | ||
77 | +### 7. css模拟'<' '>'符号 ### | ||
78 | +* HTML && CSS | ||
79 | + | ||
80 | + <span style='display: inline-block;width: 10px;height: 10px;border-top: 2px solid #ddd;border-left: 2px solid #ddd;transform: rotate(-45deg);'></span> | ||
81 | +### 8. css模拟三角 | ||
82 | +* HTML && CSS | ||
83 | + | ||
84 | + <div style="width: 0;height: 0;border: 10px solid transparent;top: 5px;border-left-color: #ddd"></div> | ||
85 | +### 9. 根据设备宽度,设置页面字体大小 | ||
86 | +* JS | ||
87 | + | ||
88 | + (function (doc, win) { | ||
89 | + var docEl = doc.documentElement, | ||
90 | + resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize', | ||
91 | + recalc = function () { | ||
92 | + var clientWidth = docEl.clientWidth; | ||
93 | + if (!clientWidth) return; | ||
94 | + docEl.style.fontSize = 10 * (clientWidth / 320) + 'px'; | ||
95 | + }; | ||
96 | + if (!doc.addEventListener) return; | ||
97 | + win.addEventListener(resizeEvt, recalc, false); | ||
98 | + doc.addEventListener('DOMContentLoaded', recalc, false); | ||
99 | + })(document, window); | ||
100 | +### 10. 各类元标签 | ||
101 | +* 设置编码信息 | ||
102 | + | ||
103 | + <meta http-equiv="Content-Type" Content="text/html; Charset=utf-8" /> | ||
104 | +* 设置语言 | ||
105 | + | ||
106 | + <meta http-equiv="Content-Language" Content="zh-CN" /> | ||
107 | +* 设置重定向 | ||
108 | + | ||
109 | + <meta http-equiv="Refresh" Content="15; Url=http://www.baidu.com" /> | ||
110 | +* 设置缓存时间 | ||
111 | + | ||
112 | + <meta http-equiv="Expires" Content="Web, 26 Jun 2015 18:21:57 GMT" /> | ||
113 | +* 不使用缓存 | ||
114 | + | ||
115 | + <meta http-equiv="Pragma" Content="No-cach" /> | ||
116 | +* 设置关键字 | ||
117 | + | ||
118 | + <meta name="Keywords" Content="key1,key2,..." /> | ||
119 | +* 设置描述信息 | ||
120 | + | ||
121 | + <meta name="Description" Content="description abc" /> | ||
122 | +* 设置对搜索引擎抓取 | ||
123 | + | ||
124 | + <meta name="Robots" Content="All|None|Index|Noindex|Follow|Nofollow" /> | ||
125 | +* 设置可视区域 | ||
126 | + | ||
127 | + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" /> | ||
128 | +* 针对浏览器使用 | ||
129 | + | ||
130 | + * 国产浏览器内核选择 | ||
131 | + | ||
132 | + <meta name="renderer" content="webkit|ie-comp|ie-stand"> | ||
133 | + * 使用最新版的ie浏览器,或者chrome | ||
134 | + | ||
135 | + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/> | ||
136 | + * 针对手持设备优化,主要是针对一些老的不识别viewport的浏览器,比如黑莓 | ||
137 | + | ||
138 | + <meta name="HandheldFriendly" content="true"> | ||
139 | + * 微软的老式浏览器 | ||
140 | + | ||
141 | + <meta name="MobileOptimized" content="320"> | ||
142 | + * uc强制竖屏 | ||
143 | + | ||
144 | + <meta name="screen-orientation" content="portrait"> | ||
145 | + * QQ强制竖屏 | ||
146 | + | ||
147 | + <meta name="x5-orientation" content="portrait"> | ||
148 | + * UC强制全屏 | ||
149 | + | ||
150 | + <meta name="full-screen" content="yes"> | ||
151 | + * QQ强制全屏 | ||
152 | + | ||
153 | + <meta name="x5-fullscreen" content="true"> | ||
154 | + * UC应用模式 | ||
155 | + | ||
156 | + <meta name="browsermode" content="application"> | ||
157 | + * QQ应用模式 | ||
158 | + | ||
159 | + <meta name="x5-page-mode" content="app"> | ||
160 | + * windows phone 点击无高光 | ||
161 | + | ||
162 | + <meta name="msapplication-tap-highlight" content="no"> | ||
163 | + * 禁止转码 | ||
164 | + | ||
165 | + <meta http-equiv="Cache-Control" content="no-siteapp" /> | ||
166 | + * 禁止数字自动识别为电话号码 | ||
167 | + | ||
168 | + <meta name="format-detection" content="telephone=no" /> | ||
169 | + * 禁止识别邮箱 | ||
170 | + | ||
171 | + <meta name="format-detection" content="email=no" /> | ||
172 | +### 11. 金额格式化: '12345678' --> '12,345,678' | ||
173 | + var numStr = '12345678'; | ||
174 | + console.log(numStr.split('').reverse().join('').replace(/(\d{3})/g,'$1,').replace(/,$/,'').split('').reverse().join('')); | ||
175 | +### 12. 移动端拖拽demo | ||
176 | +* HTML | ||
177 | + | ||
178 | + <body> | ||
179 | + <img src='homepage.svg' onclick='window.location.href="http://example.com/"' id="link"> | ||
180 | + </body> | ||
181 | +* CSS | ||
182 | + | ||
183 | + html,body { height:100%; } | ||
184 | + #link { width:50px;height:50px;position: absolute;left: 0;top: 0; } | ||
185 | +* JS | ||
186 | + | ||
187 | + <script> | ||
188 | + window.onload = function(){ | ||
189 | + drag('link') | ||
190 | + }; | ||
191 | + function drag(obj){ | ||
192 | + var block = document.getElementById(obj); | ||
193 | + var oW,oH; | ||
194 | + // 绑定touchstart事件 | ||
195 | + block.addEventListener("touchstart", function(e) { | ||
196 | + var touches = e.touches[0]; | ||
197 | + oW = touches.clientX - block.offsetLeft; | ||
198 | + oH = touches.clientY - block.offsetTop; | ||
199 | + //阻止页面的滑动默认事件 | ||
200 | + document.addEventListener("touchmove",defaultEvent,false); | ||
201 | + },false) | ||
202 | + | ||
203 | + block.addEventListener("touchmove", function(e) { | ||
204 | + var touches = e.touches[0]; | ||
205 | + var oLeft = touches.clientX - oW; | ||
206 | + var oTop = touches.clientY - oH; | ||
207 | + if(oLeft < 0) { | ||
208 | + oLeft = 0; | ||
209 | + }else if(oLeft > document.documentElement.clientWidth - block.offsetWidth) { | ||
210 | + oLeft = (document.documentElement.clientWidth - block.offsetWidth); | ||
211 | + } | ||
212 | + block.style.left = oLeft + "px"; | ||
213 | + block.style.top = oTop + "px"; | ||
214 | + },false); | ||
215 | + block.addEventListener("touchend",function() { | ||
216 | + document.removeEventListener("touchmove",defaultEvent,false); | ||
217 | + },false); | ||
218 | + function defaultEvent(e) { | ||
219 | + e.preventDefault(); | ||
220 | + } | ||
221 | + } | ||
222 | + | ||
223 | +### 13.判断是否为苹果手机 | ||
224 | + var ua = navigator.userAgent; | ||
225 | + if(ua.match(/(iPhone|iPod|iPad|iPhone\s+Simulator)/i)){ | ||
226 | + alert("是iphone!") | ||
227 | + } | ||
228 | +### 14. img标签的 alt 属性和 onerror 事件 | ||
229 | +* onerror 事件会在文档或图像加载过程中发生错误时被触发 | ||
230 | + | ||
231 | + <img src="pic.gif" onerror="javascript:this.src='/noPic.gif';" alt="pic" /> | ||
232 | +* alt属性,如果无法显示图像,浏览器将显示替代文本 |
-
Please register or login to post a comment